Jump to content

Search the Community

Showing results for tags 'post'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Categories

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 20 results

  1. Hello forum! I have a site, where I want to remember two settings defined by user: 1) Theme (light or dark) 2) Language (Finnish or English) Because user makes changes to these settings on client side, I am a bit lost with how can I save them in ProcessWire $session variable? I would like to use $session for more reliable saving, and since it is only two variables I will use, I doubt it will become too resource-needy. I have tried using jQuery's post() -method referring to a file in Templates folder (theme.php), but I get 403 Forbidden Error. I don't like the idea of trying to post to same file user currently is in, which is why I thought having a separate file would be good in this. Contents of theme.php: <?php namespace ProcessWire; header('Access-Control-Allow-Origin: https://domain.com'); $theme = $input->post['theme']; if(!empty($theme)) $session->theme = $theme; ?> Long story short: Does anybody have any pro tips I could use with setting and getting $session variables?
  2. Hello, this module can publish content of a Processwire page on a Facebook page, triggered by saving the Processwire page. To set it up, configure the module with a Facebook app ID, secret and a Page ID. Following is additional configuration on Facebook for developers: Minimum Required Facebook App configuration: on Settings -> Basics, provide the App Domains, provide the Site URL, on Settings -> Advanced, set the API version (has been tested up to v3.3), add Product: Facebook Login, on Facebook Login -> Settings, set Client OAuth Login: Yes, set Web OAuth Login: Yes, set Enforce HTTPS: Yes, add "http://www.example.com/processwire/page/" to field Valid OAuth Redirect URIs. This module is configurable as follows: Templates: posts can take place only for pages with the defined templates. On/Off switch: specify a checkbox field that will not allow the post if checked. Specify a message and/or an image for the post. Usage edit the desired PW page and save; it will post right after the initial Facebook log in and permission granting. After that, an access token is kept. Download PW module directory: http://modules.processwire.com/modules/auto-fb-post/ Github: https://github.com/kastrind/AutoFbPost Note: Facebook SDK for PHP is utilized.
  3. With JS fetch() it is a bit tricky to get for example $_POST populated (params need to be FormData / forms), but would it possible to get PW $input (get, post, urlSegments, queryString) working for fetch requests? Is there a fix / hook / workaround to solve it PW side?
  4. I am using this function to get blogpost but I don't see what's wrong in it and why it is now showing anything in frontend. function ukBlogPost(Page $page, $options = array()) { $defaults = array( 'summarize' => null, // Display blog post summary rather than full post? (null=auto-detect) 'metaIcon' => 'info', 'moreIcon' => 'arrow-right', 'moreText' => __('Read more'), 'categoryIcon' => 'hashtag', 'bylineText' => __('Posted by %1$s on %2$s'), ); $options = _ukMergeOptions($defaults, $options); $title = $page->title; $img = $page->images->first(); $date = $page->date ? $page->date : $page->createdStr; $name = $page->createdUser->name; $body = summarizeText($page->get('body'), 100); $metaIcon = ukIcon($options['metaIcon']); $moreIcon = ukIcon($options['moreIcon']); $categoryIcon = ukIcon($options['categoryIcon']); $n = $page->comments->count(); $numComments = $n ? "<a href='$page->url#comments'>" . ukIcon('comments') . " $n</a>" : ""; $itn = $page->get('itineraries'); $ito = $itn->each( "<h4> {itineraries_title}</h4> <p>{itineraries_details} </p> "); if($options['summarize'] === null) { // auto-detect: summarize if current page is not the same as the blog post $options['summarize'] = page()->id != $page->id; } /* $categories = $page->categories->each($categoryIcon . "<a class='uk-button uk-button-text' href='{url}'>{title}</a> " );*/ if($options['summarize']) { // link to post in title, and use just the first paragraph in teaser mode $title = "<a href='$page->url'>$title</a>"; $body = explode('</p>', $body); $body = reset($body) . ' '; $body .= "<a href='$page->url'>$options[moreText] $moreIcon</a></p>"; $class = 'blog-post-summary'; } else { $class = 'blog-post-full'; } if($options['summarize']) { $heading = "<h4 class='uk-margin-remove tour-heading'>$title</h4>"; } else { $heading = "<h3 class='uk-article-title uk-margin-remove tour-heading'>$title</h3>"; } $byline = sprintf($options['bylineText'], $name, $date); if($img) { $img = $img->size(375,380); } // return the blog post article markup return " <div> <div class='uk-card'> <div class='uk-inline-clip uk-transition-toggle'> <img src='$img->url' alt='$img->description' class='uk-border-rounded uk-transition-scale-up uk-transition-opaque' > <div class='uk-overlay uk-light uk-position-bottom'> <p class='uk-text-light'>$heading</p> </div> </div> $ito </div> </div> "; } I tried running $title, $img etc. - or are they all blank? simultaneously but nothing returns anything. I do not know why it is not working
  5. Hi All, I am wondering if you could provide input on the best way an item as a user favorite. I am setting up a price comaprison website, and have most of the logic done for the site. Search results, listing page, login/logout, search, etc. It's all looking pretty good. However someone has suggested to me that users might like to save an item as a favorite. So my idea behind that was to have a button on each of the grid items in the search results page. This is my search results page code with the button within the item. <form id="add_fav" name="add_fav" autocomplete="off" accept-charset="utf-8" action="./" method="post"> <button class="wish_btn" name="add_fav">Add Fav</button> </form> Where the business logic is on the page, this is what I have so far - I just don't know how to align an item to a user. $log->save ('pageview', 'testing'); function clense_input($data){ $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } $sort = "title"; // Logic for favorites if ($_SERVER["REQUEST_METHOD"] == "POST") { if (isset($_POST['add_fav'])) { $favs = $sanitizer->text($_POST['add_fav']); if(!empty($favs)){ $ticket = $pages->get($favs); // Set page name if($favs != null){ $favs->of(false); $favs->fav_title = $page->user->name; // Save username $favs->fav_title = $page->title->id; // Save page id to favs list $favs->save(); echo "Fav saved."; } } } }
  6. I'm trying to create a form that does a post to a php file, getting the values before posting to a database. For example a form with an action /controller/add_client.php. My current workaround is create a page with the add_client template. But is it possible to do that without creating a page? I.E i do not want it to show on the CMS side.
  7. dragan

    JSON POST woes

    I'm puzzled by something I thought would be rather easy: I want to send a request to a PW page. It's POST, and I define a header, and send data as JSON. I need to send data in the following format: $ POST https://mysite.com/foo/bar/ {"headers": {"Authorization": "Bearer API_KEY", "Content-Type": "application/json"}, "body": {"fields": {"Name": "<get name>", "Department": "<get team>", "Home Address": "<get address>", "Phone #": "<get phone>", "Personal Email Address": "<get email>", "Birthday": "<get birthday>", "Date Added": "<call>currentDate</call>" }}} This is supposed to be sent via a Chatbot engine (Dexter). In the PW page that should handle this, $_POST is always empty, as is $_REQUEST. Same for PW's $input or if ($config->ajax) {}. I get the header, but no data. So I dug deeper, and tried this: @ini_set("allow_url_fopen", true); @ini_set("always_populate_raw_post_data", true); $data = json_decode(file_get_contents('php://input'), true); $d = print_r($data, true); // I store this, along with the header infos and timestamp in a PW page-field (instead of using file_put_content) I checked page permissions, I made sure I use pagename/, i.e. with trailing slash only, to avoid stripping the header away due to redirects (which somebody in an older forum thread once highly suggested). I tried to send the same stuff that the chatbot does via CURL. Nothing. PW error logs don't report anything (site is still in dev-mode). PW 3.0.81 - everything else runs just fine. Any ideas what I should change? Any more PHP/Apache settings maybe? Help is highly appreciated.
  8. Hi. I have a contact page form that collects user queries in the usual manner and when validation is ok it does a method = post with action = contact-form.php to execute the sending of mail from the server. This is all fine and works well, but when the sending is done, I would like a landing page in my project to be displayed. How would i do that? I've tried adding PW code to the contact-form.php to invoke my landing page but I think this is not in scope as nothing happens. Many thanks for any guidance. Paul
  9. hi i want to post variables to a page via ajax to get result from my database depenting my post value so my ajax is: var clickval = clickelement.value; var dataval = "city=" + clickval; $.ajax({ type: 'POST', url: "*MY PAGE SMART URL*", // e.g. http://my_domain/my_page.... data: dataval, dataType: 'text', //or json, i try both complete: function(data, status){ alert(data.responseText); } }); and in php page: $getcity = $input->post->city; echo "value = ".$getcity; just to show my post value... and my alert is "value = ". $getcity is empty and $input has no value inside and it seems like post is never be done, but i have no error in my console... can anyone help me?
  10. Trying to deploy a PW site to a client's hosting provider. Everything works as expected in development, but on the production host, certain AJAX requests fail. Here's what I'm seeing: 1) I have form on every page which is submitted via AJAX POST to the current page. No matter which page you POST to, it always returns a PW 404 page. 2) AJAX image uploads on the back end return a 200 or 302 for the original request, then spawn a GET request for the homepage. In trying to troubleshoot this, I have found that the host has both suhosin and mod_security installed. They've provided me with a local php.ini to test configuration changes. I've added the following to .htaccess (temporarily): # account-specific php.ini file <IfModule mod_suphp.c> suPHP_ConfigPath /home/[username] <Files php.ini> order allow,deny deny from all </Files> </IfModule> # disable mod_security <IfModule mod_security.c> SecFilterEngine Off SecFilterScanPOST Off </IfModule> In the php.ini file, I've set the following directives: suhosin.simulation = On always_populate_raw_post_data = -1 I've also set a specific directory for uploads: upload_tmp_dir = /home/[username]/tmp GD support is included. PW doesn't log any errors, even with $config->debug set to true. This is PW 2.7.3 on PHP 5.6.28. What else should I check?
  11. I'm new to processwire and i'm looking for a solution to handle post requests with inputfields. At the moment my code looks like this: class InputfieldTest extends Inputfield { ... public function init() { if($this->config->ajax && $this->input->InputfieldTest){ header('Content-Type: application/json'); echo "{'test':'test'}"; exit; } } ... } And then there is a JS file with: var testdata = { InputfieldTest: 'InputfieldTest' }; testdata[$('#testa-tokenname').text()] = $('#testa-tokenvalue').text(); $.ajax({ url: "http://bla.at/processwire/page/edit/?id=1816&InputfieldTest=1", data: testdata, type: 'POST', success: function(json) { alert(json); } }); Everything works fine with a GET request, but with the POST i just get the message {"error":false,"message":"AJAX Page not saved (no changes)"} Any ideas? Or is it all wrong and i should use a different approach?
  12. I'm building a smartphone app that allows users to record a voice clip and send it to our server, which runs ProcessWire. Files are sent over HTTPS Post, currently without any sort of authentication. I've succeeded using the WireUpload class to fetch the uploaded file from the $_FILES super global. Where I get in trouble is when I try to add the audio file to the audio page, where there's an Input field called 'audiofile'. Whenever I try to use any file related method, an Internal Server Error occurs. Here's my code, which runs in the page's template. <?php Header("Content-Type: text/plain"); $upload_path = $config->paths->assets . "files/audio/"; $u = new WireUpload('files'); $u->setMaxFiles(1); $u->setOverwrite(false); $u->setValidExtensions(array('mp3', 'mp4', 'm4a')); $u->setDestinationPath($upload_path); // I can confirm through my FTP client that the file sent through POST actually shows up in the $upload_path location. $fileresult = $u->execute(); // This is the File input field in my template. Doing print_r($audiofield) confirms this is an existing object. $audiofield = $fields->get("audiofile"); // Trying this for the heck of it, but all that results is HTTP 500. $audiofield->deleteAll(); foreach($fileresult as $filename) { // I've seen various examples on what to do now. Here's one that causes a 500 error. $page->'audiofile' = $upload_path . $filename; // This seems the most logical thing to do, but also causes HTTP 500. $audiofield->add($upload_path . $filename); // Unlinking succeeds (given that I comment out the lines that cause the HTTP 500 errors) unlink($upload_path . $filename); } // We never get to this phase. $page->save(); ?> Things of note: Server runs PHP 5.4.4-14+deb7u8 on Debian with Apache/2.2.22. File uploading through the admin on the audio page works without issues, also when uploading multiple files at once or sequentially. I've confirmed the owner of $upload_path to be www-data and its permissions to be 755. What's the final step I'm missing to add the audio file to the input field on my page?
  13. Hi folks, Okay this is a bit of an odd one to explain so if you need to email please do at rich.g.cook(at)gmail.com and I'll happily pay a fee for any solutions if needed. I'm building a simple cart/checkout setup and on submission at the checkout the form action, on a static test, was submission.php and on this .php file it got the $_POST data from the form, parsed it using twig, and items and pushed it using swift mail to the seller and the buyer. This all works fine statically, but the issue is now it's on a CMS the $_POST data isn't getting saved across so upon submission all the fields (first name, address etc) are just returning blank. If I hard link the form submission to the templates folder to submission.php then it works but in the URL you have the weird .php whereas if I add it as a page and template in the CMS it drops the .php which is nicer but it doesn't seem to save any of the data this way. I know this is a bit confusing, but hopefully I've made some sense and you guys could help. Thanks, R
  14. Can anyone see something obvious why i don't get seem to be able to access the fields in post as below please? dmc.dudmc.com/destination-deal-finder-results/ <?php /** * Page template * */ include("./dmcheader.inc"); include("./myfunctionlib.inc"); $current_page = $page->id; $upperbudget = $input->post['upperbudget']; $eaddress = $input->post['eaddress']; echo " <div class='container' ><br /> <div class='row'> <div class='col-md-12'> <img class='img img-responsive hidden-xs mymargin ' src={$page->single_image->url}> </div> </div> <div class='row top-buffer'> <div class='col-md-6' >"; echo $page->body; foreach($input->post as $key => $value) echo htmlentities("$key = $value") . "<br />"; foreach($input->get as $key => $value) echo htmlentities("$key = $value") . "<br />"; ?> <form role="form" action="http://dmc.dudmc.com/destination-deal-finder-results/" method="post"> <div class="form-group"> <label for="exampleInputEmail1">Email address</label> <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email"> </div> <div class="form-group"> <label for="upperbudget">Budget</label> <input type="text" class="form-control" id="upperbudget" placeholder="budget in euros"> </div> <button type="submit" class="btn btn-default">Submit</button> </form> <?php echo " </table> </div> <div class='col-md-6'>"; echo "<h3>Upper budget = euro $upperbudget $eaddress </h3>"; dealfinder($upperbudget); echo " </div> </div></div> </div> <!-- end container -->"; include("./dmcfooter.inc");
  15. Hello, I'm doing an API and I need that receives params via POST, I'm using Postman extension (https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm) for testing purposes and I am not recieving the vars, but I do a curl curl --data "var1=123&var2=asdf" http://mywebsite/function I got them right. On the access logs I got this 192.185.39.26 - - [08/May/2014:18:25:03 -0500] "POST http://mywebsite/function%C2'> 200 - "-" "-" Does Processwire have a security enabled for calls via post without headers? Thanks
  16. Hello, I'm wondering if this aproach is correct, had not been tested yet. What I'm trying to do is Log In an user from one browser and keep the user logged in a different browser. example: I have an app and send a login command to a processwire backend, the backend respons with the user id if the login was successful. http://example.com/login POST (encripted): username password response: 123 The code begin could be $username = $input->post('username'); $password = $input->post('password'); $user = $session->login($username, $password); if($user){ echo $user->id; } Then I read the User Id and open a new browser like this http://example.com/user/123 And the website checks if the user is logged in and opens a section only for logged in members. because PW saves the sessions in the server I think this could work. The code for this would be $userId = $input->urlSegment1; $user = $users->get($userId); if($user->isLoggedin()){ $session->redirect('/private/'); } else { $session->redirect('/'); } Thanks in advance
  17. level1=1 print_r($input->post->level1) return [level1] = 1 level1[level2] = 1 print_r($input->post->level1) return [level1][level2] =1 level1[level2][level3] = 1 print_r($input->post->level1) return null how to fix it!? processWire 2.4
  18. Hi, I am sanitizing some variables coming in via GET through Ajax as follows before passing them on to a selector. Is this the correct way of doing it? Secondly, can I instead type cast where I am expecting integers? Thanks. $sort = explode(" ", $sanitizer->selectorValue($input->get->SortX)); $sortOrder = $sort[1] == "DESC" ? "-" : "" ; $sortValue = $sort[0]; $start = $sanitizer->selectorValue($input->get->StartX); $limit = $sanitizer->selectorValue($input->get->SizeX); //Would this suffice as well since I am expecting integers here? //$start = (int) $input->get->StartX; //$limit = (int) $input->get->SizeX; //What about this (access as array index)? //$start = (int) $input->get["StartX"]; //$limit = (int) $input->get["SizeX"]; $results = $pages->find("has_parent!=2, id!=2|7, include=all, start=$start, limit=$limit, sort=$sortOrder$sortValue");
  19. I'm trying to get Paypal express checkout working... After going through the process, paypal redirects me back to my site where I'm supposed to grab the get variable 'token' anyways, I could never see it, and finally tried getting paypal to redirect to a page outside the PW site with the same code. The variables were now there. Come to think of it, I haven't been able to post forms to other pages either. The forms work when they post to themselves, but not when they post to other pages. Is this a security measure so that people cannot post false values to the page? Perhaps there's a setting somewhere I can change? EDIT (Solved): I went to setup => templates => template name => urls and I set "should page urls end with a slash?" to NO. EDIT (Even Better Solution): Make sure my return urls have slashes on them, also my urls in forms. Thanks Soma!
  20. Hey, I've searched for a while but with no results and I am anxious to get this done. I want to create a user password change script that changes the password to do this the user needs to fill in her/his old password. No problem but since PW does hash all passwords i cant just compare a hashed to a plain text password now can I. So I looked throught the wire folder and I couldn't really find something. How can I hash the password so I can compare it? Many thanks!
×
×
  • Create New...