Jump to content

nbcommunication

Members
  • Posts

    201
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by nbcommunication

  1. Hi @adrian, A lot of the code is much the same, but tidied up with the the coding style guide implemented, so I'm not surprised the diff doesn't reveal much! The readme is pretty thorough and covers a lot, but here's the gist: addData() - add X-Mailgun-Variables - https://documentation.mailgun.com/en/latest/user_manual.html#attaching-data-to-messages - to be honest don't know what use cases there are for it but it's in the API and was easy to implement addTags() - add multiple tags as an array getHttpCode() - to get the response code from either send() or validateEmail() * Most methods now chainable (see the Advanced Example in the readme) Tracking only used if bodyHTML() is set (As this only works in HTML email) cc() and bcc() only used when batchMode is off - this seems to me to be the correct implementation WireMail::htmlToText() used for generating the text version if only HTML passed (as in WireMail now) The ASCII conversion for tags now uses $this->sanitizer->nameFilter($tag, [" "], "", false, 128); WireMail::replyTo() implemented - doesn't seem to have been before removed addAttachment(), now uses WireMail::attachment() - which adds the ability to set the filename Unixtime is now passed to setDeliveryTime() A bunch of other small tweaks like using $sanitizer->email() in validateEmail() * I'd wanted to use WireHttp for the requests, but it doesn't allow custom cURL options. I have done a pull request for this, but I don't think I'll be changing the module's cURL request implementation now anyway. Cheers, Chris
  2. Hello, We've been using Mailgun for several years now on ProcessWire developments, using a cURL implementation within a custom site development module/template site. I'm currently rewriting that and trying to use much more of the PW API as there's been a lot of handy things added in the past while. Part of that process is to use WireMailMailgun, so I installed @Macrura's fork and then began to see what could be improved/finished off from the todos. What I've ended up doing is a partial rewrite of the module: to use more ProcessWire conventions and the coding style guide implemented a few extra features removed what I though was unnecessary code. It requires 3.0.123 and above, as it uses the htmlToText() method from WireMail, which in turn uses WireTextTools. The module is here: https://github.com/chriswthomson/WireMailMailgun Please let me know your thoughts! Cheers, Chris
  3. Hi suntrop, My best guess is that the error is occurring before PW has determined that you are logged in. I'm pretty sure the PW error message is only displayed to logged in users - that's my experience anyway! Cheers, Chris NB
  4. Thinking about this further, the label method wouldn't be required if uk-text-[status] classes were employed. e.g: .uk-text-success was a bit faint compared to .uk-text-primary hence why this is used. Cheers, Chris NB
  5. Hi Ryan, Love the page tree customisation additions! I've got a request that I think would be pretty useful, which is to add the ability to break the count down by page status eg: News 40/2/5 Where the numbers represent published/hidden/unpublished. In the case of all published pages, it would just display the child count. It might also make sense for an option to display a label eg: News 40 published / 2 hidden / 5 unpublished or News 40 published / 5 unpublished This might not look that great if all rootParents have children of varying statues, but still worth having the option. If there's a better place to put this request, please let me know! I'm getting pretty familiar with the core, but don't know enough about how the admin theme works to be able to prototype and pull request it. Thanks as ever for ProcessWire and all your continuing work. Cheers, Chris NB
  6. Hi, There's a couple of display issues with this on the new UIkit theme. I managed to fix this by adding a css file to $config->styles (in admin.php) with the following: .InputfieldColorPicker ul { margin: 0; padding: 0; } .InputfieldColorPicker ul li { list-style: none; } Cheers, Chris
  7. Hi, With the introduction of GDPR regulations, many of our clients with "webuser" systems we've developed need a way to email users that haven't logged-in in a while (18 months seems to be the standard) to ask them if they still want their user account. For most of the systems we've developed, we've added a field to the user template which records the time when the user logs in, so we'll be able to develop this functionality. It got me thinking, would this be a welcome addition to the core, accessed in a similar way to created/modified dates e.g. $user->lastlogin? Were it to be implemented, it would be useful to be able to 'silently login' if using $session->login($username, $pass) or $session->forceLogin($username), in the same way you can bypass save hooks by passing in an option to $pages->save(). Cheers, Chris - NB Communication
  8. Hi matjazp, Unfortunately I don't have access to logs, basically just a file browser from a simpler time... The web.config was just hobbled together from various bits and pieces I found, although mainly based on one person's work for a 2.5 install on IIS I think - I wish I could remember who it was/where I found it. Anyway, that should be attached... The errors started happening again last night (Class 'ProcessWire\Pagefile' not found) but only lasted for 15 minutes that then stopped. Totally weird, totally frustrating, and I'm almost 100% sure it's totally not the fault of PW too! Cheers, Chris sample.web.config
  9. Hi, We recently launched a PW site (3.0.62) on the client's own Windows IIS server. After a bit of research on the forums and some back and forth with their IT team, I got the site running, with ProCache too. Twice in the past month the site has gone down, due to a really peculiar error. It's as if PW can no longer find files on the server even though they are still there. Here's an error from today: Page: http://www.sitedomain.org/http404 User: guest Error: Uncaught Error: Class 'ProcessWire\PageAccess' not found in C:\Websites\sitedomain\admin\files\web\wire\core\Page.php:3666 Stack trace: #0 C:\Websites\sitedomain\admin\files\web\wire\core\Page.php(3688): ProcessWire\Page->getHelperInstance('PageAccess') #1 C:\Websites\sitedomain\admin\files\web\wire\core\Page.php(3566): ProcessWire\Page->access() #2 C:\Websites\sitedomain\admin\files\web\wire\core\Page.php(3276): ProcessWire\Page->getAccessTemplate() #3 C:\Websites\sitedomain\admin\files\web\wire\core\Page.php(3265): ProcessWire\Page->___isPublic() #4 C:\Websites\sitedomain\admin\files\web\wire\core\PagefilesManager.php(481): ProcessWire\Page->isPublic() #5 C:\Websites\sitedomain\admin\files\web\wire\core\PagefilesManager.php(343): ProcessWire\PagefilesManager::_path(Object(ProcessWire\Page)) #6 C:\Websites\sitedomain\admin\files\web\wire\core\PagefilesManager.php(328): ProcessWire\PagefilesManager->___path() #7 C:\Websites\sitedomain\admin\files\web\wire\core\PagefilesManager.php(268): ProcessWire\PagefilesManager->path() #8 C:\Websites\sitedomain (line 3666 of C:\Websites\sitedomain\admin\files\web\wire\core\Page.php) The first time it happened it wasn't the 404 page, and it was TextformatterVideoEmbed that seemed lost. This then developed into other, more important, files not being found (Uncaught Error: Class 'ProcessWire\RepeaterPageArray' not found). I tried refreshing the module cache and clearing complied files (I think I even cleared the cache folder completely) and permissions seem fine. The first time it happened the client's IT team restarted their server and the problem was resolved. They couldn't see anything in the logs, nor had they made a change to the server. There doesn't seem to be a trigger for it happening either. Does anyone here have any experience with running PW on Windows IIS, and/or have any ideas why this may be happening? Cheers, Chris
  10. Update: I downloaded/installed a fresh copy of 3.0.62 and the same thing is happening, although only when using Inline mode. Regular mode works fine. I've submitted an issue on Github: https://github.com/processwire/processwire-issues/issues/279 Cheers, Chris
  11. Hi, Just had a client in touch to say that whenever they try to add an image into a content area (CKEditor Textarea) it always puts the image to the top. I've tested this on installs using various admin themes and the same thing is happening for me. Is anyone else getting this bug? Assuming it is likely to do with the update to CKEditor (which is lovely :D) Cheers, Chris
  12. Stack trace from the second example, which I called on the 404 page... Error: Exception: SQLSTATE[HY000]: General error: 1364 Field 'name' doesn't have a default value (in ../wire/core/PagesEditor.php line 1388) #0 ../wire/core/PagesEditor.php(1388): PDOStatement->execute() #1 ../wire/core/Pages.php(882): ProcessWire\PagesEditor->sortRebuild(Object(ProcessWire\Page)) #2 ../wire/core/Wire.php(386): ProcessWire\Pages->___sort(Object(ProcessWire\Page), true) #3 ../wire/core/WireHooks.php(698): ProcessWire\Wire->_callMethod('___sort', Array) #4 ../wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Pages), 'sort', Array) #5 /home/stmasway/public_html/site/templates/404.php(9): ProcessWire\Wire->__call('sort', Array) #6 ../wire/core/TemplateFile.php(268): require('/home/stmasway/...') #7 ../wire/core/Wire.php(380): ProcessWire\TemplateFile->___render() #8 ../wire/core/WireHooks.php(698): ProcessWire\Wire->_callMethod('___render', Array) #9 ../wire/core/Wire.
  13. Hi, I was adding a hook in admin.php which updates a field that is based on the sort value and runs after Pages::sorted. Looking through the docs, I figured hey I'll run $pages->sort($parent, true) so that the sort values are correct before setting the other field. Here's the basic hook: <?php namespace ProcessWire; $pages->addHookAfter("Pages::sorted", function($event) { $pages = $event->object; $page = $event->arguments(0); $pages->sort($page->parent, true); // Other stuff return; }); This kept returning the following exception: SQLSTATE[HY000]: General error: 1364 Field 'name' doesn't have a default value (in .../wire/core/PagesEditor.php line 1388) Now, thinking through this, sorting the pages in the admin probably runs the sortRebuild() function that the error is referring to anyway, so $pages->sort($parent, true) isn't needed at all and perhaps this is why the error is appearing. However, I've just run <?php namespace ProcessWire; if($user->hasRole("superuser")) { $pages->sort($pages->get(1072), true); } And this is returning the same error/exception. The parent called above has 14 child pages. Running 3.0.62. Is this something I'm doing wrong? Cheers, Chris NB Communication
  14. Hi, I've been working a little bit with this new theme - it's great, and I'm looking forward to the full release. I've come across one issue so far. I'm aiming for CKEditor to use as many default UIKit styles/classes as possible, and so I updated ProcessPageEditImageSelect to use the UIkit Align classes (uk-align-right etc), but I can only get this to work if I disable the HTML Purifier. If enabled it strips the classes out. I've had a hunt to try and figure out how to add them as exceptions, but MarkupHTMLPurifier is called from the InputfieldCKEditor module, and there doesn't appear to be any way to add any exceptions in the InputfieldCKEditor module? I see that it checks ProcessPageEditLink for "AllowedFrameTargets" but not ProcessPageEditImageSelect for image classes? Cheers, Chris NB Communication
  15. Hi Robin, Aye, it certainly does, thanks!
  16. Hi, I'm sure this is maybe in the works already, given that findMany() is a recent addition to the API, but having this (and the other new find options) available to $users would be a great addition. Cheers, Chris NB Communication
  17. It appears as if renderReady ($this->config->scripts->add($url)) isn't actually firing before the scripts are rendered to the admin template. I've prepended the script manually in default.php and this has fixed the issue, although I'd rather the module did it! We use a custom admin template, but I did switch over to the default one to test it, and the result was the same. I also have had to implement valan's "clear:left;" CSS fix from above.
  18. Hello again, Fixed the previous issue by upgrading the module! However the map no longer displays - "google is not defined". It doesn't appear to be loading the maps api script. Anyone else come across this and have a solution? The site with the problem is running 2.5.3 Cheers, Chris
  19. Hi, We recently migrated to a new server and we're been getting the following error when saving a page with a MapMarker on it: Error saving field "marker" - SQLSTATE[01000]: Warning: 1265 Data truncated for column 'lat' at row 1 A little digging and I got this error when saving the field: Geocode is not supported because 'allow_url_fopen' is disabled in PHP Is it possible to get around this? Can this function be replaced with a CURL request? Cheers, Chris Thomson
  20. Hello, This was caused by a ModSecurity rule on the client's hosting environment - more info here: https://www.trustwave.com/Resources/SpiderLabs-Blog/ModSecurity-Advanced-Topic-of-the-Week--Remote-File-Inclusion-Attack-Detection/ Cheers, Chris
  21. Hello, One of our clients has an issue which I haven't seen before. When they go to edit a link in the body field (CKEditor inline mode), the modal box appears, but is populated with their website homepage. An example link from the modal's iframe is: /processwire/page/link/?id=1300&modal=1&href=http%3A%2F%2Fwww.charlottejamesedinburgh.com%2F When I go to this in a new browser window, it redirects to the homepage. It only seems to do this if "http://" is at the start of the link (which is should be). If I remove the http:// in the source - it opens fine. It is the same on all the pages I tested. They are on a shared hosting platform which we don't control, so I'm assuming this is probably responsible. If tried switching the two htaccess lines - RewriteRule ^(.*)$ index.php?it=$1 [L,QSA] & RewriteRule ^(.*)$ /index.php?it=$1 [L,QSA] - but this didn't have any effect. Any ideas what could be causing this redirect? There's nothing in the htaccess file which is different to how we have the large majority of our sites set up on our own hosting platform. Thanks in advance! Chris
  22. Hey there, I've devised another (DB query) solution that works better. Basically it searches a field table for duplicate values using this function: function dbQuery($table, $column) { $o = array(); $q1 = wire('db')->query(" SELECT `$column`, COUNT(`$column`) as c FROM `field_$table` GROUP BY `$column` HAVING c > 1 "); while ($r1 = $q1->fetch_array()) { $v = addSlashes(trim($r1[$column])); $o[$v] = array(); $q2 = wire('db')->query(" SELECT `pages_id` FROM `field_$table` WHERE `$column` = '$v' "); while ($r2 = $q2->fetch_array()) $o[$v][] = $r2['pages_id']; } return $o; } It then cycles through page ids, filtering out any pages that haven't been modified since a certain date (to do with the review period / 2 year lifespan of listing data), and also sorting them into two different arrays (residential listings and commercial listings). It then pops out the duplicates. I'm using this to filter by the following fields: title - dbQuery('title', 'data') tels - dbQuery('tels', 'value') - (table field) email - dbQuery('email', 'data') mobiles - dbQuery('mobiles', 'value') - (table field) It seems to be working well and it is a lot faster than what I had previously! Cheers, Chris
  23. Hi, There are a few 'duplication' measures in place. When a listing is submitted, the page name is logged if it finds a listing with the same name (which is a ->pageName() version of the title and address), and appends the datetime to the new listing when a listing is approved by the client admin, it archives any exact duplicates it finds (from a previous version of the directory already in place). The problem is that it needs to be able to identify potential duplicates at the time they are reviewing the listings... I'll look into the MySQL query stuff - thanks guys for your help so far! Cheers, Chris
  24. Hi adrian, Thanks for the reply - I'd hoped to be able to use count, but I need to return the ids of the duplicates too
  25. Hello, I'm developing a 'directory' web app which allows users to add their own listings, and admins to review and approve listings. All user interaction is done on a custom front-end - not using the processwire admin. After a deadline date, all listings will be reviewed and exported as custom markup for creating a print edition. As part of that process the client needs to be able to identify potential duplicates. I created the script below, which does the following: Takes in a GET variable assigned to $l - a letter of the alphabet gets all the listings starting with $l finds other listings in that PageArray that have the same surname and a matching telephone number (tels is a table field) Returns an array of 'original' ids with duplicate ids within it if ($l) { $l = $sanitizer->selectorValue($l); $all_listings = $pages->get(1070)->children('include=all,surname^='.$l); $dups = array(); foreach ($all_listings as $a) { $existing = $allr->find('surname='.$sanitizer->selectorValue($a->surname).',tels.value='.$a->tels->implode('|','value').',tels.count>0,id!='.$a->id); if (count($existing)) { $c = 0; foreach ($existing as $e) { if (!count($dups[$e->id])) $dups[$a->id][$c++] = $e->id; } } } echo print_r($dups,true); } The script above does what it is meant to do. The problem is that there are nearly 5000 listings, and it is really slow - searching through 'A' takes about 15-20 seconds. I'd actually added in the letter filter as it was hitting the PHP timeout without it. I can't add a 'limit=' as in order to find the duplicates it needs to check all the listings. Are there better ways to do this? I had initially tried a direct MySQL query, but my knowledge of this is pretty basic, and gave up when it got to trying to match the 'tels'. Cheers (and thanks for the best system going!), Chris
×
×
  • Create New...