-
Posts
601 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Frank Vèssia
-
woow.. thank you so much
-
Very nice, i will try. Suggestion: could be really nice if this module can save every login as pw page (choosing the parent page as option)...so an admin can control anytime all logins in his website.
-
that's my code, i didn't use the ImageSizer class cause of my bad php knowledge but it works... thanks. <? define ("MAX_SIZE","100"); function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } require_once('../index.php'); $input = wire('input'); $sanitizer = wire('sanitizer'); $users = wire('users') if($input->post->userid) { $filename = stripslashes($_FILES['imageUpload']['name']); //get the extension of the file in a lower case format $extension = getExtension($filename); $extension = strtolower($extension); if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) { print "File non valido"; exit; }else{ $size=filesize($_FILES['imageUpload']['tmp_name']); if ($size > MAX_SIZE*1024){ print 'File troppo grosso'; exit; } //copy the image in secure folder $image_name=time().'.'.$extension; $newname="../site/tmpfiles/profiles/".$image_name; $copied = copy($_FILES['imageUpload']['tmp_name'], $newname); if ($copied) { $userid = $sanitizer->text($input->post->userid); $u = $users->get($userid); $u->setOutputFormatting(false); $u->profilephoto->add("http://".$_SERVER['HTTP_HOST']."/site/tmpfiles/profiles/".$image_name); $u->save(); //delete copied image $tmpfile = $_SERVER["DOCUMENT_ROOT"]."/site/tmpfiles/profiles/".$image_name; if (file_exists($tmpfile)) { unlink ($tmpfile); } }else{ print "Errore nel salvataggio del file."; exit; } } print $u->profilephoto->eq(1)->url; } ?> what is thew commando for remove an image? ->remove maybe?
-
thanks, i will try to build something...
-
I'm resuming this post cause now pw 2.1 is out with new user system ;D. So is there now a way to add image from disk from my external form using api?
-
thanks for your suggestion
-
Thanks Apeisa, i run 2.1 lc but didn't notice that post...
-
I always "fight" with wire method, this time i need to create a new user outside PW root folder. $name = wire('sanitizer')->username(wire('input')->post->login_name); $pass = wire('input')->post->login_pass; $email = wire('sanitizer')->email(wire('input')->post->email); $u = new User(); $u->name = $name; $u->pass = $pass; $u->addRole("guest"); $u->save(); i get error on addRole(), i need to add wire at some point but i don't know where.
-
ohhh fine, good trick
-
thanks Ryan, the second example works good. 8) I cannot use limit because i need to know the total of pages in my archive. P.S: now I count 14k pages.
-
try to empty the sessions folder...
-
for using $page->count i need first make a query with get o find method...
-
well done.
-
Ops... I moved the template folder but i get the same notice
-
Great template. Installed right now. I get this notice: Notice: Trying to get property of non-object in /home/librolo/public_html/wire/templates-admin/default.php on line 71 and before main menu i can see the link "admin>" There are also some css issues.
-
this is my query $find=wire('pages')->get(1485)->find("template=libro,title%=$titolo"); looks correct...
-
I'm trying to count the total page i have in one category but i get this error: FATAL ERROR: ALLOWED MEMORY SIZE OF 67108864 BYTES EXHAUSTED (TRIED TO ALLOCATE 80 BYTES) IN /HOME/LIBROLO/PUBLIC_HTML/WIRE/CORE/PAGES.PHP ON LINE 290 this is my code $total=$pages->get(1485)->find("template=libro"); echo $total->getTotal(); my total is almost 7000 pages. Till 4500 was fine, no error.
-
i'm creating some pages from an xml, sometimes i get this error: admin:/grab/:ProcessWire Error:Exception: Unknown Selector operator: '' -- was your selector value properly escaped? (in /home/librolo/public_html/wire/core/Selectors.php line 135) #0 /home/librolo/public_html/wire/core/Selectors.php(160): Selectors->create('indagine', '', 'senza censure s...') #1 /home/librolo/public_html/wire/core/Selectors.php(63): Selectors->extractString('has_parent=1485...') #2 /home/librolo/public_html/wire/core/Pages.php(111): Selectors->__construct('has_parent=1485...') #3 [internal function]: Pages->___find('has_parent=1485...', Array) #4 /home/librolo/public_html/wire/core/Wire.php(267): call_user_func_array(Array, Array) #5 /home/librolo/public_html/wire/core/Wire.php(229): Wire->runHooks('find', Array) #6 /home/librolo/public_html/wire/core/Page.php(656): Wire->__call('find', Array) #7 /home/librolo/public_html/wire/core/Page.php(656): Pages->find('has_parent=1485...', Array) #8 /home/librolo/public_html/site/templates/grab.php(123): Page->find('template=libro,...') #9 /home/librolo/public_html/site/templates before saving the page i use always the sanitizer for every field.
-
you are right Ryan as always, thanks ;D
-
I run several pw website on this server so php config is right. My code is very simple... include('./amazon.class.php'); // make the request $keyw = $input->post->keywords; $xml = simplexml_load_file(awsRequest("Books", "{$keyw}", "Large", "ItemSearch", "1")); foreach($xml->Items->Item as $item){ $string = preg_replace("/\[[^\]]*\]/m","",$item->ItemAttributes->Title); $string = str_replace(".","",$string); $titolo = strtolower($sanitizer->text(trim($string = preg_replace("/\([^\)]+\)/","",$string)))); $categ=$sanitizer->text($item->BrowseNodes->BrowseNode[0]->Ancestors->BrowseNode->Name); $subcateg=$sanitizer->text($item->BrowseNodes->BrowseNode[0]->Name); $publisher=$item->ItemAttributes->Publisher; $isbn13=$item->ItemAttributes->EAN; $isbn10=$item->ItemAttributes->ISBN; $cover=$item->LargeImage->URL; $libro = new Page(); $libro->template = $templates->get("libro"); $libro->parent = $pages->get(1205); $libro->title = $titolo; $libro->name = $libro->title; $libro->autore = $sanitizer->textarea($lineautori); $libro->save(); $libro->cover->add($cover); $libro->save(); }
-
url_fopen is enabled...
-
i created a template that import all from an xml (external) generated by Amazon Apis. My image field is standard so it contains jpg, jpeg, gif and png...
-
It works, thanks
-
I have an array i want to save in a textarea field. How can i have one line per array value? I tried this code.. foreach ($autori as $autore){ $lineautori .= $autore.'\n'; } $libro->autore = $sanitizer->textarea($lineautori);
-
I'm trying to create a book database using Amazon AWS API. The problem is I cannot save covers images. PW returns Exception: Item added to Pageimages is not an allowed type (in /home/librolo/public_html/wire/core/Array.php line 145) #0 /home/librolo/public_html/wire/core/Pagefiles.php(141): WireArray->add(Object(SimpleXMLElement)) #1 /home/librolo/public_html/wire/core/Pageimages.php(39): Pagefiles->add(Object(SimpleXMLElement)) #2 /home/librolo/public_html/site/templates/grab.php(101): Pageimages->add(Object(SimpleXMLElement)) #3 /home/librolo/public_html/wire/core/TemplateFile.php(88): require('/home/librolo/p...') #4 [internal function]: TemplateFile->___render() #5 /home/librolo/public_html/wire/core/Wire.php(267): call_user_func_array(Array, Array) #6 /home/librolo/public_html/wire/core/Wire.php(229): Wire->runHooks('render', Array) #7 /home/librolo/public_html/wire/modules/PageRender.module(194): Wire->__call('render', Array) #8 /home/librolo/public_html/wire/modules/PageRender.module(194): TemplateFile->render() #9 [internal function]: PageRender->___renderPage(Object(HookEvent)) #10 /home/librolo/public_html/wir in /home/librolo/public_html/index.php on line 202 This error message was shown because the site is in DEBUG mode. image example http://ecx.images-amazon.com/images/I/316stS044TL.jpg