Jump to content

fredbob

Members
  • Posts

    26
  • Joined

  • Last visited

Everything posted by fredbob

  1. Hi All, Just wondering if anyone has succ essfully run ProcessWire on an Azure App Service, Linux not Windows. Started off with a fresh install: Uploaded site files Setup Azure MySQL server Ran installer During the installer I get this error: Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /home/site/wwwroot/wire/core/Session.php on line 247 Warning: session_name(): Cannot change session name when headers already sent in /home/site/wwwroot/wire/core/Session.php on line 251 Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /home/site/wwwroot/wire/core/Session.php on line 257 Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /home/site/wwwroot/wire/core/Session.php on line 258 Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /home/site/wwwroot/wire/core/Session.php on line 259 Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /home/site/wwwroot/wire/core/Session.php on line 260 Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /home/site/wwwroot/wire/core/Session.php on line 272 Then I proceed to login ProcessWire: ProcessLogin: This request was aborted because it appears to be forged. DEBUG MODE BACKTRACE ($config->debug == true): #0 /home/site/wwwroot/wire/modules/Inputfield/InputfieldForm.module(155): ProcessWire\SessionCSRF->validate() #1 /home/site/wwwroot/wire/core/Wire.php(397): ProcessWire\InputfieldForm->___processInput(Object(ProcessWire\WireInputData)) #2 /home/site/wwwroot/wire/core/WireHooks.php(823): ProcessWire\Wire->_callMethod('___processInput', Array) #3 /home/site/wwwroot/wire/core/Wire.php(465): ProcessWire\WireHooks->runHooks(Object(ProcessWire\InputfieldForm), 'processInput', Array) #4 /home/site/wwwroot/wire/modules/Process/ProcessLogin/ProcessLogin.module(362): ProcessWire\Wire->__call('processInput', Array) #5 /home/site/wwwroot/wire/core/Wire.php(394): ProcessWire\ProcessLogin->___execute() #6 /home/site/wwwroot/wire/core/WireHooks.php(823): ProcessWire\Wire->_callMethod('___execute', Array) #7 /home/site/wwwroot/wire/core/Wire.php(465): ProcessWire\WireHooks->runHooks(Object(ProcessWire\ProcessLogin), 'execute', Array) #8 /home/site/wwwroot/wire/core/ProcessController.php(337): ProcessWire\Wire->__call('execute', Array) #9 /home/site/wwwroot/wire/core/Wire.php(394): ProcessWire\ProcessController->___execute() #10 /home/site/wwwroot/wire/core/WireHooks.php(823): ProcessWire\Wire->_callMethod('___execute', Array) #11 /home/site/wwwroot/wire/core/Wire.php(465): ProcessWire\WireHooks->runHooks(Object(ProcessWire\ProcessController), 'execute', Array) #12 /home/site/wwwroot/wire/core/admin.php(153): ProcessWire\Wire->__call('execute', Array) #13 /home/site/wwwroot/wire/modules/AdminTheme/AdminThemeUikit/controller.php(15): require('/home/site/wwwr...') #14 /home/site/wwwroot/site/templates/admin.php(15): require('/home/site/wwwr...') #15 /home/site/wwwroot/wire/core/TemplateFile.php(318): require('/home/site/wwwr...') #16 /home/site/wwwroot/wire/core/Wire.php(394): ProcessWire\TemplateFile->___render() #17 /home/site/wwwroot/wire/core/WireHooks.php(823): ProcessWire\Wire->_callMethod('___render', Array) #18 /home/site/wwwroot/wire/core/Wire.php(465): ProcessWire\WireHooks->runHooks(Object(ProcessWire\TemplateFile), 'render', Array) #19 /home/site/wwwroot/wire/modules/PageRender.module(536): ProcessWire\Wire->__call('render', Array) #20 /home/site/wwwroot/wire/core/Wire.php(397): ProcessWire\PageRender->___renderPage(Object(ProcessWire\HookEvent)) #21 /home/site/wwwroot/wire/core/WireHooks.php(823): ProcessWire\Wire->_callMethod('___renderPage', Array) #22 /home/site/wwwroot/wire/core/Wire.php(465): ProcessWire\WireHooks->runHooks(Object(ProcessWire\PageRender), 'renderPage', Array) #23 /home/site/wwwroot/wire/core/WireHooks.php(924): ProcessWire\Wire->__call('renderPage', Array) #24 /home/site/wwwroot/wire/core/Wire.php(465): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Page), 'render', Array) #25 /home/site/wwwroot/wire/modules/Process/ProcessPageView.module(213): ProcessWire\Wire->__call('render', Array) #26 /home/site/wwwroot/wire/core/Wire.php(397): ProcessWire\ProcessPageView->___execute(true) #27 /home/site/wwwroot/wire/core/WireHooks.php(823): ProcessWire\Wire->_callMethod('___execute', Array) #28 /home/site/wwwroot/wire/core/Wire.php(465): ProcessWire\WireHooks->runHooks(Object(ProcessWire\ProcessPageView), 'execute', Array) #29 /home/site/wwwroot/index.php(55): ProcessWire\Wire->__call('execute', Array) #30 {main} I've changed permissions Checked .htaccess Set PHP session path Azure - ARR affinity (Improve performance of your stateless app by turning Affinity Cookie off, stateful apps should keep this setting on for compatibility. Learn more) Azure - Always on (Prevents your app from being idled out due to inactivity) Envirnomnet Web Server - Azure App Service (Linux) https://docs.microsoft.com/en-us/azure/app-service/containers/ PHP - 7.2 (7.2-apache), also tried 7.3 (7.3-apache) MySQL - 5.7 https://docs.microsoft.com/en-us/azure/mysql/ If anyone has gotten this to work some pointers would be great! I've decided I don't want to run it on a Windows App Service, as I would have to convert .htaccess to web.config and ProcessWire is designed and supported for Apache / Linux web servers. Any help is appreciated!
  2. Did you ever work this one out? I'm trying to run Processwire on Azure App Service (Linux), file permissions are set correct, and I have set the PHP session path. I get the same errors on installation, then I can't looking due to the "ProcessWire: ProcessLogin: This request was aborted because it appears to be forged." error.
  3. I think that was just me when I was pasting it in. I still get the same error...
  4. Bump, I haven't made any progress on this. I am sure its something to do with the way that the core classes are included. But I am not sure. Cheers.
  5. I left this for a while, and have just come back to it. @BitPoet That creates the user okay, but doesn't allow to change the name, email, pass etc (in my testing anyway), it just created the user with today's date and time. For anyone who is interested, this is my solution. $u = $pw2->wire(new User()); $u->of(false); $u->name = $username; $u->email = $email; $u->pass = $password; $u->addRole("client"); $u->admin_theme = ("AdminThemeUikit"); $u->save(); $u->of(true); Credit from
  6. Hi! So I am trying to pull some information from another ProcessWire installation within the admin area (_main.php / page tree from the AdminThemeUikit module). $pwpath = "/path/"; $pwurl = "https://url.example"; $pw = new ProcessWire($pwpath , $pwurl); which then gives me this error I then read that if it is not already in a ProcessWire environment that I would have to include the core, require('/path/to/wire/core/ProcessWire.php'); Which I tried, and makes sense that it already says it is included. So what now? Here is my _main.php from the AdminThemeUikit module (work in progress), just for reference
  7. Is it possible to create users from another ProcessWire instance. This is my code for a registration page, it creates the user, but doesn't update it with the username, password and email. I presume this is because $u is on the current page, and not in the instance, and when $u is saved its not updating it on the other instance. I can't figure it out, if anyone has any ideas thy would be greatly appreciated. <?php if ($input->post->submit) { $username = $sanitizer->username($input->post->username); $email = $sanitizer->email($input->post->email); $password = $input->post->password; echo $username; echo $email; $clientbp = new ProcessWire('/path/', 'http://domain.com'); $u = $clientbp->wire(new User()); $u->of(false); $u->name = $username; $u->email = $email; $u->pass = $password; $u->addRole("guest"); $u->save(); $u->of(true); } ?> <form action="./" accept-charset="UTF-8" autocomplete="off" method="post"> <input type="text" name="username" placeholder="Username"> <input type="text" name="email" placeholder="Email"> <input type="password" name="password" placeholder="Password"> <button type="submit" name="submit" value="register">Register</button> </form>
  8. I am a bit silly, $client = $pages->get("name=" . $user->name); Replaced $client = $pages->find("name=" . $user->name); Which now means I can go <?php foreach($client->find("template=bob") as $bob): echo $bob->title; endforeach; ?> I feel a bit silly about that, it was a simple fix between find() and get().
  9. I have a couple of questions about the module, I am using multisite 0.0.6 (unsure if this is the latest?) in conjunction with Admin Restrict Branch, in the admin area I am going to have a couple of admin listing pages that will, for example list all the pages with the template 'bob'. The admin restrict is setup so when 'user1' logs in they can only see the user1 branch, and same for 'user2' and so on. Each users domain is setup so it is 'user1.example.com'. What I am after is when a user logs in and goes to the listing page, it will find all of the template 'bob' but only in their brand. <?php foreach($pages->find("template=bob") as $bob): echo $bob->title; endforeach; ?> Right now this code, displays all of the pages that have the 'bob' template not just the ones in the restricted branch. Any ideas? This works to find the 'user1' page if user1 is logged in. But I can't figure it out. <?php // This is the variable for the root users page (i.e the users home page) $userroot = $pages->find("name=" . $user->name); ?> Also, I would like the same in the frontend, so when a user goes to 'user1.example.com' and I run the same code as above it will do the same thing. For now, I have done this, which works. I don't know if this is good practice or not? <?php $pages = $page->rootParent; ?> -main --user1 ---Page1 (template=bob) ---Page2 (template=bob) --user2 ---Page3 (template=bob) ---page4 (template=bob) -Admin --Listing Page -Trash
  10. Do you think it would be wise to use multiple sites in that way? Because each site is completely separate from every other site essentially. But I also need to be able to manege them all (updates, users etc) Originally, I was going to have separate cPanel account and PW installations for each user. But this is difficult to manage future updates (from PW and myself), and share user data from the user list on the main website (like password sync etc). However, the site folder and wire folder will remain THE SAME for each install, the only difference will be the data, pages etc.
  11. Hi! Basically I have created a website 'builder' , in ProcessWire, and how I would like it to work, is that a user signs up, on the main website, and it creates their account, which then gives them access to the website builder being their own website. Similar to how Square Space works. I'm not sure how to go about the multiple sites at all, if anyone could give me some pointers? Cheers, Sam.
  12. Hi, I am trying to create a frontend form that allows the user to create a page with a specific template (and fill out the fields) I have started to use code from this post This is my current code <?php $p = $pages->get(1029); $template = $p->template->name; // this is the template where we will get the fields from // make a form $form = $modules->get('InputfieldForm'); $form->method = 'post'; $form->action = './'; $form->attr("id+name",'subscribe-form'); // add the page's fields to the form $fields = $p->fieldgroup; foreach($fields as $field) { $inputfield = $fields->{$field->name}->getInputfield($p); $form->append($inputfield); } // add a submit button to the form $submit = $modules->get('InputfieldSubmit'); $submit->name = 'save_service'; $submit->attr("value", "Go"); $form->append($submit); // process the form if it was submitted if($this->input->post->save_service) { // now we assume the form has been submitted. // tell the form to process input from the post vars. $form->processInput($this->input->post); // see if any errors occurred if( count( $form->getErrors() )) { // re-render the form, it will include the error messages echo $form->render(); } else { // successful form submission $np = new Page(); // create new page object $np->template = 'service'; // set template $np->parent = $pages->get($user); // set the parent $np->of(false); // turn off output formatting before setting values $np->save(); foreach($np->fields as $f) { $np->set($f->name, $form->get($f->name)->value); } $np->save(); //create the page echo "<p>Page saved.</p>"; } } else { echo $form->render(); } And I am getting this error, I can't figure out what it is. Error: Exception: Unknown Selector operator: '' -- was your selector value properly escaped? (in /home/dev/public_html/wire/core/Selectors.php line 396) #0 /home/dev/public_html/wire/core/Selectors.php(439): ProcessWire\Selectors->create('41', '', '') #1 /home/dev/public_html/wire/core/Selectors.php(159): ProcessWire\Selectors->extractString('41') #2 /home/dev/public_html/wire/core/Selectors.php(145): ProcessWire\Selectors->setSelectorString(Object(ProcessWire\User)) #3 /home/dev/public_html/wire/core/PagesLoader.php(217): ProcessWire\Selectors->init(Object(ProcessWire\User)) #4 /home/dev/public_html/wire/core/Pages.php(232): ProcessWire\PagesLoader->find(Object(ProcessWire\User), Array) #5 /home/dev/public_html/wire/core/Wire.php(383): ProcessWire\Pages->___find(Object(ProcessWire\User), Array) #6 /home/dev/public_html/wire/core/WireHooks.php(698): ProcessWire\Wire->_callMethod('___find', Array) #7 /home/dev/public_html/wire/core/Wire.php(439): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Pages), 'find', Ar This error message was shown because: you are logged in as a Superuser. Error has been logged.
  13. Hi, In the custom PHP selector code for a PageField how do I go about selecting pages that have a field that is the page that I am currently editing. $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->name == 'field2') { $page = $event->arguments('page'); $event->return = $event->pages->find('template=template1, field1=$page'); } });
  14. Basically I would like to know what would cause this error:
  15. The site modules do not install when I use the first method. It isn't a problem for me if I were using it, but because we are offering this a service to people, (they go to our website, purchase the product, it automatically installs then they can use the product) then yes it is a problem.
  16. I have tried one more thing, I have gotten the SQL file from the installer 'wire/core/install.sql' and then put the site profile SQL file after, and no such luck. The same error as above. Cheers.
  17. Hi! I am setting up an automated installed to install ProcessWire with a site profile using Softaculous and WHMCS. I am creating a custom package for Softaculous, basically what it is doing is coping the appropriate files across and setting up the database from a SQL file. What I have tried is: Export the SQL file straight from PhpMyAdmin This causes the modules not to be installed at all, you have to click refresh in the modules section for them to show up. Export the SQL file from PhpMyAdmin (this sets up all the dependancies etc) then copy the file from the site profile I was hoping that this would install the modules as I had them in the ProcessWire install that I am trying to replicate. However I get this error If anyone has any ideas, on what would be the best way about doing this? I realize that the second version is a little bit dodgy. The only other thing I can think of, is grabbing the install file that ProcessWire uses in its installer and using the SQL file or database information in that and merging it with the site profile.
  18. That worked perfectly thank you! I was trying to do it without putting it into a variable first like this $event->return = $page->parent->parent_multi_page_field;
  19. Hi, I have a field on a page that I am trying to set the selectable pages to the parent pages, multi page field. -- Parent (has page field with pages I want to select from) -- -- Child (has field that needs to be able to select pages from the parents page field) I have tried using custom PHP selectors, but in the new version of processwire the custom PHP selector has been changed into a hook. I am not sure how to write it, any help would be appreciated. Cheers.
  20. That worked! Thank you guys! Those conditionals hadn't been finished yet that's why the if and else were doing the same thing. @kongondo Thanks for the tip and welcome!
  21. Apologies I originally put this in the wrong sub forum. I am having some trouble with my admin table, I am using the MarkupAdminTable module that is included with ProcessWire. It is not outputting one of the columns properly when I use the links. I will attach two images and their corresponding code to show what is happening. The code bellow is how I want it to look but with links. <?php $table = $modules->get("MarkupAdminDataTable"); function publishedCol($value) { if ($value == 1) return "Yes"; else return "No"; } function pedigreeParentsName($value) { if (count($value->title) > 0) return $value->title; else return 'No Parent Defined'; } function pedigreeParentsLink($value) { if (count($value->title) > 0) return $value->url; else return $value->url; } /* breed id */ $breed = $input->get['id']; $published = $input->get['pub']; if (empty($breed)) { $table->headerRow( ["Dog", "Gender", "Sire", "Dam", "Breed", "Website display"] ); foreach($pages->find("template=dog, sort=title") as $page){ $data = array( // Values with a sting key are converter to a link: title => link $page->title => $config->urls->admin."page/edit/?id=".$page->id, $page->dog_gender->title, pedigreeParentsName($page->father), pedigreeParentsName($page->mother), $page->parent->title, publishedCol($page->dog_create_page) ); $table->row($data); } } else { echo "<h2>$title</h2>"; $table->headerRow( ["Dog", "Gender", "Sire", "Dam", "Website display"] ); foreach($pages->find("template=dog, sort=title") as $page){ $data = array( // Values with a sting key are converter to a link: title => link $page->title => $config->urls->admin."page/edit/?id=".$page->id, $page->dog_gender->title, pedigreeParentsName($page->father), pedigreeParentsName($page->mother), publishedCol($page->dog_create_page) ); $table->row($data); } } // $table->footerRow( $someArray ); echo $table->render(); ?> The code below shows the issue I am having when I add the links. <?php $table = $modules->get("MarkupAdminDataTable"); function publishedCol($value) { if ($value == 1) return "Yes"; else return "No"; } function pedigreeParentsName($value) { if (count($value->title) > 0) return $value->title; else return 'No Parent Defined'; } function pedigreeParentsLink($value) { if (count($value->title) > 0) return $value->url; else return $value->url; } /* breed id */ $breed = $input->get['id']; $published = $input->get['pub']; if (empty($breed)) { $table->headerRow( ["Dog", "Gender", "Sire", "Dam", "Breed", "Website display"] ); foreach($pages->find("template=dog, sort=title") as $page){ $data = array( // Values with a sting key are converter to a link: title => link $page->title => $config->urls->admin."page/edit/?id=".$page->id, $page->dog_gender->title, pedigreeParentsName($page->father) => pedigreeParentsLink($page->father), pedigreeParentsName($page->mother) => pedigreeParentsLink($page->mother), $page->parent->title, publishedCol($page->dog_create_page) ); $table->row($data); } } else { echo "<h2>$title</h2>"; $table->headerRow( ["Dog", "Gender", "Sire", "Dam", "Website display"] ); foreach($pages->find("template=dog, sort=title") as $page){ $data = array( // Values with a sting key are converter to a link: title => link $page->title => $config->urls->admin."page/edit/?id=".$page->id, $page->dog_gender->title, pedigreeParentsName($page->father) => pedigreeParentsLink($page->father), pedigreeParentsName($page->mother) => pedigreeParentsLink($page->mother), publishedCol($page->dog_create_page) ); $table->row($data); } } // $table->footerRow( $someArray ); echo $table->render(); ?>
  22. I think I have worked out a way for this to work, using softaculous. It enables me to push updates out to my clients when requires, and WHMCS has a module that allows an automatic install. I am in the process of making a custom package, I have copied the 'stock/default' installation package for ProcessWire and have modified the setup to use my site profile, I am having some permissions issues at the moment. Which corresponds to if($module && empty($options['noPermissionCheck'])) { if(!$this->hasPermission($module, $this->wire('user'), $this->wire('page'))) { throw new WirePermissionException($this->_('You do not have permission to execute this module') . ' - ' . wireClassName($module)); } } If I comment these lines out, I am unable to login into ProcessWire, but all the pages work.
  23. Hi! I am setting up a sass solution using ProcessWire. I'd like to be able to automatically install ProcessWire with a custom site profile when someone purchases a package through WHMCS. Currently I have it create a new cPanel account, however I am not sure on how to automate the installation of ProcessWire. Another note also is that we are going to want to push out updates and maintain each installation of ProcessWire. I don't know the best way about doing this is, I've seen some other posts but majority are very vague. Cheers.
×
×
  • Create New...