From 8c77392b37d26e4c20d6e4c49b1a3acfaed7b260 Mon Sep 17 00:00:00 2001 From: STR82U Date: Sat, 4 May 2013 11:37:04 -0600 Subject: [PATCH 1/8] Update fileinspector.php line 39 and 43 - Capitalized "File Inspector" as a proper name. Line 39 changed ". When the inspector encounters..." to ". When File Inspector encounters..." --- e107_languages/English/admin/help/fileinspector.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e107_languages/English/admin/help/fileinspector.php b/e107_languages/English/admin/help/fileinspector.php index 18574b6fe..5c5add960 100644 --- a/e107_languages/English/admin/help/fileinspector.php +++ b/e107_languages/English/admin/help/fileinspector.php @@ -36,11 +36,11 @@ $text = "
 Non Core File
"; $ns -> tablerender("File Key", $text); -$text = "The file inspector scans and analyses the files on your sites server. When the inspector encounters +$text = "File Inspector scans and analyses the files on your sites server. When File Inspector encounters an e107 core file, it checks it for file consistency to make sure it isn't corrupted."; $text .= "

-Click here to create a snapshot of your own plugins files for use in file inspector."; +Click here to create a snapshot of your own plugins files for use in File Inspector."; if ($pref['developer']) { $text .= "

From 102c3be8e9a8c52665a5bf28ab4cd0222bb802ff Mon Sep 17 00:00:00 2001 From: Moc Date: Sat, 4 May 2013 20:53:37 +0200 Subject: [PATCH 2/8] #204 - Replaces existing e107_themes/index.html with an empty zero-byte one --- e107_themes/index.html | 47 ------------------------------------------ 1 file changed, 47 deletions(-) diff --git a/e107_themes/index.html b/e107_themes/index.html index 058781910..e69de29bb 100644 --- a/e107_themes/index.html +++ b/e107_themes/index.html @@ -1,47 +0,0 @@ -\n"; -echo "\n"; -echo "\n"; -echo " -".LAN_ERROR_43." - - - -\n -\n -
"; -if (is_readable(e_IMAGE.'logo.png')) -{ - echo "".LAN_ERROR_44.""; -} -echo "
"; -echo LAN_ERROR_38.'
'; -echo LAN_ERROR_39.'
'; -echo LAN_ERROR_40.'


'; -echo "
"; -echo LAN_ERROR_41.'
'; -echo "CRITICAL_ERROR:
Line {$line} {$file}
-
".LAN_ERROR_42.$message."
\n"; -echo "
\n"; - -?> From d651d780c3c92b7009df6cbd742d89ebd72a8de5 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 4 May 2013 12:53:04 -0700 Subject: [PATCH 3/8] Closes #194 - fixes padding on top of page when bootstrap used at a width less than 1000px --- e107_themes/bootstrap/style.css | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/e107_themes/bootstrap/style.css b/e107_themes/bootstrap/style.css index 621d9fd62..8530ecf12 100644 --- a/e107_themes/bootstrap/style.css +++ b/e107_themes/bootstrap/style.css @@ -1,5 +1,12 @@ /* */ -body { padding-top: 75px; padding-bottom: 40px; } +body { padding-bottom: 40px; } + +@media (min-width: 1000px){ + +body { padding-top: 75px; } + +} + .well { padding:10px; } footer { padding:60px } From 7a89310d28044fe3cf601566c034244d8f638d19 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 4 May 2013 14:04:52 -0700 Subject: [PATCH 4/8] Issue #230 - welcome message wysiwyg editor was missing. --- e107_admin/wmessage.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/e107_admin/wmessage.php b/e107_admin/wmessage.php index 01a28c281..985d9d5fa 100644 --- a/e107_admin/wmessage.php +++ b/e107_admin/wmessage.php @@ -187,7 +187,13 @@ if ($action == "create" || $action == "edit") ".WMLAN_04." - + "; + + $text .= $frm->bbarea('data',$row['gen_chardata']); + + // $text .= ""; + + $text .= " "; // $text .= display_help("helpb", "admin"); //XXX Serves as BC Check From ea0cf34569627a7adb93f3d12f34b955c7524816 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 4 May 2013 14:29:00 -0700 Subject: [PATCH 5/8] Added missing tags to plugin.xml --- .../_blank/languages/English/English_global.php | 2 +- e107_plugins/_blank/plugin.xml | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/e107_plugins/_blank/languages/English/English_global.php b/e107_plugins/_blank/languages/English/English_global.php index c3967a67a..e889593b4 100644 --- a/e107_plugins/_blank/languages/English/English_global.php +++ b/e107_plugins/_blank/languages/English/English_global.php @@ -4,7 +4,7 @@ // This should contain the LANs used in the plugin.xml file. define("LAN_PLUGIN__BLANK_NAME", "Blank Plugin"); -define("LAN_PLUGIN__BLANK_DIZ", "A Blank Plugin to help you get started in plugin development"); +define("LAN_PLUGIN__BLANK_DIZ", "A Blank Plugin to help you get started in plugin development. More details can be added here."); define("LAN_PLUGIN__BLANK_LINK", "Blank Link"); ?> \ No newline at end of file diff --git a/e107_plugins/_blank/plugin.xml b/e107_plugins/_blank/plugin.xml index f418998e9..76750c13d 100644 --- a/e107_plugins/_blank/plugin.xml +++ b/e107_plugins/_blank/plugin.xml @@ -1,8 +1,14 @@ - A Blank Plugin to help you get started in plugin development - misc + A Blank Plugin to help you get started in plugin development + A Blank Plugin to help you get started in plugin development. More details can be added here. + misc + + blank + empty + template + LAN_CONGIGURE Blank Prefs From d76d4c4ef29bad3373fcc327068d21245fb0ac5b Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 4 May 2013 15:42:55 -0700 Subject: [PATCH 6/8] Issue #233 - Fixed LAN issue and added additional checks for plugins. Useful for developers also. --- e107_admin/db.php | 36 ++++++++++++++------ e107_handlers/plugin_class.php | 61 +++++++++++++++++++++++++++++----- 2 files changed, 78 insertions(+), 19 deletions(-) diff --git a/e107_admin/db.php b/e107_admin/db.php index 2cf1f4323..6ae2f1ba8 100644 --- a/e107_admin/db.php +++ b/e107_admin/db.php @@ -861,8 +861,10 @@ class system_tools private function plugin_viewscan($mode = 'update') { $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"); - + // $error_image = array("integrity_pass.png", "integrity_fail.png", "warning.png", "blank.png"); + $error_glyph = array(ADMIN_TRUE_ICON,ADMIN_FALSE_ICON,""," "); + + $error_type = array('warning'=>2, 'error'=>1); global $e107; @@ -908,12 +910,13 @@ 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). + $sql->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()) + while($row = $sql->fetch()) { e107::loadLanFiles($row['plugin_path'],'admin'); - + e107::plugLan($row['plugin_path'],'global',true); + $text .= " ".$tp->toHtml($row['plugin_name'], FALSE, "defs,emotes_off")." @@ -926,7 +929,7 @@ class system_tools foreach(explode(',', $row['plugin_addons']) as $this_addon) { $ret_code = 3; // Default to 'not checked - if((strpos($this_addon, 'e_') === 0) && (substr($this_addon, - 4, 4) != '_sql')) + if((strpos($this_addon, 'e_') === 0) || (substr($this_addon, - 4, 4) == '_sql')) { $ret_code = $ep->checkAddon($row['plugin_path'], $this_addon); // See whether spaces before opening tag or after closing tag } @@ -934,10 +937,23 @@ class system_tools { $this_addon = substr($this_addon, 3). ' (sc)'; } - $text .= "
"; - $text .= "".$error_messages[$ret_code].""; + + if(!is_numeric($ret_code)) + { + $errorMessage = $ret_code['msg']; + $ret_code = $error_type[$ret_code['type']]; + } + else + { + $errorMessage = $error_messages[$ret_code]; + } + + $text .= ""; + $text .= $error_glyph[$ret_code]." "; + + // $text .= "".$error_messages[$ret_code].""; $text .= trim($this_addon); // $ret_code - 0=OK, 1=content error, 2=access error - $text .= "
"; + $text .= "
"; } } @@ -957,7 +973,7 @@ class system_tools } else { - $text .= ($row['plugin_installflag'] == 1) ? DBLAN_27 : " "; // "Installed and not installed"; + $text .= ($row['plugin_installflag'] == 1) ? "".DBLAN_27."" : " "; // "Installed and not installed"; } $text .= " diff --git a/e107_handlers/plugin_class.php b/e107_handlers/plugin_class.php index 6b4e8a88f..a031ebf58 100644 --- a/e107_handlers/plugin_class.php +++ b/e107_handlers/plugin_class.php @@ -2614,18 +2614,61 @@ class e107plugin return implode(",", $p_addons); } - function checkAddon($plugin_path, $e_xxx) - { // Return 0 = OK, 1 = Fail, 2 = inaccessible + + /** + * Check Plugin Addon for errors. + * @return array or numeric. 0 = OK, 1 = Fail, 2 = inaccessible + */ + function checkAddon($plugin_path, $e_xxx) + { + if (is_readable(e_PLUGIN.$plugin_path."/".$e_xxx.".php")) { - $file_text = file_get_contents(e_PLUGIN.$plugin_path."/".$e_xxx.".php"); - if ((substr($file_text, 0, 5) != '<'.'?php') || ((substr($file_text, -2, 2) != '?'.'>') && (strrpos($file_text, '?'.'>') !== FALSE))) - { - return 1; - } - return 0; + $content = file_get_contents(e_PLUGIN.$plugin_path."/".$e_xxx.".php"); } - return 2; + else + { + return 2; + } + + if(substr($e_xxx, - 4, 4) == '_sql') + { + + if(strpos($content,'INSERT INTO')!==false) + { + return array('type'=> 'error', 'msg'=>"INSERT sql commands are not permitted here. Use a ".$plugin_path."_setup.php file instead."); + } + else + { + return 0; + } + } + + // Generic markup check + if ((substr($content, 0, 5) != '<'.'?php') || ((substr($content, -2, 2) != '?'.'>') && (strrpos($content, '?'.'>') !== FALSE))) + { + return 1; + } + + + if($e_xxx == 'e_meta' && strpos($content,' 'warning', 'msg'=>"Contains script tags. Use e_header.php with the e107::js() function instead."); + } + + + if($e_xxx == 'e_latest' && strpos($content,' 'warning', 'msg'=>"Using deprecated method. See e_latest.php in the forum plugin for an example."); + } + + if($e_xxx == 'e_status' && strpos($content,' 'warning', 'msg'=>"Using deprecated method. See e_status.php in the forum plugin for an example."); + } + + + return 0; } // Entry point to read plugin configuration data From a8fc30016cda3f18b1672d4744a9c0bfc998e11a Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 4 May 2013 19:59:54 -0700 Subject: [PATCH 7/8] Issue #235 - Database Utility fixes. --- e107_admin/db.php | 268 +++++++++++++++++--------- e107_admin/e107_update.php | 189 ------------------ e107_admin/header.php | 2 +- e107_admin/update_routines.php | 193 +++++++++++++++++++ e107_handlers/db_verify_class.php | 4 +- e107_handlers/e107_class.php | 14 +- e107_handlers/form_handler.php | 5 +- e107_themes/bootstrap/admin_style.css | 4 + e107_web/js/core/admin.jquery.js | 9 +- 9 files changed, 394 insertions(+), 294 deletions(-) diff --git a/e107_admin/db.php b/e107_admin/db.php index 6ae2f1ba8..81eaa9344 100644 --- a/e107_admin/db.php +++ b/e107_admin/db.php @@ -52,11 +52,7 @@ if(isset($_POST['db_execute'])) } } -if(isset($_POST['db_update']) || varset($_GET['mode'])=='db_update') -{ - header("location: ".e_ADMIN."e107_update.php"); - exit(); -} + @@ -117,11 +113,11 @@ class system_tools 'plugin_scan' => array('diz'=>DBLAN_28, 'label'=> DBLAN_29), 'pref_editor' => array('diz'=>DBLAN_19, 'label'=> DBLAN_20), // 'backup_core' => array('diz'=>DBLAN_8, 'label'=> DBLAN_9), - 'verify_sql_record' => array('diz'=>DBLAN_35, 'label'=> DBLAN_36), + // 'verify_sql_record' => array('diz'=>DBLAN_35, 'label'=> DBLAN_36), 'importForm' => array('diz'=>DBLAN_59, 'label'=> DBLAN_59), 'exportForm' => array('diz'=>DBLAN_58, 'label'=> DBLAN_58), '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'), + 'convert_to_utf8' => array('diz'=>'Check Database Charset','label'=>'Check Charset'), 'correct_perms' => array('diz'=>'Correct File and Directory permissions','label'=>'Correct Perms') ); @@ -151,18 +147,25 @@ class system_tools return; } - if(isset($_POST['verify_sql_record']) || varset($_GET['mode'])=='verify_sql_record' || isset($_POST['check_verify_sql_record']) || isset($_POST['delete_verify_sql_record'])) - { + // 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_class.php - } + // } if(isset($_POST['importForm']) || $_GET['mode']=='importForm') { $this->importForm(); } - - + + if(isset($_POST['db_update']) || varset($_GET['mode'])=='db_update') // Requires further testing. + { + // header("location: ".e_ADMIN."e107_update.php"); + require_once(e_ADMIN."update_routines.php"); + new e107Update($dbupdate); + return; + } + if(isset($_POST['convert_to_utf8']) || $_GET['mode']=='convert_to_utf8') { $this->convertUTF8Form(); @@ -243,117 +246,188 @@ class system_tools private function convertUTF8Form() { - $mes = e107::getMessage(); - $frm = e107::getForm(); - //TODO a function to call the e107_config information in e107_class.php. - require(e_BASE."e107_config.php"); - $dbtable = $mySQLdefaultdb; + $mes = e107::getMessage(); + $frm = e107::getForm(); + $config = e107::getMySQLConfig(); + $sql = e107::getDb(); + + $sql->gen('SHOW TABLE STATUS WHERE Name LIKE "'.$config['mySQLprefix'].'%" '); + + + $text = " + + + + + + + + + + + + + + + + "; + + + + $invalidCollations = false; + while($row = $sql->fetch()) + { + $text .= " + + + + + "; + // print_a($row); + + if($row['Collation'] != 'utf8_general_ci') + { + $invalidCollations = true; + } - //TODO LAN - $message = ' - This function will permanently modify all tables in your database. ('.$mySQLdefaultdb.')
- It is HIGHLY recommended that you backup your database first.
- If possible use a copy of your database.
- Do not forget to purge unnecessary input - e.g. old chatbox messages, pm, …
- as well as to set the maintenance flag to main admins only.
-
- Be sure to click the “Convert Database” button only once.
- The conversion process can take up to one minute or much much more depending on the size of your database.
-
- Known problems (list non-exhaustive): -
    -
  • The MySQL user needs privileges to ALTER the database - this is mandatory.
  • -
  • The conversion does not work with serialised arrays.
    - 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.
  • -
- '; + } + + $text .= "
TableEngineCollationStatus
".$row['Name']."".$row['Engine']."".$row['Collation']."".(($row['Collation'] == 'utf8_general_ci') ? ADMIN_TRUE_ICON : ADMIN_FALSE_ICON)."
"; - $mes->add($message, E_MESSAGE_WARNING); - $text = " -
-
- "."Convert Database"." -
- ".$frm->admin_button('perform_utf8_convert', "Convert Database")." -
-
-
"; + if($invalidCollations == true) + { + //TODO LAN + $message = ' + This function will permanently modify all tables in your database. ('.$config['mySQLdefaultdb'].')
+ It is HIGHLY recommended that you first backup your database and switch your site into maintenance mode. +
+
+ Please note: +
    +
  • The conversion process can take up to one minute or much much more depending on the size of your database.
  • +
  • The conversion does not work with serialized arrays.
  • +
  • Be sure that you have followed all steps of the upgrade process first.
  • +
+ '; + + $mes->add($message, E_MESSAGE_WARNING); + + $text .= " +
+
+ "."Convert Database"." +
+ ".$frm->admin_button('perform_utf8_convert', "Convert non-UTF8 Tables",false,"Convert non-UTF8 Tables",'class=btn-success&data-loading-text=Please wait...')." +
+
+
"; + + } + else + { + $mes->addSuccess("Your tables are using the correct character set."); + } - e107::getRender()->tablerender(DBLAN_10.SEP."Convert Database to UTF-8", $mes->render().$text); + + e107::getRender()->tablerender(DBLAN_10.SEP."Check Charset".SEP.$config['mySQLdefaultdb'], $mes->render().$text); } private function perform_utf8_convert() { - require(e_BASE."e107_config.php"); - - $dbtable = $mySQLdefaultdb; + $config = e107::getMySQLConfig(); + $dbtable = $config['mySQLdefaultdb']; //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('utf8-convert'); $mes = e107::getMessage(); $ERROR = FALSE; - if(!mysql_query("USE information_schema;")) - { - $mes->add("Couldn't read information_schema", E_MESSAGE_ERROR); - return; - } - + // if(!$sql->gen("USE information_schema;")) + // { + // $mes->add("Couldn't read information_schema", E_MESSAGE_ERROR); + // return; + // } + + $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%';"); + $queries[] = $this->getQueries("SELECT CONCAT('ALTER TABLE `', table_name, '` MODIFY ', column_name, ' ', REPLACE(column_type, 'char', 'binary'), ';') FROM information_schema.columns WHERE TABLE_SCHEMA = '".$dbtable."' AND TABLE_NAME LIKE '".$config['mySQLprefix']."%' AND COLLATION_NAME != 'utf8_general_ci' and data_type LIKE '%char%';"); + $queries[] = $this->getQueries("SELECT CONCAT('ALTER TABLE `', table_name, '` MODIFY ', column_name, ' ', REPLACE(column_type, 'text', 'blob'), ';') FROM information_schema.columns WHERE TABLE_SCHEMA = '".$dbtable."' AND TABLE_NAME LIKE '".$config['mySQLprefix']."%' AND COLLATION_NAME != 'utf8_general_ci' and data_type LIKE '%text%';"); $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%';"); + $queries2[] = $this->getQueries("SELECT CONCAT('ALTER TABLE `', table_name, '` MODIFY ', column_name, ' ', column_type, ' CHARACTER SET utf8;') FROM information_schema.columns WHERE TABLE_SCHEMA ='".$dbtable."' AND TABLE_NAME LIKE '".$config['mySQLprefix']."%' AND COLLATION_NAME != 'utf8_general_ci' and data_type LIKE '%char%';"); + $queries2[] = $this->getQueries("SELECT CONCAT('ALTER TABLE `', table_name, '` MODIFY ', column_name, ' ', column_type, ' CHARACTER SET utf8;') FROM information_schema.columns WHERE TABLE_SCHEMA = '".$dbtable."' AND TABLE_NAME LIKE '".$config['mySQLprefix']."%' AND COLLATION_NAME != 'utf8_general_ci' and data_type LIKE '%text%';"); - mysql_query("USE ".$dbtable); + // $sql->gen("USE ".$dbtable); + + + // print_a($queries2); + // echo $mes->render(); + // return; + + // Convert Text tables to Binary. foreach($queries as $qry) { + foreach($qry as $q) { if(!$sql->db_Query($q)) { - $mes->add($q, E_MESSAGE_ERROR); + $mes->addError($q); $ERROR = TRUE; } + else + { + $mes->addDebug($q); + } } } //------------ - $result = mysql_list_tables($dbtable); - while ($row = mysql_fetch_array($result, MYSQL_NUM)) + // Convert Table Fields to utf8 + $sql2 = e107::getDb('sql2'); + + $sql->gen('SHOW TABLE STATUS WHERE Collation != "utf8_general_ci" '); + while ($row = $sql->fetch()) { - $table = $row[0]; - $tab_query = "ALTER TABLE ".$table." charset=utf8; "; - if(!$sql->db_Query($tab_query)) + $table = $row['Name']; + $tab_query = "ALTER TABLE ".$table." DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; "; + + //echo "TABQRT= ".$tab_query; + + if(!$sql2->db_Query($tab_query)) { - $mes->add($tab_query, E_MESSAGE_ERROR); + $mes->addError($tab_query); $ERROR = TRUE; } + else + { + $mes->addDebug($tab_query); + } } // --------------- - + // Convert Table Fields back to Text/varchar etc. foreach($queries2 as $qry) { foreach($qry as $q) { if(!$sql->db_Query($q)) { - $mes->add($q, E_MESSAGE_ERROR); + $mes->addError($q); $ERROR = TRUE; } + else + { + $mes->addDebug($q); + } } } @@ -367,22 +441,40 @@ class system_tools } elseif($ERROR != TRUE) { - $message = "Database Converted successfully to UTF-8.
- Please now add the following line to your e107_config.php file:
- \$mySQLcharset = 'utf8'; - "; + $message = "Database Converted successfully to UTF-8. "; + //$message .= "
Please now add the following line to your e107_config.php file:
\$mySQLcharset = 'utf8';"; $mes->add($message, E_MESSAGE_SUCCESS); } - + echo $mes->render(); } function getQueries($query) { + + $mes = e107::getMessage(); + $sql = e107::getDb('utf8-convert'); + + if($sql->gen($query)) + { + while ($row = $sql->fetch(MYSQL_NUM)) + { + $qry[] = $row[0]; + } + } + else + { + $mes->addError($query); + } + + return $qry; + + + /* if(!$result = mysql_query($query)) { - $mes->add("Query Failed", E_MESSAGE_ERROR); + $mes->addError("Query Failed: ".$query); return; } while ($row = mysql_fetch_array($result, MYSQL_NUM)) @@ -391,6 +483,7 @@ class system_tools } return $qry; + * */ } @@ -485,18 +578,7 @@ class system_tools ".ADMIN_EXECUTE_ICON."

".$val['label']."

".$val['diz']." "; - /* - $text .= " - ".$val['diz']." - - ".ADMIN_EXECUTE_ICON." - ". - // $frm->submit_image('db_execute['.$key.']', '1', 'execute', $val['label']). - // $frm->radio('db_execute', $key).$frm->label($val['label'], 'db_execute', $key). - " - - \n"; - */ + } /* $text .= " @@ -702,7 +784,7 @@ class system_tools * Optimize SQL * @return none */ - private function optimizesql($mySQLdefaultdb) + private function optimizesql($mySQLdefaultdb) //FIXME Use mysql class. { // global $mes; $result = mysql_list_tables($mySQLdefaultdb); @@ -1118,7 +1200,7 @@ function backup_core() */ - +/* function verify_sql_record() // deprecated by db_verify.php ( i think). { global $e107; @@ -1531,6 +1613,6 @@ function verify_sql_record() // deprecated by db_verify.php ( i think). $ns->tablerender(DBLAN_10.SEP.DBLAN_50, $mes->render().$text); } } - +*/ ?> \ No newline at end of file diff --git a/e107_admin/e107_update.php b/e107_admin/e107_update.php index c230055d0..b7202832e 100644 --- a/e107_admin/e107_update.php +++ b/e107_admin/e107_update.php @@ -158,195 +158,6 @@ function show_updates($dbupdate, $what) */ -// New in v2.x ------------------------------------------------ - -class e107Update -{ - var $core = array(); - var $updates = 0; - var $disabled = 0; - - - function __construct($core=null) - { - $mes = e107::getMessage(); - - $this->core = $core; - - if(varset($_POST['update_core']) && is_array($_POST['update_core'])) - { - $func = key($_POST['update_core']); - $message = $this->updateCore(); - } - - if(varset($_POST['update']) && is_array($_POST['update'])) // Do plugin updates - { - $func = key($_POST['update']); - $this->updatePlugin($func); - } - - if(vartrue($message)) - { - $mes->addSuccess($message); - } - - $this->renderForm(); - } - - - - - function updateCore($func='') - { - $mes = e107::getMessage(); - - // foreach($this->core as $func => $data) - // { - if(function_exists('update_'.$func)) // Legacy Method. - { - $installed = call_user_func("update_".$func); - //?! (LAN_UPDATE == $_POST[$func]) - if(varsettrue($_POST['update_core'][$func]) && !$installed) - { - if(function_exists("update_".$func)) - { - $message = LAN_UPDATE_7." ".$data['title']; - $error = call_user_func("update_".$func, "do"); - - if($error != '') - { - $mes->add($message, E_MESSAGE_ERROR); - $mes->add($error, E_MESSAGE_ERROR); - } - else - { - $mes->add($message, E_MESSAGE_SUCCESS); - } - } - } - } - - //} - - } - - - - function updatePlugin($path) - { - e107::getPlugin()->install_plugin_xml($path, 'upgrade'); - } - - - - function plugins() - { - if(!$list = e107::getPlugin()->updateRequired()) - { - return; - } - - $frm = e107::getForm(); - - $text = ""; - foreach($list as $path=>$val) - { - $text .= " - ".$val['@attributes']['name']." - ".$frm->admin_button('update['.$path.']', LAN_UPDATE, 'warning', '', 'disabled='.$this->disabled)." - "; - } - - return $text; - } - - - - - function core() - { - $frm = e107::getForm(); - $mes = e107::getMessage(); - - $text = ""; - - foreach($this->core as $func => $data) - { - if(function_exists("update_".$func)) - { - $text .= "".$data['title'].""; - - - - if(call_user_func("update_".$func)) - { - $text .= "".ADMIN_TRUE_ICON.""; - } - else - { - if(vartrue($data['message'])) - { - $mes->addInfo($data['message']); - } - - $this->updates ++; - - $text .= "".$frm->admin_button('update_core['.$func.']', LAN_UPDATE, 'warning', '', "id=e-{$func}&disabled=".$this->disabled).""; - if($data['master'] == true) - { - $this->disabled = 1; - } - } - $text .= "\n"; - } - } - - return $text; - } - - - - function renderForm() - { - $ns = e107::getRender(); - $mes = e107::getMessage(); - - $caption = LAN_UPDATE; - $text = " -
-
- {$caption} - - - - - - - - - - - - - "; - - $text .= $this->core(); - $text .= $this->plugins(); - - $text .= " - -
".LAN_UPDATE_55."".LAN_UPDATE_2."
-
-
- "; - - - $ns->tablerender("Updates",$mes->render() . $text); - - } - - -} new e107Update($dbupdate); diff --git a/e107_admin/header.php b/e107_admin/header.php index b0e0ce303..3ae3c8e98 100644 --- a/e107_admin/header.php +++ b/e107_admin/header.php @@ -468,7 +468,7 @@ echo getAlert(); } -function getAlert($caption) +function getAlert($caption='') { return '
diff --git a/e107_admin/update_routines.php b/e107_admin/update_routines.php index 1d2c5b335..b3be3d73e 100644 --- a/e107_admin/update_routines.php +++ b/e107_admin/update_routines.php @@ -135,6 +135,199 @@ if (!$dont_check_update) +// New in v2.x ------------------------------------------------ + +class e107Update +{ + var $core = array(); + var $updates = 0; + var $disabled = 0; + + + function __construct($core=null) + { + $mes = e107::getMessage(); + + $this->core = $core; + + if(varset($_POST['update_core']) && is_array($_POST['update_core'])) + { + $func = key($_POST['update_core']); + $message = $this->updateCore($func); + } + + if(varset($_POST['update']) && is_array($_POST['update'])) // Do plugin updates + { + $func = key($_POST['update']); + $this->updatePlugin($func); + } + + if(vartrue($message)) + { + $mes->addSuccess($message); + } + + $this->renderForm(); + } + + + + + function updateCore($func='') + { + $mes = e107::getMessage(); + + // foreach($this->core as $func => $data) + // { + if(function_exists('update_'.$func)) // Legacy Method. + { + $installed = call_user_func("update_".$func); + //?! (LAN_UPDATE == $_POST[$func]) + if(varsettrue($_POST['update_core'][$func]) && !$installed) + { + if(function_exists("update_".$func)) + { + $message = LAN_UPDATE_7." ".$data['title']; + $error = call_user_func("update_".$func, "do"); + + if($error != '') + { + $mes->add($message, E_MESSAGE_ERROR); + $mes->add($error, E_MESSAGE_ERROR); + } + else + { + $mes->add($message, E_MESSAGE_SUCCESS); + } + } + } + } + else + { + $mes->addDebug("could run 'update_".$func); + } + + //} + + } + + + + function updatePlugin($path) + { + e107::getPlugin()->install_plugin_xml($path, 'upgrade'); + } + + + + function plugins() + { + if(!$list = e107::getPlugin()->updateRequired()) + { + return; + } + + $frm = e107::getForm(); + + $text = ""; + foreach($list as $path=>$val) + { + $text .= " + ".$val['@attributes']['name']." + ".$frm->admin_button('update['.$path.']', LAN_UPDATE, 'warning', '', 'disabled='.$this->disabled)." + "; + } + + return $text; + } + + + + + function core() + { + $frm = e107::getForm(); + $mes = e107::getMessage(); + + $text = ""; + + foreach($this->core as $func => $data) + { + if(function_exists("update_".$func)) + { + $text .= "".$data['title'].""; + + + + if(call_user_func("update_".$func)) + { + $text .= "".ADMIN_TRUE_ICON.""; + } + else + { + if(vartrue($data['message'])) + { + $mes->addInfo($data['message']); + } + + $this->updates ++; + + $text .= "".$frm->admin_button('update_core['.$func.']', LAN_UPDATE, 'warning', '', "id=e-{$func}&disabled=".$this->disabled).""; + if($data['master'] == true) + { + $this->disabled = 1; + } + } + $text .= "\n"; + } + } + + return $text; + } + + + + function renderForm() + { + $ns = e107::getRender(); + $mes = e107::getMessage(); + + $caption = LAN_UPDATE; + $text = " +
+
+ {$caption} + + + + + + + + + + + + + "; + + $text .= $this->core(); + $text .= $this->plugins(); + + $text .= " + +
".LAN_UPDATE_55."".LAN_UPDATE_2."
+
+
+ "; + + + $ns->tablerender("Updates",$mes->render() . $text); + + } + + +} /** * Master routine to call to check for updates diff --git a/e107_handlers/db_verify_class.php b/e107_handlers/db_verify_class.php index ae90cede9..3a4ebdffd 100644 --- a/e107_handlers/db_verify_class.php +++ b/e107_handlers/db_verify_class.php @@ -924,7 +924,7 @@ class db_verify - ".$frm->checkbox_toggle('check-all-verify', 'verify_table').LAN_CHECKALL.' | '.LAN_UNCHECKALL." + ".$frm->checkbox_toggle('check-all-verify', 'verify_table',false,LAN_CHECKALL.' | '.LAN_UNCHECKALL)." @@ -934,7 +934,7 @@ class db_verify { $text .= " - ".$frm->checkbox('verify_table[]', $x).$frm->label($x, "verify_table".$x, $x)." + ".$frm->checkbox('verify_table[]', $x,false,'label='.$x)." "; } diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php index b58e52711..ea28a9131 100644 --- a/e107_handlers/e107_class.php +++ b/e107_handlers/e107_class.php @@ -596,16 +596,20 @@ class e107 * Replaces all $mySQL(*) globals * Example: $e107->getMySQLConfig('prefix'); * - * @param string $for prefix|server|user|password|defaultdb - * @return string + * @param string $for prefix|server|user|password|defaultdb - leave blank for full array. + * @return string or array */ - function getMySQLConfig($for) + function getMySQLConfig($for='') { $key = 'mySQL'.$for; $self = self::getInstance(); - return (isset($self->e107_config_mysql_info[$key]) ? $self->e107_config_mysql_info[$key] : ''); - // return (isset($this->e107_config_mysql_info[$key]) ? $this->e107_config_mysql_info[$key] : ''); + if($for == '') + { + return $self->e107_config_mysql_info; + } + + return (isset($self->e107_config_mysql_info[$key]) ? $self->e107_config_mysql_info[$key] : ''); } diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index d8e31931d..d25e813a2 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -967,11 +967,12 @@ class e_form return $this->checkbox($name, $value, $checked).$this->label($label ? $label : LAN_ENABLED, $name, $value); } - function checkbox_toggle($name, $selector = 'multitoggle', $id = false) + function checkbox_toggle($name, $selector = 'multitoggle', $id = false, $label='') { $selector = 'jstarget:'.$selector; if($id) $id = $this->name2id($id); - return $this->checkbox($name, $selector, false, array('id' => $id,'class' => 'checkbox toggle-all')); + + return $this->checkbox($name, $selector, false, array('id' => $id,'class' => 'checkbox toggle-all','label'=>$label)); } function uc_checkbox($name, $current_value, $uc_options, $field_options = array()) diff --git a/e107_themes/bootstrap/admin_style.css b/e107_themes/bootstrap/admin_style.css index d9e5dd9db..c515fcebf 100644 --- a/e107_themes/bootstrap/admin_style.css +++ b/e107_themes/bootstrap/admin_style.css @@ -397,9 +397,13 @@ i.s-message-debug { background-position: -1480px 0; width: 32px; height: 32px; } tr.e-sort { box-shadow: 0 5px 8px #cccccc; -webkit-box-shadow: 0 5px 8px #cccccc; -moz-box-shadow: 0 5px 8px #cccccc;} +th label.checkbox { min-height:inherit; } /* Bootstrap Fix but doesn't work */ /* ****************************** ICONS ************************************* */ + + + i.S16 { background: url(images/adminicons_16.png) no-repeat top left; display:inline-block; diff --git a/e107_web/js/core/admin.jquery.js b/e107_web/js/core/admin.jquery.js index d135dede3..ac3393f5c 100644 --- a/e107_web/js/core/admin.jquery.js +++ b/e107_web/js/core/admin.jquery.js @@ -123,8 +123,13 @@ $(document).ready(function() $('button[data-loading-text],a[data-loading-text]').on('click', function() { - var caption = $(this).attr('data-loading-text'); - $(this).attr('disabled', 'disabled').html(caption); + var caption = $(this).attr('data-loading-text'); + $(this).removeClass('btn-success'); + $(this).html(caption); + if($(this).attr('data-disable') == 'true') + { + $(this).attr('disabled', 'disabled'); + } return true; } ); From 18e0d2102479d87058e1e52525aa65ee2a8ba693 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 4 May 2013 20:17:58 -0700 Subject: [PATCH 8/8] Issue #238 - disabled form when category creation is not an option. --- e107_admin/image.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/e107_admin/image.php b/e107_admin/image.php index 25e2b72a6..1de4d1678 100644 --- a/e107_admin/image.php +++ b/e107_admin/image.php @@ -222,11 +222,23 @@ class media_cat_ui extends e_admin_ui } } } - if(!varset($this->fields['media_cat_owner']['writeParms'])) - { - $this->fields['media_cat_owner']['writeParms'] = array('', ''); - } + + } + + + public function createPage() + { + if(!count($this->fields['media_cat_owner']['writeParms'])) + { + e107::getMessage()->addInfo("Category creation not available."); + return; + } + + return $this->getUI()->getCreate(); + } + + public function beforeCreate($new_data) {