Jump to content

horst

PW-Moderators
  • Posts

    4,088
  • Joined

  • Last visited

  • Days Won

    88

Everything posted by horst

  1. @SwimToWin: to get all fields from a page (template) you can use a snippet like this: foreach ($page->template->fieldgroup as $field) { But you have to check what types of field you can export to csv, I think. I'm not sure but I think so. Or maybe I'm wrong. If you want to check for fieldtypes you do it like if($field->type instanceof FieldtypeFile) // or FieldtypeText, or ...
  2. @Sakkoulas: as far as I understood, every article page has a counterfield that needs to be counted up one and also needs to be displayed into the article page? If so, you can set up a new branch in your page tree, lets say you call it counter and assign a new created template, also called counter, to it. This branch will hold all article pages by its ids. And it has only one additional filed, the counter field. Now you can exclude this from ProCache. With your (cached) article pages you use an AJAX - request to a bootstrapped script (we call it countMeUp.php and it resides in your webroot where we guessing pw's index.php also). Just send the article id to it and get back the current countvalue to display it. // JS in the article pages template $.ajax({ url: '/countMeUp.php', // here is your Ajax-URL type: 'POST', data: { action: 'articleCounter', // only needed if you use this script for more than only the counter articleId: '<?php echo $page->id;?>', }, success: function(data) { // here you have to validate that you have got an integer and nothing else ... // if you have an integer you can assign it to your DOM-node to display it $('span#idOfTheArticleCounterDisplay').html(data); } }); The countMeUp.php may look like <?php // bootstrap PW require_once(dirname(__FILE__).'/index.php'); // validation of untrusted user input if(!isset($input->post->action) || !in_array($input->post->action, array('articleCounter'))) { echo "INVALID1"; return; } if(!isset($input->post->articleId) || !is_numeric($input->post->articleId)) { echo "INVALID2"; return; } // now check if it is a valid page id, we use find to respect hidden and unpublished pages, otherwise we could use ->get() $p = wire('page')->find('id=' . intval($input->post->articleId)); if(0==$p->id) { echo "INVALID3"; return; } // is the found page an article page? you should validate template or something other to be sure if('article-template' != $p->template) { echo "INVALID4"; return; } // uff! - we have a valid id - lets get its counter $parent = wire('pages')->get('template=counter,name=counter'); if(0==$parent->id) { // uhm, someone must have messed up our Page Tree, damn! Where is the Counters Parent? echo "INVALID5"; return; } $cp = wire('pages')->find("parent=$parent,title=" . $p->id); if(0==$cp->id) { // assuming the first call of a new page from the frontend $cp = new Page(); $cp->of(false); $cp->template = 'counterChild'; // or what ever you have set up for it $cp->parent = $parent; $cp->title = $p->id; $cp->counterField = 1; $cp->save(); } else { // we have the counter, lets count it up $cp->of(false); $cp->counterField = intval($cp->counterField) + 1; $cp->save(); } // finally we return the current countValue echo intval($cp->counterField); This is not tested! And yes it could be done more shortened. If you have got it work, you highly want to add some security to it, (sending a hash together with the AJAX that resolves to something what is unique to the article page and not public) otherwise people can mess up your counter by just sending integers to it. EDIT: and everything what you are allready doing to avoid counter manipulation you also have to add into the countMeUp.php.
  3. @Martijn: Normally the module should handle this and all other options simply by adding them to the url in the TinyMCE. Ryan has answered to my post that this should be, but it isn't. Looking to the code shows parts that deal with the params, but they never get executed or after the embed-linkis already created and saved. Haven't investigated further, unfortunately not enough time to do so.
  4. small update: added separate inputfield for HTML signature into config page to solve an issue found by tuomassalo. https://github.com/horst-n/WireMailSmtp/issues/1 version now is 0.1.8
  5. you may try sharpening 'none', but may be to blurry or you try out PageImageManipulator. It has additional sharpening methods (stepResize, unsharpMask).
  6. This one I use for something other, so please modify to your needs (maybe 'saveReady' ): public function init() { $this->addHookAfter('Pages::save', $this, 'hookAfterPagesSave'); } Following code is not tested! // in your function, first get the page with something like $p = $event->arguments('page'); // depends on hooked method // check to avoid endless loop if($p->skipMe) return; // validate if it is a page of the right type, maybe check template if('video'!=$p->template) return; // don't do it for videos that have already their unique id if($p->video_id) return; // get the last used number $data = wire('modules')->getModuleConfigData($this); // get the modules data $id = intval($data['myIncrementalId']) + 1; // get the last used number and add +1 $data['myIncrementalId'] = $id; wire('modules')->saveModuleConfigData($this, $data); // save back the data // save this to the template field $p->video_id = $id; // add this to avoid endless loop $p->skipMe = true; // ready $event->return = $p;
  7. Hi Zahari, with $input->urlSegment you can only use type casting for integers, but that's easy and secure. If you have to use strings with it, you need to validate it. This depends on what you are uses, but possible could be: strlen() min / max / exact in_array() against array with valid values ... and so on It depends on what you need to send as urlSegment.
  8. Hi Zahari, don't forget: $page = $pages->get("video_id=" . (int)$input->urlSegment1); // type casting for untrusted user inputs !!
  9. JPEG compression is lossy, JPEG compression with 8-bit images is very lossy. (http://www.4p8.com/eric.brasseur/gamma.html#introduction) And the GD-lib is not the photoshop engine.
  10. http://www.4p8.com/eric.brasseur/gamma.html#introduction or before: http://processwire.com/talk/topic/3768-processwire-231-dev-branch/page-5#entry43649 BTW: I remember well the first words from a colleague who has experience for more then 20 years working in international architecture photography bussiness after playing around 2-3 days with his first ProcessWire version of his site: "Schönes Programm, übersichtlich und einfach. Vor allem alle meine Bilder sind so klar und knackig." (english with googleTranslate: "Nice program, clear and simple. Above all, all my images are so clear and crisp.") And be aware: by visualizing images or anything else within a website there are involved many instances. (Browser, System, Monitor). Above all, one can not make reliable statements if you do not at least use a good set hardware calibrated monitor. And even two well adjusted monitors doesn't show the exact same output. So, before going academic here, ... back to work.
  11. horst

    New Logo

    Ah, you have a new car, right?
  12. Lance, if it is just the password you can reset that simply within a few minutes: http://processwire.com/talk/topic/490-how-to-reset-your-password-how-to-enable-the-forgot-password-function/ And I know sites running the PW 2.4.0 stable on PHP 5.3.3
  13. @MadeMyDay, @Guy Verville: - http://processwire.com/talk/topic/4323-field-dependencies/page-5#entry45033
  14. Hello Peter, PW 2.3.0 uses PDO and it seems that with some server configurations this can happen. There is a fix from Hari KT, that I have used instead of the existing WireDatabasePDO.php in a PW 2.3.5 Installation. And since then I haven't had that (rare) error anymore. Ryan already has included it into the current Dev Branch (PW 2.4.1), too. Maybe you like to try it. WireDatabasePDO.zip
  15. Don't know, but if yes, we will buy you additional space! Soma, you write complete modules in the same time where others write a single line of code. (a little bit frightening)
  16. @apeisa: short and concise!
  17. @Raymond: I don't know how FormBuilder works, where and how you can connect the uploaded files to the WireMail classes. If you find a solution it would be kind if you can post it here.
  18. Most of it you have already done! You only need to install under Modules -> Core the Multilanguage Fields: Page Title (Multi-Language), Text (Multi-language), Textarea (Multi-language) change all of your Fields that need to have multiple languages support to their Multilanguage alternative also do a check under its details tab if settings for e.g. text formatters etc. you may have configured, holds the appropriate values after the change add at least one alternate language to the system go through your pages and edit / add other languages content add a language switcher to your frontend Done! Remember to save a Backup from your DB before you change the Fields to MultilanguageFields!
  19. We should send them Skyscrapers or another huge site (with ProCache and some other nice features) for a full conversion (DB and full content) with destination WordPress. They say that if we are not satisfied and can provide valid reasons we have not to pay anything. One reason could be that afterwards it is somewhat slower, maybe. Or it will have full DB, full Content but not full functionality. Or both?
  20. I don't know FormBuilder. wireMail()->attachment() needs an absolute path for every (disk) file it should attach to a message. You can pass it as array or have to call it multiple times. Here are all is working as expected. Maybe you can debug what is passed to the attachment function when running with FormBuilder? You can call a log here wire('log')->save( "debug_attachments", strtolower(__FUNCTION__).' :: '.serialize($filenames)); // ATTENTION this is $filename(s) ending with s and here wire('log')->save( "debug_attachments", strtolower(__FUNCTION__).' :: '.serialize($filename)); // ATTENTION this is $filename, without s Trying this with passing an array logs something like: 2014-03-11 14:04:36 guest http://pw4.kawobi.local/mailtest/ attachments :: a:2:{i:0;s:75:"W:/WEB_MIRRORS/_ProcessWire/pw4/htdocs/site/assets/files/1/hyatt2.0x100.jpg";i:1;s:79:"W:/WEB_MIRRORS/_ProcessWire/pw4/htdocs/site/assets/files/1/westin_interior1.jpg";} 2014-03-11 14:04:36 guest http://pw4.kawobi.local/mailtest/ attachfile :: s:75:"W:/WEB_MIRRORS/_ProcessWire/pw4/htdocs/site/assets/files/1/hyatt2.0x100.jpg"; 2014-03-11 14:04:36 guest http://pw4.kawobi.local/mailtest/ attachfile :: s:79:"W:/WEB_MIRRORS/_ProcessWire/pw4/htdocs/site/assets/files/1/westin_interior1.jpg"; Calling it multiple times (2) with string filenames: 2014-03-11 14:10:10 guest http://pw4.kawobi.local/mailtest/ attachments :: s:75:"W:/WEB_MIRRORS/_ProcessWire/pw4/htdocs/site/assets/files/1/hyatt2.0x100.jpg"; 2014-03-11 14:10:10 guest http://pw4.kawobi.local/mailtest/ attachments :: s:79:"W:/WEB_MIRRORS/_ProcessWire/pw4/htdocs/site/assets/files/1/westin_interior1.jpg"; 2014-03-11 14:10:10 guest http://pw4.kawobi.local/mailtest/ attachfile :: s:75:"W:/WEB_MIRRORS/_ProcessWire/pw4/htdocs/site/assets/files/1/hyatt2.0x100.jpg"; 2014-03-11 14:10:10 guest http://pw4.kawobi.local/mailtest/ attachfile :: s:79:"W:/WEB_MIRRORS/_ProcessWire/pw4/htdocs/site/assets/files/1/westin_interior1.jpg";
  21. Yep, that sounds exactly like what I have done the last 10+ years on my local win machines (w2k, xp , win7), except that there isn't allready an Apache installed.
  22. Ah, ok. (sorry @Raymond) And also I cannot see the post in FormBuilder Forum, I believe!
  23. Ok, I try out a few days and come back here. (actually it looks promising, I have 5k+ sessions and the oldest one was created 24 hours and 10 minutes ago) EDIT: Now, almost 2 hours later, I have 200 records less. Oldest entry is 23 hours and 30 minutes ago. Server-Engine: Apache 2.0 Handler - PHP 5.4.24-nmm1 Linux dd13102 3.2.0-57-generic #87-Ubuntu SMP Tue Nov 12 21:35:10 UTC 2013 x86_64
  24. @Raymond: Hi, this sounds that you have get the PW 2.4.0 stable. - If you have the right version, you must see at least a 2.4.1 in the backend Version 4.3.1 isn't known. Current stable is 2.4.0 and DEV is 2.4.1
  25. in this case you only have to change the order in this line: if (!$p->viewable() || $p->template != "basic-page" ) continue; // old if ($p->template != "basic-page" || !$p->viewable()) continue; // new PHP will return after the first conditional if it does not match and in these cases the code of the second condition (or any following) never get executed. Changing this, Teppos code is a complete fix.
×
×
  • Create New...