From caa79b6454e230cb8a8eed215eeb6bdd5fe6b353 Mon Sep 17 00:00:00 2001 From: CaMer0n Date: Wed, 10 Feb 2010 21:53:56 +0000 Subject: [PATCH] Shortcode path fixes --- class2.php | 92 ++-- contact.php | 2 +- e107_admin/db.php | 461 +++++++++--------- e107_admin/download.php | 114 ++--- e107_admin/includes/infopanel.php | 34 +- .../shortcodes/batch/admin_shortcodes.php | 4 +- e107_handlers/comment_class.php | 72 +-- e107_handlers/news_class.php | 306 ++++++------ e107_handlers/ren_help.php | 8 +- e107_handlers/shortcode_handler.php | 63 +-- e107_plugins/banner/banner_menu.php | 6 +- e107_plugins/facebook/e_module.php | 68 +-- news.php | 78 +-- signup.php | 6 +- sitedown.php | 4 +- upload.php | 22 +- user.php | 2 +- usersettings.php | 26 +- 18 files changed, 685 insertions(+), 683 deletions(-) diff --git a/class2.php b/class2.php index 689aed069..7f62550f1 100644 --- a/class2.php +++ b/class2.php @@ -93,7 +93,7 @@ if($register_globals == true) // MOVED TO $e107->prepare_request() // TODO - better ajax detection method (headers when possible) //define('e_AJAX_REQUEST', isset($_REQUEST['ajax_used'])); -//unset($_REQUEST['ajax_used']); // removed because it's auto-appended from JS (AJAX), could break something... +//unset($_REQUEST['ajax_used']); // removed because it's auto-appended from JS (AJAX), could break something... // //if(isset($_E107['minimal']) || e_AJAX_REQUEST) //{ @@ -331,7 +331,7 @@ if (!$ADMIN_DIRECTORY && !$DOWNLOADS_DIRECTORY) // J: MYSQL INITIALIZATION // e107::getSingleton('e107_traffic'); // We start traffic counting ASAP -//$eTraffic->Calibrate($eTraffic); +//$eTraffic->Calibrate($eTraffic); e107_require_once(e_HANDLER.'mysql_class.php'); @@ -437,7 +437,7 @@ $pref = e107::getPref(); //this could be part of e107->init() method now, prefs will be auto-initialized //when proper called (e107::getPref()) -// $e107->set_base_path(); moved to init(). +// $e107->set_base_path(); moved to init(). //DEPRECATED, BC, call e107::getConfig('menu')->get('pref_name') only when needed $menu_pref = e107::getConfig('menu')->getPref(); //extract menu prefs @@ -736,8 +736,8 @@ if(isset($pref['notify']) && $pref['notify'] == true) $sql -> db_Mark_Time('Start: Init session'); init_session(); -//DEPRECATED but necessary. BC Fix. -function getip() +//DEPRECATED but necessary. BC Fix. +function getip() { return e107::ipDecode(USERIP); } @@ -1019,14 +1019,14 @@ define('TIMEOFFSET', $e_deltaTime); $sql->db_Mark_Time('(Start: Find/Load Theme)'); if(e_ADMIN_AREA) // Load admin phrases ASAP -{ +{ e107::includeLan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_admin.php'); } if(!defined('THEME')) { - + if (e_ADMIN_AREA && varsettrue($pref['admintheme'])) { //We have now e_IFRAME mod and USER_AREA force @@ -1315,8 +1315,8 @@ function getperms($arg, $ap = ADMINPERMS) { return false; } - - if ($ap === '0' || $ap === '0.') // BC fix. + + if ($ap === '0' || $ap === '0.') // BC fix. { return true; } @@ -1324,14 +1324,14 @@ function getperms($arg, $ap = ADMINPERMS) if ($arg == 'P' && preg_match("#(.*?)/".e107::getInstance()->getFolder('plugins')."(.*?)/(.*?)#", e_SELF, $matches)) { $sql = e107::getDb('psql'); - + if ($sql->db_Select('plugin', 'plugin_id', "plugin_path = '".$matches[2]."' LIMIT 1 ")) { $row = $sql->db_Fetch(); - $arg = 'P'.$row['plugin_id']; + $arg = 'P'.$row['plugin_id']; } } - + $ap_array = explode('.',$ap); if(in_array($arg,$ap_array)) @@ -1574,17 +1574,17 @@ function init_session() # - return boolean # - scope public */ - - + + global $pref, $user_pref, $currentUser, $e107, $_E107; - + $sql = e107::getDb(); $tp = e107::getParser(); $eArrayStorage = e107::getArrayStorage(); - + define('USERIP', $e107->getip()); - + if(varset($_E107['cli'])) { define('USER', true); @@ -1596,7 +1596,7 @@ function init_session() define('USERCLASS', ''); define('USEREMAIL', ''); define('USERCLASS_LIST', ''); - define('USERCLASS', ''); + define('USERCLASS', ''); return; } @@ -1624,7 +1624,7 @@ function init_session() if (empty($uid) || empty($upw)) { //$_SESSION[] = e_SELF."?".e_QUERY; - + cookie(e_COOKIE, '', (time() - 2592000)); $_SESSION[e_COOKIE] = ""; session_destroy(); @@ -1688,7 +1688,7 @@ function init_session() define('ADMINEMAIL', $result['user_email']); define('ADMINPWCHANGE', $result['user_pwchange']); e107::getRedirect()->setPreviousUrl(); - + } else { @@ -2096,54 +2096,54 @@ function plugInstalled($plugname) /** * Magic class autoload. - * We are raising plugin structure standard here - plugin auto-loading works ONLY if + * We are raising plugin structure standard here - plugin auto-loading works ONLY if * classes live inside 'includes' folder. - * Example: plugin_myplug_admin_ui -> + * Example: plugin_myplug_admin_ui -> * * * TODO - use spl_autoload[_*] for core autoloading some day (PHP5 > 5.1.2) * TODO - at this time we could create e107 version of spl_autoload_register - e_event->register/trigger('autoload') - * - * @todo plugname/e_shortcode.php auto-detection (hard, near impossible at this time) - we need 'plugin_' prefix to - * distinguish them from the core batches - * + * + * @todo plugname/e_shortcode.php auto-detection (hard, near impossible at this time) - we need 'plugin_' prefix to + * distinguish them from the core batches + * * @param string $className * @return void */ -function __autoload($className) +function __autoload($className) { //Security... - if (strpos($className, '/') !== false) + if (strpos($className, '/') !== false) { return; } $tmp = explode('_', $className); $filename = ''; - + switch($tmp[0]) { case 'plugin': // plugin handlers/shortcode batches array_shift($tmp); // remove 'plugin' $end = array_pop($tmp); // check for 'shortcodes' end phrase - + if (!isset($tmp[0]) || !$tmp[0]) return; // In case we get an empty class part - - // Currently only batches inside shortcodes/ folder are auto-detected, - // read the todo for e_shortcode.php related problems + + // Currently only batches inside shortcodes/ folder are auto-detected, + // read the todo for e_shortcode.php related problems if('shortcodes' == $end) { $filename = e_PLUGIN.$tmp[0].'/shortcodes/'; // plugname/shortcodes/ @@ -2155,35 +2155,35 @@ function __autoload($className) { $tmp[] = $end; // not a shortcode batch - append the end phrase again } - - // Handler check - $tmp[0] .= '/includes'; //folder 'includes' is not part of the class name + + // Handler check + $tmp[0] .= '/includes'; //folder 'includes' is not part of the class name $filename = e_PLUGIN.implode('/', $tmp).'.php'; //TODO add debug screen Auto-loaded classes - ['plugin: '.$filename.' - '.$className]; break; - + default: //core libraries, core shortcode batches // core SC batch check $end = array_pop($tmp); - if('shortcodes' == $end) + if('shortcodes' == $end) { - $filename = e_FILE.'shortcode/batch/'.$className.'.php'; // core shortcode batch + $filename = e_CORE.'shortcodes/batch/'.$className.'.php'; // core shortcode batch break; } - $filename = e107::getHandlerPath($className, true); + $filename = e107::getHandlerPath($className, true); //TODO add debug screen Auto-loaded classes - ['core: '.$filename.' - '.$className]; break; } - + if($filename) { // autoload doesn't REQUIRE files, because this will break things like call_user_func() include($filename); } -} +} -// register __autoload if possible to prevent its override by +// register __autoload if possible to prevent its override by // 3rd party spl_autoload_register calls if(function_exists('spl_autoload_register')) { diff --git a/contact.php b/contact.php index 88b9e1aea..769c235be 100644 --- a/contact.php +++ b/contact.php @@ -154,7 +154,7 @@ if(SITECONTACTINFO && $CONTACT_INFO) if(isset($pref['sitecontacts']) && $pref['sitecontacts'] != 255) { - require_once(e_FILE."shortcode/batch/contact_shortcodes.php"); + require_once(e_CORE."shortcodes/batch/contact_shortcodes.php"); $text = $tp->parseTemplate($CONTACT_FORM, TRUE, $contact_shortcodes); if(trim($text) != "") diff --git a/e107_admin/db.php b/e107_admin/db.php index b5781b322..d514689af 100644 --- a/e107_admin/db.php +++ b/e107_admin/db.php @@ -77,7 +77,7 @@ if(isset($_POST['exportXmlFile'])) $emessage = eMessage::getInstance(); $emessage->add(LAN_SUCCESS, E_MESSAGE_SUCCESS); } - + } require_once ("auth.php"); @@ -86,7 +86,7 @@ $frm = new e_form(); $st = new system_tools; -/* No longer needed after XML feature added. +/* No longer needed after XML feature added. if(isset($_POST['backup_core']) || $_GET['mode']=='backup_core') { @@ -111,14 +111,14 @@ require_once ("footer.php"); class system_tools { - + public $_options = array(); - - + + function __construct() { global $mySQLdefaultdb; - + $this->_options = array( "db_update" => array('diz'=>DBLAN_15, 'label'=>DBLAN_16), "verify_sql" => array('diz'=>DBLAN_4, 'label'=>DBLAN_5), @@ -132,90 +132,90 @@ class system_tools 'sc_override_scan' => array('diz'=>DBLAN_55, 'label'=> DBLAN_56), 'convert_to_utf8' => array('diz'=>'Convert Database to UTF-8','label'=>'Convert DB to UTF-8') ); - - //TODO Merge db_verify.php into db.php - - + //TODO Merge db_verify.php into db.php + + + if(isset($_POST['delplug'])) { - $this->delete_plugin_entry($_POST['pref_type']); + $this->delete_plugin_entry($_POST['pref_type']); } - + if(isset($_POST['upload'])) - { - $this->importXmlFile(); + { + $this->importXmlFile(); } - + if(isset($_POST['delpref']) || (isset($_POST['delpref_checked']) && isset($_POST['delpref2']))) { $this->del_pref_val($_POST['pref_type']); } - + if(isset($_POST['verify_sql_record']) || varset($_GET['mode'])=='verify_sql_record' || isset($_POST['check_verify_sql_record']) || isset($_POST['delete_verify_sql_record'])) { // $this->verify_sql_record(); - currently performed in db_verify.php } - + if(isset($_POST['importForm']) || $_GET['mode']=='importForm') { - $this->importForm(); + $this->importForm(); } - - + + if(isset($_POST['convert_to_utf8']) || $_GET['mode']=='convert_to_utf8') { - $this->convertUTF8Form(); + $this->convertUTF8Form(); } - + if(isset($_POST['exportForm']) || $_GET['mode']=='exportForm') { - $this->exportXmlForm(); + $this->exportXmlForm(); } if(isset($_POST['optimize_sql']) || $_GET['mode']=='optimize_sql') { $this->optimizesql($mySQLdefaultdb); } - + if(isset($_POST['pref_editor']) || $_GET['mode']=='pref_editor' || isset($_POST['delpref']) || isset($_POST['delpref_checked'])) { $type = isset($_GET['type']) ? $_GET['type'] : "core"; $this->pref_editor($type); } - + if(isset($_POST['sc_override_scan']) || $_GET['mode']=='sc_override_scan') { $this->scan_override(); } - + if(isset($_POST['plugin_scan']) || e_QUERY == "plugin" || isset($_POST['delplug']) || $_GET['mode']=='plugin_scan') { $this->plugin_viewscan(); } - + if(vartrue($_POST['perform_utf8_convert'])) { $this->perform_utf8_convert(); } - + if(!vartrue($_GET['mode'])) - { + { $this->render_options(); } - - + + } - + private function convertUTF8Form() { $emessage = e107::getMessage(); $frm = e107::getForm(); - //TODO a function to call the e107_config information in e107_class.php. - require(e_BASE."e107_config.php"); + //TODO a function to call the e107_config information in e107_class.php. + require(e_BASE."e107_config.php"); $dbtable = $mySQLdefaultdb; - + //TODO LAN $message = ' This function will permanently modify all tables in your database. ('.$mySQLdefaultdb.')
@@ -234,7 +234,7 @@ class system_tools Be sure you followed all steps of the upgrade process first.
  • It should work without troubles for databases of sites using only UTF-8 charset. Probably not with other charsets.
  • The function uses the information_schema database for now.
  • - + '; $emessage->add($message, E_MESSAGE_WARNING); @@ -248,70 +248,70 @@ class system_tools "; - - e107::getRender()->tablerender("Convert Database to UTF-8", $emessage->render().$text); - + + e107::getRender()->tablerender("Convert Database to UTF-8", $emessage->render().$text); + } - + private function perform_utf8_convert() { require(e_BASE."e107_config.php"); - + $dbtable = $mySQLdefaultdb; - - //TODO Add a check to be sure the database is not already utf-8. + + //TODO Add a check to be sure the database is not already utf-8. // yep, needs more methods - possibly a class in e107_handler - - $sql = e107::getDb(); + + $sql = e107::getDb(); $mes = e107::getMessage(); - + $ERROR = FALSE; - + if(!mysql_query("USE information_schema;")) { $mes->add("Couldn't read information_schema", E_MESSAGE_ERROR); return; } - - $queries = array(); + + $queries = array(); $queries[] = $this->getQueries("SELECT CONCAT('ALTER TABLE ', table_name, ' MODIFY ', column_name, ' ', REPLACE(column_type, 'char', 'binary'), ';') FROM columns WHERE table_schema = '".$dbtable."' and data_type LIKE '%char%';"); $queries[] = $this->getQueries("SELECT CONCAT('ALTER TABLE ', table_name, ' MODIFY ', column_name, ' ', REPLACE(column_type, 'text', 'blob'), ';') FROM columns WHERE table_schema = '".$dbtable."' and data_type LIKE '%text%';"); - - $queries2 = array(); + + $queries2 = array(); $queries2[] = $this->getQueries("SELECT CONCAT('ALTER TABLE ', table_name, ' MODIFY ', column_name, ' ', column_type, ' CHARACTER SET utf8;') FROM columns WHERE table_schema = '".$dbtable."' and data_type LIKE '%char%';"); $queries2[] = $this->getQueries("SELECT CONCAT('ALTER TABLE ', table_name, ' MODIFY ', column_name, ' ', column_type, ' CHARACTER SET utf8;') FROM columns WHERE table_schema = '".$dbtable."' and data_type LIKE '%text%';"); - - + + mysql_query("USE ".$dbtable); - + foreach($queries as $qry) { foreach($qry as $q) { if(!$sql->db_Query($q)) { - $mes->add($q, E_MESSAGE_ERROR); + $mes->add($q, E_MESSAGE_ERROR); $ERROR = TRUE; } - } + } } - + //------------ - + $result = mysql_list_tables($dbtable); while ($row = mysql_fetch_array($result, MYSQL_NUM)) { - $table = $row[0]; + $table = $row[0]; $tab_query = "ALTER TABLE ".$table." charset=utf8; "; if(!$sql->db_Query($tab_query)) { - $mes->add($tab_query, E_MESSAGE_ERROR); - $ERROR = TRUE; + $mes->add($tab_query, E_MESSAGE_ERROR); + $ERROR = TRUE; } } - + // --------------- - + foreach($queries2 as $qry) { foreach($qry as $q) @@ -319,32 +319,32 @@ class system_tools if(!$sql->db_Query($q)) { $mes->add($q, E_MESSAGE_ERROR); - $ERROR = TRUE; + $ERROR = TRUE; } - } + } } //------------ - + $lastQry = "ALTER DATABASE `".$dbtable."` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;"; - + if(!$sql->db_Query($lastQry)) { - $mes->add($lastQry, E_MESSAGE_ERROR); + $mes->add($lastQry, E_MESSAGE_ERROR); } elseif($ERROR != TRUE) { $message = "Database Converted successfully to UTF-8.
    - Please now add the following line to your e107_config.php file:
    + Please now add the following line to your e107_config.php file:
    \$mySQLcharset = 'utf8'; "; - - $mes->add($message, E_MESSAGE_SUCCESS); + + $mes->add($message, E_MESSAGE_SUCCESS); } - - + + } - + function getQueries($query) { if(!$result = mysql_query($query)) @@ -354,49 +354,49 @@ class system_tools } while ($row = mysql_fetch_array($result, MYSQL_NUM)) { - $qry[] = $row[0]; + $qry[] = $row[0]; } - - return $qry; + + return $qry; } /** - * Delete selected preferences. + * Delete selected preferences. * @return none - */ + */ private function del_pref_val($mode='core') { global $emessage; - + $deleted_list = ""; - + $config = ($mode == 'core' || $mode='') ? e107::getConfig('core') : e107::getPlugConfig($mode); - + // Single Pref Deletion using button if(varset($_POST['delpref'])) { $delpref = key($_POST['delpref']); if($config->remove($delpref)) { - $deleted_list .= "
  • ".$delpref."
  • "; - } + $deleted_list .= "
  • ".$delpref."
  • "; + } } - + // Multiple Pref deletion using checkboxes if(varset($_POST['delpref2'])) - { + { foreach($_POST['delpref2'] as $k => $v) { if($config->remove($k)) { - $deleted_list .= "
  • ".$k."
  • "; - } + $deleted_list .= "
  • ".$k."
  • "; + } } - } - + } + if($deleted_list && $config->save()) - { + { $emessage->add(LAN_DELETED.""); e107::getCache()->clear(); } @@ -406,7 +406,7 @@ class system_tools private function delete_plugin_entry() { global $sql, $emessage; - + $del = array_keys($_POST['delplug']); if($sql->db_Delete("plugin", "plugin_id='".intval($del[0])."' LIMIT 1")) { @@ -416,7 +416,7 @@ class system_tools { $emessage->add(LAN_DELETED_FAILED, E_MESSAGE_WARNING); } - + } @@ -424,11 +424,11 @@ class system_tools /** * Render Options * @return none - */ + */ private function render_options() { $frm = e107::getSingleton('e_form'); - + $text = "
    @@ -439,7 +439,7 @@ class system_tools "; - + foreach($this->_options as $key=>$val) { $text .= " @@ -447,12 +447,12 @@ class system_tools ".$frm->radio('db_execute', $key).$frm->label($val['label'], 'db_execute', $key)." - \n"; - - } - + \n"; + + } + $text .= " - +
    @@ -461,36 +461,36 @@ class system_tools
    "; - + $emessage = eMessage::getInstance(); - e107::getRender()->tablerender(DBLAN_10, $emessage->render().$text); + e107::getRender()->tablerender(DBLAN_10, $emessage->render().$text); } - + /** * Import XML Form * @return none - */ + */ private function importForm() { // Get largest allowable file upload - + $frm = e107::getSingleton('e_form'); - - + + require_once(e_HANDLER.'upload_handler.php'); $max_file_size = get_user_max_upload(); - + $text = "
    - + - - + + @@ -502,138 +502,138 @@ class system_tools
    ".LAN_UPLOAD."
    - +
    "; $text .= $frm->admin_button('upload', LAN_UPLOAD, 'submit', LAN_UPLOAD); - + $text .= "
    - +
    \n"; - + $emessage = eMessage::getInstance(); - e107::getRender()->tablerender(DBLAN_59, $emessage->render().$text); - + e107::getRender()->tablerender(DBLAN_59, $emessage->render().$text); + } /** * Export XML Dump * @return none - */ + */ private function exportXmlForm() { $emessage = eMessage::getInstance(); $frm = e107::getSingleton('e_form'); - - + + //TODO LANs - + $text = "
    Export Options - + - + - - + + - + "; - + $pref_types = e107::getConfig()->aliases; - unset($pref_types['core_old'],$pref_types['core_backup']); + unset($pref_types['core_old'],$pref_types['core_backup']); // $exclusions = array('core_old'=>1,'core_backup'=>1); // $filteredprefs = array_diff($pref_types,$exclusions); - + foreach($pref_types as $key=>$description) { - $checked = ($_POST['xml_prefs'][$key] == $key) ? 1: 0; + $checked = ($_POST['xml_prefs'][$key] == $key) ? 1: 0; $text .= " - + "; - + } $text .= "
    ".$frm->checkbox_toggle('check-all-verify', 'xml_prefs')." Preferences Rows
    ".$frm->checkbox("xml_prefs[".$key."]", $key, $checked)." ".LAN_PREFS.": ".$key."  
    - + - + - + - - + + \n"; - + $tables = table_list(); - + foreach($tables as $name=>$count) - { - $checked = ($_POST['xml_tables'][$name] == $name) ? 1: 0; - $text .= " + { + $checked = ($_POST['xml_tables'][$name] == $name) ? 1: 0; + $text .= ""; } - + $text .=" - +
    ".$frm->checkbox_toggle('check-all-verify', 'xml_tables')."Tables Rows
    - ".$frm->checkbox("xml_tables[".$name."]", $name, $checked)." Table Data: ".$name." + ".$frm->checkbox("xml_tables[".$name."]", $name, $checked)." Table Data: ".$name." $count
    - + - + - + - +
    ".LAN_OPTIONS."
    "; - $checked = (vartrue($_POST['package_images'])) ? 1: 0; - $text .= $frm->checkbox("package_images",'package_images', $checked)." Convert paths and package images and xml into: ".e107::getParser()->replaceConstants(EXPORT_PATH)." - + $checked = (vartrue($_POST['package_images'])) ? 1: 0; + $text .= $frm->checkbox("package_images",'package_images', $checked)." Convert paths and package images and xml into: ".e107::getParser()->replaceConstants(EXPORT_PATH)." +
    - +
    ".$frm->admin_button('exportXmlFile', "Export File", 'exportXmlFile')."
    "; - - - e107::getRender()->tablerender("Export Options",$emessage->render(). $text); - - + + + e107::getRender()->tablerender("Export Options",$emessage->render(). $text); + + } /** @@ -646,15 +646,15 @@ class system_tools foreach($ret['success'] as $table) { - eMessage::getInstance()->add("Inserted $table", E_MESSAGE_SUCCESS); + eMessage::getInstance()->add("Inserted $table", E_MESSAGE_SUCCESS); } - + foreach($ret['failed'] as $table) { - eMessage::getInstance()->add("Failed to Insert $table", E_MESSAGE_ERROR); - } + eMessage::getInstance()->add("Failed to Insert $table", E_MESSAGE_ERROR); + } } - + /** * Optimize SQL * @return none @@ -667,11 +667,11 @@ class system_tools { mysql_query("OPTIMIZE TABLE ".$row[0]); } - + // $emessage->add(DBLAN_11." $mySQLdefaultdb ".DBLAN_12, E_MESSAGE_SUCCESS); - e107::getRender()->tablerender(DBLAN_7, DBLAN_11." $mySQLdefaultdb ".DBLAN_12); + e107::getRender()->tablerender(DBLAN_7, DBLAN_11." $mySQLdefaultdb ".DBLAN_12); } - + /** * Preferences Editor * @return string text for display @@ -679,36 +679,36 @@ class system_tools private function pref_editor($type='core') { //TODO Add drop-down for editing personal perfs also. ie. user pref of self. (admin) - - global $pref, $e107, $emessage, $frm; - - + global $pref, $e107, $emessage, $frm; + + + $config = ($type == 'core') ? e107::getConfig('core') : e107::getPlugConfig($type); $spref = $config->getPref(); - - ksort($spref); - + + ksort($spref); + $text = "
    ".DBLAN_20.""; - + $text .= " @@ -727,12 +727,12 @@ class system_tools "; - + foreach($spref as $key => $val) { $ptext = (is_array($val)) ? "
    ".print_r($val, TRUE)."
    " : htmlspecialchars($val, ENT_QUOTES, 'utf-8'); $ptext = $e107->tp->textclean($ptext, 80); - + $text .= " @@ -742,7 +742,7 @@ class system_tools "; } - + $text .= "
    ".$frm->checkbox("delpref2[$key]", 1)."
    @@ -753,25 +753,26 @@ class system_tools
    \n\n"; - + e107::getRender()->tablerender(DBLAN_10.' :: '.DBLAN_20." :: ".ucwords($type), $emessage->render().$text); - + return $text; } - + /** * Preferences Editor * @return none - */ + */ private function scan_override() { global $pref, $emessage; - + require_once(e_HANDLER.'file_class.php'); $f = new e_file; - + $scList = ''; - $fList = $f->get_files(e_FILE.'shortcode/override', '\.sc$'); + + $fList = $f->get_files(e_SYSTEM.'override/shortcodes', '\.sc$'); if(count($fList)) { $tmp = array(); @@ -791,38 +792,38 @@ class system_tools /** * Plugin Folder Scanner * @return none - */ + */ private function plugin_viewscan() { $error_messages = array(0 => DBLAN_31, 1 => DBLAN_32, 2 => DBLAN_33, 3 => DBLAN_34); $error_image = array("integrity_pass.png", "integrity_fail.png", "warning.png", "blank.png"); - - - + + + global $e107; $sql = e107::getDb(); $tp = e107::getParser(); $frm = e107::getForm(); $emessage = e107::getMessage(); - - - + + + require_once (e_HANDLER."plugin_class.php"); $ep = new e107plugin(); $ep->update_plugins_table(); // scan for e_xxx changes and save to plugin table. $ep->save_addon_prefs(); // generate global e_xxx_list prefs from plugin table. - + /* we all are awaiting for PHP5 only support - method chaining... $emessage->add(DBLAN_22.' - '.DBLAN_23, E_MESSAGE_SUCCESS) ->add("".LAN_BACK."", E_MESSAGE_SUCCESS) ->add(DBLAN_30); */ - + $emessage->add(DBLAN_23, E_MESSAGE_SUCCESS); $emessage->add("".LAN_BACK."", E_MESSAGE_SUCCESS); $emessage->add(DBLAN_30); - + $text = "
    @@ -844,19 +845,19 @@ class system_tools "; - + $sql->db_Select("plugin", "*", "plugin_id !='' order by plugin_path ASC"); // Must order by path to pick up duplicates. (plugin names may change). $previous = ''; while($row = $sql->db_Fetch()) { e107::loadLanFiles($row['plugin_path'],'admin'); - + $text .= " ".$e107->tp->toHtml($row['plugin_name'], FALSE, "defs,emotes_off")." ".$row['plugin_path']." "; - + if(trim($row['plugin_addons'])) { //XXX - $nl_code = ''; - OLD VAR? @@ -873,12 +874,12 @@ class system_tools $text .= ""; } } - + $text .= " "; - + if($previous == $row['plugin_path']) { $delid = $row['plugin_id']; @@ -898,14 +899,14 @@ class system_tools "; $previous = $row['plugin_path']; } - + $text .= "
    "; - + e107::getRender()->tablerender(DBLAN_10.' - '.DBLAN_22, $emessage->render().$text); } } @@ -915,14 +916,14 @@ class system_tools function db_adminmenu() { global $st; - + foreach($st->_options as $key=>$val) { $var[$key]['text'] = $val['label']; $var[$key]['link'] = e_SELF."?mode=".$key; } - - e_admin_menu(DBLAN_10, $_GET['mode'], $var); + + e_admin_menu(DBLAN_10, $_GET['mode'], $var); } @@ -938,28 +939,28 @@ function exportXmlFile($prefs,$tables,$package=FALSE,$debug=FALSE) $xml = e107::getSingleton('xmlClass'); $tp = e107::getParser(); $emessage = eMessage::getInstance(); - + //TODO LANs - + if(vartrue($package)) { - + $xml->convertFilePaths = TRUE; $xml->filePathDestination = EXPORT_PATH; $xml->filePathPrepend = array( 'news_thumbnail' => "{e_IMAGE}newspost_images/" ); - - + + $desinationFolder = $tp->replaceConstants($xml->filePathDestination); - + if(!is_writable($desinationFolder)) - { + { $emessage->add($desinationFolder." is not writable", E_MESSAGE_ERROR); return ; } } - + if($xml->e107Export($prefs,$tables,$debug)) { @@ -976,8 +977,8 @@ function exportXmlFile($prefs,$tables,$package=FALSE,$debug=FALSE) } else { - $emessage->add("Couldn't copy: ".$newfile, E_MESSAGE_ERROR); - } + $emessage->add("Couldn't copy: ".$newfile, E_MESSAGE_ERROR); + } } } } @@ -989,8 +990,8 @@ function exportXmlFile($prefs,$tables,$package=FALSE,$debug=FALSE) function table_list() { // grab default language lists. - //TODO - a similar function is in db_verify.php. Should probably all be moved to mysql_class.php. - + //TODO - a similar function is in db_verify.php. Should probably all be moved to mysql_class.php. + $exclude = array(); $exclude[] = "core"; $exclude[] = "rbinary"; @@ -1000,19 +1001,19 @@ function table_list() $exclude[] = "upload"; $exclude[] = "user_extended_country"; $exclude[] = "plugin"; - + $coreTables = e107::getDb()->db_TableList('nolan'); $tables = array_diff($coreTables,$exclude); - + foreach($tables as $e107tab) - { + { $count = e107::getDb()->db_Select_gen("SELECT * FROM #".$e107tab); - + if($count) { - $tabs[$e107tab] = $count; - } + $tabs[$e107tab] = $count; + } } return $tabs; @@ -1035,7 +1036,7 @@ function backup_core() */ -function verify_sql_record() // deprecated by db_verify.php ( i think). +function verify_sql_record() // deprecated by db_verify.php ( i think). { global $emessage, $sql, $sql2, $sql3, $frm, $e107, $tp; diff --git a/e107_admin/download.php b/e107_admin/download.php index 440eb735c..7f0c88631 100644 --- a/e107_admin/download.php +++ b/e107_admin/download.php @@ -17,7 +17,7 @@ define('DOWNLOAD_DEBUG',FALSE); require_once("../class2.php"); -if (!getperms("R")) +if (!getperms("R")) { header("location:".e_BASE."index.php"); exit; @@ -68,7 +68,7 @@ $pst->save_preset("admin_downloads"); // unique name for the preset $sub_action = ''; -if (e_QUERY) +if (e_QUERY) { $tmp = explode(".", e_QUERY); $action = $tmp[0]; @@ -109,7 +109,7 @@ if($public_array = $fl->get_files(e_UPLOAD)) if ($sql->db_Select("rbinary")) { - while ($row = $sql->db_Fetch()) + while ($row = $sql->db_Fetch()) { extract($row); $file_array[] = "Binary ".$binary_id."/".$binary_name; @@ -135,13 +135,13 @@ if(isset($_POST)) $e107cache->clear("download_cat"); } -if (isset($_POST['add_category'])) +if (isset($_POST['add_category'])) { $download->create_category($sub_action, $id); } -if (isset($_POST['submit_download'])) +if (isset($_POST['submit_download'])) { $download->submit_download($sub_action, $id); $action = "main"; @@ -281,15 +281,15 @@ if ($action == "dlm") } -if ($action == "create") +if ($action == "create") { $download->create_download($sub_action, $id); } -if ($delete == 'category') +if ($delete == 'category') { - if (admin_update($sql->db_Delete('download_category', 'download_category_id='.$del_id), 'delete', DOWLAN_49." #".$del_id." ".DOWLAN_36)) + if (admin_update($sql->db_Delete('download_category', 'download_category_id='.$del_id), 'delete', DOWLAN_49." #".$del_id." ".DOWLAN_36)) { $sql->db_Delete('download_category', 'download_category_parent='.$del_id); $admin_log->log_event('DOWNL_04',$del_id,E_LOG_INFORMATIVE,''); @@ -297,13 +297,13 @@ if ($delete == 'category') } -if ($action == 'cat') +if ($action == 'cat') { $download->show_categories($sub_action, $id); } -if ($delete == 'main') +if ($delete == 'main') { $result = admin_update($sql->db_Delete('download', 'download_id='.$del_id), 'delete', DOWLAN_27." #".$del_id." ".DOWLAN_36); if($result) @@ -316,14 +316,14 @@ if ($delete == 'main') } -if (isset($message)) +if (isset($message)) { $ns->tablerender("", "
    ".$message."
    "); } -if (!e_QUERY || $action == "main") +if (!e_QUERY || $action == "main") { $download->show_existing_items($action, $sub_action, $id, $from, $amount); } @@ -331,7 +331,7 @@ if (!e_QUERY || $action == "main") -if ($action == "opt") +if ($action == "opt") { global $pref, $ns; $agree_flag = $pref['agree_flag']; @@ -545,7 +545,7 @@ exit; class download { - function show_existing_items($action, $sub_action, $id, $from, $amount) + function show_existing_items($action, $sub_action, $id, $from, $amount) { global $sql, $rs, $ns, $tp, $mySQLdefaultdb, $pref; $text = "
    "; @@ -569,7 +569,7 @@ class download $query = "SELECT d.*, dc.* FROM `#download` AS d LEFT JOIN `#download_category` AS dc ON dc. download_category_id = d.download_category"; - if (isset($_POST['searchquery']) && $_POST['searchquery'] != "") + if (isset($_POST['searchquery']) && $_POST['searchquery'] != "") { $query .= " WHERE download_url REGEXP('".$_POST['searchquery']."') OR download_author REGEXP('".$_POST['searchquery']."') OR download_description REGEXP('".$_POST['searchquery']."') "; foreach($search_display as $disp) @@ -577,13 +577,13 @@ class download $query .= " OR $disp REGEXP('".$_POST['searchquery']."') "; } $query .= " ORDER BY {$sortorder} {$sortdirection}"; - } - else + } + else { $query .= " ORDER BY ".($sub_action ? $sub_action : $sortorder)." ".($id ? $id : $sortdirection)." LIMIT $from, $amount"; } - if ($dl_count = $sql->db_Select_gen($query)) + if ($dl_count = $sql->db_Select_gen($query)) { $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform")." @@ -608,11 +608,11 @@ class download $text .=""; - while ($row = $sql->db_Fetch()) + while ($row = $sql->db_Fetch()) { $text .= ""; - // Display Chosen options + // Display Chosen options foreach($search_display as $disp) { $text .= ""; } $text .= "
    ".LAN_OPTIONS."
    ".$row['download_id'].""; @@ -645,16 +645,16 @@ class download break; case "download_active" : if($row[$disp]== 1) - { - $text .= "\n"; + { + $text .= "\n"; } elseif($row[$disp]== 2) - { - $text .= "\n"; + { + $text .= "\n"; } else - { - $text .= "\n"; + { + $text .= "\n"; } break; case "download_comment" : @@ -675,8 +675,8 @@ class download
    "; - } - else + } + else { // 'No downloads yet' $text .= "
    ".DOWLAN_6."
    "; } @@ -684,7 +684,7 @@ class download // Next-Previous. $downloads = $sql->db_Count("download"); - if ($downloads > $amount && !$_POST['searchquery']) + if ($downloads > $amount && !$_POST['searchquery']) { $parms = "{$downloads},{$amount},{$from},".e_SELF."?".(e_QUERY ? "$action.$sub_action.$id." : "main.{$sortorder}.{$sortdirection}.")."[FROM]"; $text .= "
    ".$tp->parseTemplate("{NEXTPREV={$parms}}"); @@ -795,10 +795,10 @@ class download - function create_download($sub_action, $id) + function create_download($sub_action, $id) { global $cal,$tp, $sql, $fl, $rs, $ns, $file_array, $image_array, $thumb_array,$pst; - require_once(e_FILE."shortcode/batch/download_shortcodes.php"); + require_once(e_CORE."shortcodes/batch/download_shortcodes.php"); $mirrorArray = array(); @@ -808,15 +808,15 @@ class download $preset = $pst->read_preset("admin_downloads"); // read preset values into array extract($preset); - if (!$sql->db_Select("download_category")) + if (!$sql->db_Select("download_category")) { $ns->tablerender(ADLAN_24, "
    ".DOWLAN_5."
    "); return; } $download_active = 1; - if ($sub_action == "edit" && !$_POST['submit']) + if ($sub_action == "edit" && !$_POST['submit']) { - if ($sql->db_Select("download", "*", "download_id=".$id)) + if ($sql->db_Select("download", "*", "download_id=".$id)) { $row = $sql->db_Fetch(); extract($row); @@ -825,9 +825,9 @@ class download } } - if ($sub_action == "dlm" && !$_POST['submit']) + if ($sub_action == "dlm" && !$_POST['submit']) { - if ($sql->db_Select("upload", "*", "upload_id=".$id)) + if ($sql->db_Select("upload", "*", "upload_id=".$id)) { $row = $sql->db_Fetch(); @@ -874,11 +874,11 @@ class download "; $counter = 0; - while (isset($file_array[$counter])) + while (isset($file_array[$counter])) { $fpath = str_replace(e_DOWNLOAD,"",$file_array[$counter]['path']).$file_array[$counter]['fname']; $selected = ''; - if (stristr($fpath, $download_url) !== FALSE) + if (stristr($fpath, $download_url) !== FALSE) { $selected = " selected='selected'"; $found = 1; @@ -889,7 +889,7 @@ class download } $dt = 'display:none'; - if (preg_match("/http:|ftp:/", $download_url)) + if (preg_match("/http:|ftp:/", $download_url)) { $download_url_external = $download_url; $download_url = ''; @@ -897,12 +897,12 @@ class download } $etext = " - (".DOWLAN_68.")"; - if (file_exists(e_UPLOAD.$download_url)) + if (file_exists(e_UPLOAD.$download_url)) { $etext = ""; } - if (!$found && $download_url) + if (!$found && $download_url) { $text .= "\n"; } @@ -947,7 +947,7 @@ class download