-
-
- ".LAN_DELETE."
- ".DBLAN_17."
- ".DBLAN_18."
- ".LAN_OPTIONS."
- ";
+ $text = "
+ ";
- $text .= "\n";
- $ns -> tablerender(DBLAN_20, $text);
+ $text .= "
+
+ ".$frm->checkbox("delpref2[$key]", 1)."
+ {$key}
+ {$ptext}
+ ".$frm->submit_image("delpref[$key]", LAN_DELETE, 'delete', LAN_CONFIRMDEL." [$key]")."
+
+ ";
+ }
- return $text;
+ $text .= "
+
+
+
+ ".$frm->admin_button('delpref_checked', DBLAN_21, 'delete')."
+ ".$frm->admin_button('back', DBLAN_13, 'back')."
+
+
+
+
+ ";
+ //$text .= "
\n";
+ $e107->ns->tablerender(DBLAN_10.' - '.DBLAN_20, $emessage->render().$text);
+
+ return $text;
}
-
-
-function del_pref_val(){
- global $pref,$ns,$e107cache;
+function del_pref_val()
+{
+ global $pref, $e107cache, $emessage;
$del = array_keys($_POST['delpref']);
$delpref = $del[0];
if($delpref)
{
- unset($pref[$delpref]);
- $deleted_list .= "
".$delpref." ";
+ unset($pref[$delpref]);
+ $deleted_list .= "
".$delpref." ";
}
- if($_POST['delpref2']){
- foreach($_POST['delpref2'] as $k=>$v)
+ if($_POST['delpref2'])
+ {
+
+ foreach($_POST['delpref2'] as $k => $v)
{
- $deleted_list .= "
".$k." ";
+ $deleted_list .= "
".$k." ";
unset($pref[$k]);
}
}
- $message = "
-
";
- save_prefs();
+ save_prefs();
+ $emessage->add(LAN_DELETED."
");
$e107cache->clear();
- $ns -> tablerender(LAN_DELETED,$message);
+ //$e107->ns->tablerender(LAN_DELETED,$message);
+
}
function delete_plugin_entry()
{
- global $sql,$ns;
+ global $sql, $emessage;
+
$del = array_keys($_POST['delplug']);
- $message = ($sql -> db_Delete("plugin", "plugin_id='".intval($del[0])."' LIMIT 1")) ? LAN_DELETED : LAN_DELETED_FAILED;
- $caption = ($message == LAN_DELETED) ? LAN_DELETED : LAN_ERROR;
- $ns -> tablerender($caption,$message);
+ if($sql->db_Delete("plugin", "plugin_id='".intval($del[0])."' LIMIT 1"))
+ {
+ $emessage->add(LAN_DELETED, E_MESSAGE_SUCCESS);
+ }
+ else
+ {
+ $emessage->add(LAN_DELETED_FAILED, E_MESSAGE_WARNING);
+ }
+
}
-function verify_sql_record(){
- global $ns, $sql, $sql2, $tp;
+function verify_sql_record()
+{
+ global $emessage, $sql, $sql2, $sql3, $frm, $e107, $tp;
- if(!is_object($sql)){ $sql = new db; }
- if(!is_object($sql2)){ $sql2 = new db; }
- if(!is_object($sql3)){ $sql3 = new db; }
+ if(!is_object($sql))
+ {
+ $sql = new db();
+ }
+ if(!is_object($sql2))
+ {
+ $sql2 = new db();
+ }
+ if(!is_object($sql3))
+ {
+ $sql3 = new db();
+ }
$tables = array();
$tables[] = 'rate';
$tables[] = 'comments';
- if(isset($_POST['delete_verify_sql_record'])){
+ if(isset($_POST['delete_verify_sql_record']))
+ {
- $text = "
";
- $text .= "ok, so you want to delete some records? not a problem at all!
";
- $text .= "but, since this is still an experimental procedure, i won't actually delete anything
";
- $text .= "instead, i will show you the queries that would be performed
";
- $text .= "
";
+ if(!varset($_POST['del_dbrec']))
+ {
+ $emessage->add('Nothing to delete', E_MESSAGE_DEBUG);
+ }
+ else
+ {
+ $msg = "ok, so you want to delete some records? not a problem at all!
";
+ $msg .= "but, since this is still an experimental procedure, i won't actually delete anything
";
+ $msg .= "instead, i will show you the queries that would be performed
";
+ $text .= "
";
+ $emessage->add($msg, E_MESSAGE_DEBUG);
- foreach($_POST['del_dbrec'] as $k=>$v){
-
- if($k=='rate'){
+ foreach($_POST['del_dbrec'] as $k => $v)
+ {
- $keys = implode(", ", array_keys($v));
- $qry .= "DELETE * FROM rate WHERE rate_id IN (".$keys.")
";
+ if($k == 'rate')
+ {
- }elseif($k=='comments'){
+ $keys = implode(", ", array_keys($v));
+ $qry .= "DELETE * FROM rate WHERE rate_id IN (".$keys.")
";
- $keys = implode(", ", array_keys($v));
- $qry .= "DELETE * FROM comments WHERE comment_id IN (".$keys.")
";
+ }
+ elseif($k == 'comments')
+ {
+
+ $keys = implode(", ", array_keys($v));
+ $qry .= "DELETE * FROM comments WHERE comment_id IN (".$keys.")
";
+
+ }
}
+ $emessage->add($qry, E_MESSAGE_DEBUG);
+ $emessage->add("
".DBLAN_13." ", E_MESSAGE_DEBUG);
}
- $text .= $qry;
-
- $text .= "
-
-
";
-
- $ns->tablerender($caption, $text);
-
- return;
}
- if(!isset($_POST['check_verify_sql_record'])){
+ //Nothing selected
+ if(isset($_POST['check_verify_sql_record']) && (!isset($_POST['table_rate']) && !isset($_POST['table_comments'])))
+ {
+ $_POST['check_verify_sql_record'] = '';
+ unset($_POST['check_verify_sql_record']);
+ $emessage->add(DBLAN_53, E_MESSAGE_WARNING);
+ }
+
+ if(!isset($_POST['check_verify_sql_record']))
+ {
//select table to verify
$text = "
-
+ ";
+ $e107->ns->tablerender(DBLAN_10.' - '.DBLAN_39, $emessage->render().$text);
+ }
+ else
+ {
//function to sort the results
- function verify_sql_record_cmp($a, $b) {
-
- $orderby=array('type'=>'asc', 'itemid'=>'asc');
+ function verify_sql_record_cmp($a, $b)
+ {
- $result= 0;
- foreach( $orderby as $key => $value ) {
- if( $a[$key] == $b[$key] ) continue;
- $result = ($a[$key] < $b[$key])? -1 : 1;
- if( $value=='desc' ) $result = -$result;
+ $orderby = array('type' => 'asc', 'itemid' => 'asc');
+
+ $result = 0;
+ foreach($orderby as $key => $value)
+ {
+ if($a[$key] == $b[$key])
+ continue;
+ $result = ($a[$key] < $b[$key]) ? - 1 : 1;
+ if($value == 'desc')
+ $result = - $result;
break;
}
return $result;
@@ -402,98 +570,131 @@ function verify_sql_record(){
//function to display the results
//$err holds the error data
//$ctype holds the tablename
- function verify_sql_record_displayresult($err, $ctype){
+ function verify_sql_record_displayresult($err, $ctype)
+ {
+ global $frm;
usort($err, 'verify_sql_record_cmp');
- $text = '';
- if(is_array($err) && !empty($err)){
+ $text = "
- $text .= "
-
- ".DBLAN_40." ".$ctype."
-
- ".DBLAN_41."
- ".DBLAN_42."
- ".DBLAN_43."
- ".DBLAN_44."
- ";
+
+ ".DBLAN_40." ".$ctype."
+ ";
+
}
+ else
+ {
+ $text .= "
+
+ {$err}
+
+ ";
+ }
+ $text .= "
+
+
+
+ ";
return $text;
}
- function verify_sql_record_gettables(){
+ function verify_sql_record_gettables()
+ {
global $sql2;
//array which will hold all db tables
$dbtables = array();
//get all tables in the db
- $sql2 -> db_Select_gen("SHOW TABLES");
- while($row2=$sql2->db_Fetch()){
+ $sql2->db_Select_gen("SHOW TABLES");
+ while($row2 = $sql2->db_Fetch())
+ {
$dbtables[] = $row2[0];
}
return $dbtables;
}
- $text = '';
+ $text = "
";
- $ns->tablerender(DBLAN_50,$text);
+ $text .= "
+
+ ".$frm->admin_button('delete_verify_sql_record', DBLAN_48, 'delete')."
+ ".$frm->admin_button('verify_sql_record', DBLAN_13, 'back')."
+
+
+
+ ";
+
+ $e107->ns->tablerender(DBLAN_10.' - '.DBLAN_50, $emessage->render().$text);
}
}
-require_once("footer.php");
+require_once ("footer.php");
+/**
+ * Handle page DOM within the page header
+ *
+ * @return string JS source
+ */
+function headerjs()
+{
+ require_once (e_HANDLER.'js_helper.php');
+ $ret = "
+
+
+ ";
+
+ return $ret;
+}
?>
\ No newline at end of file
diff --git a/e107_admin/db_verify.php b/e107_admin/db_verify.php
index 001ef4484..5e26ddc91 100644
--- a/e107_admin/db_verify.php
+++ b/e107_admin/db_verify.php
@@ -1,71 +1,80 @@
";
+if(varset($_POST['db_tools_back']))
+{
+ header("Location:".e_ADMIN_ABS."db.php");
exit;
}
- $tables["core"] = $sql_data;
+require_once("auth.php");
-if (!getperms("0")) {
- header("location:".e_BASE."index.php");
+require_once(e_HANDLER."form_handler.php");
+$frm = new e_form();
+
+require_once (e_HANDLER."message_handler.php");
+$emessage = &eMessage::getInstance();
+
+$sql_data = file_get_contents(e_ADMIN.'sql/core_sql.php');
+if (!$sql_data)
+{
+ exit(DBLAN_1);
+}
+
+$tables["core"] = $sql_data;
+
+if (!getperms("0"))
+{
+ header("Location:".SITEURL."index.php");
exit;
}
//Get any plugin _sql.php files
-
- foreach($pref['e_sql_list'] as $path => $file)
- {
- $filename = e_PLUGIN.$path."/".$file.".php";
- if(is_readable($filename)){
- $fd = fopen($filename, "r");
- $sql_data = fread($fd, filesize($filename));
- fclose ($fd);
- $id = str_replace("_sql","",$file);
- $tables[$id] = $sql_data;
- }else{
- echo $filename.DBLAN_22."
";
- }
- }
+foreach($pref['e_sql_list'] as $path => $file)
+{
+ $filename = e_PLUGIN.$path."/".$file.".php";
+ if(is_readable($filename))
+ {
+ $id = str_replace("_sql","",$file);
+ $tables[$id] = file_get_contents($filename);
+ }
+ else
+ {
+ $emessage->add($filename.DBLAN_22, E_MESSAGE_WARNING);
+ }
+}
-function read_tables($tab) {
- global $tablines;
- global $table_list;
- global $tables,$sql,$pref;
+function read_tables($tab)
+{
+ global $tablines, $table_list, $tables, $pref;
$file = split("\n", $tables[$tab]);
- foreach($file as $line) {
+ foreach($file as $line)
+ {
$line = ltrim(stripslashes($line));
- if (preg_match("/CREATE TABLE (.*) /", $line, $match)) {
- if($match[1] != "user_extended"){
+ $match = array();
+ if (preg_match('/CREATE TABLE (.*) /', $line, $match))
+ {
+ if($match[1] != "user_extended")
+ {
$table_list[$match[1]] = 1;
$current_table = $match[1];
$x = 0;
@@ -73,231 +82,339 @@ function read_tables($tab) {
}
}
- if (strpos($line, "TYPE=") !== FALSE) {
+ if (strpos($line, "TYPE=") !== FALSE)
+ {
$current_table = "";
}
- if ($current_table && $x) {
+ if ($current_table && $x)
+ {
$tablines[$current_table][$cnt++] = $line;
-
}
$x = 1;
}
// Get multi-language tables as well
- if($pref['multilanguage']){
+ if($pref['multilanguage'])
+ {
$langs = table_list();
- foreach($table_list as $name=>$stuff){
- if($langs[$name]){
+ foreach(array_keys($table_list) as $name)
+ {
+ if($langs[$name])
+ {
$ltab = $langs[$name];
$table_list[$ltab] = 1;
$tablines[$ltab] = $tablines[$name];
}
}
}
-
}
// Get list of fields and keys for a table
-function get_current($tab, $prefix = "")
-{
- if (!$prefix)
- {
- $prefix = MPREFIX;
- }
- $result = mysql_query('SET SQL_QUOTE_SHOW_CREATE = 1');
- $qry = 'SHOW CREATE TABLE `'.$prefix.$tab."`";
- $z = mysql_query($qry);
- if ($z)
- {
- $row = mysql_fetch_row($z);
- return str_replace("`", "", stripslashes($row[1]));
- }
- else
- {
- return FALSE;
- }
+function get_current($tab, $prefix = "")
+{
+ if(! $prefix)
+ {
+ $prefix = MPREFIX;
+ }
+ mysql_query('SET SQL_QUOTE_SHOW_CREATE = 1');
+ $qry = 'SHOW CREATE TABLE `' . $prefix . $tab . "`";
+ $z = mysql_query($qry);
+ if($z)
+ {
+ $row = mysql_fetch_row($z);
+ return str_replace("`", "", stripslashes($row[1]));
+ }
+ else
+ {
+ return FALSE;
+ }
}
-function check_tables($what)
+function check_tables($what)
{
- global $tablines;
- global $table_list;
- global $ns;
- $cur=0;
+ global $tablines, $table_list, $frm;
+
+ $cur = 0;
$table_list = "";
read_tables($what);
$fix_active = FALSE; // Flag set as soon as there's a fix - enables 'Fix it' button
-
- $text = "