1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 21:27:25 +02:00

Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Deltik
2013-05-04 22:31:30 -05:00
17 changed files with 514 additions and 371 deletions

View File

@@ -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 = "<table class='table adminlist'>
<colgroup>
<col style='width: auto' />
<col style='width: auto' />
<col style='width: auto' />
<col style='width: auto' />
</colgroup>
<thead>
<tr>
<th>Table</th>
<th>Engine</th>
<th>Collation</th>
<th>Status</th>
</tr>
</thead>
<tbody>";
$invalidCollations = false;
while($row = $sql->fetch())
{
$text .= "<tr>
<td>".$row['Name']."</td>
<td>".$row['Engine']."</td>
<td>".$row['Collation']."</td>
<td>".(($row['Collation'] == 'utf8_general_ci') ? ADMIN_TRUE_ICON : ADMIN_FALSE_ICON)."</td>
</tr>";
// 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.')<br />
It is <b>HIGHLY</b> recommended that you backup your database first.<br />
If possible use a copy of your database.<br />
Do not forget to purge unnecessary input - e.g. old chatbox messages, pm, …<br />
as well as to set the maintenance flag to main admins only.<br />
<br />
Be sure to click the “Convert Database” button only once.<br />
The conversion process can take up to one minute or much much more depending on the size of your database.<br />
<br />
Known problems (list non-exhaustive):
<ul>
<li>The MySQL user needs privileges to ALTER the database - this is mandatory.</li>
<li>The conversion does not work with serialised arrays.<br />
<strong>Be sure</strong> you followed all steps of the upgrade process first.</li>
<li>It should work without troubles for databases of sites using only UTF-8 charset. Probably not with other charsets.</li>
<li>The function uses the information_schema database for now.</li>
</ul>
';
}
$text .= "</tbody></table>";
$mes->add($message, E_MESSAGE_WARNING);
$text = "
<form method='post' action='".e_SELF."' id='linkform'>
<fieldset id='core-db-utf8-convert'>
<legend class='e-hideme'>"."Convert Database"."</legend>
<div class='buttons-bar center'>
".$frm->admin_button('perform_utf8_convert', "Convert Database")."
</div>
</fieldset>
</form>";
if($invalidCollations == true)
{
//TODO LAN
$message = '
This function will permanently modify all tables in your database. ('.$config['mySQLdefaultdb'].')<br />
It is <b>HIGHLY</b> recommended that you first backup your database and switch your site into maintenance mode.
<br />
<br />
Please note:
<ul>
<li>The conversion process can take up to one minute or much much more depending on the size of your database.</li>
<li>The conversion does not work with serialized arrays.</li>
<li>Be sure that you have followed all steps of the upgrade process first.</li>
</ul>
';
$mes->add($message, E_MESSAGE_WARNING);
$text .= "
<form method='post' action='".e_SELF."' id='linkform'>
<fieldset id='core-db-utf8-convert'>
<legend class='e-hideme'>"."Convert Database"."</legend>
<div class='buttons-bar center'>
".$frm->admin_button('perform_utf8_convert', "Convert non-UTF8 Tables",false,"Convert non-UTF8 Tables",'class=btn-success&data-loading-text=Please wait...')."
</div>
</fieldset>
</form>";
}
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. <br />
Please now add the following line to your e107_config.php file:<br />
<b>\$mySQLcharset = 'utf8';</b>
";
$message = "Database Converted successfully to UTF-8. ";
//$message .= "<br />Please now add the following line to your e107_config.php file:<br /><b>\$mySQLcharset = 'utf8';</b>";
$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
<a class='btn btn-large pull-left' style='margin-right:10px' href='".e_SELF."?mode=".$key."' title=\"".$val['label']."\">".ADMIN_EXECUTE_ICON."</a>
<h4 style='margin-bottom:3px'><a href='".e_SELF."?mode=".$key."' title=\"".$val['label']."\">".$val['label']."</a></h4><small>".$val['diz']."</small>
</div>";
/*
$text .= "<tr>
<td>".$val['diz']."</td>
<td>
<a class='btn btn-large' href='".e_SELF."?mode=".$key."' title=\"".$val['label']."\">".ADMIN_EXECUTE_ICON."</a>
".
// $frm->submit_image('db_execute['.$key.']', '1', 'execute', $val['label']).
// $frm->radio('db_execute', $key).$frm->label($val['label'], 'db_execute', $key).
"
</td>
</tr>\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);
@@ -861,8 +943,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,"<i class='S16 e-warning-16'></i>","<i style='display:inline-block;width:17px;height:16px;'> </i>");
$error_type = array('warning'=>2, 'error'=>1);
global $e107;
@@ -908,12 +992,13 @@ class system_tools
<tbody>
";
$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 .= "
<tr>
<td>".$tp->toHtml($row['plugin_name'], FALSE, "defs,emotes_off")."</td>
@@ -926,7 +1011,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 +1019,23 @@ class system_tools
{
$this_addon = substr($this_addon, 3). ' (sc)';
}
$text .= "<div class='clear'>";
$text .= "<img class='icon action S16' src='".e_IMAGE_ABS."fileinspector/".$error_image[$ret_code]."' alt='".$error_messages[$ret_code]."' title='".$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 .= "<span class='clear e-tip' style='cursor:pointer' title='".$errorMessage."'>";
$text .= $error_glyph[$ret_code]."&nbsp;";
// $text .= "<img class='icon action S16' src='".e_IMAGE_ABS."fileinspector/".$error_image[$ret_code]."' alt='".$error_messages[$ret_code]."' title='".$error_messages[$ret_code]."' />";
$text .= trim($this_addon); // $ret_code - 0=OK, 1=content error, 2=access error
$text .= "</div>";
$text .= "</span><br />";
}
}
@@ -957,7 +1055,7 @@ class system_tools
}
else
{
$text .= ($row['plugin_installflag'] == 1) ? DBLAN_27 : " "; // "Installed and not installed";
$text .= ($row['plugin_installflag'] == 1) ? "<span class='label label-warning'>".DBLAN_27."</span>" : " "; // "Installed and not installed";
}
$text .= "
</td>
@@ -1102,7 +1200,7 @@ function backup_core()
*/
/*
function verify_sql_record() // deprecated by db_verify.php ( i think).
{
global $e107;
@@ -1515,6 +1613,6 @@ function verify_sql_record() // deprecated by db_verify.php ( i think).
$ns->tablerender(DBLAN_10.SEP.DBLAN_50, $mes->render().$text);
}
}
*/
?>

View File

@@ -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 .= "<tr>
<td>".$val['@attributes']['name']."</td>
<td>".$frm->admin_button('update['.$path.']', LAN_UPDATE, 'warning', '', 'disabled='.$this->disabled)."</td>
</tr>";
}
return $text;
}
function core()
{
$frm = e107::getForm();
$mes = e107::getMessage();
$text = "";
foreach($this->core as $func => $data)
{
if(function_exists("update_".$func))
{
$text .= "<tr><td>".$data['title']."</td>";
if(call_user_func("update_".$func))
{
$text .= "<td>".ADMIN_TRUE_ICON."</td>";
}
else
{
if(vartrue($data['message']))
{
$mes->addInfo($data['message']);
}
$this->updates ++;
$text .= "<td>".$frm->admin_button('update_core['.$func.']', LAN_UPDATE, 'warning', '', "id=e-{$func}&disabled=".$this->disabled)."</td>";
if($data['master'] == true)
{
$this->disabled = 1;
}
}
$text .= "</tr>\n";
}
}
return $text;
}
function renderForm()
{
$ns = e107::getRender();
$mes = e107::getMessage();
$caption = LAN_UPDATE;
$text = "
<form method='post' action='".e_SELF."'>
<fieldset id='core-e107-update'>
<legend>{$caption}</legend>
<table class='table adminlist'>
<colgroup>
<col style='width: 60%' />
<col style='width: 40%' />
</colgroup>
<thead>
<tr>
<th>".LAN_UPDATE_55."</th>
<th class='last'>".LAN_UPDATE_2."</th>
</tr>
</thead>
<tbody>
";
$text .= $this->core();
$text .= $this->plugins();
$text .= "
</tbody>
</table>
</fieldset>
</form>
";
$ns->tablerender("Updates",$mes->render() . $text);
}
}
new e107Update($dbupdate);

View File

@@ -468,7 +468,7 @@ echo getAlert();
}
function getAlert($caption)
function getAlert($caption='')
{
return '<div id="uiAlert" class="alert alert-block alert-success hide fade in" style="box-shadow:0px 15px 8px #000;width:300px;position:absolute;left:40%;right:40%;top:15%;z-index:10000">

View File

@@ -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)
{

View File

@@ -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 .= "<tr>
<td>".$val['@attributes']['name']."</td>
<td>".$frm->admin_button('update['.$path.']', LAN_UPDATE, 'warning', '', 'disabled='.$this->disabled)."</td>
</tr>";
}
return $text;
}
function core()
{
$frm = e107::getForm();
$mes = e107::getMessage();
$text = "";
foreach($this->core as $func => $data)
{
if(function_exists("update_".$func))
{
$text .= "<tr><td>".$data['title']."</td>";
if(call_user_func("update_".$func))
{
$text .= "<td>".ADMIN_TRUE_ICON."</td>";
}
else
{
if(vartrue($data['message']))
{
$mes->addInfo($data['message']);
}
$this->updates ++;
$text .= "<td>".$frm->admin_button('update_core['.$func.']', LAN_UPDATE, 'warning', '', "id=e-{$func}&disabled=".$this->disabled)."</td>";
if($data['master'] == true)
{
$this->disabled = 1;
}
}
$text .= "</tr>\n";
}
}
return $text;
}
function renderForm()
{
$ns = e107::getRender();
$mes = e107::getMessage();
$caption = LAN_UPDATE;
$text = "
<form method='post' action='".e_SELF."'>
<fieldset id='core-e107-update'>
<legend>{$caption}</legend>
<table class='table adminlist'>
<colgroup>
<col style='width: 60%' />
<col style='width: 40%' />
</colgroup>
<thead>
<tr>
<th>".LAN_UPDATE_55."</th>
<th class='last'>".LAN_UPDATE_2."</th>
</tr>
</thead>
<tbody>
";
$text .= $this->core();
$text .= $this->plugins();
$text .= "
</tbody>
</table>
</fieldset>
</form>
";
$ns->tablerender("Updates",$mes->render() . $text);
}
}
/**
* Master routine to call to check for updates

View File

@@ -187,7 +187,13 @@ if ($action == "create" || $action == "edit")
</tr>
<tr>
<td>".WMLAN_04."</td>
<td><textarea class='e-wysiwyg tbox' id='data' name='data' cols='70' rows='15' style='width:95%' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this)'>".$tp->toForm(vartrue($row['gen_chardata']))."</textarea></td>
<td>";
$text .= $frm->bbarea('data',$row['gen_chardata']);
// $text .= "<textarea class='e-wysiwyg tbox' id='data' name='data' cols='70' rows='15' style='width:95%' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this)'>".$tp->toForm(vartrue($row['gen_chardata']))."</textarea>";
$text .= "</td>
</tr>";
// $text .= display_help("helpb", "admin"); //XXX Serves as BC Check

View File

@@ -924,7 +924,7 @@ class db_verify
</colgroup>
<thead>
<tr>
<th class='last'>".$frm->checkbox_toggle('check-all-verify', 'verify_table').LAN_CHECKALL.' | '.LAN_UNCHECKALL."</th>
<th class='last'>".$frm->checkbox_toggle('check-all-verify', 'verify_table',false,LAN_CHECKALL.' | '.LAN_UNCHECKALL)."</th>
</tr>
</thead>
<tbody>
@@ -934,7 +934,7 @@ class db_verify
{
$text .= "
<tr>
<td>".$frm->checkbox('verify_table[]', $x).$frm->label($x, "verify_table".$x, $x)."</td>
<td>".$frm->checkbox('verify_table[]', $x,false,'label='.$x)."</td>
</tr>
";
}

View File

@@ -596,16 +596,20 @@ class e107
* Replaces all $mySQL(*) globals
* Example: <code>$e107->getMySQLConfig('prefix');</code>
*
* @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] : '');
}

View File

@@ -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())

View File

@@ -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,'<script')!==false)
{
return array('type'=> 'warning', 'msg'=>"Contains script tags. Use e_header.php with the e107::js() function instead.");
}
if($e_xxx == 'e_latest' && strpos($content,'<div')!==false)
{
return array('type'=> 'warning', 'msg'=>"Using deprecated method. See e_latest.php in the forum plugin for an example.");
}
if($e_xxx == 'e_status' && strpos($content,'<div')!==false)
{
return array('type'=> '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

View File

@@ -36,11 +36,11 @@ $text = "<div style='margin-left: 0px; margin-bottom: 1px; margin-top: 2px; vert
<img src='".e_IMAGE."fileinspector/file_unknown.png' alt='".$dir."' style='margin-left: 3px; width: 16px; height: 16px' />&nbsp;Non Core File</div>";
$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 .= "<br /><br />
<a href='".e_SELF."?create'>Click here to create a snapshot of your own plugins files for use in file inspector.</a>";
<a href='".e_SELF."?create'>Click here to create a snapshot of your own plugins files for use in File Inspector.</a>";
if ($pref['developer']) {
$text .= "<br /><br />

View File

@@ -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");
?>

View File

@@ -1,8 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<e107Plugin name="Blank Plugin" lan="LAN_PLUGIN__BLANK_NAME" version="2.0" date="2012-08-01" compatibility="2.0" installRequired="true" >
<author name="e107 Inc." url="http://e107.org" />
<description lan="LAN_PLUGIN__BLANK_DIZ">A Blank Plugin to help you get started in plugin development</description>
<category>misc</category>
<summary>A Blank Plugin to help you get started in plugin development</summary>
<description lan="LAN_PLUGIN__BLANK_DIZ">A Blank Plugin to help you get started in plugin development. More details can be added here.</description>
<category>misc</category>
<keywords>
<word>blank</word>
<word>empty</word>
<word>template</word>
</keywords>
<adminLinks>
<link url='admin_config.php' description='Configure Blank Plugin' icon='images/blank_32.png' iconSmall='images/blank_16.png' primary='true' >LAN_CONGIGURE</link>
<link url="admin_config.php?mode=options" description="Configure Blank Prefs" icon="manage" >Blank Prefs</link>

View File

@@ -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;

View File

@@ -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 }

View File

@@ -1,47 +0,0 @@
<?php
/*
+ ----------------------------------------------------------------------------------------------+
| e107 website system : http://e107.org
| Steve Dunstan 2001-2002 : jalist@e107.org
| Released under the terms and conditions of the GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_themes/index.html,v $
| $Revision: 1.2 $
| $Date: 2008-08-08 20:16:12 $
| $Author: e107steved $
+-----------------------------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
// Parameters available: $line, $file, $message
echo "<?xml version='1.0' encoding='utf-8' ?>\n";
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n";
echo "<html xmlns='http://www.w3.org/1999/xhtml'".(defined("TEXTDIRECTION") ? " dir='".TEXTDIRECTION."'" : "").(defined("CORE_LC") ? " xml:lang=\"".CORE_LC."\"" : "").">\n";
echo "<head>
<title>".LAN_ERROR_43."</title>
<meta http-equiv='content-type' content='text/html; charset=utf-8' />
<meta http-equiv='content-style-type' content='text/css' />
<meta http-equiv='content-language' content='en' />
</head>\n
<body>\n
<div id='bodytext'>";
if (is_readable(e_IMAGE.'logo.png'))
{
echo "<img src='".e_IMAGE_ABS.'logo.png'."' alt='".LAN_ERROR_44."' />";
}
echo "<div style='text-align:center; font: 14px verdana, tahoma, arial, helvetica, sans-serif;'>";
echo LAN_ERROR_38.'<br />';
echo LAN_ERROR_39.'<br />';
echo LAN_ERROR_40.'<br /><br /><br /></div>';
echo "<div style='text-align:center; font: 12px verdana, tahoma, arial, helvetica, sans-serif;'>";
echo LAN_ERROR_41.'<br />';
echo "<b>CRITICAL_ERROR: </b><br />Line {$line} {$file}<br />
<br />".LAN_ERROR_42.$message."</div>\n";
echo "</div></body>\n</html>";
?>

View File

@@ -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;
}
);