Jump to content

Search the Community

Showing results for tags 'api'.

  • 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
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

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

  1. I'm using the multi-instance feature of PW to create a page from the wordpress admin and after the page is created i save its id in a custom meta field in wp. The page should be created/updated when a post is first created or updated through wp's post_updated hook. Here is the code: The page is created in PW but its id is not saved in wp custom meta field. If i comment the "$p->save();" line i don't get the error, but i obviously need it. On localhost it works, but on the server i get the error; same PW, WP (same plugins) and PHP version, only the os differs, Windows on localhost and Debian on the server. Any ideas? Update: I used the site profile exporter module to move from localhost to the live server and it seems like this was the cause as everything worked after i manually set up the templates and fields on a clean install. I did uncheck the installed checkbox from the module's options. Could that be the reason?
  2. Hello Fellow PW fans. I have since i started using PW allways been a bit afraid to use the API:s more advanced functions. Like creating pages or subpages on the fly in my PHP code in the page template file. So i read alot and finaly got a Eureka the other day. And have now tinkered around a bit and this simple example is the result. It´s just the bare basics. You could make this more advanced in infinity. I wanted to put this example somewhere for the future because i don´t think there is such a clean to the point example anywhere on the forums. All the others are deep within discussion threads with advanced stuff that are not of concern for people who looking for a simple example to start from. Notes: You should log in as admin before trying to run this code in your page template. I put the parent page i use in my testing as unpuplished for security. As allways, the API reference: https://processwire.com/api/ref/ is allways great to have when tinkering with the API. Any ways, here it comes, and you have to change paths and such to your requirements. <?PHP /* some random strings and stuff for testing */ $randTitle = 'test_' . mt_rand(0, 1000000); $randHash = 'test_' . md5(mt_rand(0, 100000) + time()); /* Example: Creating a new sub page to a parent page via API Author: EyeDentify This example do not check if the page name allready exist it just tries to save it no mather what. so you have to create that check your self. */ /* get parent page object to add sub page object to */ $addParent = $pages->get('/api-test-start/'); /* Instantiate a new page object */ $newPage = new Page(); /* turn output formating of for property manipulation */ $newPage->of(false); /* set the page objects parent so it is saved in the right place */ $newPage->parent = $addParent; /* set the name of the template to be used wich we uploaded before hand. */ $newPage->template = 'tmp_api_test_post'; /* sanitize and set page name and also used in the path */ $newPage->setName($sanitizer->pageNameUTF8($randTitle)); /* the title */ $newPage->title = $sanitizer->text($randTitle); /* set custom fields propertys, the ones we created ourselfs */ $newPage->api_test_hash = $randHash; /* save the page object to database as child of the given parent */ $newPage->save(); /* turn on output formatting again, importent because it should be ON when outputting it in template files later on. */ $newPage->of(true); ?> This is kind of a example and code template in one. I hope this can get others started that are beginners like myself to get more advanced with the PW API. I expect there is propably things that should be done a certain way but this is my way. Good luck with your API adventures. Update created a gist for the github users of the PW community of this example. https://gist.github.com/magnusbonnevier/4dbb3a28634a9b76bbf5855dd871606f
  3. I'm looking for the module(s) that contain the code used to define and process forms. I don't see anything in the dist/wire/* directories that has 'form' in the name. Does anyone know where this code is?
  4. Need your kindly tips and guidance: So I need for the configuration to have a field for every existing [template=]supplier, for matching with a dir (not already matched) within the module directory which contains the import & update scripts for that supplier. Then on the admin page created by this module under Admin > Setup, all of the Suppliers need to be listed with corresponding links to Import or Update where available (for those matched to a directory); and when one of those actions is executed it should load the results log in an iframe. But, how? Here is what I have so far, yet to try activated: <?php /** * Process Products Data (0.0.1) * Scrapes imports products, and updates pricing, availability variations synchronized with data feeds. Process tailored per source account/supplier. * * @author * * ProcessWire 3.x * Copyright (C) 2011 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://www.processwire.com * http://www.ryancramer.com * */ class ImportProductsData extends Process implements ConfigurableModule { public static function getModuleInfo() { return array( 'title' => "Process Products Data", 'version' => "0.0.1", 'summary' => "Scrapes &amp; imports products, and updates pricing, availability &amp; variations synchronized with data feeds. Process tailored per source account/supplier.", 'permission' => array(""), 'autoload' => false, 'singular' => true, 'permanent' => false, 'permission' => 'products-impupd', 'requires' => array("PHP>=5.4.0", "ProcessWire>=2.5.28", ""), //'installs' => array(""), ); } const PAGE_NAME = 'products-impupd'; static public function getDefaults() { return array( ); } public function init() { // $this->addStyle("custom.css"); // $this->addScript("custom.js"); // $this->addHookAfter("class::function", $this, "yourFunction"); } public function ___install() { // Create page "Product Data ImpUpd" under Setup $page = $this->pages->get('template=admin, name='.self::PAGE_NAME); if (!$page->id) { $page = new Page(); $page->template = 'admin'; $page->parent = $this->pages->get($this->config->adminRootPageID)->child('name=setup'); $page->title = 'Products Import&amp;Update'; $page->name = self::PAGE_NAME; $page->process = $this; $page->save(); // tell the user we created this page $this->message("Created Page: {$page->path}"); } } public function ___uninstall() { // Del page ImpUpd under Setup //$moduleID = $this->modules->getModuleID($this); $page = $this->pages->get('template=admin, name='.self::PAGE_NAME); if($page->id) { // if we found the page, let the user know and delete it $this->wire('pages')->delete($page, true); $this->message($this->_('Deleted Page: ') . $page->path); } } static public function getModuleConfigInputfields(array $data) { $inputfields = new InputfieldWrapper(); $defaults = self::getDefaults(); $data = array_merge($defaults, $data); return $inputfields; // foreach supplier select data set dir (each w/ import & update fct) // defaults = supplier.name // once selected execute import or update & log // in iframe & display results [log] } }
  5. I'm building a custom web service to service a mobile app from a PW site. I'm very exited to extend the site's functionality with PW's flexibility. I would like to check if what I'm doing is 'safe' and I'm not overexposing the site to vulnerabilities. 1. The site should serve a json file when accessing a specific URL. I like to keep my site's URLs with a /json to keep everything mirrored in my template files. products.php ?php /** * Productos template * */ if ($page->name == 'productos' AND $input->urlSegment(1) == 'json' ) { include("./productos.json.php"); die(); } if ($page->name == 'categorias' AND $input->urlSegment(1) == 'json' ) { include("./categorias.json.php"); die(); } include("./head.inc"); ?> // ... GOES ON 2. The template in charge of generating the JSON output. Loosely based in Ryan's web service plugin. Is there something dangerous in here? products.json.php <?php /** * Productos JSON * */ // $_GET Variables from URL $types = array( 'limit' => $input->get->limit, 'sort' => $input->get->sort ); $params = array(); foreach($types as $name => $type) { $value = $input->get->$name; if($value === null) continue; // not specified, skip over if(is_string($type)) $params[$name] = $sanitizer->text($value); // sanitize as string else $params[$name] = (int) $value; // sanitizer as int } // Set defaults if(empty($params['sort'])) $params['sort'] = '-modified'; // set a default if(empty($params['limit'])) $params['limit'] = 10; // set a default $params['template'] = 'producto'; // Build query string to search $new_query_string = http_build_query($params, '', ','); // Find $q = $pages->find($new_query_string); // Results $result = array( 'selector' => $new_query_string, 'total' => $q->count(), 'limit' => (int)$params['limit'], 'start' => 0, 'matches' => array() ); $categorias = $pages->get("/categorias/"); $soluciones = $pages->get("/soluciones/"); foreach ($q as $i) { // ... // PREPARING some variables // ... $result[matches][] = array( 'id' => $i->id, 'template' => $i->template->name, 'name' => $i->name, 'created' => $i->created, 'modified' => $i->modified, 'url' => $i->url, 'producto_thumb' => $product_thumb, 'producto_imagen' => $product_images, 'producto_packaging'=> $product_pack, 'producto_ficha' => $product_sheet, 'title' => $i->title, 'producto_bajada' => $i->producto_bajada, 'body' => $i->body, 'categorias' => $product_categories, 'soluciones' => $product_solutions, 'calc' => $i->calc, 'rendimiento_min' => $i->rendimiento_min, 'rendimiento_max' => $i->rendimiento_max ); } // JSON header('Content-Type: application/json'); echo(json_encode($result)); 3. Finally, this seems to be working ok, but I was wondering: a. How can I check for products modified since date X? b. How can I notify the web service that a product has been deleted since date X? PW moves files to the trash and I would like to keep it that way but I can't imagine how to notify the webservice!
  6. It dawned on me as I'm trying to write some code to synch between 2 Processwire sites that it would be handy to be able to access another site's object and data via the Processwire API. I'm guessing it hasn't been considered so far, most likely because of security concerns? It appears to me the only way that is currently possible is to have a Single Database, Multi site setup? https://processwire.com/api/modules/multi-site-support/
  7. Hello, i have some uderdata that i need to import to mailchimp or something else. How can i create with the api an xls or cv file ? This is simple data like name surname email an newsletterstatus.
  8. My code looks like this: //the page $p = new \ProcessWire\Page(); $p->template = 'template'; $p->parent = $site->pages->get('/parent/'); $p->title = 'title'; $p->save(); // the child pages for the pagetable field $d = new \ProcessWire\Page(); $d->template = 'template_pagetable'; $d->parent = $p->id; $d->title = 'title'; $d->save(); $p->save(); I get the page and it's children created, but the pagetable field doesn't have those pages set instead they are displayed as a checkbox list How can I add the child pages to the pageTable field?
  9. Hey, I made a hook that is triggered when a page with a certain template is saved. I meant to create the script only for the backend of the website. Now, whenever a page is saved on the front end (with the API) the module is being triggered. I was wondering if there is a method to have it only trigger whenever a page is saved on the backend (so not through the API). Jim
  10. Hi I have an image field in the back end, that expects multiple images. Now I've added this hook as the files are added: $page->addHookAfter('InputfieldFile::fileAdded', function($event) { $inputfield = $event->object; wire('log')->save('image-resizing', "Resizing "); $image = $event->argumentsByName("pagefile"); $image->size(800,0,array('upscaling' => false)); $image->size(300,200,array('cropping' => true, 'quality' => 80 )); }); It works absolutely fine for a small amount of images, but uploading a large amount doesn't seem to work. No errors are logged either. Now all thes photos appear to have uploaded in the back end, and show the thumbnails, but upon clicking save images are missing. I've checked all my php settings and ensured they are all adequate enough. memory_limit 512mb upload_max_filesize 200mb max_execution_time 300 If I disable this hook, I can upload all images fine. Please could anyone other any insight into what may be causing this issue? Thanks in advance
  11. Greetings Everyone, ************************************************* ************************************************* EDIT NOTE: This post started as a work-in-progress discussion as I was working out the elements of a successful form. After contributions from participants in this discussion, the code below has been tested and works well. You can use the code as shown below in your ProcessWire templates! Feel free to follow up with additional quesations/comments! ************************************************* ************************************************* I have successfully built front-end forms with ProcessWire to add pages via the API. It works great -- until I had to include image uploads along with the "regular" form fields. Then it temporarily got a bit complicated. In this discussion, I show how to handle front-end submissions in ProcessWire with the goal of allowing us to create pages from custom forms. I then go a step further and show how to use the same form to upload files (images and other files). I'm hoping this discussion can illustrate the whole process. I know a lot of people are interested in using ProcessWire to do front-end submissions, and my goal for this discussion is to benefit others as well as myself! First, here's my original contact form (no file uploads): <form action="/customer-service/contact/contact-success/" method="post"> <p><label for="contactname">Name:</label></p> <p><input type="text" name="contactname"></p> <p><label for="email">E-Mail:</label></p> <p><input type="email" name="email"></p> <p><label for="comments">Comments:</label></p> <p><textarea name="comments" cols="25" rows="6"></textarea></p> <button type="submit">Submit</button></form> And here's the "contact-success" page that picks up the form entry to create ProcessWire pages: <?php // First, confirm that a submission has been made if ($input->post->contactname) { // Save in the ProcessWire page tree; map submission to the template fields $np = new Page(); // create new page object $np->template = $templates->get("contact_submission"); $np->parent = $pages->get("/customer-service/contact-us/contact-submission-listing/"); // Send all form submissions through ProcessWire sanitization $title = $sanitizer->text($input->post->contactname); $name = $sanitizer->text($input->post->contactname); $contactname = $sanitizer->text($input->post->contactname); $email = $sanitizer->email($input->post->email); $comments = $sanitizer->textarea($input->post->comments); // Match up the sanitized inputs we just got with the template fields $np->of(false); $np->title = $contactname; $np->name = $contactname; $np->contactname = $contactname; $np->email = $email; $np->comments = $comments; // Save/create the page $np->save(); } ?> This works great! After submitting the form, we go to the "Success" page, and new submissions show up in the ProcessWire page tree right away. Excellent! Now I need to add a photo field. I altered the above form so it looks like this: <form action="/customer-service/contact/contact-success/" method="post" enctype="multipart/form-data"> <p><label for="contactname">Name:</label></p> <p><input type="text" name="contactname"></p> <p><label for="email">E-Mail:</label></p> <p><input type="email" name="email"></p> <p><label for="comments">Comments:</label></p> <p><textarea name="comments" cols="25" rows="6"></textarea></p> <p>Click the "Select Files" button below to upload your photo.</p> <input type="file" name="contact_photo" /> <button type="submit">Submit</button> </form> And here's the updated "contact-success" page: <?php // First, confirm that a submission has been made if($input->post->contactname) { // Set a temporary upload location where the submitted files are stored during form processing $upload_path = $config->paths->assets . "files/contact_files/"; // New wire upload $contact_photo = new WireUpload('contact_photo'); // References the name of the field in the HTML form that uploads the photo $contact_photo->setMaxFiles(5); $contact_photo->setOverwrite(false); $contact_photo->setDestinationPath($upload_path); $contact_photo->setValidExtensions(array('jpg', 'jpeg', 'png', 'gif')); // execute upload and check for errors $files = $contact_photo->execute(); // Run a count($files) test to make sure there are actually files; if so, proceed; if not, generate getErrors() if(!count($files)) { $contact_photo->error("Sorry, but you need to add a photo!"); return false; } // Do an initial save in the ProcessWire page tree; set the necessary information (template, parent, title, and name) $np = new Page(); // create new page object $np->template = $templates->get("contact_submission"); // set the template that applies to pages created from form submissions $np->parent = $pages->get("/customer-service/contact-us/contact-submission-listing/"); // set the parent for the page being created here // Send all the form's $_POST submissions through ProcessWire's sanitization and/or map to a variable with the same name as the template fields we'll be populating $np->title = $sanitizer->text($input->post->contactname); $np->name = $np->title; $np->contactname = $sanitizer->text($input->post->contactname); $np->email = $sanitizer->email($input->post->email); $np->comments = $sanitizer->textarea($input->post->comments); $np->save(); // Run photo upload foreach($files as $filename) { $pathname = $upload_path . $filename; $np->contact_photo->add($pathname); $np->message("Added file: $filename"); unlink($pathname); } // Save page again $np->save(); ?> <p>Thank you for your contact information.</p> <?php return true; } else { ?> <p> Sorry, your photo upload was not successful...</P> <?php } ?> Replace the field references with your own field names, make sure to change the various paths to match yours, and change the various messages to be what you need for your project. Read the entire discussion to see how we worked through getting to the solution shown above. Thanks, Matthew
  12. Hello, I'm migrated a few hundred users from an old system to PW via API. I created users, they can log in etc but only one thing is not working. Users have repeater fields. After I create users I also create those repeaters but I cannot get their value from front-end of the website. But if I go to users editing page from admin I see the values in place correctly. And when I save the user from editing page (without changing anything just saving), it starts to work normally. What am I missing here, what should I do to achieve this by API? Thanks
  13. I'm trying to create a new page through a file outside of the PW system. require('path/to/index.php'); $p = new Page(); $p->template = 'basic-page'; $p->parent = '/about/'; $p->title = 'Title'; $p->save(); Error: Echoing $wire->config->urls->assets works. I'm executing the code from the command line.
  14. Hi folks! In my current project I'm using ProcessWire v2.5 as pure backend service, including it in my frontend application as described here. Now I encountered some problems with the pw session handling interfering with the session handling of my frontend application. In this case the pw installation runs on a subdomain of my frontend application. Duplicate session_start() Each time I include pw's index.php pw tries to start it's own session, resulting in a notice that a session has already been started. To encounter this problem, I changed one row in Session::___init() (/ProcessWire/wire/core/Session.php): protected function ___init() { if (session_status() != PHP_SESSION_ACTIVE) @session_start(); } Session configuration override Additionally pw sets it's own session configuration and therefore overrides the config of my frontend application. To prevent this, I wrapped the session configuration block within the index.php (/ProcessWire/index.php, rows ~176ff) in a condition: if (session_status() != PHP_SESSION_ACTIVE) { session_name($config->sessionName); ini_set('session.use_cookies', true); ini_set('session.use_only_cookies', 1); ini_set('session.cookie_httponly', 1); ini_set('session.gc_maxlifetime', $config->sessionExpireSeconds); if (ini_get('session.save_handler') == 'files') { if (ini_get('session.gc_probability') == 0) { // Some debian distros replace PHP's gc without fully implementing it, // which results in broken garbage collection if the save_path is set. // As a result, we avoid setting the save_path when this is detected. } else { ini_set("session.save_path", rtrim($config->paths->sessions, '/')); } } } This is surely a bad way to fix my problem, because I had to change some code within the pw core. If anybody knows a more elegant solution to prevent pw from starting/configuring a session if used vi include, it would be very welcome. regards, Wumbo
  15. Hi, I have one xml FEED and I want to create pages for each item in XML via API. First time i am trying to create page with API, every thing is working fine but the issue is 1. its creating duplicate pages every time i run that XML. i have one unique field in XML called item_id & i want to create page with item_id as page name, i want to check that if page exist with item_id name before creating page. how can i do that ? Thanks
  16. I want to use the ProcessWire API and rendering of templates inside of a Shopware installation. So CMS pages should be served via ProcessWire (but with elements like a shopping cart coming from Shopware) and the products category page and the products detail page should be served from Shopware. How would I do that? I tried to include ProcessWire´s index.php into the shopware.php and even Shopware´s autoload.php but when I do this, I get a 500 Server Error. I use ProcessWire Version 3.0.24 (devns) and Shopware 5.2.1 My shopware directory is located at the same level as ProcessWire´s index.php and site and wire directories. Now I enabled ProcessWire´s debug mode and I get the following error: Error: Uncaught Zend_Session_Exception: session has already been started by session.auto-start or session_start() in K:\xampp\htdocs\meinprojekt\relaunch2016\src\shopware\engine\Library\Zend\Session.php:473 Stack trace: #0 K:\xampp\htdocs\meinprojekt\relaunch2016\src\shopware\engine\Shopware\Components\DependencyInjection\Bridge\Session.php(77): Zend_Session::start(Array) #1 K:\xampp\htdocs\meinprojekt\relaunch2016\src\shopware\var\cache\production_201607041559\proxies\ShopwareProductionda39a3ee5e6b4b0d3255bfef95601890afd80709ProjectContainer.php(679): Shopware\Components\DependencyInjection\Bridge\Session->factory(Object(ShopwareProductionda39a3ee5e6b4b0d3255bfef95601890afd80709ProjectContainer)) #2 K:\xampp\htdocs\meinprojekt\relaunch2016\src\shopware\vendor\symfony\dependency-injection\Container.php(314): ShopwareProductionda39a3ee5e6b4b0d3255bfef95601890afd80709ProjectContainer->getSessionService() #3 K:\xampp\htdocs\meinprojekt\relaunch2016\src\shopwar (line 473 of K:\xampp\htdocs\jentschura\p-jentschura\relaunch2016\src\shopware\engine\Library\Zend\Session.php) This error message was shown because: site is in debug mode. ($config->debug = true; => /site/config.php). Error has been logged. So it seems, when I include ProcessWire, it wants to start a new session, but Shopware already started one. Any suggestions what to do?
  17. Hello all. I have a question that I know must have a simple answer but I've been unable to find it in the forums or documentation. I want to throw a styled bit of markup around the links to switch language on a given page, but I don't want to output the markup if there is only the default language available and therefor no links to output. I was approaching this by trying to count the languages for the page which are marked in the settings tab as active, but I can't seem to find the correct syntax for that. I'm using the basic recommended method to generate the links but nothing in these lines helped me find the answer. foreach($languages as $language) { // if user is already viewing the page in this language, skip it if($language->id == $savedLanguage->id) continue; // if this page isn't viewable (active) for the language, skip it if(!$page->viewable($language)) continue; // set the user's language, so that the $page->url and any other // fields we access from it will be reflective of the $language $user->language = $language; // output a link to this page in the other language $language .= "<li class='language' style='float: left; display: inline; padding: 1em;'><a href='$page->url'>$language->title</a></li>"; } I tried count($languages) but that includes inactive languages in the count. I tried count($page->viewable($language)) and a few other inventive lines with no results until I decided to finally just ask here. I'm of course open to using some other calculation to determine whether to output my code. Appreciate the help!
  18. The situation I'm trying to arrive at a good solution for is how to store user-created data in a production environment. We're pre-production but the issue I'm running into is that storing user-data as pages creates problems when it comes time to update the production site with a new version (of our site, not PW). Because I'm adding data as pages the data will be deleted if I create a backup and restore it to the production environment. I've spent a fair amount of time writing some DB compare logic to find differences but that will require manual updating for each difference. Because pages reference other page numbers via IDs and the production environment will be creating users and meta-information pages it isn't possible to save/restore those particular pages around a backup (from development) and restore (to production) of the PW database. It seems like the most straightforward approach is to put the user-created data in separate tables so that PW information can be updated independently. That is pretty easy using $db or $database. Are there any best practices for this kind of thing? Am I thinking about it wrong? How is this problem generally solved? The user-data is 1) user accounts and 2) meta-information about uploaded files (stored in the file system).
  19. Hi, i want to set a date field value by api but i have problems to do so. I think this should be work: $page->of(false); $page->expire_date = time(); $page->save(); $page->of(true); but when i look into the field i get not the saved time. The output is always: 30 Nov, -0001 00:00 (timestamp: -62169987208). when i echo the time directly after the $page->of(true); than i get the current time but avter reload and output the time bevor $page->of(false); i get the time above! do you have any idea whats the problem?
  20. I'm curious to know if this is possible. I'd like to write a hook that upon adding an image to a specific page it will rename the image to the name of the page it's been/being uploaded to? I have a bank of images all with really useless filenames but would like to sort this upon uploading each one. Each image is added in a repeater with a corresponding colour (Pagefield), for example: I wonder if I could write a hook that would take each image in the repeater and rename each one something like pagetitle_01_charcoal pagetitle_02_red What do you think? Is it possible to write a hook to change a filename? Either on save or as it's uploading? Any advice/help is appreciated.
  21. hey all. i experienced a strange behaviour and wanted to ask if somebody has a solution for this. i have a page 'POIs' (points of interest) that keeps multiple 'POI' as childs. each 'POI' should be creatable via frontend through an ajax-call to the page 'create-poi'. then i have a page 'get-pois' that queries all the pages with template 'poi' and return them. Home --> POIs --> --> POI 1 [*front-end created] --> --> POI 2 [*front-end created] --> --> POI X [*back-end created] --> API --> --> Create POI --> --> Get POIs all works fine except that all the POIs created through the api only show up when 'get-pois' is called from default language. for example, POI 1 and POI 2 have been create through frontend, POI X in the admin-backend. now calling localhost/en/api/get-pois outputs all pois, calling localhost/de/api/get-pois outputs only POI X. all the pois have the required fields in both translations. can anybody of you think of a solution?
  22. Hello, I want to know, is there any chance to render only visible fields based on their Dependencies? For example, I have many fields in template with conditional logic. But all their values stored in DB, and render in loop with $page->$fields. I could duplicate logic in PHP, but It's seems very inefficient. I couldn't find any API command for such task. Something like flag "isShown". More over, there isn't such flags when I printed array. I just can't find it, or this data keeps somewhere outside? Or is there some other ability to achieve this? Thanks for any advise in advance.
  23. I'm looking at the session information in the database. The "ts" column shows my local time formatted as text. The code in the wire/core/sessions.php file shows a check against the normal PHP/Unix "time()" function, which is GMT/UTC time. Shouldn't the timestamp in the DB be GMT/UTC? And pardon the next question; I'm still trying to grasp the structure of PW. How/where does Session.php fetch the 'ts' column from the database? I was trying to track down the answer to my own questions but couldn't find where the 'ts' column gets used. Context - I'm writing a lazy cron job to delete files if the session they are associated with has expired. It seems like the sessions in the DB need to be cleaned up as well - if I explicitly logout the session is deleted. But there are leftover sessions from months ago in the DB, so it looks like old sessions that just don't come back don't get deleted because the expiration logic doesn't delete the session record when it determines the session timed out.
  24. Hi there, in an image gallery with the following code foreach ($page->bilder as $bild) { $thumbnail = $bild->size($page->thumbnail_size,$page->thumbnail_size); ... a JS gallery function broke down with the error message: "unitegallery.min.js:6 Uncaught Error: Can't get image size - image not inited." I looked into the /assets/files/nnnn/ folder and found 5 images (of about 16 or so) having api - generated version with only 42 Bytes. 4 of them had the string "....0x0.jpg" in their filename, but the 5th had an unsuspicious filename. They were all generated within the same second, according to their timestamp. In the backend, they could neither be opened nor deleted. Via FTP they could be deleted. This fixed the problem with the gallery. In the /logs/exceptions.txt I found lines like leute_im_boot.0x0.jpg - not a recognized image (in /wire/core/ImageSizer.php line 257) In the errors log I did not find anything apparently related. Did anybody observe something similar? cheers - - -
  25. We use init.inc in our site implementation. There is a class that is used across all our pages, a global variable referring to the instantiated class, and a function that returns the global variable so it's available within other functions. Recently I've had issues with either the function or the class being redeclared. How can init.inc be included more than once? Can it be set to use require_once in some fashion?
×
×
  • Create New...