From: <var...@us...> - 2014-11-21 16:27:20
|
Revision: 9361 http://sourceforge.net/p/phpwiki/code/9361 Author: vargenau Date: 2014-11-21 16:27:17 +0000 (Fri, 21 Nov 2014) Log Message: ----------- Check constants are defined Modified Paths: -------------- trunk/lib/Captcha.php trunk/lib/EditToolbar.php trunk/lib/InlineParser.php trunk/lib/PagePerm.php trunk/lib/Units.php trunk/lib/WikiDB.php trunk/lib/display.php trunk/lib/editpage.php trunk/lib/loadsave.php trunk/lib/main.php Modified: trunk/lib/Captcha.php =================================================================== --- trunk/lib/Captcha.php 2014-11-21 15:59:41 UTC (rev 9360) +++ trunk/lib/Captcha.php 2014-11-21 16:27:17 UTC (rev 9361) @@ -88,7 +88,7 @@ function get_word() { - if (USE_CAPTCHA_RANDOM_WORD) + if (defined('USE_CAPTCHA_RANDOM_WORD') and USE_CAPTCHA_RANDOM_WORD) return $this->get_dictionary_word(); else return rand_ascii_readable($this->length); // lib/stdlib.php Modified: trunk/lib/EditToolbar.php =================================================================== --- trunk/lib/EditToolbar.php 2014-11-21 15:59:41 UTC (rev 9360) +++ trunk/lib/EditToolbar.php 2014-11-21 16:27:17 UTC (rev 9361) @@ -39,7 +39,7 @@ $this->tokens = array(); //FIXME: enable Undo button for all other buttons also, not only the search/replace button - if (JS_SEARCHREPLACE) { + if (defined('JS_SEARCHREPLACE') and JS_SEARCHREPLACE) { $this->tokens['JS_SEARCHREPLACE'] = 1; $undo_btn = $WikiTheme->getImageURL("ed_undo.png"); $undo_d_btn = $WikiTheme->getImageURL("ed_undo_d.png"); @@ -68,7 +68,7 @@ $WikiTheme->addMoreAttr('body', "editfocus", "document.getElementById('edit-content]').editarea.focus()"); } - if (ENABLE_EDIT_TOOLBAR) { + if (defined('ENABLE_EDIT_TOOLBAR') and ENABLE_EDIT_TOOLBAR) { $init = JavaScript("var data_path = '" . javascript_quote_string(DATA_PATH) . "';\n"); $js = JavaScript('', array('src' => $WikiTheme->_findData("toolbar.js"))); if (empty($WikiTheme->_headers_printed)) { @@ -87,13 +87,13 @@ // regenerate if number of pages changes (categories, pages, templates, images uploaded) $key = $dbi->numPages(); $key .= '+categories+plugin' . (isBrowserSafari() ? '+safari' : ''); - if (TOOLBAR_PAGELINK_PULLDOWN) { + if (defined('TOOLBAR_PAGELINK_PULLDOWN') and TOOLBAR_PAGELINK_PULLDOWN) { $key .= "+pages"; } - if (TOOLBAR_TEMPLATE_PULLDOWN) { + if (defined('TOOLBAR_TEMPLATE_PULLDOWN') and TOOLBAR_TEMPLATE_PULLDOWN) { $key .= "+templates_" . $dbi->getTimestamp(); } - if (TOOLBAR_IMAGE_PULLDOWN) { + if (defined('TOOLBAR_IMAGE_PULLDOWN') and TOOLBAR_IMAGE_PULLDOWN) { if (file_exists(getUploadFilePath())) { $key .= "+images_" . filemtime(getUploadFilePath()); } @@ -122,7 +122,7 @@ $toolbar = "document.writeln(\"<div class=\\\"edit-toolbar\\\" id=\\\"toolbar\\\">\");\n"; - if (ENABLE_EDIT_TOOLBAR) { + if (defined('ENABLE_EDIT_TOOLBAR') and ENABLE_EDIT_TOOLBAR) { $username = $request->_user->UserName(); if ((defined('FUSIONFORGE') and FUSIONFORGE) or DISABLE_MARKUP_WIKIWORD or (!isWikiWord($username))) { $username = '[[' . $username . ']]'; @@ -246,7 +246,7 @@ } } - if (JS_SEARCHREPLACE) { + if (defined('JS_SEARCHREPLACE') and JS_SEARCHREPLACE) { $undo_d_btn = $WikiTheme->getImageURL("ed_undo_d.png"); //$redo_btn = $WikiTheme->getImageURL("ed_redo.png"); $sr_btn = $WikiTheme->getImageURL("ed_replace.png"); @@ -279,14 +279,14 @@ $sr_html = HTML($sr_html, $this->pluginPulldown()); // Button to generate pagenames, display in extra window as popup and insert - if (TOOLBAR_PAGELINK_PULLDOWN) + if (defined('TOOLBAR_PAGELINK_PULLDOWN') and TOOLBAR_PAGELINK_PULLDOWN) $sr_html = HTML($sr_html, $this->pagesPulldown(TOOLBAR_PAGELINK_PULLDOWN)); // Button to insert from an template, display pagename in extra window as popup and insert - if (TOOLBAR_TEMPLATE_PULLDOWN) + if (defined('TOOLBAR_TEMPLATE_PULLDOWN') and TOOLBAR_TEMPLATE_PULLDOWN) $sr_html = HTML($sr_html, $this->templatePulldown(TOOLBAR_TEMPLATE_PULLDOWN)); // Button to add images, display in extra window as popup and insert - if (TOOLBAR_IMAGE_PULLDOWN) + if (defined('TOOLBAR_IMAGE_PULLDOWN') and TOOLBAR_IMAGE_PULLDOWN) $sr_html = HTML($sr_html, $this->imagePulldown()); // don't use document.write for replace, otherwise self.opener is not defined. @@ -399,7 +399,7 @@ $pages = array(); while ($p = $page_iter->next()) { $page = $p->getName(); - if (DISABLE_MARKUP_WIKIWORD or (!isWikiWord($page))) + if (defined('DISABLE_MARKUP_WIKIWORD') and DISABLE_MARKUP_WIKIWORD or (!isWikiWord($page))) $pages[] = "['$page', '%5B" . $page . "%5D']"; else $pages[] = "['$page', '$page']"; @@ -427,7 +427,7 @@ $pd = new imageOrVideoSet($image_dir, '*'); $images = $pd->getFiles(); unset($pd); - if (UPLOAD_USERDIR) { + if (defined('UPLOAD_USERDIR') and UPLOAD_USERDIR) { $image_dir .= "/" . $request->_user->_userid; $pd = new imageOrVideoSet($image_dir, '*'); $images = array_merge($images, $pd->getFiles()); Modified: trunk/lib/InlineParser.php =================================================================== --- trunk/lib/InlineParser.php 2014-11-21 15:59:41 UTC (rev 9360) +++ trunk/lib/InlineParser.php 2014-11-21 16:27:17 UTC (rev 9361) @@ -1215,7 +1215,7 @@ 'html_emphasis', 'html_abbr', 'plugin', 'plugin_wikicreole', 'isonumchars', 'isohexchars', /*'html_entities'*/ ); - if (DISABLE_MARKUP_WIKIWORD) + if (defined('DISABLE_MARKUP_WIKIWORD') and DISABLE_MARKUP_WIKIWORD) $markup_types = array_remove($markup_types, 'wikiword'); $action = $request->getArg('action'); @@ -1234,13 +1234,13 @@ $this->_addMarkup(new $class); } $this->_addMarkup(new Markup_nowiki); - if (ENABLE_MARKUP_DIVSPAN and !$non_default) + if (defined('ENABLE_MARKUP_DIVSPAN') and ENABLE_MARKUP_DIVSPAN and !$non_default) $this->_addMarkup(new Markup_html_divspan); - if (ENABLE_MARKUP_COLOR and !$non_default) + if (defined('ENABLE_MARKUP_COLOR') and ENABLE_MARKUP_COLOR and !$non_default) $this->_addMarkup(new Markup_color); // Markup_wikicreole_preformatted must be before Markup_template_plugin $this->_addMarkup(new Markup_wikicreole_preformatted); - if (ENABLE_MARKUP_TEMPLATE and !$non_default) + if (defined('ENABLE_MARKUP_TEMPLATE') and ENABLE_MARKUP_TEMPLATE and !$non_default) $this->_addMarkup(new Markup_template_plugin); } Modified: trunk/lib/PagePerm.php =================================================================== --- trunk/lib/PagePerm.php 2014-11-21 15:59:41 UTC (rev 9360) +++ trunk/lib/PagePerm.php 2014-11-21 16:27:17 UTC (rev 9361) @@ -468,10 +468,10 @@ ACL_OWNER => true), 'change' => array(ACL_ADMIN => true, ACL_OWNER => true)); - if (ZIPDUMP_AUTH) + if (defined('ZIPDUMP_AUTH') and ZIPDUMP_AUTH) $perm['dump'] = array(ACL_ADMIN => true, ACL_OWNER => true); - elseif (INSECURE_ACTIONS_LOCALHOST_ONLY) { + elseif (defined('INSECURE_ACTIONS_LOCALHOST_ONLY') and INSECURE_ACTIONS_LOCALHOST_ONLY) { if (is_localhost()) $perm['dump'] = array(ACL_EVERY => true); else Modified: trunk/lib/Units.php =================================================================== --- trunk/lib/Units.php 2014-11-21 15:59:41 UTC (rev 9360) +++ trunk/lib/Units.php 2014-11-21 16:27:17 UTC (rev 9361) @@ -25,7 +25,7 @@ { function __construct() { - if (DISABLE_UNITS) + if (defined('DISABLE_UNITS') and DISABLE_UNITS) $this->errcode = 1; elseif (defined("UNITS_EXE")) // ignore dynamic check $this->errcode = 0; Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2014-11-21 15:59:41 UTC (rev 9360) +++ trunk/lib/WikiDB.php 2014-11-21 16:27:17 UTC (rev 9361) @@ -222,7 +222,7 @@ $result = -1; /* Generate notification emails */ - if (ENABLE_MAILNOTIFY) { + if (defined('ENABLE_MAILNOTIFY') and ENABLE_MAILNOTIFY) { include_once 'lib/MailNotify.php'; $MailNotify = new MailNotify($pagename); $MailNotify->onDeletePage($this, $pagename); Modified: trunk/lib/display.php =================================================================== --- trunk/lib/display.php 2014-11-21 15:59:41 UTC (rev 9360) +++ trunk/lib/display.php 2014-11-21 16:27:17 UTC (rev 9361) @@ -91,7 +91,7 @@ RecentChanges or AllPages might be an exception. */ $args = array(); - if (GOOGLE_LINKS_NOFOLLOW) { + if (defined('GOOGLE_LINKS_NOFOLLOW') and GOOGLE_LINKS_NOFOLLOW) { $robots = "noindex,nofollow"; $args = array('ROBOTS_META' => $robots); } Modified: trunk/lib/editpage.php =================================================================== --- trunk/lib/editpage.php 2014-11-21 15:59:41 UTC (rev 9360) +++ trunk/lib/editpage.php 2014-11-21 16:27:17 UTC (rev 9361) @@ -48,14 +48,14 @@ $this->tokens = array(); - if (ENABLE_WYSIWYG) { + if (defined('ENABLE_WYSIWYG') and ENABLE_WYSIWYG) { $backend = WYSIWYG_BACKEND; // TODO: error message require_once("lib/WysiwygEdit/$backend.php"); $class = "WysiwygEdit_$backend"; $this->WysiwygEdit = new $class(); } - if (ENABLE_CAPTCHA) { + if (defined('ENABLE_CAPTCHA' and ENABLE_CAPTCHA)) { require_once 'lib/Captcha.php'; $this->Captcha = new Captcha($this->meta); } @@ -119,7 +119,7 @@ return $this->viewSource(); $tokens['PAGE_LOCKED_MESSAGE'] = $this->getLockedMessage(); } elseif ($r->getArg('save_and_redirect_to') != "") { - if (ENABLE_CAPTCHA && $this->Captcha->Failed()) { + if (defined('ENABLE_CAPTCHA') and ENABLE_CAPTCHA && $this->Captcha->Failed()) { $this->tokens['PAGE_LOCKED_MESSAGE'] = HTML::p(HTML::h1($this->Captcha->failed_msg)); } elseif ($this->savePage()) { @@ -131,7 +131,7 @@ } $saveFailed = true; } elseif ($this->editaction == 'save') { - if (ENABLE_CAPTCHA && $this->Captcha->Failed()) { + if (defined('ENABLE_CAPTCHA') and ENABLE_CAPTCHA && $this->Captcha->Failed()) { $this->tokens['PAGE_LOCKED_MESSAGE'] = HTML::p(HTML::h1($this->Captcha->failed_msg)); } elseif ($this->savePage()) { @@ -226,13 +226,13 @@ $title = new FormattedText ($title_fs, $pagelink); // not for dumphtml or viewsource - if (ENABLE_WYSIWYG and $template == 'editpage') { + if (defined('ENABLE_WYSIWYG') and ENABLE_WYSIWYG and $template == 'editpage') { $WikiTheme->addMoreHeaders($this->WysiwygEdit->Head()); //$tokens['PAGE_SOURCE'] = $this->WysiwygEdit->ConvertBefore($this->_content); } $template = Template($template, $this->tokens); /* Tell google (and others) not to take notice of edit links */ - if (GOOGLE_LINKS_NOFOLLOW) + if (defined('GOOGLE_LINKS_NOFOLLOW') and GOOGLE_LINKS_NOFOLLOW) $args = array('ROBOTS_META' => "noindex,nofollow"); GeneratePage($template, $title, $rev); return true; @@ -268,7 +268,7 @@ : _("Page now unlocked.") . " "); $changed = true; } - if (ENABLE_PAGE_PUBLIC and (bool)$this->page->get('public') != (bool)$this->public) { + if (defined('ENABLE_PAGE_PUBLIC') and ENABLE_PAGE_PUBLIC and (bool)$this->page->get('public') != (bool)$this->public) { $this->page->set('public', (bool)$this->public); $this->tokens['LOCK_CHANGED_MSG'] .= ($this->public @@ -277,7 +277,7 @@ $changed = true; } - if (ENABLE_EXTERNAL_PAGES) { + if (defined('ENABLE_EXTERNAL_PAGES') and ENABLE_EXTERNAL_PAGES) { if ((bool)$this->page->get('external') != (bool)$this->external) { $this->page->set('external', (bool)$this->external); $this->tokens['LOCK_CHANGED_MSG'] @@ -449,7 +449,7 @@ } } // 3. extract (new) links and check surbl for blocked domains - if (ENABLE_SPAMBLOCKLIST and ($newlinks > 5)) { + if (defined('ENABLE_SPAMBLOCKLIST') and ENABLE_SPAMBLOCKLIST and ($newlinks > 5)) { require_once 'lib/SpamBlocklist.php'; require_once 'lib/InlineParser.php'; $parsed = TransformLinks($newtext); @@ -629,7 +629,7 @@ 'cols' => $request->getPref('editWidth'), 'readonly' => (bool)$readonly), $this->_content); - if (ENABLE_WYSIWYG) { + if (defined('ENABLE_WYSIWYG') and ENABLE_WYSIWYG) { return $this->WysiwygEdit->Textarea($textarea, $this->_wikicontent, $textarea->getAttr('name')); } else Modified: trunk/lib/loadsave.php =================================================================== --- trunk/lib/loadsave.php 2014-11-21 15:59:41 UTC (rev 9360) +++ trunk/lib/loadsave.php 2014-11-21 16:27:17 UTC (rev 9361) @@ -169,7 +169,7 @@ $current = $page->getCurrentRevision(false); $head = ''; - if (STRICT_MAILABLE_PAGEDUMPS) { + if (defined('STRICT_MAILABLE_PAGEDUMPS') and STRICT_MAILABLE_PAGEDUMPS) { $from = defined('SERVER_ADMIN') ? SERVER_ADMIN : 'foo@bar'; //This is for unix mailbox format: (not RFC (2)822) // $head .= "From $from " . CTime(time()) . "\r\n"; Modified: trunk/lib/main.php =================================================================== --- trunk/lib/main.php 2014-11-21 15:59:41 UTC (rev 9360) +++ trunk/lib/main.php 2014-11-21 16:27:17 UTC (rev 9361) @@ -30,7 +30,7 @@ require_once 'lib/WikiDB.php'; require_once 'lib/WikiUser.php'; require_once 'lib/WikiGroup.php'; -if (ENABLE_PAGEPERM) +if (defined('ENABLE_PAGEPERM') and ENABLE_PAGEPERM) require_once 'lib/PagePerm.php'; /** @@ -39,7 +39,7 @@ */ function mayAccessPage($access, $pagename) { - if (ENABLE_PAGEPERM) + if (defined('ENABLE_PAGEPERM') and ENABLE_PAGEPERM) return _requiredAuthorityForPagename($access, $pagename); // typically [10-20ms per page] else return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |