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)
{
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 = "
+
+ ";
+
+
+ $ns->tablerender("Updates",$mes->render() . $text);
+
+ }
+
+
+}
/**
* Master routine to call to check for updates
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
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_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,'