Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by Bacos

  1. Hi Sebi, I guess I'm a little confused about phpSession feature. Calling API with curl getting the same problem. Do you have some sample calling API inside a processwire template with route authenticated ? Calling from Postman with JWT works fine. Thank you again!
  2. Additional informations: I believe the AppApi has a bug with PHP Session. I've changed the line 187 in router.php to show the user name logged in and it shows "guest". if (isset($routeParams['auth']) && $routeParams['auth'] === true && !$this->wire('user')->isLoggedIn()) { throw new AppApiException('User does not have authorization ' .$this->wire('user')->name, 401); But running the same command inside a page it shows the real name of logged user. Inside Page user name = 2069008 From API : {"error":"User does not have authorization guest","devmessage":{"class":"ProcessWire\\AppApiException","code":401,"message":"User does not have authorization guest","location":"C:\\xampp\\htdocs\\cinemed\\site\\modules\\AppApi\\classes\\Router.php","line":187} Any help please? Thank you all!
  3. Hi friends, I'm here again with another newbie question, but... I'm getting "failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized" when I try to access API using file_get_contents from PHP page. I'm passing ApiKey (PHP Session) and logged in as superuser. If I remove ["auth"=>true] from routes.php it works. In my mind, if I'm logged in as superuser it should work with authorization enabled or am I wrong? Here is my code... Thank you all! $apiKey = $config->apikey; $getdata = http_build_query( [ 'nome' => 'sample name', 'endereco' => 'sample address' ] ); $context = stream_context_create( [ 'http' => [ 'method' => 'GET', 'header' => ["X-Api-Key: $apiKey", "Content-Type: application/x-www-form-urlencoded"], ], 'ssl' => [ 'verify_peer' => false, 'verify_peer_name' => false ] ] ); $url_returns = file_get_contents("$url" . $getdata, false, $context);
  4. Hi friends, After running "$pages->parents()->rebuildAll();" in TracyDebugger (PW version 3.0.178), I got table "pages_parents" empty! Any suggestions? has_parent still not working and I really needed it. Thank you all ------ After a lot of tests, I realize that the problem is missing system resources. My database is getting huge and the rebuildAll cannot work properly. I did some tunning in my machine and could run properly. I hope that problem has_parent has finally solved. Thank you anyway!
  5. Thank you very much my friends, The problem was the "api" instead "testeapi/api". Now I'm going to keep studying.
  6. Hi masters, I'm going to make a newbie question, but... I just can't make it work. I've installed a new fresh processwire in xampp, the AppApi module, created an application and keeping the "api" endpoint. But when I run "https://localhost/testeapi/api/test" in Insomnia, I get the standard "404 Page Not Found" instead AppApi error or sucess message. It seems that the AppApi is never being called. The https is correctly configured in xampp. Thank you for any help.
  7. Hi friends ! I'm intend to create a very complex website for a insurance company that will include very complex calculations and validation rules. To achieve this, I've created a global field called "validation (textarea)", where I want to write php scripts for validation in the style Hanna Code. So, every single record that I will save (backend and frontend) should call the validation script before doing that. Is it possible with PW ? Could you help me with a roadmap ? Thank you all ! Bacos
  8. You're welcome ! I think that I found the new instruction : echo $modules->MarkupSocialShareButtons->render(array("theme" => "templates/mythemes/mytheme"); I'm gonna try it !
  9. Hi Soma ! I saw in theme.php file. * Alternatively from the API you can set a theme by using method ->setTheme(themename) * i.e. $modules->MarkupSocialShareButtons->setTheme("round")->render(); * * To create your own create a file with the content of this file somewhere in your site/templates/ folder * This would be a subfolder, and in there a file "theme.php". * * Now you can enter the path relative from "site/templates" in the module config * $modules->MarkupSocialShareButtons->setTheme("mythemes/mytheme")->render(); I guess I misunderstood this instruction !
  10. Hi Soma !! Very nice module... help me a lot ! I'm trying to create my own theme (color) and when I call : $content .= $modules->MarkupSocialShareButtons->setTheme("css/color")->render(); I got Error: Exception: Method MarkupSocialShareButtons::setTheme does not exist or is not callable in this context (in D:\xampp\htdocs\PWGriffConvites\wire\core\Wire.php line 326) #0 D:\xampp\htdocs\PWGriffConvites\site\templates\convite.php(34): Wire->__call('setTheme', Array) #1 D:\xampp\htdocs\PWGriffConvites\site\templates\convite.php(34): MarkupSocialShareButtons->setTheme('css/color') css/color are folders, and inside color folder I have theme.php and png folder also. Am I doing something wrong ? Thank you !
  • Create New...