1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 20:57:26 +02:00

#125 - require_once() clean-up, also header and various other clean-up

This commit is contained in:
Tijn Kuyper
2013-02-27 15:18:48 +01:00
parent 8e6d5fbaeb
commit e2a9133e80
5 changed files with 62 additions and 101 deletions

View File

@@ -1,21 +1,15 @@
<?php <?php
/* /*
+ ----------------------------------------------------------------------------+ * e107 website system
| e107 website system *
| * Copyright (C) 2008-2013 e107 Inc (e107.org)
| Copyright (C) 2008-2009 e107 Inc * Released under the terms and conditions of the
| http://e107.org * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
| *
| * /contact.php
| Released under the terms and conditions of the *
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/contact.php,v $
| $Revision$
| $Date$
| $Author$
+----------------------------------------------------------------------------+
*/ */
require_once("class2.php"); require_once("class2.php");
// security image may be disabled by removing the appropriate shortcodes from the template. // security image may be disabled by removing the appropriate shortcodes from the template.
@@ -150,7 +144,7 @@ if(isset($_POST['send-contactus']))
} }
else else
{ {
require_once(e_HANDLER."message_handler.php"); require_once(e_HANDLER."message_handler.php"); //FIXME needs removing
message_handler("P_ALERT", $error); message_handler("P_ALERT", $error);
} }

View File

@@ -2,18 +2,13 @@
/* /*
* e107 website system * e107 website system
* *
* Copyright (C) 2008-2009 e107 Inc (e107.org) * Copyright (C) 2008-2013 e107 Inc (e107.org)
* Released under the terms and conditions of the * Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
* *
* Administration Area - Language check * Administration Area - Language check
* With code from Izydor and Lolo. * With code from Izydor and Lolo.
* *
* $Source: /cvs_backup/e107_0.8/e107_admin/lancheck.php,v $
* $Revision$
* $Date$
* $Author$
*
*/ */
require_once("../class2.php"); require_once("../class2.php");
if (!getperms("0")) { if (!getperms("0")) {
@@ -25,14 +20,11 @@ include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
$e_sub_cat = 'language'; $e_sub_cat = 'language';
require_once("auth.php"); require_once("auth.php");
require_once(e_HANDLER."message_handler.php");
require_once(e_HANDLER."form_handler.php");
$frm = e107::getForm(); $frm = e107::getForm();
$mes = e107::getMessage(); $mes = e107::getMessage();
$lck = new lancheck; $lck = new lancheck;
$qry = explode("|",e_QUERY); $qry = explode("|",e_QUERY);
$f = $qry[0]; $f = $qry[0];
$lan = $qry[1]; $lan = $qry[1];
@@ -41,7 +33,6 @@ $mode = $qry[2];
// Write the language file. // Write the language file.
if(isset($_POST['submit'])) if(isset($_POST['submit']))
{ {
unset($input); unset($input);
$kom_start = chr(47)."*"; $kom_start = chr(47)."*";
$kom_end = "*".chr(47); $kom_end = "*".chr(47);

View File

@@ -2,16 +2,10 @@
/* /*
* e107 website system * e107 website system
* *
* Copyright (C) 2008-2009 e107 Inc (e107.org) * Copyright (C) 2008-2013 e107 Inc (e107.org)
* Released under the terms and conditions of the * Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
* *
*
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/e_upgrade_class.php,v $
* $Revision$
* $Date$
* $Author$
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
@@ -70,9 +64,8 @@ class e_upgrade
if(($cache==TRUE) && ($cacheData = $e107cache->retrieve($cacheString, 3600, TRUE))) if(($cache==TRUE) && ($cacheData = $e107cache->retrieve($cacheString, 3600, TRUE)))
{ {
require_once(e_HANDLER."message_handler.php"); $mes = e107::getMessage();
$emessage = &eMessage::getInstance(); $mes->addInfo($cacheData);
$emessage->add($cacheData);
$e107cache->CachePageMD5 = ""; $e107cache->CachePageMD5 = "";
return; return;
} }
@@ -111,9 +104,7 @@ class e_upgrade
if($txt) if($txt)
{ {
require_once (e_HANDLER."message_handler.php"); $mes->addInfo($txt);
$emessage = &eMessage::getInstance();
$emessage->add($txt);
if($cache==TRUE) if($cache==TRUE)
{ {
$e107cache->set($cacheString, $txt, TRUE); $e107cache->set($cacheString, $txt, TRUE);
@@ -128,10 +119,9 @@ class e_upgrade
function checkAllPlugins() function checkAllPlugins()
{ {
global $pref; $pref = e107::getPref();
$sql = e107::getDB(); $sql = e107::getDB();
if($sql -> db_Select_Gen("SELECT * FROM #plugin WHERE plugin_installflag = 1 AND plugin_releaseUrl !=''")) if($sql -> db_Select_Gen("SELECT * FROM #plugin WHERE plugin_installflag = 1 AND plugin_releaseUrl !=''"))
{ {
@@ -163,5 +153,3 @@ class e_upgrade
} }

View File

@@ -2,28 +2,25 @@
/* /*
* e107 website system * e107 website system
* *
* Copyright (C) 2008-2012 e107 Inc (e107.org) * Copyright (C) 2008-2013 e107 Inc (e107.org)
* Released under the terms and conditions of the * Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
* *
* $URL$
* $Id$
*
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
/** /**
* *
* @package e107 * @package e107
* @category e107_handlers * @category e107_handlers
* @version $Id$
* @author e107inc * @author e107inc
* *
* Plugin administration handler * Plugin administration handler
*/ */
// TODO LAN
e107::coreLan('plugin', true); e107::coreLan('plugin', true);
class e107plugin class e107plugin
@@ -267,8 +264,7 @@ class e107plugin
} }
$sql->db_Mark_Time('After Scanning Plugin Files'); $sql->db_Mark_Time('After Scanning Plugin Files');
$p_installed = e107::getPref('plug_installed', array()); // load preference; $p_installed = e107::getPref('plug_installed', array()); // load preference;
require_once(e_HANDLER."message_handler.php"); $mes = e107::getMessage();
$mes = eMessage::getInstance();
foreach ($pluginList as $p) foreach ($pluginList as $p)
{ {
@@ -277,7 +273,7 @@ class e107plugin
if (strpos($plugin_path, 'e107_') !== FALSE) if (strpos($plugin_path, 'e107_') !== FALSE)
{ {
$mes->add("Folder error: <i>{$p['path']}</i>. 'e107_' is not permitted within plugin folder names.", E_MESSAGE_WARNING); $mes->addWarning("Folder error: <i>{$p['path']}</i>. 'e107_' is not permitted within plugin folder names.");
continue; continue;
} }
@@ -293,7 +289,7 @@ class e107plugin
if (!$this->parse_plugin($p['path'])) if (!$this->parse_plugin($p['path']))
{ {
//parsing of plugin.php/plugin.xml failed. //parsing of plugin.php/plugin.xml failed.
$mes->add("Parsing failed - file format error: {$p['path']}", E_MESSAGE_ERROR); $mes->addError("Parsing failed - file format error: {$p['path']}");
continue; // Carry on and do any others that are OK continue; // Carry on and do any others that are OK
} }
@@ -372,11 +368,11 @@ class e107plugin
if (e107::getDb()->db_Insert("plugin", "0, '".$tp->toDB($pName, true)."', '".$tp->toDB($plug_info['@attributes']['version'], true)."', '".$tp->toDB($plugin_path, true)."',{$_installed}, '{$eplug_addons}', '".$this->manage_category($plug_info['category'])."', '".varset($plug_info['@attributes']['releaseUrl'])."' ")) if (e107::getDb()->db_Insert("plugin", "0, '".$tp->toDB($pName, true)."', '".$tp->toDB($plug_info['@attributes']['version'], true)."', '".$tp->toDB($plugin_path, true)."',{$_installed}, '{$eplug_addons}', '".$this->manage_category($plug_info['category'])."', '".varset($plug_info['@attributes']['releaseUrl'])."' "))
{ {
$mes->add("Added <b>".$tp->toHTML($pName,false,"defs")."</b> to the plugin table.", E_MESSAGE_DEBUG); $mes->addDebug("Added <b>".$tp->toHTML($pName,false,"defs")."</b> to the plugin table.");
} }
else else
{ {
$mes->add("Failed to add ".$tp->toHTML($pName,false,"defs")." to the plugin table.", E_MESSAGE_DEBUG); $mes->addDebug("Failed to add ".$tp->toHTML($pName,false,"defs")." to the plugin table.");
} }
} }
} }
@@ -436,7 +432,7 @@ class e107plugin
return; return;
} }
$mes = eMessage::getInstance(); $mes = e107::getMessage();
$sql = e107::getDb(); $sql = e107::getDb();
$tp = e107::getParser(); $tp = e107::getParser();
$med = e107::getMedia(); $med = e107::getMedia();
@@ -451,7 +447,7 @@ class e107plugin
{ {
if (vartrue($this->unInstallOpts['delete_ipool'], FALSE)) if (vartrue($this->unInstallOpts['delete_ipool'], FALSE))
{ {
$status = ($med->removePath(e_PLUGIN.$plugin, 'icon')) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; $status = ($med>removePath(e_PLUGIN.$plugin, 'icon')) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add('Removing Icons from Media-Manager', $status); $mes->add('Removing Icons from Media-Manager', $status);
} }
return; return;
@@ -577,7 +573,7 @@ class e107plugin
$type = $this->ue_field_type($field_attrib); $type = $this->ue_field_type($field_attrib);
$type_name = $this->ue_field_type_name($type); $type_name = $this->ue_field_type_name($type);
$mes->add("Extended Field: ".$action.": ".$field_name." : ".$type_name, E_MESSAGE_DEBUG); $mes->addDebug("Extended Field: ".$action.": ".$field_name." : ".$type_name);
// predefined // predefined
if($type == EUF_PREFIELD) if($type == EUF_PREFIELD)
@@ -771,7 +767,7 @@ class e107plugin
$sql = e107::getDb(); $sql = e107::getDb();
$mes = e107::getMessage(); $mes = e107::getMessage();
$mes->add("Userclass: ".$action.": ".$class_name." : ".$class_description, E_MESSAGE_DEBUG); $mes->addDebug("Userclass: ".$action.": ".$class_name." : ".$class_description);
if (!$e107->user_class->isAdmin()) if (!$e107->user_class->isAdmin())
{ {
@@ -1355,7 +1351,7 @@ class e107plugin
$tableList = $dbHandler->get_table_def('', $path.$sqlFile); $tableList = $dbHandler->get_table_def('', $path.$sqlFile);
if (!is_array($tableList)) if (!is_array($tableList))
{ {
$mes->add("Can't read SQL definition: ".$path.$sqlFile, E_MESSAGE_ERROR); $mes->addError("Can't read SQL definition: ".$path.$sqlFile);
break; break;
} }
// Got the required definition here // Got the required definition here
@@ -1392,7 +1388,7 @@ class e107plugin
} }
else else
{ {
$mes->add("Table {$ct[1]} left in place.", E_MESSAGE_SUCCESS); $mes->addSuccess("Table {$ct[1]} left in place.");
} }
break; break;
} }
@@ -1505,7 +1501,7 @@ class e107plugin
$text .= "&nbsp;<a href='".$this->plugConfigFile."'>[".LAN_CONFIGURE."]</a>"; $text .= "&nbsp;<a href='".$this->plugConfigFile."'>[".LAN_CONFIGURE."]</a>";
} }
$mes->add($text, E_MESSAGE_SUCCESS); $mes->addSuccess($text);
} }
} }
@@ -1531,7 +1527,7 @@ class e107plugin
function XmlDependencies($tag) function XmlDependencies($tag)
{ {
$canContinue = TRUE; $canContinue = TRUE;
$mes = eMessage::getInstance(); $mes = e107::getMessage();
$error = array(); $error = array();
foreach ($tag as $dt => $dv) foreach ($tag as $dt => $dv)
@@ -1588,7 +1584,7 @@ class e107plugin
if (count($error)) if (count($error))
{ {
$text = '<b>'.LAN_INSTALL_FAIL.'</b><br />'.implode('<br />', $error); $text = '<b>'.LAN_INSTALL_FAIL.'</b><br />'.implode('<br />', $error);
$mes->add($text, E_MESSAGE_ERROR); $mes->addError($text);
} }
return $canContinue; return $canContinue;
@@ -1617,6 +1613,7 @@ class e107plugin
public function XmlLanguageFileCheck($fileEnd, $prefName, $when, $isInstalled, $justPath = FALSE, $plugin = '') public function XmlLanguageFileCheck($fileEnd, $prefName, $when, $isInstalled, $justPath = FALSE, $plugin = '')
{ {
$core = e107::getConfig('core'); $core = e107::getConfig('core');
$mes = e107::getMessage();
if (trim($plugin) == '') $plugin = $this->plugFolder; if (trim($plugin) == '') $plugin = $this->plugFolder;
if (!$plugin) return FALSE; // No plugin name - error if (!$plugin) return FALSE; // No plugin name - error
@@ -1648,7 +1645,7 @@ class e107plugin
case 'refresh': case 'refresh':
if ($currentPref != $pathEntry) if ($currentPref != $pathEntry)
{ {
e107::getMessage()->addDebug('Adding '.$plugin.' to '.$prefName); $mes->addDebug('Adding '.$plugin.' to '.$prefName);
$core->setPref($prefName.'/'.$plugin, $pathEntry); $core->setPref($prefName.'/'.$plugin, $pathEntry);
$updated = true; $updated = true;
} }
@@ -1656,7 +1653,7 @@ class e107plugin
case 'uninstall': case 'uninstall':
if ($currentPref) if ($currentPref)
{ {
e107::getMessage()->addDebug('Removing '.$plugin.' from '.$prefName); $mes->addDebug('Removing '.$plugin.' from '.$prefName);
$core->removePref($prefName.'/'.$plugin); $core->removePref($prefName.'/'.$plugin);
$updated = true; $updated = true;
} }
@@ -1772,7 +1769,7 @@ class e107plugin
if($result !== NULL) if($result !== NULL)
{ {
$status = ($result) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; $status = ($result) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add("Adding Link: {$linkName} with url [{$url}] and perm {$perm} ", $status); //TODO LAN $mes->add("Adding Link: {$linkName} with url [{$url}] and perm {$perm} ", $status);
} }
} }
@@ -1872,10 +1869,6 @@ class e107plugin
/** /**
* Process XML Tag <bbcodes> * Process XML Tag <bbcodes>
* @return none * @return none
@@ -1970,6 +1963,7 @@ class e107plugin
} }
} }
/** /**
* Process XML Tag <extendedFields> * Process XML Tag <extendedFields>
* @param string $function install|upgrade|refresh|uninstall * @param string $function install|upgrade|refresh|uninstall
@@ -2069,7 +2063,7 @@ class e107plugin
if (varset($tag['@attributes']['value'])) if (varset($tag['@attributes']['value']))
{ {
$mes->add("Deprecated plugin.xml spec. found. Use the following format: ".htmlentities("<pref name='name'>value</pref>"), E_MESSAGE_ERROR); $mes->addError("Deprecated plugin.xml spec. found. Use the following format: ".htmlentities("<pref name='name'>value</pref>"));
} }
switch ($function) switch ($function)
@@ -2079,7 +2073,7 @@ class e107plugin
$ret = $config->add($key, $value); $ret = $config->add($key, $value);
if($ret->data_has_changed == TRUE) if($ret->data_has_changed == TRUE)
{ {
$mes->add("Adding Pref: ".$key, E_MESSAGE_SUCCESS); $mes->addSuccess("Adding Pref: ".$key);
} }
break; break;
@@ -2089,19 +2083,19 @@ class e107plugin
{ {
$config->remove($key, $value); $config->remove($key, $value);
$mes->add("Removing Pref: ".$key, E_MESSAGE_SUCCESS); $mes->addSuccess("Removing Pref: ".$key);
} }
else else
{ {
$config->update($key, $value); $config->update($key, $value);
$mes->add("Updating Pref: ".$key, E_MESSAGE_SUCCESS); $mes->addSuccess("Updating Pref: ".$key);
} }
break; break;
case 'uninstall': case 'uninstall':
$config->remove($key, $value); $config->remove($key, $value);
$mes->add("Removing Pref: ".$key, E_MESSAGE_SUCCESS); $mes->addSuccess("Removing Pref: ".$key);
break; break;
} }
} }
@@ -2123,7 +2117,7 @@ class e107plugin
*/ */
function execute_function($path = null, $what = '', $when = '', $callbackData = null) function execute_function($path = null, $what = '', $when = '', $callbackData = null)
{ {
$mes = eMessage::getInstance(); $mes = e107::getMessage();
if($path == null) if($path == null)
{ {
@@ -2150,7 +2144,7 @@ class e107plugin
{ {
if(e_PAGE == 'e107_update.php') if(e_PAGE == 'e107_update.php')
{ {
$mes->add("Found setup file <b>".$path."_setup.php</b> ", E_MESSAGE_DEBUG); $mes->addDebug("Found setup file <b>".$path."_setup.php</b> ");
} }
include_once($setup_file); include_once($setup_file);
@@ -2165,7 +2159,7 @@ class e107plugin
{ {
if(e_PAGE == 'e107_update.php') if(e_PAGE == 'e107_update.php')
{ {
$mes->add("Executing setup function <b>".$class_name." :: ".$method_name."()</b>", E_MESSAGE_DEBUG); $mes->addDebug("Executing setup function <b>".$class_name." :: ".$method_name."()</b>");
} }
if(null !== $callbackData) return call_user_func_array(array($obj, $method_name), $callbackData); if(null !== $callbackData) return call_user_func_array(array($obj, $method_name), $callbackData);
return call_user_func(array($obj, $method_name), $this); return call_user_func(array($obj, $method_name), $this);
@@ -2174,7 +2168,7 @@ class e107plugin
{ {
if(e_PAGE == 'e107_update.php') if(e_PAGE == 'e107_update.php')
{ {
$mes->add("Setup function ".$class_name." :: ".$method_name."() NOT found.", E_MESSAGE_DEBUG); $mes->addDebug("Setup function ".$class_name." :: ".$method_name."() NOT found.");
} }
return FALSE; return FALSE;
} }
@@ -2260,14 +2254,12 @@ class e107plugin
if ($result === TRUE) if ($result === TRUE)
{ {
$text .= EPL_ADLAN_19.'<br />'; $text .= EPL_ADLAN_19.'<br />';
$mes->addSuccess(EPL_ADLAN_19);
$mes->add(EPL_ADLAN_19, E_MESSAGE_SUCCESS);
//success
} }
else else
{ {
$mes->add(EPL_ADLAN_18, E_MESSAGE_ERROR); $mes->addError(EPL_ADLAN_18);
//fail
} }
} }
@@ -2335,8 +2327,8 @@ class e107plugin
*/ */
function install_plugin($id) function install_plugin($id)
{ {
global $ns, $sysprefs, $mySQLprefix; global $sysprefs, $mySQLprefix;
$ns = e107::getRender();
$sql = e107::getDb(); $sql = e107::getDb();
$tp = e107::getParser(); $tp = e107::getParser();
@@ -2515,6 +2507,7 @@ class e107plugin
function getAddons($plugin_path, $debug = FALSE) function getAddons($plugin_path, $debug = FALSE)
{ {
$fl = e107::getFile(); $fl = e107::getFile();
$mes = e107::getMessage();
$p_addons = array(); $p_addons = array();
@@ -2540,7 +2533,6 @@ class e107plugin
} }
echo $plugin_path."/".$addon.".php - ".$passfail."<br />"; echo $plugin_path."/".$addon.".php - ".$passfail."<br />";
} }
$mes = e107::getMessage();
// $mes->add('Detected addon: <b>'.$addon.'</b>', E_MESSAGE_DEBUG); // $mes->add('Detected addon: <b>'.$addon.'</b>', E_MESSAGE_DEBUG);
$p_addons[] = $addon; $p_addons[] = $addon;
@@ -2772,7 +2764,7 @@ class e107plugin
if ($this->plug_vars === FALSE) if ($this->plug_vars === FALSE)
{ {
$mes->add("Error reading {$plugName}/plugin.xml", E_MESSAGE_ERROR); $mes->addError("Error reading {$plugName}/plugin.xml");
return FALSE; return FALSE;
} }
@@ -2818,3 +2810,4 @@ class e107plugin
} }
} }
?>

View File

@@ -8,9 +8,6 @@
* *
* Plugin Administration - Blog calendar menu * Plugin Administration - Blog calendar menu
* *
* $URL$
* $Id$
*
*/ */
$eplug_admin = TRUE; $eplug_admin = TRUE;
require_once("../../class2.php"); require_once("../../class2.php");
@@ -24,8 +21,6 @@ if (!getperms("1"))
} }
require_once(e_ADMIN."auth.php"); require_once(e_ADMIN."auth.php");
require_once(e_HANDLER."form_handler.php");
require_once(e_HANDLER."message_handler.php");
$frm = e107::getForm(); $frm = e107::getForm();
$mes = e107::getMessage(); $mes = e107::getMessage();