2006-12-02 04:36:16 +00:00
< ? php
/*
2008-12-30 13:51:41 +00:00
* e107 website system
*
2009-11-18 01:06:08 +00:00
* Copyright ( C ) 2008 - 2009 e107 Inc ( e107 . org )
2008-12-30 13:51:41 +00:00
* Released under the terms and conditions of the
* GNU General Public License ( http :// www . gnu . org / licenses / gpl . txt )
*
* Administration - Database Utilities
*
2011-06-08 03:16:47 +00:00
* $URL $
2010-02-10 18:18:01 +00:00
* $Revision $
2011-06-08 03:16:47 +00:00
* $Id $
2010-02-10 18:18:01 +00:00
* $Author $
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 " );
2009-09-05 23:02:23 +00:00
$theme = e107 :: getPref ( 'sitetheme' );
define ( " EXPORT_PATH " , " { e_THEME} " . $theme . " /install/ " );
2008-12-30 13:51:41 +00:00
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
}
2008-12-30 13:51:41 +00:00
if ( isset ( $_POST [ 'back' ]))
{
header ( " location: " . e_SELF );
exit ();
}
2011-06-08 03:16:47 +00:00
include_lan ( e_LANGUAGEDIR . e_LANGUAGE . '/admin/lan_' . e_PAGE );
2009-08-28 16:11:02 +00:00
2009-11-13 07:14:57 +00:00
2011-06-08 03:16:47 +00:00
$e_sub_cat = 'database' ;
2009-11-13 07:14:57 +00:00
2011-06-08 03:16:47 +00:00
$frm = e107 :: getForm ();
$mes = e107 :: getMessage ();
2008-12-30 13:51:41 +00:00
/*
* Execute trigger
*/
2011-06-08 03:16:47 +00:00
if ( isset ( $_POST [ 'db_execute' ]))
2008-12-30 13:51:41 +00:00
{
2011-06-08 03:16:47 +00:00
$type = key ( $_POST [ 'db_execute' ]);
2008-12-30 13:51:41 +00:00
if ( ! varset ( $_POST [ 'db_execute' ]))
{
2011-06-08 03:16:47 +00:00
$mes -> add ( DBLAN_53 , E_MESSAGE_WARNING );
2008-12-30 13:51:41 +00:00
}
else
{
2011-06-08 03:16:47 +00:00
$_POST [ $type ] = true ;
2008-12-30 13:51:41 +00:00
}
}
2009-08-31 13:12:03 +00:00
if ( isset ( $_POST [ 'db_update' ]) || varset ( $_GET [ 'mode' ]) == 'db_update' )
2008-12-30 13:51:41 +00:00
{
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
}
2011-06-08 03:16:47 +00:00
2009-08-27 21:01:44 +00:00
if ( isset ( $_POST [ 'exportXmlFile' ]))
2009-08-22 00:28:55 +00:00
{
2009-09-06 01:02:01 +00:00
if ( exportXmlFile ( $_POST [ 'xml_prefs' ], $_POST [ 'xml_tables' ], $_POST [ 'package_images' ]))
2009-09-05 23:02:23 +00:00
{
2011-06-08 03:16:47 +00:00
$mes = eMessage :: getInstance ();
$mes -> add ( LAN_SUCCESS , E_MESSAGE_SUCCESS );
2009-09-05 23:02:23 +00:00
}
2010-02-10 21:53:56 +00:00
2009-08-22 00:28:55 +00:00
}
2006-12-02 04:36:16 +00:00
2008-12-30 13:51:41 +00:00
require_once ( " auth.php " );
2011-06-08 03:16:47 +00:00
2009-11-13 07:14:57 +00:00
$st = new system_tools ;
2009-09-05 23:02:23 +00:00
2006-12-02 04:36:16 +00:00
2010-02-10 21:53:56 +00:00
/* No longer needed after XML feature added .
2006-12-02 04:36:16 +00:00
2009-08-29 15:30:41 +00:00
if ( isset ( $_POST [ 'backup_core' ]) || $_GET [ 'mode' ] == 'backup_core' )
2009-08-27 21:01:44 +00:00
{
2009-08-29 15:30:41 +00:00
backup_core ();
//message_handler("MESSAGE", DBLAN_1);
$emessage -> add ( DBLAN_1 , E_MESSAGE_SUCCESS );
2009-08-27 21:01:44 +00:00
}
2009-08-29 15:30:41 +00:00
*/
2009-08-27 21:01:44 +00:00
2006-12-02 04:36:16 +00:00
2009-01-16 01:02:41 +00:00
2006-12-02 04:36:16 +00:00
2009-11-13 07:14:57 +00:00
2006-12-02 04:36:16 +00:00
2009-08-29 15:30:41 +00:00
require_once ( " footer.php " );
class system_tools
{
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
public $_options = array ();
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
function __construct ()
{
global $mySQLdefaultdb ;
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
$this -> _options = array (
" db_update " => array ( 'diz' => DBLAN_15 , 'label' => DBLAN_16 ),
" verify_sql " => array ( 'diz' => DBLAN_4 , 'label' => DBLAN_5 ),
'optimize_sql' => array ( 'diz' => DBLAN_6 , 'label' => DBLAN_7 ),
'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 ),
'importForm' => array ( 'diz' => DBLAN_59 , 'label' => DBLAN_59 ),
'exportForm' => array ( 'diz' => DBLAN_58 , 'label' => DBLAN_58 ),
2009-11-13 07:14:57 +00:00
'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' )
2009-08-29 15:30:41 +00:00
);
2009-08-29 18:07:42 +00:00
2010-02-10 21:53:56 +00:00
//TODO Merge db_verify.php into db.php
2009-08-29 15:30:41 +00:00
if ( isset ( $_POST [ 'delplug' ]))
{
2010-02-10 21:53:56 +00:00
$this -> delete_plugin_entry ( $_POST [ 'pref_type' ]);
2009-08-29 15:30:41 +00:00
}
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
if ( isset ( $_POST [ 'upload' ]))
2010-02-10 21:53:56 +00:00
{
$this -> importXmlFile ();
2009-08-29 15:30:41 +00:00
}
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
if ( isset ( $_POST [ 'delpref' ]) || ( isset ( $_POST [ 'delpref_checked' ]) && isset ( $_POST [ 'delpref2' ])))
{
2009-09-26 18:08:14 +00:00
$this -> del_pref_val ( $_POST [ 'pref_type' ]);
2009-08-29 15:30:41 +00:00
}
2011-06-08 03:16:47 +00:00
if ( isset ( $_POST [ 'verify_sql' ]) || varset ( $_GET [ 'mode' ]) == 'verify_sql' )
{
require_once ( e_HANDLER . " db_verify_class.php " );
$dbv = new db_verify ;
2011-06-09 07:03:55 +00:00
$dbv -> backUrl = e_SELF . " ?mode=verify_sql " ;
$dbv -> verify ();
2011-06-08 03:16:47 +00:00
return ;
}
2009-08-31 13:12:03 +00:00
if ( isset ( $_POST [ 'verify_sql_record' ]) || varset ( $_GET [ 'mode' ]) == 'verify_sql_record' || isset ( $_POST [ 'check_verify_sql_record' ]) || isset ( $_POST [ 'delete_verify_sql_record' ]))
2009-08-29 15:30:41 +00:00
{
2011-06-08 03:16:47 +00:00
//$this->verify_sql_record(); // - currently performed in db_verify_class.php
2009-08-29 15:30:41 +00:00
}
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
if ( isset ( $_POST [ 'importForm' ]) || $_GET [ 'mode' ] == 'importForm' )
{
2010-02-10 21:53:56 +00:00
$this -> importForm ();
2009-08-29 15:30:41 +00:00
}
2010-02-10 21:53:56 +00:00
2009-11-13 07:14:57 +00:00
if ( isset ( $_POST [ 'convert_to_utf8' ]) || $_GET [ 'mode' ] == 'convert_to_utf8' )
{
2010-02-10 21:53:56 +00:00
$this -> convertUTF8Form ();
2009-11-13 07:14:57 +00:00
}
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
if ( isset ( $_POST [ 'exportForm' ]) || $_GET [ 'mode' ] == 'exportForm' )
{
2010-02-10 21:53:56 +00:00
$this -> exportXmlForm ();
2009-08-29 15:30:41 +00:00
}
2009-08-22 00:28:55 +00:00
2009-08-29 15:30:41 +00:00
if ( isset ( $_POST [ 'optimize_sql' ]) || $_GET [ 'mode' ] == 'optimize_sql' )
{
$this -> optimizesql ( $mySQLdefaultdb );
}
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
if ( isset ( $_POST [ 'pref_editor' ]) || $_GET [ 'mode' ] == 'pref_editor' || isset ( $_POST [ 'delpref' ]) || isset ( $_POST [ 'delpref_checked' ]))
{
2009-09-10 12:49:47 +00:00
$type = isset ( $_GET [ 'type' ]) ? $_GET [ 'type' ] : " core " ;
$this -> pref_editor ( $type );
2009-08-29 15:30:41 +00:00
}
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
if ( isset ( $_POST [ 'sc_override_scan' ]) || $_GET [ 'mode' ] == 'sc_override_scan' )
{
$this -> scan_override ();
}
2010-02-10 21:53:56 +00:00
2009-09-10 10:23:12 +00:00
if ( isset ( $_POST [ 'plugin_scan' ]) || e_QUERY == " plugin " || isset ( $_POST [ 'delplug' ]) || $_GET [ 'mode' ] == 'plugin_scan' )
2009-08-29 15:30:41 +00:00
{
$this -> plugin_viewscan ();
}
2010-02-10 21:53:56 +00:00
2009-11-13 07:14:57 +00:00
if ( vartrue ( $_POST [ 'perform_utf8_convert' ]))
{
$this -> perform_utf8_convert ();
2011-06-08 03:16:47 +00:00
return ;
2009-11-13 07:14:57 +00:00
}
2010-02-10 21:53:56 +00:00
2011-06-08 03:16:47 +00:00
if ( ! vartrue ( $_GET [ 'mode' ]) && ! isset ( $_POST [ 'db_execute' ]))
2010-02-10 21:53:56 +00:00
{
2009-08-29 18:07:42 +00:00
$this -> render_options ();
}
2009-11-13 07:14:57 +00:00
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
}
2010-02-10 21:53:56 +00:00
2009-11-14 00:56:57 +00:00
private function convertUTF8Form ()
2009-11-13 07:14:57 +00:00
{
2009-11-14 04:14:56 +00:00
$emessage = e107 :: getMessage ();
2009-11-13 07:14:57 +00:00
$frm = e107 :: getForm ();
2010-02-10 21:53:56 +00:00
//TODO a function to call the e107_config information in e107_class.php.
require ( e_BASE . " e107_config.php " );
2009-11-14 00:56:57 +00:00
$dbtable = $mySQLdefaultdb ;
2010-02-10 21:53:56 +00:00
2009-11-13 07:14:57 +00:00
//TODO LAN
2009-11-14 04:14:56 +00:00
$message = '
This function will permanently modify all tables in your database . ( '.$mySQLdefaultdb.' ) < br />
2009-11-13 07:14:57 +00:00
It is < b > HIGHLY </ b > recommended that you backup your database first .< br />
2009-11-14 04:14:56 +00:00
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 >
2010-02-10 21:53:56 +00:00
</ ul >
2009-11-14 04:14:56 +00:00
' ;
$emessage -> add ( $message , E_MESSAGE_WARNING );
2009-11-13 07:14:57 +00:00
2009-11-14 04:26:07 +00:00
$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 > " ;
2010-02-10 21:53:56 +00:00
e107 :: getRender () -> tablerender ( " Convert Database to UTF-8 " , $emessage -> render () . $text );
2009-11-13 07:14:57 +00:00
}
2010-02-10 21:53:56 +00:00
2009-11-14 00:56:57 +00:00
private function perform_utf8_convert ()
2009-11-13 07:14:57 +00:00
{
2009-11-14 00:58:35 +00:00
require ( e_BASE . " e107_config.php " );
2010-02-10 21:53:56 +00:00
2009-11-14 00:56:57 +00:00
$dbtable = $mySQLdefaultdb ;
2010-02-10 21:53:56 +00:00
//TODO Add a check to be sure the database is not already utf-8.
2009-11-14 04:28:04 +00:00
// yep, needs more methods - possibly a class in e107_handler
2010-02-10 21:53:56 +00:00
$sql = e107 :: getDb ();
2009-11-13 07:14:57 +00:00
$mes = e107 :: getMessage ();
2010-02-10 21:53:56 +00:00
2009-11-13 07:14:57 +00:00
$ERROR = FALSE ;
2010-02-10 21:53:56 +00:00
2009-11-13 07:14:57 +00:00
if ( ! mysql_query ( " USE information_schema; " ))
{
$mes -> add ( " Couldn't read information_schema " , E_MESSAGE_ERROR );
return ;
}
2010-02-10 21:53:56 +00:00
$queries = array ();
2009-11-13 07:14:57 +00:00
$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%'; " );
2010-02-10 21:53:56 +00:00
$queries2 = array ();
2009-11-13 07:14:57 +00:00
$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%'; " );
2010-02-10 21:53:56 +00:00
2009-11-13 07:14:57 +00:00
mysql_query ( " USE " . $dbtable );
2010-02-10 21:53:56 +00:00
2009-11-13 07:14:57 +00:00
foreach ( $queries as $qry )
{
foreach ( $qry as $q )
{
if ( ! $sql -> db_Query ( $q ))
{
2010-02-10 21:53:56 +00:00
$mes -> add ( $q , E_MESSAGE_ERROR );
2009-11-13 07:14:57 +00:00
$ERROR = TRUE ;
}
2010-02-10 21:53:56 +00:00
}
2009-11-13 07:14:57 +00:00
}
2010-02-10 21:53:56 +00:00
2009-11-13 07:14:57 +00:00
//------------
2010-02-10 21:53:56 +00:00
2009-11-13 07:14:57 +00:00
$result = mysql_list_tables ( $dbtable );
while ( $row = mysql_fetch_array ( $result , MYSQL_NUM ))
{
2010-02-10 21:53:56 +00:00
$table = $row [ 0 ];
2009-11-13 07:14:57 +00:00
$tab_query = " ALTER TABLE " . $table . " charset=utf8; " ;
if ( ! $sql -> db_Query ( $tab_query ))
{
2010-02-10 21:53:56 +00:00
$mes -> add ( $tab_query , E_MESSAGE_ERROR );
$ERROR = TRUE ;
2009-11-13 07:14:57 +00:00
}
}
2010-02-10 21:53:56 +00:00
2009-11-13 07:14:57 +00:00
// ---------------
2010-02-10 21:53:56 +00:00
2009-11-13 07:14:57 +00:00
foreach ( $queries2 as $qry )
{
foreach ( $qry as $q )
{
if ( ! $sql -> db_Query ( $q ))
{
$mes -> add ( $q , E_MESSAGE_ERROR );
2010-02-10 21:53:56 +00:00
$ERROR = TRUE ;
2009-11-13 07:14:57 +00:00
}
2010-02-10 21:53:56 +00:00
}
2009-11-13 07:14:57 +00:00
}
//------------
2010-02-10 21:53:56 +00:00
2009-11-13 07:14:57 +00:00
$lastQry = " ALTER DATABASE ` " . $dbtable . " ` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; " ;
2010-02-10 21:53:56 +00:00
2009-11-13 07:14:57 +00:00
if ( ! $sql -> db_Query ( $lastQry ))
{
2010-02-10 21:53:56 +00:00
$mes -> add ( $lastQry , E_MESSAGE_ERROR );
2009-11-13 07:14:57 +00:00
}
elseif ( $ERROR != TRUE )
{
$message = " Database Converted successfully to UTF-8. <br />
2010-02-10 21:53:56 +00:00
Please now add the following line to your e107_config . php file :< br />
2009-11-13 07:14:57 +00:00
< b > \ $mySQLcharset = 'utf8' ; </ b >
" ;
2010-02-10 21:53:56 +00:00
$mes -> add ( $message , E_MESSAGE_SUCCESS );
2009-11-13 07:14:57 +00:00
}
2010-02-10 21:53:56 +00:00
2009-11-13 07:14:57 +00:00
}
2010-02-10 21:53:56 +00:00
2009-11-13 07:14:57 +00:00
function getQueries ( $query )
{
if ( ! $result = mysql_query ( $query ))
{
$mes -> add ( " Query Failed " , E_MESSAGE_ERROR );
return ;
}
while ( $row = mysql_fetch_array ( $result , MYSQL_NUM ))
{
2010-02-10 21:53:56 +00:00
$qry [] = $row [ 0 ];
2009-11-13 07:14:57 +00:00
}
2010-02-10 21:53:56 +00:00
return $qry ;
2009-11-13 07:14:57 +00:00
}
2009-08-22 00:28:55 +00:00
2009-08-29 15:30:41 +00:00
/**
2010-02-10 21:53:56 +00:00
* Delete selected preferences .
2009-12-13 21:52:32 +00:00
* @ return none
2010-02-10 21:53:56 +00:00
*/
2009-09-26 18:08:14 +00:00
private function del_pref_val ( $mode = 'core' )
2009-08-29 15:30:41 +00:00
{
2009-09-26 18:08:14 +00:00
global $emessage ;
2010-02-10 21:53:56 +00:00
2009-09-26 18:08:14 +00:00
$deleted_list = " " ;
2010-02-10 21:53:56 +00:00
2009-09-28 07:17:52 +00:00
$config = ( $mode == 'core' || $mode = '' ) ? e107 :: getConfig ( 'core' ) : e107 :: getPlugConfig ( $mode );
2010-02-10 21:53:56 +00:00
2009-09-26 18:08:14 +00:00
// Single Pref Deletion using button
if ( varset ( $_POST [ 'delpref' ]))
2009-08-29 15:30:41 +00:00
{
2009-09-26 18:08:14 +00:00
$delpref = key ( $_POST [ 'delpref' ]);
if ( $config -> remove ( $delpref ))
{
2010-02-10 21:53:56 +00:00
$deleted_list .= " <li> " . $delpref . " </li> " ;
}
2009-08-29 15:30:41 +00:00
}
2010-02-10 21:53:56 +00:00
2009-09-26 18:08:14 +00:00
// Multiple Pref deletion using checkboxes
if ( varset ( $_POST [ 'delpref2' ]))
2010-02-10 21:53:56 +00:00
{
2009-08-29 15:30:41 +00:00
foreach ( $_POST [ 'delpref2' ] as $k => $v )
{
2009-09-26 18:08:14 +00:00
if ( $config -> remove ( $k ))
{
2010-02-10 21:53:56 +00:00
$deleted_list .= " <li> " . $k . " </li> " ;
}
2009-08-29 15:30:41 +00:00
}
2010-02-10 21:53:56 +00:00
}
2009-09-26 18:08:14 +00:00
if ( $deleted_list && $config -> save ())
2010-02-10 21:53:56 +00:00
{
2009-09-10 12:49:47 +00:00
$emessage -> add ( LAN_DELETED . " <ul> " . $deleted_list . " </ul> " );
2009-09-26 18:08:14 +00:00
e107 :: getCache () -> clear ();
2009-09-10 12:49:47 +00:00
}
2009-09-26 18:08:14 +00:00
2009-08-29 15:30:41 +00:00
}
2006-12-02 04:36:16 +00:00
2009-08-29 15:30:41 +00:00
private function delete_plugin_entry ()
{
global $sql , $emessage ;
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
$del = array_keys ( $_POST [ 'delplug' ]);
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 );
}
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
}
2006-12-02 04:36:16 +00:00
2009-08-29 15:30:41 +00:00
/**
* Render Options
2009-12-13 21:52:32 +00:00
* @ return none
2010-02-10 21:53:56 +00:00
*/
2009-08-29 15:30:41 +00:00
private function render_options ()
{
2011-06-08 03:16:47 +00:00
$frm = e107 :: getForm ();
2010-02-10 21:53:56 +00:00
2009-08-29 15:30: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 >
2012-05-13 05:26:11 +00:00
< table class = 'adminlist' >
< colgroup >
< col style = 'width: 60%' />
< col style = 'width: 40%' />
2009-08-29 15:30:41 +00:00
</ colgroup >
< tbody > " ;
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
foreach ( $this -> _options as $key => $val )
{
$text .= " <tr>
< td > " . $val['diz'] . " </ td >
< td >
2011-06-08 03:16:47 +00:00
< a 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).
"
2009-08-29 15:30:41 +00:00
</ td >
2010-02-10 21:53:56 +00:00
</ tr > \n " ;
}
2009-08-29 15:30:41 +00:00
$text .= "
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
</ tbody >
2011-06-08 03:16:47 +00:00
</ table > " ;
// $text .= "<div class='buttons-bar center'>
// ".$frm->admin_button('trigger_db_execute', DBLAN_51, 'execute')."
// </div>";
$text .= "
2009-08-29 15:30:41 +00:00
</ fieldset >
</ form >
" ;
2010-02-10 21:53:56 +00:00
2011-06-08 03:16:47 +00:00
$mes = e107 :: getMessage ();
e107 :: getRender () -> tablerender ( DBLAN_10 , $mes -> render () . $text );
2009-08-29 15:30:41 +00:00
}
2010-02-10 21:53:56 +00:00
2006-12-02 04:36:16 +00:00
2009-08-29 15:30:41 +00:00
/**
* Import XML Form
2009-12-13 21:52:32 +00:00
* @ return none
2010-02-10 21:53:56 +00:00
*/
2009-08-29 15:30:41 +00:00
private function importForm ()
{
// Get largest allowable file upload
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
$frm = e107 :: getSingleton ( 'e_form' );
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
require_once ( e_HANDLER . 'upload_handler.php' );
$max_file_size = get_user_max_upload ();
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
$text = "
< form enctype = 'multipart/form-data' method = 'post' action = '".e_SELF."?mode=".$_GET[' mode ']."' >
2012-05-13 05:26:11 +00:00
< table class = 'adminform' >
< colgroup >
2009-08-29 15:30:41 +00:00
< col class = 'col-label' />
< col class = 'col-control' />
</ colgroup >
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
< tbody >
< tr >
< td > " .LAN_UPLOAD. " </ td >
2008-12-30 13:51:41 +00:00
< td >
2009-08-29 15:30:41 +00:00
< input type = 'hidden' name = 'MAX_FILE_SIZE' value = '{$max_file_size}' />
< input type = 'hidden' name = 'ac' value = '".md5(ADMINPWCHANGE)."' />
< input class = 'tbox' type = 'file' name = 'file_userfile[]' accept = 'text/xml' size = '50' />
2008-12-30 13:51:41 +00:00
</ td >
2009-08-29 15:30:41 +00:00
</ tr >
</ tbody >
</ table >
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
< div class = 'center buttons-bar' > " ;
$text .= $frm -> admin_button ( 'upload' , LAN_UPLOAD , 'submit' , LAN_UPLOAD );
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
$text .= "
</ div >
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
</ form > \n " ;
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
$emessage = eMessage :: getInstance ();
2010-02-10 21:53:56 +00:00
e107 :: getRender () -> tablerender ( DBLAN_59 , $emessage -> render () . $text );
2009-08-29 15:30:41 +00:00
}
2006-12-02 04:36:16 +00:00
2009-08-29 15:30:41 +00:00
/**
* Export XML Dump
2009-12-13 21:52:32 +00:00
* @ return none
2010-02-10 21:53:56 +00:00
*/
2009-08-29 15:30:41 +00:00
private function exportXmlForm ()
{
2009-09-05 23:02:23 +00:00
$emessage = eMessage :: getInstance ();
2009-08-29 15:30:41 +00:00
$frm = e107 :: getSingleton ( 'e_form' );
2010-02-10 21:53:56 +00:00
2009-09-02 17:27:29 +00:00
//TODO LANs
2010-02-10 21:53:56 +00:00
2009-09-05 23:02:23 +00:00
$text = " <form method='post' action=' " . e_SELF . " ? " . e_QUERY . " ' id='core-db-export-form'>
2009-08-29 15:30:41 +00:00
< fieldset id = 'core-db-export' >
< legend class = 'e-hideme' > Export Options </ legend >
2012-05-13 05:26:11 +00:00
< table class = 'adminlist' >
< colgroup >
2012-05-13 05:56:35 +00:00
< col style = 'width: 80%' />
< col style = 'width: 20%' />
2010-02-10 21:53:56 +00:00
</ colgroup >
2009-08-29 15:30:41 +00:00
< thead >
2008-12-30 13:51:41 +00:00
< tr >
2009-09-02 17:27:29 +00:00
< th > " . $frm->checkbox_toggle ('check-all-verify', 'xml_prefs'). " Preferences </ th >
2009-08-29 15:30:41 +00:00
< th class = 'right' > Rows </ th >
2010-02-10 21:53:56 +00:00
</ tr >
2009-08-29 15:30:41 +00:00
</ thead >
< tbody >
2010-02-10 21:53:56 +00:00
2009-08-31 02:00:51 +00:00
" ;
2010-02-10 21:53:56 +00:00
2009-09-05 23:02:23 +00:00
$pref_types = e107 :: getConfig () -> aliases ;
2010-02-10 21:53:56 +00:00
unset ( $pref_types [ 'core_old' ], $pref_types [ 'core_backup' ]);
2009-09-05 23:02:23 +00:00
// $exclusions = array('core_old'=>1,'core_backup'=>1);
// $filteredprefs = array_diff($pref_types,$exclusions);
2010-02-10 21:53:56 +00:00
2009-08-31 02:00:51 +00:00
foreach ( $pref_types as $key => $description )
2009-08-29 15:30:41 +00:00
{
2010-02-10 21:53:56 +00:00
$checked = ( $_POST [ 'xml_prefs' ][ $key ] == $key ) ? 1 : 0 ;
2009-09-05 23:02:23 +00:00
$text .= " <tr>
2009-08-31 02:00:51 +00:00
< td >
2009-09-05 23:02:23 +00:00
" . $frm->checkbox ( " xml_prefs [ " . $key . " ] " , $key , $checked ). "
2009-08-31 02:00:51 +00:00
" .LAN_PREFS. " : " . $key . " </ td >
< td >& nbsp ; </ td >
2010-02-10 21:53:56 +00:00
2009-08-31 02:00:51 +00:00
</ tr > " ;
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
}
2009-09-02 17:27:29 +00:00
$text .= " </tbody>
</ table >
2012-05-13 05:26:11 +00:00
< table class = 'adminlist' >
< colgroup >
< col style = 'width: 80%' />
< col style = 'width: 20%' />
2010-02-10 21:53:56 +00:00
</ colgroup >
2009-09-02 17:27:29 +00:00
< thead >
< tr >
< th > " . $frm->checkbox_toggle ('check-all-verify', 'xml_tables'). " Tables </ th >
< th class = 'right' > Rows </ th >
2010-02-10 21:53:56 +00:00
</ tr >
2009-09-02 17:27:29 +00:00
</ thead >
< tbody > \n " ;
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
$tables = table_list ();
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
foreach ( $tables as $name => $count )
2010-02-10 21:53:56 +00:00
{
$checked = ( $_POST [ 'xml_tables' ][ $name ] == $name ) ? 1 : 0 ;
$text .= " <tr>
2009-08-29 15:30:41 +00:00
< td >
2010-02-10 21:53:56 +00:00
" . $frm->checkbox ( " xml_tables [ " . $name . " ] " , $name , $checked ). " Table Data : " . $name . "
2009-08-29 15:30:41 +00:00
</ td >
< td class = 'right' > $count </ td >
</ tr > " ;
}
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
$text .= "
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
</ tbody >
</ table >
2010-02-10 21:53:56 +00:00
2012-05-13 05:26:11 +00:00
< table class = 'adminlist' >
< colgroup >
< col style = 'width: 80%' />
< col style = 'width: 20%' />
2010-02-10 21:53:56 +00:00
</ colgroup >
2009-09-02 17:27:29 +00:00
< thead >
< tr >
< th colspan = '2' > " .LAN_OPTIONS. " </ th >
2010-02-10 21:53:56 +00:00
</ tr >
2009-09-02 17:27:29 +00:00
</ thead >
< tbody >
< tr >
2009-09-05 23:02:23 +00:00
< td colspan = '2' > " ;
2010-02-10 21:53:56 +00:00
$checked = ( vartrue ( $_POST [ 'package_images' ])) ? 1 : 0 ;
$text .= $frm -> checkbox ( " package_images " , 'package_images' , $checked ) . " Convert paths and package images and xml into: <i> " . e107 :: getParser () -> replaceConstants ( EXPORT_PATH ) . " </i>
2009-09-02 17:27:29 +00:00
</ td >
</ tr >
</ tbody >
</ table >
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
< div class = 'buttons-bar center' >
" . $frm->admin_button ('exportXmlFile', " Export File " , 'exportXmlFile'). "
</ div >
</ fieldset >
</ form > " ;
2010-02-10 21:53:56 +00:00
e107 :: getRender () -> tablerender ( " Export Options " , $emessage -> render () . $text );
2009-08-29 15:30:41 +00:00
}
2006-12-02 04:36:16 +00:00
2009-08-29 15:30:41 +00:00
/**
* Import XML Dump
2009-12-13 21:52:32 +00:00
* @ return none
2009-08-29 15:30:41 +00:00
*/
2009-08-31 02:00:51 +00:00
private function importXmlFile ()
2009-08-29 15:30:41 +00:00
{
2009-08-31 02:00:51 +00:00
$ret = e107 :: getSingleton ( 'xmlClass' ) -> e107Import ( $_FILES [ 'file_userfile' ][ 'tmp_name' ][ 0 ]);
2007-03-15 15:55:08 +00:00
2009-08-31 02:00:51 +00:00
foreach ( $ret [ 'success' ] as $table )
2009-08-29 15:30:41 +00:00
{
2010-02-10 21:53:56 +00:00
eMessage :: getInstance () -> add ( " Inserted $table " , E_MESSAGE_SUCCESS );
2009-08-29 18:07:42 +00:00
}
2010-02-10 21:53:56 +00:00
2009-08-31 02:00:51 +00:00
foreach ( $ret [ 'failed' ] as $table )
2009-08-29 18:07:42 +00:00
{
2010-02-10 21:53:56 +00:00
eMessage :: getInstance () -> add ( " Failed to Insert $table " , E_MESSAGE_ERROR );
}
2009-08-29 15:30:41 +00:00
}
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
/**
* Optimize SQL
2009-12-13 21:52:32 +00:00
* @ return none
2009-08-29 15:30:41 +00:00
*/
private function optimizesql ( $mySQLdefaultdb )
{
// global $emessage;
$result = mysql_list_tables ( $mySQLdefaultdb );
while ( $row = mysql_fetch_row ( $result ))
{
mysql_query ( " OPTIMIZE TABLE " . $row [ 0 ]);
}
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
// $emessage->add(DBLAN_11." $mySQLdefaultdb ".DBLAN_12, E_MESSAGE_SUCCESS);
2010-02-10 21:53:56 +00:00
e107 :: getRender () -> tablerender ( DBLAN_7 , DBLAN_11 . " $mySQLdefaultdb " . DBLAN_12 );
2009-08-29 15:30:41 +00:00
}
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
/**
* Preferences Editor
2009-12-13 21:52:32 +00:00
* @ return string text for display
2009-08-29 15:30:41 +00:00
*/
2009-09-28 07:17:52 +00:00
private function pref_editor ( $type = 'core' )
2009-08-29 15:30:41 +00:00
{
2009-11-14 04:05:35 +00:00
//TODO Add drop-down for editing personal perfs also. ie. user pref of self. (admin)
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
global $pref , $e107 , $emessage , $frm ;
2009-09-10 12:49:47 +00:00
2010-02-10 21:53:56 +00:00
2009-09-26 18:08:14 +00:00
$config = ( $type == 'core' ) ? e107 :: getConfig ( 'core' ) : e107 :: getPlugConfig ( $type );
$spref = $config -> getPref ();
2010-02-10 21:53:56 +00:00
ksort ( $spref );
2009-08-29 15:30:41 +00:00
$text = "
2009-09-26 18:08:14 +00:00
< form method = 'post' action = '".e_ADMIN."db.php?mode=".$_GET[' mode ']."&type=".$type."' id = 'pref_edit' >
2009-08-29 15:30:41 +00:00
< fieldset id = 'core-db-pref-edit' >
2009-09-10 12:49:47 +00:00
< legend class = 'e-hideme' > " .DBLAN_20. " </ legend > " ;
2010-02-10 21:53:56 +00:00
2009-09-26 18:08:14 +00:00
$text .= " <select class='tbox' name='type_select' onchange='urljump(this.options[selectedIndex].value)' >
< option value = '".e_ADMIN."db.php?mode=".$_GET[' mode ']."&type=core' > Core </ option > \n " ;
2010-02-10 21:53:56 +00:00
2009-09-26 18:08:14 +00:00
// e107::getConfig($type)->aliases
2010-02-10 21:53:56 +00:00
2009-09-26 18:08:14 +00:00
e107 :: getDb () -> db_Select_gen ( " SELECT e107_name FROM #core WHERE e107_name LIKE ('plugin_%') ORDER BY e107_name " );
while ( $row = e107 :: getDb () -> db_Fetch ())
2009-09-10 12:49:47 +00:00
{
2009-09-26 18:08:14 +00:00
$key = str_replace ( " plugin_ " , " " , $row [ 'e107_name' ]);
2009-09-10 12:49:47 +00:00
$selected = ( varset ( $_GET [ 'type' ]) == $key ) ? " selected='selected' " : " " ;
2010-02-10 21:53:56 +00:00
$text .= " <option value=' " . e_ADMIN . " db.php?mode= " . $_GET [ 'mode' ] . " &type= " . $key . " ' { $selected } > " . ucwords ( $key ) . " </option> \n " ;
}
2009-09-10 12:49:47 +00:00
$text .= " </select></div>
2012-05-13 05:26:11 +00:00
< table class = 'adminlist' >
< colgroup >
< col style = 'width: 5%' />
< col style = 'width: 20%' />
< col style = 'width: 70%' />
< col style = 'width: 5%' />
2009-08-29 15:30:41 +00:00
</ 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 >
" ;
2010-02-10 21:53:56 +00:00
2009-09-10 12:49:47 +00:00
foreach ( $spref as $key => $val )
2009-08-29 15:30:41 +00:00
{
$ptext = ( is_array ( $val )) ? " <pre> " . print_r ( $val , TRUE ) . " </pre> " : htmlspecialchars ( $val , ENT_QUOTES , 'utf-8' );
$ptext = $e107 -> tp -> textclean ( $ptext , 80 );
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
$text .= "
2009-08-22 00:28:55 +00:00
< tr >
2009-08-29 15:30:41 +00:00
< 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 >
2009-08-22 00:28:55 +00:00
</ tr >
2009-08-29 15:30:41 +00:00
" ;
}
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
$text .= "
</ tbody >
</ table >
< div class = 'buttons-bar center' >
2009-11-08 09:14:39 +00:00
" . $frm->admin_button ('delpref_checked', LAN_DELCHECKED, 'delete'). "
" . $frm->admin_button ('back', LAN_BACK, 'back'). "
2009-09-28 07:17:52 +00:00
< input type = 'hidden' name = 'pref_type' value = '".$type."' />
2009-08-29 15:30:41 +00:00
</ div >
</ fieldset >
</ form > \n\n " ;
2010-02-10 21:53:56 +00:00
2009-09-26 18:08:14 +00:00
e107 :: getRender () -> tablerender ( DBLAN_10 . ' :: ' . DBLAN_20 . " :: " . ucwords ( $type ), $emessage -> render () . $text );
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
return $text ;
}
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
/**
* Preferences Editor
2009-12-13 21:52:32 +00:00
* @ return none
2010-02-10 21:53:56 +00:00
*/
2009-08-29 15:30:41 +00:00
private function scan_override ()
{
global $pref , $emessage ;
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
require_once ( e_HANDLER . 'file_class.php' );
$f = new e_file ;
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
$scList = '' ;
2010-02-10 21:53:56 +00:00
2010-02-10 22:20:05 +00:00
$fList = $f -> get_files ( e_CORE . 'override/shortcodes' , '\.sc$' );
2009-08-29 15:30:41 +00:00
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);
e107 :: getRender () -> tablerender ( DBLAN_56 , DBLAN_57 . ':<br />' . $pref [ 'sc_override' ]);
}
2009-08-22 00:28:55 +00:00
2009-08-29 15:30:41 +00:00
/**
* Plugin Folder Scanner
2009-12-13 21:52:32 +00:00
* @ return none
2010-02-10 21:53:56 +00:00
*/
2009-08-29 15:30:41 +00:00
private function plugin_viewscan ()
{
$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 " );
2010-02-10 21:53:56 +00:00
2009-10-26 01:04:06 +00:00
global $e107 ;
$sql = e107 :: getDb ();
$tp = e107 :: getParser ();
$frm = e107 :: getForm ();
$emessage = e107 :: getMessage ();
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
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.
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
/* we all are awaiting for PHP5 only support - method chaining ...
$emessage -> add ( DBLAN_22 . ' - ' . DBLAN_23 , E_MESSAGE_SUCCESS )
2009-11-08 09:14:39 +00:00
-> add ( " <a href=' " . e_SELF . " '> " . LAN_BACK . " </a> " , E_MESSAGE_SUCCESS )
2009-08-29 15:30:41 +00:00
-> add ( DBLAN_30 );
*/
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
$emessage -> add ( DBLAN_23 , E_MESSAGE_SUCCESS );
2009-11-08 09:14:39 +00:00
$emessage -> add ( " <a href=' " . e_SELF . " '> " . LAN_BACK . " </a> " , E_MESSAGE_SUCCESS );
2009-08-29 15:30:41 +00:00
$emessage -> add ( DBLAN_30 );
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
$text = "
< form method = 'post' action = '".e_ADMIN."db.php?mode=".$_GET[' mode ']."' id = 'plug_edit' >
< fieldset id = 'core-db-plugin-scan' >
< legend class = 'e-hideme' > " .ADLAN_CL_7. " </ legend >
2012-05-13 05:26:11 +00:00
< table class = 'adminlist' >
< colgroup >
< col style = 'width: 20%' />
< col style = 'width: 20%' />
< col style = 'width: 35%' />
< col style = 'width: 25%' />
2009-08-29 15:30:41 +00:00
</ 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 >
" ;
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
$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 ())
{
2009-10-26 01:04:06 +00:00
e107 :: loadLanFiles ( $row [ 'plugin_path' ], 'admin' );
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
$text .= "
< tr >
< td > " . $e107->tp ->toHtml( $row['plugin_name'] , FALSE, " defs , emotes_off " ). " </ td >
< td > " . $row['plugin_path'] . " </ td >
< td > " ;
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
if ( trim ( $row [ 'plugin_addons' ]))
{
//XXX - $nl_code = ''; - OLD VAR?
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' ))
{
$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> " ;
2009-08-27 21:01:44 +00:00
}
2009-08-29 15:30:41 +00:00
}
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
$text .= "
</ td >
< td class = 'center' >
" ;
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
if ( $previous == $row [ 'plugin_path' ])
{
$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]");
}
else
{
$text .= ( $row [ 'plugin_installflag' ] == 1 ) ? DBLAN_27 : " " ; // "Installed and not installed";
}
$text .= "
</ td >
</ tr >
" ;
$previous = $row [ 'plugin_path' ];
}
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
$text .= "
</ tbody >
</ table >
</ fieldset >
</ form >
" ;
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
e107 :: getRender () -> tablerender ( DBLAN_10 . ' - ' . DBLAN_22 , $emessage -> render () . $text );
}
}
//XXX - what is this for (backup core)? <input type='hidden' name='sqltext' value='{$sqltext}' />
function db_adminmenu ()
{
global $st ;
2010-02-10 21:53:56 +00:00
2009-08-29 15:30:41 +00:00
foreach ( $st -> _options as $key => $val )
{
$var [ $key ][ 'text' ] = $val [ 'label' ];
$var [ $key ][ 'link' ] = e_SELF . " ?mode= " . $key ;
}
2010-02-10 21:53:56 +00:00
e_admin_menu ( DBLAN_10 , $_GET [ 'mode' ], $var );
2009-08-27 21:01:44 +00:00
}
2009-08-22 00:28:55 +00:00
2009-08-27 21:01:44 +00:00
2009-09-06 01:02:01 +00:00
/**
* Export XML File and Copy Images .
* @ param object $prefs
* @ param object $tables
* @ param object $debug [ optional ]
2009-12-13 21:52:32 +00:00
* @ return none
2009-09-06 01:02:01 +00:00
*/
function exportXmlFile ( $prefs , $tables , $package = FALSE , $debug = FALSE )
2009-08-27 21:01:44 +00:00
{
2009-09-02 17:27:29 +00:00
$xml = e107 :: getSingleton ( 'xmlClass' );
2009-09-05 23:02:23 +00:00
$tp = e107 :: getParser ();
$emessage = eMessage :: getInstance ();
2010-02-10 21:53:56 +00:00
2009-09-06 01:02:01 +00:00
//TODO LANs
2010-02-10 21:53:56 +00:00
2009-09-06 01:02:01 +00:00
if ( vartrue ( $package ))
2009-09-02 17:27:29 +00:00
{
2010-02-10 21:53:56 +00:00
2009-09-05 23:02:23 +00:00
$xml -> convertFilePaths = TRUE ;
$xml -> filePathDestination = EXPORT_PATH ;
2009-09-10 09:49:01 +00:00
$xml -> filePathPrepend = array (
'news_thumbnail' => " { e_IMAGE}newspost_images/ "
);
2010-02-10 21:53:56 +00:00
2009-09-05 23:02:23 +00:00
$desinationFolder = $tp -> replaceConstants ( $xml -> filePathDestination );
2010-02-10 21:53:56 +00:00
2009-09-05 23:02:23 +00:00
if ( ! is_writable ( $desinationFolder ))
2010-02-10 21:53:56 +00:00
{
2009-09-06 01:02:01 +00:00
$emessage -> add ( $desinationFolder . " is not writable " , E_MESSAGE_ERROR );
2009-09-05 23:02:23 +00:00
return ;
}
2009-09-02 17:27:29 +00:00
}
2010-02-10 21:53:56 +00:00
2009-09-06 01:02:01 +00:00
2009-09-05 23:02:23 +00:00
if ( $xml -> e107Export ( $prefs , $tables , $debug ))
{
$emessage -> add ( " Created: " . $desinationFolder . " install.xml " , E_MESSAGE_SUCCESS );
if ( varset ( $xml -> fileConvertLog ))
{
foreach ( $xml -> fileConvertLog as $oldfile )
{
$file = basename ( $oldfile );
$newfile = $desinationFolder . $file ;
2009-09-06 01:02:01 +00:00
if ( $oldfile == $newfile || ( copy ( $oldfile , $newfile )))
2009-09-05 23:02:23 +00:00
{
$emessage -> add ( " Copied: " . $newfile , E_MESSAGE_SUCCESS );
}
else
{
2010-02-10 21:53:56 +00:00
$emessage -> add ( " Couldn't copy: " . $newfile , E_MESSAGE_ERROR );
}
2009-09-05 23:02:23 +00:00
}
}
}
2009-08-22 00:28:55 +00:00
}
2009-08-29 15:30:41 +00:00
2009-08-27 22:19:51 +00:00
2009-08-27 21:01:44 +00:00
function table_list ()
{
// grab default language lists.
2010-02-10 21:53:56 +00:00
//TODO - a similar function is in db_verify.php. Should probably all be moved to mysql_class.php.
2009-08-27 21:01:44 +00:00
$exclude = array ();
2009-08-29 15:30:41 +00:00
$exclude [] = " core " ;
2009-08-27 21:01:44 +00:00
$exclude [] = " rbinary " ;
$exclude [] = " parser " ;
$exclude [] = " tmp " ;
$exclude [] = " online " ;
$exclude [] = " upload " ;
$exclude [] = " user_extended_country " ;
2009-08-29 18:07:42 +00:00
$exclude [] = " plugin " ;
2010-02-10 21:53:56 +00:00
2009-09-05 23:02:23 +00:00
$coreTables = e107 :: getDb () -> db_TableList ( 'nolan' );
2009-08-29 18:07:42 +00:00
2009-09-05 23:02:23 +00:00
$tables = array_diff ( $coreTables , $exclude );
2010-02-10 21:53:56 +00:00
2009-09-05 23:02:23 +00:00
foreach ( $tables as $e107tab )
2010-02-10 21:53:56 +00:00
{
2009-09-05 23:02:23 +00:00
$count = e107 :: getDb () -> db_Select_gen ( " SELECT * FROM # " . $e107tab );
2010-02-10 21:53:56 +00:00
2009-09-05 23:02:23 +00:00
if ( $count )
2009-08-27 21:01:44 +00:00
{
2010-02-10 21:53:56 +00:00
$tabs [ $e107tab ] = $count ;
}
2009-08-27 21:01:44 +00:00
}
2009-08-22 00:28:55 +00:00
2009-08-27 21:01:44 +00:00
return $tabs ;
}
2009-09-05 23:02:23 +00:00
2009-08-29 15:30:41 +00:00
/* Still needed ?
2009-08-22 00:28:55 +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' " );
}
}
2009-08-29 15:30:41 +00:00
*/
2008-12-30 13:51:41 +00:00
2006-12-02 04:36:16 +00:00
2010-02-10 21:53:56 +00:00
function verify_sql_record () // deprecated by db_verify.php ( i think).
2008-12-30 13:51:41 +00:00
{
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 );
2009-11-08 09:14:39 +00:00
$emessage -> add ( " <a href=' " . e_SELF . " '> " . LAN_BACK . " </a> " , E_MESSAGE_DEBUG );
2008-12-30 13:51:41 +00:00
}
}
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 >
2012-05-13 05:26:11 +00:00
< table class = 'adminlist' >
< colgroup >
< col style = 'width: 100%' />
2008-12-30 13:51:41 +00:00
</ 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). "
2009-11-08 09:14:39 +00:00
" . $frm->admin_button ('back', LAN_BACK, 'back'). "
2008-12-30 13:51:41 +00:00
</ 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 >
2012-05-13 05:26:11 +00:00
< table class = 'adminlist' >
< colgroup >
2012-05-13 05:56:35 +00:00
< col style = 'width: 20%' />
< col style = 'width: 10%' />
< col style = 'width: 50%' />
< col style = 'width: 20%' />
2008-12-30 13:51:41 +00:00
</ colgroup >
< thead >
< tr >
< th > " .DBLAN_41. " </ th >
< th > " .DBLAN_42. " </ th >
< th > " .DBLAN_43. " </ th >
2009-11-08 09:14:39 +00:00
< th class = 'center last' > " .LAN_OPTIONS. " </ th >
2008-12-30 13:51:41 +00:00
</ 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' >
2009-11-08 09:14:39 +00:00
" . $frm->checkbox ('del_dbrec['. $ctype .']['. $delkey .'][]', '1'). $frm->label (LAN_DELETE, 'del_dbrec['. $ctype .']['. $delkey .'][]', '1'). "
2008-12-30 13:51:41 +00:00
</ 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' >
2009-11-08 09:14:39 +00:00
" . $frm->admin_button ('delete_verify_sql_record', LAN_DELCHECKED, 'delete'). "
" . $frm->admin_button ('verify_sql_record', LAN_BACK, 'back'). "
2008-12-30 13:51:41 +00:00
</ div >
</ form >
" ;
$e107 -> ns -> tablerender ( DBLAN_10 . ' - ' . DBLAN_50 , $emessage -> render () . $text );
2007-03-15 15:55:08 +00:00
}
}
2009-08-29 15:30:41 +00:00
2007-03-15 15:55:08 +00:00
?>