2006-12-02 04:36:16 +00:00
|
|
|
<?php
|
|
|
|
/*
|
2008-12-30 13:51:41 +00:00
|
|
|
* e107 website system
|
|
|
|
*
|
|
|
|
* Copyright (C) 2001-2008 e107 Inc (e107.org)
|
|
|
|
* Released under the terms and conditions of the
|
|
|
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
|
|
|
*
|
|
|
|
* Administration - Database Utilities
|
|
|
|
*
|
|
|
|
* $Source: /cvs_backup/e107_0.8/e107_admin/db.php,v $
|
2009-07-23 15:21:41 +00:00
|
|
|
* $Revision: 1.11 $
|
|
|
|
* $Date: 2009-07-23 15:21:41 $
|
|
|
|
* $Author: e107coders $
|
2008-12-30 13:51:41 +00:00
|
|
|
*
|
2006-12-02 04:36:16 +00:00
|
|
|
*/
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
require_once ("../class2.php");
|
|
|
|
|
|
|
|
require_once (e_HANDLER."form_handler.php");
|
|
|
|
$frm = new e_form();
|
|
|
|
|
|
|
|
if(!getperms('0'))
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
header('location:'.e_BASE.'index.php');
|
2008-12-30 13:51:41 +00:00
|
|
|
exit();
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
$e_sub_cat = 'database';
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
if(isset($_POST['back']))
|
|
|
|
{
|
|
|
|
header("location: ".e_SELF);
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
|
|
|
require_once (e_HANDLER."message_handler.php");
|
|
|
|
$emessage = &eMessage::getInstance();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Execute trigger
|
|
|
|
*/
|
|
|
|
if(isset($_POST['trigger_db_execute']))
|
|
|
|
{
|
|
|
|
if(!varset($_POST['db_execute']))
|
|
|
|
{
|
|
|
|
$emessage->add(DBLAN_53, E_MESSAGE_WARNING);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$_POST[$_POST['db_execute']] = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isset($_POST['db_update']))
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
header("location: ".e_ADMIN."e107_update.php");
|
2008-12-30 13:51:41 +00:00
|
|
|
exit();
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
if(isset($_POST['verify_sql']))
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
header("location: ".e_ADMIN."db_verify.php");
|
2008-12-30 13:51:41 +00:00
|
|
|
exit();
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
require_once ("auth.php");
|
|
|
|
require_once (e_HANDLER."form_handler.php");
|
|
|
|
$frm = new e_form();
|
|
|
|
$emessage = &eMessage::getInstance(); //nothing wrong with doing it twice
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
if(isset($_POST['delpref']) || (isset($_POST['delpref_checked']) && isset($_POST['delpref2'])))
|
2006-12-02 04:36:16 +00:00
|
|
|
{
|
|
|
|
del_pref_val();
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isset($_POST['pref_editor']) || isset($_POST['delpref']) || isset($_POST['delpref_checked']))
|
|
|
|
{
|
|
|
|
pref_editor();
|
2008-12-30 13:51:41 +00:00
|
|
|
require_once ("footer.php");
|
|
|
|
exit();
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
if(isset($_POST['optimize_sql']))
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
optimizesql($mySQLdefaultdb);
|
|
|
|
}
|
|
|
|
|
2009-01-16 01:02:41 +00:00
|
|
|
if(isset($_POST['sc_override_scan']))
|
|
|
|
{
|
|
|
|
scan_override();
|
|
|
|
}
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
if(isset($_POST['backup_core']))
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
backup_core();
|
2008-12-30 13:51:41 +00:00
|
|
|
//message_handler("MESSAGE", DBLAN_1);
|
|
|
|
$emessage->add(DBLAN_1, E_MESSAGE_SUCCESS);
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(isset($_POST['delplug']))
|
|
|
|
{
|
|
|
|
delete_plugin_entry();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
if(isset($_POST['plugin_scan']) || e_QUERY == "plugin" || $_POST['delplug'])
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
plugin_viewscan();
|
2008-12-30 13:51:41 +00:00
|
|
|
require_once ("footer.php");
|
|
|
|
exit();
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
if(isset($_POST['verify_sql_record']) || isset($_POST['check_verify_sql_record']) || isset($_POST['delete_verify_sql_record']))
|
|
|
|
{
|
2007-03-15 15:55:08 +00:00
|
|
|
verify_sql_record();
|
2008-12-30 13:51:41 +00:00
|
|
|
require_once ("footer.php");
|
|
|
|
exit();
|
2007-03-15 15:55:08 +00:00
|
|
|
}
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
//XXX - what is this for (backup core)? <input type='hidden' name='sqltext' value='{$sqltext}' />
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
$text = "
|
|
|
|
<form method='post' action='".e_SELF."' id='core-db-main-form'>
|
|
|
|
<fieldset id='core-db-plugin-scan'>
|
|
|
|
<legend class='e-hideme'>".DBLAN_10."</legend>
|
|
|
|
<table cellpadding='0' cellspacing='0' class='adminlist'>
|
2008-12-30 15:56:12 +00:00
|
|
|
<colgroup span='2'>
|
2008-12-30 13:51:41 +00:00
|
|
|
<col style='width: 60%'></col>
|
|
|
|
<col style='width: 40%'></col>
|
|
|
|
</colgroup>
|
|
|
|
<tbody>
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
<!-- CHECK FOR UPDATES -->
|
|
|
|
<tr>
|
|
|
|
<td>".DBLAN_15."</td>
|
|
|
|
<td>
|
|
|
|
".$frm->radio('db_execute', 'db_update').$frm->label(DBLAN_16, 'db_execute', 'db_update')."
|
|
|
|
<!-- <input class='button' style='width: 100%' type='submit' name='db_update' value='".DBLAN_16."' /> -->
|
|
|
|
</td>
|
|
|
|
</tr>
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
<!-- CHECK DATABASE VALIDITY -->
|
|
|
|
<tr>
|
|
|
|
<td>".DBLAN_4."</td>
|
|
|
|
<td>
|
|
|
|
".$frm->radio('db_execute', 'verify_sql').$frm->label(DBLAN_5, 'db_execute', 'verify_sql')."
|
|
|
|
<!-- <input class='button' style='width: 100%' type='submit' name='verify_sql' value='".DBLAN_5."' /> -->
|
|
|
|
</td>
|
|
|
|
</tr>
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
<!-- OPTIMIZE SQL DATABASE -->
|
|
|
|
<tr>
|
|
|
|
<td>".DBLAN_6."</td>
|
|
|
|
<td>
|
|
|
|
".$frm->radio('db_execute', 'optimize_sql').$frm->label(DBLAN_7, 'db_execute', 'optimize_sql')."
|
|
|
|
<!-- <input class='button' style='width: 100%' type='submit' name='optimize_sql' value='".DBLAN_7."' /> -->
|
|
|
|
</td>
|
|
|
|
</tr>
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
<!-- SCAN PLUGIN DIRECTORIES -->
|
|
|
|
<tr>
|
|
|
|
<td>".DBLAN_28."</td>
|
|
|
|
<td>
|
|
|
|
".$frm->radio('db_execute', 'plugin_scan').$frm->label(DBLAN_29, 'db_execute', 'plugin_scan')."
|
|
|
|
<!-- <input class='button' style='width: 100%' type='submit' name='plugin_scan' value=\"".DBLAN_29."\" /> -->
|
|
|
|
</td>
|
|
|
|
</tr>
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
<!-- PREFERENCE EDITOR -->
|
|
|
|
<tr>
|
|
|
|
<td>".DBLAN_19."</td>
|
|
|
|
<td>
|
|
|
|
".$frm->radio('db_execute', 'pref_editor').$frm->label(DBLAN_20, 'db_execute', 'pref_editor')."
|
|
|
|
<!-- <input class='button' style='width: 100%' type='submit' name='pref_editor' value='".DBLAN_20."' /> -->
|
|
|
|
</td>
|
|
|
|
</tr>
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
<!-- BACKUP CORE -->
|
|
|
|
<tr>
|
|
|
|
<td>".DBLAN_8."</td>
|
|
|
|
<td>
|
|
|
|
".$frm->radio('db_execute', 'backup_core').$frm->label(DBLAN_9, 'db_execute', 'backup_core')."
|
|
|
|
<!-- <input class='button' style='width: 100%' type='submit' name='backup_core' value='".DBLAN_9."' /> -->
|
|
|
|
</td>
|
|
|
|
</tr>
|
2007-03-15 15:55:08 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
<!-- VERIFY SQL -->
|
|
|
|
<tr>
|
|
|
|
<td>".DBLAN_35."</td>
|
|
|
|
<td>
|
|
|
|
".$frm->radio('db_execute', 'verify_sql_record').$frm->label(DBLAN_36, 'db_execute', 'verify_sql_record')."
|
|
|
|
<!-- <input class='button' style='width: 100%' type='submit' name='verify_sql_record' value='".DBLAN_36."' /> -->
|
|
|
|
</td>
|
|
|
|
</tr>
|
2007-03-15 15:55:08 +00:00
|
|
|
|
2009-01-16 01:02:41 +00:00
|
|
|
<!-- SCAN SC OVERRIDE -->
|
|
|
|
<tr>
|
|
|
|
<td>".DBLAN_55."</td>
|
|
|
|
<td>
|
|
|
|
".$frm->radio('db_execute', 'sc_override_scan').$frm->label(DBLAN_56, 'db_execute', 'sc_override_scan')."
|
|
|
|
<!-- <input class='button' style='width: 100%' type='submit' name='sc_override_scan' value='".DBLAN_36."' /> -->
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<div class='buttons-bar center'>
|
|
|
|
".$frm->admin_button('trigger_db_execute', DBLAN_51, 'execute')."
|
|
|
|
</div>
|
|
|
|
</fieldset>
|
2006-12-02 04:36:16 +00:00
|
|
|
</form>
|
2008-12-30 13:51:41 +00:00
|
|
|
";
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
$e107->ns->tablerender(DBLAN_10, $emessage->render().$text);
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
function backup_core()
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
global $pref, $sql;
|
|
|
|
$tmp = base64_encode((serialize($pref)));
|
2008-12-30 13:51:41 +00:00
|
|
|
if(!$sql->db_Insert("core", "'pref_backup', '{$tmp}' "))
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
$sql->db_Update("core", "e107_value='{$tmp}' WHERE e107_name='pref_backup'");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
function optimizesql($mySQLdefaultdb)
|
|
|
|
{
|
|
|
|
global $emessage;
|
2006-12-02 04:36:16 +00:00
|
|
|
$result = mysql_list_tables($mySQLdefaultdb);
|
2008-12-30 13:51:41 +00:00
|
|
|
while($row = mysql_fetch_row($result))
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
mysql_query("OPTIMIZE TABLE ".$row[0]);
|
|
|
|
}
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
$emessage->add(DBLAN_11." $mySQLdefaultdb ".DBLAN_12, E_MESSAGE_SUCCESS);
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
|
2009-01-16 01:02:41 +00:00
|
|
|
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$');
|
|
|
|
if(count($fList))
|
|
|
|
{
|
|
|
|
$tmp = array();
|
|
|
|
foreach($fList as $file)
|
|
|
|
{
|
|
|
|
$tmp[] = strtoupper(substr($file['fname'], 0, -3));
|
|
|
|
}
|
|
|
|
$scList = implode(',', $tmp);
|
|
|
|
unset($tmp);
|
|
|
|
}
|
|
|
|
$pref['sc_override'] = $scList;
|
|
|
|
save_prefs();
|
|
|
|
$emessage->add(DBLAN_57.':<br />'.$pref['sc_override'], E_MESSAGE_SUCCESS);
|
|
|
|
}
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
function plugin_viewscan()
|
|
|
|
{
|
2008-12-30 13:51:41 +00:00
|
|
|
$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 $sql, $e107, $emessage, $frm;
|
|
|
|
|
|
|
|
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("<a href='".e_SELF."'>".DBLAN_13."</a>", E_MESSAGE_SUCCESS)
|
|
|
|
->add(DBLAN_30);
|
|
|
|
*/
|
|
|
|
|
|
|
|
$emessage->add(DBLAN_23, E_MESSAGE_SUCCESS);
|
|
|
|
$emessage->add("<a href='".e_SELF."'>".DBLAN_13."</a>", E_MESSAGE_SUCCESS);
|
|
|
|
$emessage->add(DBLAN_30);
|
|
|
|
|
|
|
|
$text = "
|
|
|
|
<form method='post' action='".e_ADMIN."db.php' id='plug_edit'>
|
|
|
|
<fieldset id='core-db-plugin-scan'>
|
|
|
|
<legend class='e-hideme'>".ADLAN_CL_7."</legend>
|
|
|
|
<table cellpadding='0' cellspacing='0' class='adminlist'>
|
|
|
|
<colgroup span='4'>
|
|
|
|
<col style='width: 20%'></col>
|
|
|
|
<col style='width: 20%'></col>
|
|
|
|
<col style='width: 35%'></col>
|
|
|
|
<col style='width: 25%'></col>
|
|
|
|
</colgroup>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>".DBLAN_24."</th>
|
|
|
|
<th>".DBLAN_25."</th>
|
|
|
|
<th>".DBLAN_26."</th>
|
|
|
|
<th class='center last'>".DBLAN_27."</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
";
|
|
|
|
|
|
|
|
$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())
|
|
|
|
{
|
|
|
|
$text .= "
|
|
|
|
<tr>
|
|
|
|
<td>".$e107->tp->toHtml($row['plugin_name'], FALSE, "defs,emotes_off")."</td>
|
|
|
|
<td>".$row['plugin_path']."</td>
|
|
|
|
<td>";
|
|
|
|
|
|
|
|
if(trim($row['plugin_addons']))
|
2007-02-14 21:17:42 +00:00
|
|
|
{
|
2008-12-30 13:51:41 +00:00
|
|
|
//XXX - $nl_code = ''; - OLD VAR?
|
|
|
|
foreach(explode(',', $row['plugin_addons']) as $this_addon)
|
2007-02-14 21:17:42 +00:00
|
|
|
{
|
2008-12-30 13:51:41 +00:00
|
|
|
$ret_code = 3; // Default to 'not checked
|
|
|
|
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
|
|
|
|
}
|
|
|
|
$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]."' />";
|
|
|
|
$text .= trim($this_addon); // $ret_code - 0=OK, 1=content error, 2=access error
|
|
|
|
$text .= "</div>";
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
$text .= "
|
|
|
|
</td>
|
|
|
|
<td class='center'>
|
|
|
|
";
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
if($previous == $row['plugin_path'])
|
2006-12-02 04:36:16 +00:00
|
|
|
{
|
2008-12-30 13:51:41 +00:00
|
|
|
$delid = $row['plugin_id'];
|
|
|
|
$delname = $row['plugin_name'];
|
|
|
|
//Admin delete button
|
|
|
|
$text .= $frm->admin_button("delplug[{$delid}]", DBLAN_52, 'delete', '', array('title' => LAN_CONFIRMDEL." ID:{$delid} [$delname]"));
|
|
|
|
//Or maybe image submit? -
|
|
|
|
//$text .= $frm->submit_image("delplug[{$delid}]", DBLAN_52, 'delete', LAN_CONFIRMDEL." ID:{$delid} [$delname]");
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
2008-12-30 13:51:41 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
$text .= ($row['plugin_installflag'] == 1) ? DBLAN_27 : " "; // "Installed and not installed";
|
|
|
|
}
|
|
|
|
$text .= "
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
";
|
|
|
|
$previous = $row['plugin_path'];
|
|
|
|
}
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
$text .= "
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</fieldset>
|
|
|
|
</form>
|
|
|
|
";
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
$e107->ns->tablerender(DBLAN_10.' - '.DBLAN_22, $emessage->render().$text);
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
function pref_editor()
|
|
|
|
{
|
|
|
|
global $pref, $e107, $emessage, $frm;
|
|
|
|
ksort($pref);
|
|
|
|
|
|
|
|
$text = "
|
|
|
|
<form method='post' action='".e_ADMIN."db.php' id='pref_edit'>
|
|
|
|
<fieldset id='core-db-pref-edit'>
|
|
|
|
<legend class='e-hideme'>".DBLAN_20."</legend>
|
|
|
|
<table cellpadding='0' cellspacing='0' class='adminlist'>
|
|
|
|
<colgroup span='4'>
|
|
|
|
<col style='width: 5%'></col>
|
|
|
|
<col style='width: 20%'></col>
|
|
|
|
<col style='width: 70%'></col>
|
|
|
|
<col style='width: 5%'></col>
|
|
|
|
</colgroup>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th class='center'>".LAN_DELETE."</th>
|
|
|
|
<th>".DBLAN_17."</th>
|
|
|
|
<th>".DBLAN_18."</th>
|
|
|
|
<th class='center last'>".LAN_OPTIONS."</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
";
|
|
|
|
|
|
|
|
foreach($pref as $key => $val)
|
|
|
|
{
|
2009-07-19 11:44:30 +00:00
|
|
|
$ptext = (is_array($val)) ? "<pre>".print_r($val, TRUE)."</pre>" : htmlspecialchars($val, ENT_QUOTES, 'utf-8');
|
2008-12-30 13:51:41 +00:00
|
|
|
$ptext = $e107->tp->textclean($ptext, 80);
|
|
|
|
|
|
|
|
$text .= "
|
|
|
|
<tr>
|
|
|
|
<td class='center autocheck e-pointer'>".$frm->checkbox("delpref2[$key]", 1)."</td>
|
|
|
|
<td>{$key}</td>
|
|
|
|
<td>{$ptext}</td>
|
|
|
|
<td class='center'>".$frm->submit_image("delpref[$key]", LAN_DELETE, 'delete', LAN_CONFIRMDEL." [$key]")."</td>
|
|
|
|
</tr>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
|
|
|
$text .= "
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<div class='buttons-bar center'>
|
|
|
|
".$frm->admin_button('delpref_checked', DBLAN_21, 'delete')."
|
|
|
|
".$frm->admin_button('back', DBLAN_13, 'back')."
|
|
|
|
</div>
|
|
|
|
</fieldset>
|
|
|
|
</form>
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
";
|
|
|
|
//$text .= "<div style='text-align:center'><a href='".e_SELF."'>".DBLAN_13."</a></div>\n";
|
|
|
|
$e107->ns->tablerender(DBLAN_10.' - '.DBLAN_20, $emessage->render().$text);
|
|
|
|
|
|
|
|
return $text;
|
|
|
|
}
|
|
|
|
|
|
|
|
function del_pref_val()
|
|
|
|
{
|
|
|
|
global $pref, $e107cache, $emessage;
|
2006-12-02 04:36:16 +00:00
|
|
|
$del = array_keys($_POST['delpref']);
|
|
|
|
$delpref = $del[0];
|
|
|
|
|
|
|
|
if($delpref)
|
|
|
|
{
|
2008-12-30 13:51:41 +00:00
|
|
|
unset($pref[$delpref]);
|
|
|
|
$deleted_list .= "<li>".$delpref."</li>";
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
if($_POST['delpref2'])
|
|
|
|
{
|
|
|
|
|
|
|
|
foreach($_POST['delpref2'] as $k => $v)
|
2006-12-02 04:36:16 +00:00
|
|
|
{
|
2008-12-30 13:51:41 +00:00
|
|
|
$deleted_list .= "<li>".$k."</li>";
|
2006-12-02 04:36:16 +00:00
|
|
|
unset($pref[$k]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
save_prefs();
|
|
|
|
$emessage->add(LAN_DELETED."<ul>".$deleted_list."</ul>");
|
2006-12-02 04:36:16 +00:00
|
|
|
$e107cache->clear();
|
2008-12-30 13:51:41 +00:00
|
|
|
//$e107->ns->tablerender(LAN_DELETED,$message);
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function delete_plugin_entry()
|
|
|
|
{
|
2008-12-30 13:51:41 +00:00
|
|
|
global $sql, $emessage;
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
$del = array_keys($_POST['delplug']);
|
2008-12-30 13:51:41 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
function verify_sql_record()
|
|
|
|
{
|
|
|
|
global $emessage, $sql, $sql2, $sql3, $frm, $e107, $tp;
|
2007-03-15 15:55:08 +00:00
|
|
|
|
2009-07-23 15:21:41 +00:00
|
|
|
$sql = e107::getDb();
|
|
|
|
$sql2 = e107::getDb('sql2');
|
|
|
|
$sql3 = e107::getDb('sql3');
|
2007-03-15 15:55:08 +00:00
|
|
|
|
|
|
|
$tables = array();
|
|
|
|
$tables[] = 'rate';
|
|
|
|
$tables[] = 'comments';
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
if(isset($_POST['delete_verify_sql_record']))
|
|
|
|
{
|
2007-03-15 15:55:08 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
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!<br />";
|
|
|
|
$msg .= "but, since this is still an experimental procedure, i won't actually delete anything<br />";
|
|
|
|
$msg .= "instead, i will show you the queries that would be performed<br />";
|
|
|
|
$text .= "<br />";
|
|
|
|
$emessage->add($msg, E_MESSAGE_DEBUG);
|
2007-03-15 15:55:08 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
foreach($_POST['del_dbrec'] as $k => $v)
|
|
|
|
{
|
2007-03-15 15:55:08 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
if($k == 'rate')
|
|
|
|
{
|
2007-03-15 15:55:08 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
$keys = implode(", ", array_keys($v));
|
|
|
|
$qry .= "DELETE * FROM rate WHERE rate_id IN (".$keys.")<br />";
|
2007-03-15 15:55:08 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
}
|
|
|
|
elseif($k == 'comments')
|
|
|
|
{
|
2007-03-15 15:55:08 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
$keys = implode(", ", array_keys($v));
|
|
|
|
$qry .= "DELETE * FROM comments WHERE comment_id IN (".$keys.")<br />";
|
2007-03-15 15:55:08 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
}
|
2007-03-15 15:55:08 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
}
|
2007-03-15 15:55:08 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
$emessage->add($qry, E_MESSAGE_DEBUG);
|
|
|
|
$emessage->add("<a href='".e_SELF."'>".DBLAN_13."</a>", E_MESSAGE_DEBUG);
|
|
|
|
}
|
|
|
|
}
|
2007-03-15 15:55:08 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
//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);
|
2007-03-15 15:55:08 +00:00
|
|
|
}
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
if(!isset($_POST['check_verify_sql_record']))
|
|
|
|
{
|
2007-03-15 15:55:08 +00:00
|
|
|
//select table to verify
|
|
|
|
$text = "
|
2008-12-30 13:51:41 +00:00
|
|
|
<form method='post' action='".e_SELF."'>
|
|
|
|
<fieldset id='core-db-verify-sql-tables'>
|
|
|
|
<legend class='e-hideme'>".DBLAN_39."</legend>
|
|
|
|
<table cellpadding='0' cellspacing='0' class='adminlist'>
|
|
|
|
<colgroup span='1'>
|
|
|
|
<col style='width: 100%'></col>
|
|
|
|
</colgroup>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th class='last'>".DBLAN_37."</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
";
|
|
|
|
foreach($tables as $t)
|
|
|
|
{
|
2007-03-15 15:55:08 +00:00
|
|
|
$text .= "
|
2008-12-30 13:51:41 +00:00
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
".$frm->checkbox('table_'.$t, $t).$frm->label($t, 'table_'.$t, $t)."
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
$text .= "
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<div class='buttons-bar center'>
|
|
|
|
".$frm->admin_button('check_verify_sql_record', DBLAN_38)."
|
|
|
|
".$frm->admin_button('back', DBLAN_13, 'back')."
|
|
|
|
</div>
|
|
|
|
</fieldset>
|
|
|
|
</form>
|
|
|
|
";
|
|
|
|
|
|
|
|
$e107->ns->tablerender(DBLAN_10.' - '.DBLAN_39, $emessage->render().$text);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-03-15 15:55:08 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
//function to sort the results
|
|
|
|
function verify_sql_record_cmp($a, $b)
|
|
|
|
{
|
2007-03-15 15:55:08 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
$orderby = array('type' => 'asc', 'itemid' => 'asc');
|
2007-03-15 15:55:08 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
$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;
|
2007-03-15 15:55:08 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
|
|
|
|
//function to display the results
|
|
|
|
//$err holds the error data
|
|
|
|
//$ctype holds the tablename
|
2008-12-30 13:51:41 +00:00
|
|
|
function verify_sql_record_displayresult($err, $ctype)
|
|
|
|
{
|
|
|
|
global $frm;
|
2007-03-15 15:55:08 +00:00
|
|
|
|
|
|
|
usort($err, 'verify_sql_record_cmp');
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
$text = "
|
|
|
|
|
|
|
|
<fieldset id='core-core-db-verify-sql-records-{$ctype}'>
|
|
|
|
<legend>".DBLAN_40." ".$ctype."</legend>
|
|
|
|
<table cellpadding='0' cellspacing='0' class='adminlist'>
|
|
|
|
<colgroup span='4'>
|
|
|
|
<col style='width: 20%'></col>
|
|
|
|
<col style='width: 10%'></col>
|
|
|
|
<col style='width: 50%'></col>
|
|
|
|
<col style='width: 20%'></col>
|
|
|
|
</colgroup>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>".DBLAN_41."</th>
|
|
|
|
<th>".DBLAN_42."</th>
|
|
|
|
<th>".DBLAN_43."</th>
|
|
|
|
<th class='center last'>".DBLAN_44."</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
";
|
|
|
|
if(is_array($err) && !empty($err))
|
|
|
|
{
|
2007-03-15 15:55:08 +00:00
|
|
|
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
foreach($err as $k => $v)
|
|
|
|
{
|
2007-03-15 15:55:08 +00:00
|
|
|
$delkey = $v['sqlid'];
|
|
|
|
$text .= "
|
2008-12-30 13:51:41 +00:00
|
|
|
<tr>
|
|
|
|
<td>{$v['type']}</td>
|
|
|
|
<td>{$v['itemid']}</td>
|
|
|
|
<td>".($v['table_exist'] ? DBLAN_45 : DBLAN_46)."</td>
|
|
|
|
<td class='center'>
|
|
|
|
".$frm->checkbox('del_dbrec['.$ctype.']['.$delkey.'][]', '1').$frm->label(DBLAN_47, 'del_dbrec['.$ctype.']['.$delkey.'][]', '1')."
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
";
|
2007-03-15 15:55:08 +00:00
|
|
|
}
|
2008-12-30 13:51:41 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-03-15 15:55:08 +00:00
|
|
|
$text .= "
|
2008-12-30 13:51:41 +00:00
|
|
|
<tr>
|
|
|
|
<td colspan='4'>{$err}</td>
|
|
|
|
</tr>
|
|
|
|
";
|
2007-03-15 15:55:08 +00:00
|
|
|
}
|
2008-12-30 13:51:41 +00:00
|
|
|
$text .= "
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</fieldset>
|
|
|
|
";
|
2007-03-15 15:55:08 +00:00
|
|
|
|
|
|
|
return $text;
|
|
|
|
}
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
function verify_sql_record_gettables()
|
|
|
|
{
|
2007-03-15 15:55:08 +00:00
|
|
|
global $sql2;
|
|
|
|
|
|
|
|
//array which will hold all db tables
|
|
|
|
$dbtables = array();
|
|
|
|
|
|
|
|
//get all tables in the db
|
2008-12-30 13:51:41 +00:00
|
|
|
$sql2->db_Select_gen("SHOW TABLES");
|
|
|
|
while($row2 = $sql2->db_Fetch())
|
|
|
|
{
|
2007-03-15 15:55:08 +00:00
|
|
|
$dbtables[] = $row2[0];
|
|
|
|
}
|
|
|
|
return $dbtables;
|
|
|
|
}
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
$text = "<form method='post' action='".e_SELF.(e_QUERY ? '?'.e_QUERY : '')."'>";
|
2007-03-15 15:55:08 +00:00
|
|
|
|
|
|
|
//validate rate table records
|
2008-12-30 13:51:41 +00:00
|
|
|
if(isset($_POST['table_rate']))
|
|
|
|
{
|
2007-03-15 15:55:08 +00:00
|
|
|
|
|
|
|
$query = "
|
|
|
|
SELECT r.*
|
|
|
|
FROM #rate AS r
|
|
|
|
WHERE r.rate_id!=''
|
|
|
|
ORDER BY r.rate_table, r.rate_itemid";
|
2008-12-30 13:51:41 +00:00
|
|
|
$data = array('type' => 'rate', 'table' => 'rate_table', 'itemid' => 'rate_itemid', 'id' => 'rate_id');
|
2007-03-15 15:55:08 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
if(!$sql->db_Select_gen($query))
|
|
|
|
{
|
|
|
|
$text .= verify_sql_record_displayresult(DBLAN_49, $data['type']);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-03-15 15:55:08 +00:00
|
|
|
//the master error array
|
2008-12-30 13:51:41 +00:00
|
|
|
$err = array();
|
2007-03-15 15:55:08 +00:00
|
|
|
|
|
|
|
//array which will hold all db tables
|
|
|
|
$dbtables = verify_sql_record_gettables();
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
while($row = $sql->db_Fetch())
|
|
|
|
{
|
2007-03-15 15:55:08 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
$ctype = $data['type'];
|
|
|
|
$cid = $row[$data['id']];
|
|
|
|
$citemid = $row[$data['itemid']];
|
|
|
|
$ctable = $row[$data['table']];
|
2007-03-15 15:55:08 +00:00
|
|
|
|
|
|
|
//if the rate_table is an existing table, we need to do more validation
|
|
|
|
//else if the rate_table is not an existing table, this is an invalid reference
|
2008-12-30 13:51:41 +00:00
|
|
|
//FIXME Steve: table is never found without MPREFIX; Multi-language tables?
|
|
|
|
if(in_array(MPREFIX.$ctable, $dbtables))
|
|
|
|
{
|
2007-03-15 15:55:08 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
$sql3->db_Select_gen("SHOW COLUMNS FROM ".MPREFIX.$ctable);
|
|
|
|
while($row3 = $sql3->db_Fetch())
|
|
|
|
{
|
2007-03-15 15:55:08 +00:00
|
|
|
//find the auto_increment field, since that's the most likely key used
|
2008-12-30 13:51:41 +00:00
|
|
|
if($row3['Extra'] == 'auto_increment')
|
|
|
|
{
|
2007-03-15 15:55:08 +00:00
|
|
|
$aif = $row3['Field'];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//we need to check if the itemid (still) exists in this table
|
|
|
|
//if the record is not found, this could well be an obsolete record
|
|
|
|
//if the record is found, we need to keep this record since it's a valid reference
|
2008-12-30 13:51:41 +00:00
|
|
|
if(!$sql2->db_Select("{$ctable}", "*", "{$aif}='{$citemid}' ORDER BY {$aif} "))
|
|
|
|
{
|
|
|
|
$err[] = array('type' => $ctable, 'sqlid' => $cid, 'table' => $ctable, 'itemid' => $citemid, 'table_exist' => TRUE);
|
2007-03-15 15:55:08 +00:00
|
|
|
}
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$err[] = array('type' => $ctable, 'sqlid' => $cid, 'table' => $ctable, 'itemid' => $citemid, 'table_exist' => FALSE);
|
2007-03-15 15:55:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
$text .= verify_sql_record_displayresult(($err ? $err : DBLAN_54), $ctype);
|
2007-03-15 15:55:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//validate comments table records
|
2008-12-30 13:51:41 +00:00
|
|
|
if(isset($_POST['table_comments']))
|
|
|
|
{
|
2007-03-15 15:55:08 +00:00
|
|
|
|
|
|
|
$query = "
|
|
|
|
SELECT c.*
|
|
|
|
FROM #comments AS c
|
|
|
|
WHERE c.comment_id!=''
|
|
|
|
ORDER BY c.comment_type, c.comment_item_id";
|
2008-12-30 13:51:41 +00:00
|
|
|
$data = array('type' => 'comments', 'table' => 'comment_type', 'itemid' => 'comment_item_id', 'id' => 'comment_id');
|
2007-03-15 15:55:08 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
if(!$sql->db_Select_gen($query))
|
|
|
|
{
|
|
|
|
$text .= verify_sql_record_displayresult(DBLAN_49, $data['type']);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-03-15 15:55:08 +00:00
|
|
|
|
|
|
|
//the master error array
|
2008-12-30 13:51:41 +00:00
|
|
|
$err = array();
|
2007-03-15 15:55:08 +00:00
|
|
|
|
|
|
|
//array which will hold all db tables
|
|
|
|
$dbtables = verify_sql_record_gettables();
|
|
|
|
|
|
|
|
//get all e_comment files and variables
|
2008-12-30 13:51:41 +00:00
|
|
|
require_once (e_HANDLER."comment_class.php");
|
|
|
|
$cobj = new comment();
|
2007-03-15 15:55:08 +00:00
|
|
|
$e_comment = $cobj->get_e_comment();
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
while($row = $sql->db_Fetch())
|
|
|
|
{
|
2007-03-15 15:55:08 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
$ctype = $data['type'];
|
|
|
|
$cid = $row[$data['id']];
|
|
|
|
$citemid = $row[$data['itemid']];
|
|
|
|
$ctable = $row[$data['table']];
|
2007-03-15 15:55:08 +00:00
|
|
|
|
|
|
|
//for each comment we need to validate the referencing record exists
|
|
|
|
//we need to check if the itemid (still) exists in this table
|
|
|
|
//if the record is not found, this could well be an obsolete record
|
|
|
|
//if the record is found, we need to keep this record since it's a valid reference
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
|
2007-03-15 15:55:08 +00:00
|
|
|
// news
|
2008-12-30 13:51:41 +00:00
|
|
|
if($ctable == "0")
|
|
|
|
{
|
|
|
|
if(!$sql2->db_Select("news", "*", "news_id='{$citemid}' "))
|
|
|
|
{
|
|
|
|
$err[] = array('type' => 'news', 'sqlid' => $cid, 'table' => $ctable, 'itemid' => $citemid, 'table_exist' => TRUE);
|
2007-03-15 15:55:08 +00:00
|
|
|
}
|
2008-12-30 13:51:41 +00:00
|
|
|
// article, review or content page
|
|
|
|
}
|
|
|
|
elseif($ctable == "1")
|
|
|
|
{
|
2007-03-15 15:55:08 +00:00
|
|
|
|
|
|
|
// downloads
|
2008-12-30 13:51:41 +00:00
|
|
|
}
|
|
|
|
elseif($ctable == "2")
|
|
|
|
{
|
|
|
|
if(!$sql2->db_Select("download", "*", "download_id='{$citemid}' "))
|
|
|
|
{
|
|
|
|
$err[] = array('type' => 'download', 'sqlid' => $cid, 'table' => $ctable, 'itemid' => $citemid, 'table_exist' => TRUE);
|
2007-03-15 15:55:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// poll
|
2008-12-30 13:51:41 +00:00
|
|
|
}
|
|
|
|
elseif($ctable == "4")
|
|
|
|
{
|
|
|
|
if(!$sql2->db_Select("polls", "*", "poll_id='{$citemid}' "))
|
|
|
|
{
|
|
|
|
$err[] = array('type' => 'polls', 'sqlid' => $cid, 'table' => $ctable, 'itemid' => $citemid, 'table_exist' => TRUE);
|
2007-03-15 15:55:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// userprofile
|
2008-12-30 13:51:41 +00:00
|
|
|
}
|
|
|
|
elseif($ctable == "profile")
|
|
|
|
{
|
|
|
|
if(!$sql2->db_Select("user", "*", "user_id='{$citemid}' "))
|
|
|
|
{
|
|
|
|
$err[] = array('type' => 'user', 'sqlid' => $cid, 'table' => $ctable, 'itemid' => $citemid, 'table_exist' => TRUE);
|
2007-03-15 15:55:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//else if this is a plugin comment
|
2008-12-30 13:51:41 +00:00
|
|
|
}
|
|
|
|
elseif(isset($e_comment[$ctable]) && is_array($e_comment[$ctable]))
|
|
|
|
{
|
2007-03-15 15:55:08 +00:00
|
|
|
$var = $e_comment[$ctable];
|
2008-12-30 13:51:41 +00:00
|
|
|
$qryp = '';
|
2007-03-15 15:55:08 +00:00
|
|
|
//new method must use the 'qry' variable
|
2008-12-30 13:51:41 +00:00
|
|
|
if(isset($var) && $var['qry'] != '')
|
|
|
|
{
|
|
|
|
if($installed = $sql2->db_Select("plugin", "*", "plugin_path = '".$var['plugin_path']."' AND plugin_installflag = '1' "))
|
|
|
|
{
|
2007-03-15 15:55:08 +00:00
|
|
|
$qryp = str_replace("{NID}", $citemid, $var['qry']);
|
2008-12-30 13:51:41 +00:00
|
|
|
if(!$sql2->db_Select_gen($qryp))
|
|
|
|
{
|
|
|
|
$err[] = array('type' => $ctable, 'sqlid' => $cid, 'table' => $ctable, 'itemid' => $citemid, 'table_exist' => TRUE);
|
2007-03-15 15:55:08 +00:00
|
|
|
}
|
|
|
|
}
|
2008-12-30 13:51:41 +00:00
|
|
|
//old method
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(!$sql2->db_Select($var['db_table'], $var['db_title'], $var['db_id']." = '{$citemid}' "))
|
|
|
|
{
|
|
|
|
$err[] = array('type' => $ctable, 'sqlid' => $cid, 'table' => $ctable, 'itemid' => $citemid, 'table_exist' => TRUE);
|
2007-03-15 15:55:08 +00:00
|
|
|
}
|
|
|
|
}
|
2008-12-30 13:51:41 +00:00
|
|
|
//in all other cases
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$err[] = array('type' => $ctable, 'sqlid' => $cid, 'table' => $ctable, 'itemid' => $citemid, 'table_exist' => FALSE);
|
2007-03-15 15:55:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
$text .= verify_sql_record_displayresult(($err ? $err : DBLAN_54), $ctype);
|
2007-03-15 15:55:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
$text .= "
|
|
|
|
<div class='buttons-bar center'>
|
|
|
|
".$frm->admin_button('delete_verify_sql_record', DBLAN_48, 'delete')."
|
|
|
|
".$frm->admin_button('verify_sql_record', DBLAN_13, 'back')."
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
";
|
|
|
|
|
|
|
|
$e107->ns->tablerender(DBLAN_10.' - '.DBLAN_50, $emessage->render().$text);
|
2007-03-15 15:55:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
require_once ("footer.php");
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2008-12-30 13:51:41 +00:00
|
|
|
/**
|
|
|
|
* Handle page DOM within the page header
|
|
|
|
*
|
|
|
|
* @return string JS source
|
|
|
|
*/
|
|
|
|
function headerjs()
|
|
|
|
{
|
|
|
|
require_once (e_HANDLER.'js_helper.php');
|
|
|
|
$ret = "
|
|
|
|
<script type='text/javascript'>
|
|
|
|
if(typeof e107Admin == 'undefined') var e107Admin = {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* OnLoad Init Control
|
|
|
|
*/
|
|
|
|
e107Admin.initRules = {
|
|
|
|
'Helper': true,
|
|
|
|
'AdminMenu': false
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<script type='text/javascript' src='".e_FILE_ABS."jslib/core/admin.js'></script>
|
|
|
|
";
|
|
|
|
|
|
|
|
return $ret;
|
|
|
|
}
|
2007-03-15 15:55:08 +00:00
|
|
|
?>
|