Jump to content

abdus

Members
  • Posts

    743
  • Joined

  • Last visited

  • Days Won

    42

Everything posted by abdus

  1. https://github.com/processwire/processwire-issues/issues
  2. If you want to use $page->render(), then $page has to have a template file, but if a page is viewable (i.e. has a template file) you won't get a 404 error. I'm not sure you can have both. If you want the same template file for multiple templates, then you can set it so in template settings > File tab
  3. User agent blocking may help. From Perishable Press: <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_USER_AGENT} ^$|\<|\>|\'|\%|\_iRc|\_Works|\@\$x|\<\?|\$x0e|\+select\+|\+union\+|1\,\1\,1\,|2icommerce|3GSE|4all|59\.64\.153\.|88\.0\.106\.|98|85\.17\.|A\_Browser|ABAC|Abont|abot|Accept|Access|Accoo|AceFTP|Acme|ActiveTouristBot|Address|Adopt|adress|adressendeutschland|ADSARobot|agent|ah\-ha|Ahead|AESOP\_com\_SpiderMan|aipbot|Alarm|Albert|Alek|Alexibot|Alligator|AllSubmitter|alma|almaden|ALot|Alpha|aktuelles|Akregat|Amfi|amzn\_assoc|Anal|Anarchie|andit|Anon|AnotherBot|Ansearch|AnswerBus|antivirx|Apexoo|appie|Aqua_Products|Arachmo|archive|arian|ASPSe|ASSORT|aster|Atari|ATHENS|AtHome|Atlocal|Atomic_Email_Hunter|Atomz|Atrop|^attach|attrib|autoemailspider|autohttp|axod|batch|b2w|Back|BackDoorBot|BackStreet|BackWeb|Badass|Baid|Bali|Bandit|Baidu|Barry|BasicHTTP|BatchFTP|bdfetch|beat|Become|Beij|BenchMark|berts|bew|big.brother|Bigfoot|Bilgi|Bison|Bitacle|Biz360|Black|Black.Hole|BlackWidow|bladder.fusion|Blaiz|Blog.Checker|Blogl|BlogPeople|Blogshares.Spiders|Bloodhound|Blow|bmclient|Board|BOI|boitho|Bond|Bookmark.search.tool|boris|Bost|Boston.Project|BotRightHere|Bot.mailto:craftbot@yahoo.com|BotALot|botpaidtoclick|botw|brandwatch|BravoBrian|Brok|Bropwers|Broth|browseabit|BrowseX|Browsezilla|Bruin|bsalsa|Buddy|Build|Built|Bulls|bumblebee|Bunny|Busca|Busi|Buy|bwh3|c\-spider|CafeK|Cafi|camel|Cand|captu|Catch|cd34|Ceg|CFNetwork|cgichk|Cha0s|Chang|chaos|Char|char\(32\,35\)|charlotte|CheeseBot|Chek|CherryPicker|chill|ChinaClaw|CICC|Cisco|Cita|Clam|Claw|Click.Bot|clipping|clshttp|Clush|COAST|ColdFusion|Coll|Comb|commentreader|Compan|contact|Control|contype|Conc|Conv|Copernic|Copi|Copy|Coral|Corn|core-project|cosmos|costa|cr4nk|crank|craft|Crap|Crawler0|Crazy|Cres|cs\-CZ|cuill|Curl|Custo|Cute|CSHttp|Cyber|cyberalert|^DA$|daoBot|DARK|Data|Daten|Daum|dcbot|dcs|Deep|DepS|Detect|Deweb|Diam|Digger|Digimarc|digout4uagent|DIIbot|Dillo|Ding|DISC|discobot|Disp|Ditto|DLC|DnloadMage|DotBot|Doubanbot|Download|Download.Demon|Download.Devil|Download.Wonder|Downloader|drag|DreamPassport|Drec|Drip|dsdl|dsok|DSurf|DTAAgent|DTS|Dual|dumb|DynaWeb|e\-collector|eag|earn|EARTHCOM|EasyDL|ebin|EBM-APPLE|EBrowse|eCatch|echo|ecollector|Edco|edgeio|efp\@gmx\.net|EirGrabber|email|Email.Extractor|EmailCollector|EmailSearch|EmailSiphon|EmailWolf|Emer|empas|Enfi|Enhan|Enterprise\_Search|envolk|erck|EroCr|ESurf|Eval|Evil|Evere|EWH|Exabot|Exact|EXPLOITER|Expre|Extra|ExtractorPro|EyeN|FairAd|Fake|FANG|FAST|fastlwspider|FavOrg|Favorites.Sweeper|Faxo|FDM\_1|FDSE|fetch|FEZhead|Filan|FileHound|find|Firebat|Firefox.2\.0|Firs|Flam|Flash|FlickBot|Flip|fluffy|flunky|focus|Foob|Fooky|Forex|Forum|ForV|Fost|Foto|Foun|Franklin.Locator|freefind|FreshDownload|FrontPage|FSurf|Fuck|Fuer|futile|Fyber|Gais|GalaxyBot|Galbot|Gamespy\_Arcade|GbPl|Gener|geni|Geona|Get|gigabaz|Gira|Ginxbot|gluc|glx.?v|gnome|Go.Zilla|Goldfire|Google.Wireless.Transcoder|Googlebot\-Image|Got\-It|GOFORIT|gonzo|GornKer|GoSearch|^gotit$|gozilla|grab|Grabber|GrabNet|Grub|Grup|Graf|Green.Research|grub|grub\-client|gsa\-cra|GSearch|GT\:\:WWW|GuideBot|guruji|gvfs|Gyps|hack|haha|hailo|Harv|Hatena|Hax|Head|Helm|herit|hgre|hhjhj\@yahoo|Hippo|hloader|HMView|holm|holy|HomePageSearch|HooWWWer|HouxouCrawler|HMSE|HPPrint|htdig|HTTPConnect|httpdown|http.generic|HTTPGet|httplib|HTTPRetriever|HTTrack|human|Huron|hverify|Hybrid|Hyper|ia\_archiver|iaskspi|IBM\_Planetwide|iCCra|ichiro|ID\-Search|IDA|IDBot|IEAuto|IEMPT|iexplore\.exe|iGetter|Ilse|Iltrov|Image|Image.Stripper|Image.Sucker|imagefetch|iimds\_monitor|Incutio|IncyWincy|Indexer|Industry.Program|Indy|InetURL|informant|InfoNav|InfoTekies|Ingelin|Innerpr|Inspect|InstallShield.DigitalWizard|Insuran\.|Intellig|Intelliseek|InterGET|Internet.Ninja|Internet.x|Internet\_Explorer|InternetLinkagent|InternetSeer.com|Intraf|IP2|Ipsel|Iria|IRLbot|Iron33|Irvine|ISC\_Sys|iSilo|ISRCCrawler|ISSpi|IUPUI.Research.Bot|Jady|Jaka|Jam|^Java|java\/|Java\(tm\)|JBH.agent|Jenny|JetB|JetC|jeteye|jiro|JoBo|JOC|jupit|Just|Jyx|Kapere|kash|Kazo|KBee|Kenjin|Kernel|Keywo|KFSW|KKma|Know|kosmix|KRAE|KRetrieve|Krug|ksibot|ksoap|Kum|KWebGet|Lachesis|lanshan|Lapo|larbin|leacher|leech|LeechFTP|LeechGet|leipzig\.de|Lets|Lexi|lftp|Libby|libcrawl|libcurl|libfetch|libghttp|libWeb|libwhisker|libwww|libwww\-FM|libwww\-perl|LightningDownload|likse|Linc|Link|Link.Sleuth|LinkextractorPro|Linkie|LINKS.ARoMATIZED|LinkScan|linktiger|LinkWalker|Lint|List|lmcrawler|LMQ|LNSpiderguy|loader|LocalcomBot|Locu|London|lone|looksmart|loop|Lork|LTH\_|lwp\-request|LWP|lwp-request|lwp-trivial|Mac.Finder|Macintosh\;.I\;.PPC|Mac\_F|magi|Mag\-Net|Magnet|Magp|Mail.Sweeper|main|majest|Mam|Mana|MarcoPolo|mark.blonin|MarkWatch|MaSagool|Mass|Mass.Downloader|Mata|mavi|McBot|Mecha|MCspider|mediapartners|^Memo|MEGAUPLOAD|MetaProducts.Download.Express|Metaspin|Mete|Microsoft.Data.Access|Microsoft.URL|Microsoft\_Internet\_Explorer|MIDo|MIIx|miner|Mira|MIRE|Mirror|Miss|Missauga|Missigua.Locator|Missouri.College.Browse|Mist|Mizz|MJ12|mkdb|mlbot|MLM|MMMoCrawl|MnoG|moge|Moje|Monster|Monza.Browser|Mooz|Moreoverbot|MOT\-MPx220|mothra\/netscan|mouse|MovableType|Mozdex|Mozi\!|^Mozilla$|Mozilla\/1\.22|Mozilla\/22|^Mozilla\/3\.0.\(compatible|Mozilla\/3\.Mozilla\/2\.01|Mozilla\/4\.0\(compatible|Mozilla\/4\.08|Mozilla\/4\.61.\(Macintosh|Mozilla\/5\.0|Mozilla\/7\.0|Mozilla\/8|Mozilla\/9|Mozilla\:|Mozilla\/Firefox|^Mozilla.*Indy|^Mozilla.*NEWT|^Mozilla*MSIECrawler|Mp3Bot|MPF|MRA|MS.FrontPage|MS.?Search|MSFrontPage|MSIE\_6\.0|MSIE6|MSIECrawler|msnbot\-media|msnbot\-Products|MSNPTC|MSProxy|MSRBOT|multithreaddb|musc|MVAC|MWM|My\_age|MyApp|MyDog|MyEng|MyFamilyBot|MyGetRight|MyIE2|mysearch|myurl|NAG|NAMEPROTECT|NASA.Search|nationaldirectory|Naver|Navr|Near|NetAnts|netattache|Netcach|NetCarta|Netcraft|NetCrawl|NetMech|netprospector|NetResearchServer|NetSp|Net.Vampire|netX|NetZ|Neut|newLISP|NewsGatorInbox|NEWT|NEWT.ActiveX|Next|^NG|NICE|nikto|Nimb|Ninja|Ninte|NIPGCrawler|Noga|nogo|Noko|Nomad|Norb|noxtrumbot|NPbot|NuSe|Nutch|Nutex|NWSp|Obje|Ocel|Octo|ODI3|oegp|Offline|Offline.Explorer|Offline.Navigator|OK.Mozilla|omg|Omni|Onfo|onyx|OpaL|OpenBot|Openf|OpenTextSiteCrawler|OpenU|Orac|OrangeBot|Orbit|Oreg|osis|Outf|Owl|P3P|PackRat|PageGrabber|PagmIEDownload|pansci|Papa|Pars|Patw|pavu|Pb2Pb|pcBrow|PEAR|PEER|PECL|pepe|Perl|PerMan|PersonaPilot|Persuader|petit|PHP|PHP.vers|PHPot|Phras|PicaLo|Piff|Pige|pigs|^Ping|Pingd|PingALink|Pipe|Plag|Plant|playstarmusic|Pluck|Pockey|POE\-Com|Poirot|Pomp|Port.Huron|Post|powerset|Preload|press|Privoxy|Probe|Program.Shareware|Progressive.Download|ProPowerBot|prospector|Provider.Protocol.Discover|ProWebWalker|Prowl|Proxy|Prozilla|psbot|PSurf|psycheclone|^puf$|Pulse|Pump|PushSite|PussyCat|PuxaRapido|PycURL|Pyth|PyQ|QuepasaCreep|Query|Quest|QRVA|Qweer|radian|Radiation|Rambler|RAMP|RealDownload|Reap|Recorder|RedCarpet|RedKernel|ReGet|relevantnoise|replacer|Repo|requ|Rese|Retrieve|Rip|Rix|RMA|Roboz|Rogue|Rover|RPT\-HTTP|Rsync|RTG30|.ru\)|ruby|Rufus|Salt|Sample|SAPO|Sauger|savvy|SBIder|SBP|SCAgent|scan|SCEJ\_|Sched|Schizo|Schlong|Schmo|Scout|Scooter|Scorp|ScoutOut|SCrawl|screen|script|SearchExpress|searchhippo|Searchme|searchpreview|searchterms|Second.Street.Research|Security.Kol|Seekbot|Seeker|Sega|Sensis|Sept|Serious|Sezn|Shai|Share|Sharp|Shaz|shell|shelo|Sherl|Shim|Shiretoko|ShopWiki|SickleBot|Simple|Siph|sitecheck|SiteCrawler|SiteSnagger|Site.Sniper|SiteSucker|sitevigil|SiteX|Sleip|Slide|Slurpy.Verifier|Sly|Smag|SmartDownload|Smurf|sna\-|snag|Snake|Snapbot|Snip|Snoop|So\-net|SocSci|sogou|Sohu|solr|sootle|Soso|SpaceBison|Spad|Span|spanner|Speed|Spegla|Sphere|Sphider|spider|SpiderBot|SpiderEngine|SpiderView|Spin|sproose|Spurl|Spyder|Squi|SQ.Webscanner|sqwid|Sqworm|SSM\_Ag|Stack|Stamina|stamp|Stanford|Statbot|State|Steel|Strateg|Stress|Strip|studybot|Style|subot|Suck|Sume|sun4m|Sunrise|SuperBot|SuperBro|Supervi|Surf4Me|SuperHTTP|Surfbot|SurfWalker|Susi|suza|suzu|Sweep|sygol|syncrisis|Systems|Szukacz|Tagger|Tagyu|tAke|Talkro|TALWinHttpClient|tamu|Tandem|Tarantula|tarspider|tBot|TCF|Tcs\/1|TeamSoft|Tecomi|Teleport|Telesoft|Templeton|Tencent|Terrawiz|Test|TexNut|trivial|Turnitin|The.Intraformant|TheNomad|Thomas|TightTwatBot|Timely|Titan|TMCrawler|TMhtload|toCrawl|Todobr|Tongco|topic|Torrent|Track|translate|Traveler|TREEVIEW|True|Tunnel|turing|Turnitin|TutorGig|TV33\_Mercator|Twat|Tweak|Twice|Twisted.PageGetter|Tygo|ubee|UCmore|UdmSearch|UIowaCrawler|Ultraseek|UMBC|unf|UniversalFeedParser|unknown|UPG1|UtilMind|URLBase|URL.Control|URL\_Spider\_Pro|urldispatcher|URLGetFile|urllib|URLSpiderPro|URLy|User\-Agent|UserAgent|USyd|Vacuum|vagabo|Valet|Valid|Vamp|vayala|VB\_|VCI|VERI\~LI|verif|versus|via|Viewer|virtual|visibilitygap|Visual|vobsub|Void|VoilaBot|voyager|vspider|VSyn|w\:PACBHO60|w0000t|W3C|w3m|w3search|walhello|Walker|Wand|WAOL|WAPT|Watch|Wavefire|wbdbot|Weather|web.by.mail|Web.Data.Extractor|Web.Downloader|Web.Ima|Web.Mole|Web.Sucker|Web2Mal|Web2WAP|WebaltBot|WebAuto|WebBandit|Webbot|WebCapture|WebCat|webcraft\@bea|Webclip|webcollage|WebCollector|WebCopier|WebCopy|WebCor|webcrawl|WebDat|WebDav|webdevil|webdownloader|Webdup|WebEMail|WebEMailExtrac|WebEnhancer|WebFetch|WebGo|WebHook|Webinator|WebInd|webitpr|WebFilter|WebFountain|WebLea|Webmaster|WebmasterWorldForumBot|WebMin|WebMirror|webmole|webpic|WebPin|WebPix|WebReaper|WebRipper|WebRobot|WebSauger|WebSite|Website.eXtractor|Website.Quester|WebSnake|webspider|Webster|WebStripper|websucker|WebTre|WebVac|webwalk|WebWasher|WebWeasel|WebWhacker|WebZIP|Wells|WEP\_S|WEP.Search.00|WeRelateBot|wget|Whack|Whacker|whiz|WhosTalking|Widow|Win67|window.location|Windows.95\;|Windows.95\)|Windows.98\;|Windows.98\)|Winodws|Wildsoft.Surfer|WinHT|winhttp|WinHttpRequest|WinHTTrack|Winnie.Poh|wire|WISEbot|wisenutbot|wish|Wizz|WordP|Works|world|WUMPUS|Wweb|WWWC|WWWOFFLE|WWW\-Collector|WWW.Mechanize|www.ranks.nl|wwwster|^x$|X12R1|x\-Tractor|Xaldon|Xenu|XGET|xirq|Y\!OASIS|Y\!Tunnel|yacy|YaDirectBot|Yahoo\-MMAudVid|YahooSeeker|YahooYSMcm|Yamm|Yand|yang|Yeti|Yoono|yori|Yotta|YTunnel|Zade|zagre|ZBot|Zeal|ZeBot|zerx|Zeus|ZIPCode|Zixy|zmao|Zyborg [NC] RewriteRule ^(.*)$ - [F,L] </IfModule> Or block requests directly if `name` parameter includes your strings RewriteCond %{QUERY_STRING} (^|&)name=(Not%20Recognized|No%20Subscription%20Detected)(&|$) RewriteRule ^(.*) - [F] It looks like "hackers" are using a paid tool with expired/pirated/trial license
  4. There's nothing to integrate, array-config is a joke repository :), it's just there to show that you can you can return variables from files and use them with include statement, instead of dealing with parsing, validation of JSON/YAML etc. I want the same thing with @adrian, which is essentially how getModuleConfigArray() method of ConfigurableModule interface works. public function getModuleConfigArray() { return [ 'colors' => [ 'type' => 'radios', 'label' => $this->_('Color Set'), 'options' => [ 'classic' => $this->_('Classic'), 'warm' => $this->_('Warm'), 'modern' => $this->_('Modern'), 'futura' => $this->_('Futura') ], 'value' => 'classic', 'optionColumns' => 1 ] ]; } Exactly. Also, I agree with @tpr and @szabesz on the naming. While fa-train looks really smooth, fa-industry or fa-wrench isn't too bad either. We really should switch to Material Icons, though. There's an icon for everything, and every icon is crafted with top notch attention to detail. FA looks quite rough in comparison. Small list of Font Awesome icons can be replaced with their Material counterparts, or both can be combined
  5. $reason parameter looks like it's for internal use $page = $this->checkAccess($page); if(!$page || $_page->id == $config->http404PageID) { return $this->pageNotFound($_page, $this->requestURL, true, 'access not allowed'); } Why do you need $reason for?, if you want to narrow down 404s to missing template files than you can use wire()->addHookBefore('ProcessPageView::pageNotFound', function (HookEvent $e) { $page = $e->arguments('page'); if ($page->id && !$page->template->filenameExists()) { // page exists, but template file does not } });
  6. Well, your code runs slow because: You have multiple nested loops, each of which is querying pages, which would be slow by definition. Inside every loop you're getting, resizing images, which is even slower than querying pages (on the first request, at least) You seem to use repeater fields to store metadata for images, and each repeater item has page reference fields, which slows down your code even more Points for improvement: Use Image Extra module instead of repeaters for saving extra data with images Use WireCache a lot Check out this thread Not a speed improvement, but escape long spreads of HTML from PHP, you don't have to write all of your HTML into strings http://php.net/manual/en/language.basic-syntax.phpmode.php Look up ternary operators and elvis operator Instead of writing CSS into HTML elements, use CSS classes and separate your CSS from HTML. You can refactor $bgcolor as .bg-white and .bg-gray, for example That said, here's an reformatted/rewritten version of your code: <?php namespace ProcessWire; ?> <style> .bg-white { background-color: #fff; } .bg-gray { background-color: #e4e4e4; } .group { min-height: 110px; } .prod-list-category-label { font-size: .7em; } .list-headline { font-size: .8em; } .featured-icons-list { margin: 2em .5em; } </style> <div class='span_12_of_12'> <?php foreach ($products as $p): ?> <?php // $bgcolor = $sum % 2 == 0 ? '#fff' : '#e4e4e4'; $bgClass = $sum % 2 == 0 ? 'bg-white' : 'bg-gray'; $par = $p->parent; $img = $p->prod_image; $thumb = $img->pim2Load('squarethumb100')->canvas(100,100,array(0,0,0,0),'north',0)->pimSave()->url; ?> <?php // Replace inline styles with classes ?> <div class="section group <?= $bgClass ?>"> <div class="col span_2_of_12 hide" data-match-height="<?= $p->title ?>"> <a href="<?= $p->url ?>"><span class="product-image-box"><img src="<?= $thumb ?>" alt="<?= $p->title ?>" title="<?= $p->title ?>"></span></a> </div> <div class="col span_6_of_12" data-match-height="<?= $p->title ?>"> <div class="prod-list-name-label"><a href="<?= $p->url ?>"><?= $p->title ?></a></div> <?php if ($page != $par): ?> <?php // Replace inline styles with classes ?> <div class='prod-list-category-label'>Category: <a href='<?= $par->url ?>'><?= $par->title ?></a></div> <?php endif; ?> <?php // Replace inline styles with classes ?> <div class="list-headline"><?= $p->headline ?></div> <div class="learn-more-buttons-sm"> <a href='<?= $p->url ?>' title='Product Specs and Documentation'><span class='find-out-more-button' style='font-size: .8em;'><i style='font-size: .8em;' class='fa fa-lightbulb-o' ></i> Learn More</span></a> </div> </div> <div data-match-height='<?= $p->title ?>' class='col span_4_of_12'> <?php if ($p->prod_feat_imgs->count > 0): ?> <div class='featured-icons-list'> <?php foreach ($p->prod_feat_imgs as $feat) { $icon = $pages->get("$feat->prod_featicon_pages"); if ($icon->image) { // Loop up Elvis operator $icontitle = $feat->prod_feat_textlang ?: $icon->title; $out .= "<img src='" . $icon->image->size(35, 35, $imgOptions)->url . "' alt='" . $icontitle . "' title='" . $icontitle . "' class='listing-feat-icon' style='margin-right: .5em;' />"; } } ?> </div> <?php if($p->prod_product_line){ foreach($p->prod_product_line as $pline) if($pline->image) { $out .= "<div style='height: 35px;'>\n"; $out .= "<img src='{$pline->image->size(75,35,$imgOptions)->url}' alt='{$pline->title}' />"; $out .= "</div>"; } } ?> <?php endif; ?> </div> </div> <?php endforeach; ?> </div>
  7. I haven't tried it with image input, but you are able to use InputfieldImage and InputfieldFile in isolation. I'm using it with one of my modules like this: [ 'type' => 'file', 'name' => 'recipientListFile', 'id' => 'recipientListFile', 'label' => $this->_('Recipient Emails File'), 'description' => $this->_('The file must contain one record per line'), 'notes' => $this->_('First column in CSV files is assumed to be email addresses'), 'maxFiles' => 1, 'extensions' => 'csv txt', 'noAjax' => true, 'uploadOnlyMode' => true, 'destinationPath' => $temp->get(), 'attr' => [ 'required' => true, ], // 'uploadOnlyMode' => true, 'overwrite' => true, 'icon' => 'file-text-o', ], Then save the file using $temp = $this->files->tempDir($this->className); $recipientList = (new WireUpload('recipientListFile')) ->setDestinationPath($temp->get()) ->setValidExtensions(['csv', 'txt']) ->execute(); As InputfieldImage extends InputfieldFile, it should be quite similar.
  8. Really cool . I can see myself using this a lot. One simple request, can you add support for using regular PHP files for configuration? https://github.com/mrkrstphr/array-config Manually typing JSON for building inputs array would get tedious really quick. I'd rather use a PHP file because: I can add logic to my configuration files (and even include other files). This eliminates having to write some parts over and over. I can just write a function to create a text field and use that. I can use my IDE and its tools, autocomplete, intellisense etc
  9. I'm thinking of integrating mailing services like Mailgun, SparkPost, SendGrid (currently working on Mailgun), and their `Mailing List` features via their APIs, because it's much easier to delegate potentially difficult points to a service experienced in this kind of work, instead of using regular SMTP to send emails (not to say I'm discarding SMTP option) Using a mailing service also brings an easier way to add/remove subscribers to a list. With a method like $modules->ProcessMailer->getSubscriptionForm($options), I can return an instance of InputfieldForm, and developers can modify and render it as they see fit. Then I can issue a call to their API and add subscriber to a list.
  10. Here's a working example for you: <?php namespace ProcessWire; $showForm = true; if ($input->post->upload) { $tempDir = wire()->files->tempDir('userUploads')->get(); $uploaded = (new WireUpload('uploadedFile')) // same as form field name ->setValidExtensions(['txt', 'png', 'jpg', 'pdf']) ->setMaxFiles(1) // remove this to allow multiple files ->setMaxFileSize(10 * pow(2, 20))// 10MB ->setDestinationPath($tempDir) ->execute(); // $page = $pages->get(1234); foreach ($uploaded as $file) { $filePath = $tempDir . $file; // $page->files->add($filePath); echo $filePath . "<br>"; } // $page->save('files'); if (count($uploaded)) { echo sprintf("Uploaded %d files", count($uploaded)); $showForm = false; } } ?> <?php if ($showForm): ?> <?php // Adding enctype is crucial!! ?> <form method="POST" action="./" enctype="multipart/form-data"> <label for="uploadedFile"> Upload: <?php // suffix name with [] and add multiple attribute if you allow multiple files ?> <input type="file" name="uploadedFile[]" id="uploadedFile" multiple> </label> <div> <button name="upload" value="1">Upload</button> </div> </form> <?php endif; ?>
  11. It's uninstalled by default, you need to install it under Modules > Core
  12. Just realized that I forgot to increment the version, I appreciate if you could sort that out
  13. Done. https://github.com/horst-n/WireMailSmtp/pull/9/ Here's how it looks now:
  14. Good point. I left page template optional (but it's really encouraged), but I didn't consider user pages at all. Updated the OP.
  15. There's Fieldset in Tab (Open) for that. Create one, add to a template and move fields that you want to show in the tab between tabField and tabfield_END fields Which gives you a tab like this
  16. @horst, I'm not sure how you'd feed about this but do you mind if I fix labels, icons a bit and send PR for it? I mean turning this: Into something like this:
  17. You need to remove the id suffix. This one works in my setup // This site is a onepager $portfolio = $pages->get('/Portfolio/'); echo "title: ".$portfolio->repeater_portfolio->first->Category_repeater->title;
  18. Good idea Extending my answer above, you can create a page with a separate template and a file field, and set any role restrictions you want. Then with the help of some regex magic you can match any mysite.com/filename.ext url and serve files added to the page. <?php namespace ProcessWire; // match any url that ends with /name.ext if (preg_match('#/([^\/]+\.[^\.\/]+)$#', $input->url, $matches)) { // Respect page access settings $filesPage = $pages->findOne('template=files'); if ($filesPage->id) { // page's files folder under site/assets/files/<pageid> $pageFilesDir = $filesPage->files->url; $filePath = $pageFilesDir . $matches[1]; if (file_exists($filePath)) { readfile($file); exit; } } }
  19. There's native `Fieldset in Tab` for creating editor tabs, but sometimes it could make more sense to put a field that's not directly related to `Content` into `Settings` or `Children` tab (such as for body class or some toggles that I see being used often). You can use the hook below to move fields between the tabs. // site/ready.php wire()->addHookAfter('ProcessPageEdit::buildForm', function (HookEvent $e) { // make sure we're editing a page and not a user if ($e->process != 'ProcessPageEdit') return; // RESTRICT BY TEMPLATE // $page = $e->object->getPage(); // if ($page->template != 'home') return; // RESTRICT BY ROLE // $user = $e->user; // if (!$user->hasRole('editor')) return; $form = $e->return; $contentTab = $form->children->get('id=ProcessPageEditContent'); $settingsTab = $form->children->get('id=ProcessPageEditSettings'); // $childrenTab = $form->children->get('id=ProcessPageEditChildren'); // if page template is set noSettings = true, $settings will not exist if (!$settingsTab) return; // MOVE TITLE FIELD TO SETTINGS TAB $title = $contentTab->get('title'); if (!$title) return; $contentTab->remove('title'); $settingsTab->prepend($title); });
  20. Page actions modules look like custom made, and this one seems suspicious. Try disabling/uninstalling it. Edit: If it doesn't work, search the /site/ directory for `addHook` and look for Page::save / Page::saved / Page::saveReady
  21. There are modules you can use: https://modules.processwire.com/modules/schedule-pages/ https://modules.processwire.com/modules/publish-date/
  22. I might be guilty of that. From this point forward, the post becomes unrelated to the question, and it's probably better if it's moved into a separate topic in Dev Talk subforum.
×
×
  • Create New...