diff --git a/class2.php b/class2.php
index ddf131324..9efc7c47e 100755
--- a/class2.php
+++ b/class2.php
@@ -452,7 +452,7 @@ if(!e107::getConfig()->hasData())
{
// Core prefs error - admin log
- e107::getAdminLog()->log_event('CORE_LAN8', 'CORE_LAN7', E_LOG_WARNING);
+ e107::getAdminLog()->add('CORE_LAN8', 'CORE_LAN7', E_LOG_WARNING);
// Try for the automatic backup..
if(e107::getConfig('core_backup')->hasData())
@@ -469,7 +469,7 @@ if(!e107::getConfig()->hasData())
if(!e107::getConfig('core_old')->hasData())
{
// Core could not restore from automatic backup. Execution halted.
- e107::getAdminLog()->log_event('CORE_LAN8', 'CORE_LAN9', E_LOG_FATAL);
+ e107::getAdminLog()->add('CORE_LAN8', 'CORE_LAN9', E_LOG_FATAL);
message_handler('CRITICAL_ERROR', 3, __LINE__, __FILE__);
// No old system, so point in the direction of resetcore :(
@@ -1869,7 +1869,7 @@ function get_user_data($uid, $extra = '')
{
if(e107::getPref('developer'))
{
- e107::getAdminLog()->log_event(
+ e107::getAdminLog()->add(
'Deprecated call - get_user_data()',
'Call to deprecated function get_user_data() (class2.php) '."\n".print_r(debug_backtrace(null,2), true),
E_LOG_INFORMATIVE,
@@ -1893,7 +1893,7 @@ function get_user_data($uid, $extra = '')
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
//SO MUCH DEPRECATED
/**
- * @deprecated
+ * @deprecated Use instead: e107::getConfig(alias)->->setPref($array)->save();
* @example Use instead: e107::getConfig(alias)->->setPref($array)->save(); Not to be used for saving plugin or theme prefs!
* @param string $table
* @param int|mixed $uid
@@ -2460,12 +2460,12 @@ function force_userupdate($currentUser)
$user_extended_struct_name = "user_{$row['user_extended_struct_name']}";
if (!isset($currentUser[$user_extended_struct_name]))
{
- //e107::admin_log->e_log_event(4, __FILE__."|".__FUNCTION__."@".__LINE__, 'FORCE', 'Force User update', 'Trigger field: '.$user_extended_struct_name, FALSE, LOG_TO_ROLLING);
+ //e107::admin_log->addEvent(4, __FILE__."|".__FUNCTION__."@".__LINE__, 'FORCE', 'Force User update', 'Trigger field: '.$user_extended_struct_name, FALSE, LOG_TO_ROLLING);
return TRUE;
}
if (($row['user_extended_struct_type'] == 7) && ($currentUser[$user_extended_struct_name] == '0000-00-00'))
{
- //e107::admin_log->e_log_event(4, __FILE__."|".__FUNCTION__."@".__LINE__, 'FORCE', 'Force User update', 'Trigger field: '.$user_extended_struct_name, FALSE, LOG_TO_ROLLING);
+ //e107::admin_log->addEvent(4, __FILE__."|".__FUNCTION__."@".__LINE__, 'FORCE', 'Force User update', 'Trigger field: '.$user_extended_struct_name, FALSE, LOG_TO_ROLLING);
return TRUE;
}
}
diff --git a/e107_admin/admin_log.php b/e107_admin/admin_log.php
index 8a08e6696..2c571a536 100644
--- a/e107_admin/admin_log.php
+++ b/e107_admin/admin_log.php
@@ -357,7 +357,7 @@ class admin_log_ui extends e_admin_ui
// Add in a log event
$message = $db_name.str_replace(array('[x]', '[y]'), array($old_string, $del_count), RL_LAN_057);
$mes->addSuccess($message);
- $log->log_event($db_msg, "db_Delete - earlier than {$old_string} (past {$back_count} days)[!br!]".$message.'[!br!]'.$db_table.' '.$qry, E_LOG_INFORMATIVE, '');
+ $log->add($db_msg, "db_Delete - earlier than {$old_string} (past {$back_count} days)[!br!]".$message.'[!br!]'.$db_table.' '.$qry, E_LOG_INFORMATIVE, '');
}
else
{
diff --git a/e107_admin/auth.php b/e107_admin/auth.php
index 48dcdddf9..2bf4b2edc 100644
--- a/e107_admin/auth.php
+++ b/e107_admin/auth.php
@@ -148,7 +148,7 @@ else
if ($row[0] == "authfail")
{
- $admin_log->e_log_event(4, __FILE__."|".__FUNCTION__."@".__LINE__, "LOGIN", LAN_ROLL_LOG_11, "U: ".$tp->toDB($_POST['authname']), FALSE, LOG_TO_ROLLING);
+ $admin_log->addEvent(4, __FILE__."|".__FUNCTION__."@".__LINE__, "LOGIN", LAN_ROLL_LOG_11, "U: ".$tp->toDB($_POST['authname']), FALSE, LOG_TO_ROLLING);
echo "\n";
e107::getRedirect()->redirect('admin.php?failed');
@@ -458,7 +458,7 @@ class auth
$text = 'CHAP: '.$username.' ('.$extra_text.')';
$title = e107::getParser()->toDB($title);
$text = e107::getParser()->toDB($text);
- e107::getAdminLog()->e_log_event(4, __FILE__."|".__FUNCTION__."@".__LINE__, "LOGIN", $title, $text, FALSE, LOG_TO_ROLLING);
+ e107::getAdminLog()->addEvent(4, __FILE__."|".__FUNCTION__."@".__LINE__, "LOGIN", $title, $text, FALSE, LOG_TO_ROLLING);
$logfp = fopen(e_LOG.'authlog.txt', 'a+'); fwrite($logfp, $title.': '.$text."\n"); fclose($logfp);
*/
@@ -476,7 +476,7 @@ class auth
$text = 'STD: '.$username.' ('.$extra_text.')';
$title = e107::getParser()->toDB($title);
$text = e107::getParser()->toDB($text);
- e107::getAdminLog()->e_log_event(4, __FILE__."|".__FUNCTION__."@".__LINE__, "LOGIN", $title, $text, FALSE, LOG_TO_ROLLING);
+ e107::getAdminLog()->addEvent(4, __FILE__."|".__FUNCTION__."@".__LINE__, "LOGIN", $title, $text, FALSE, LOG_TO_ROLLING);
// $logfp = fopen(e_LOG.'authlog.txt', 'a+'); fwrite($logfp, $title.': '.$text."\n"); fclose($logfp);
*/
diff --git a/e107_admin/banlist.php b/e107_admin/banlist.php
index a916dbe78..c67f986c9 100644
--- a/e107_admin/banlist.php
+++ b/e107_admin/banlist.php
@@ -962,1026 +962,3 @@ require_once(e_ADMIN.'footer.php');
exit;
-
-// Unused code below, but left here for reference.
-
-
-
-$e_sub_cat = 'banlist';
-require_once('auth.php');
-$frm = e107::getForm();
-// $frm = new e_form(true);
-
-$mes = e107::getMessage();
-
-$pref = e107::getPref();
-
-// Set a default to avoid issues with legacy systems
-if (!isset($pref['ban_date_format'])) $pref['ban_date_format'] = '%H:%M %d-%m-%y';
-
-$ipAdministrator = new banlistManager;
-
-// Character options for import & export
-$separator_char = array(1 => ',', 2 => '|');
-$quote_char = array(1 => '(none)', 2 => "'", 3 => '"');
-
-
-$action = 'list';
-if (e_QUERY)
-{
- $tmp = explode('-', e_QUERY); // Use '-' instead of '.' to avoid confusion with IP addresses
- $action = $tmp[0];
- $sub_action = varset($tmp[1], '');
- if ($sub_action) $sub_action = preg_replace('/[^\w*@\.:]*/', '', urldecode($sub_action));
- $id = intval(varset($tmp[2], 0));
- unset($tmp);
-}
-
-if($_GET['action']) // Temporary Fix.
-{
- $action = $_GET['action'];
-}
-
-
-
-
-
-$writeBanFile = FALSE;
-if (isset($_POST['ban_ip']))
-{
- $_POST['ban_ip'] = trim($_POST['ban_ip']);
- $new_ban_ip = preg_replace('/[^\w*@\.:]*/', '', urldecode($_POST['ban_ip']));
- if ($new_ban_ip != $_POST['ban_ip'])
- {
- $message = BANLAN_27.' '.$new_ban_ip;
- //$ns->tablerender(BANLAN_9, $message);
- $mes->add(BANLAN_33, $message);
- $_POST['ban_ip'] = $new_ban_ip;
- }
-
- if (isset($_POST['entry_intent']) && (isset($_POST['add_ban']) || isset($_POST['update_ban'])) && $_POST['ban_ip'] != "" && strpos($_POST['ban_ip'], ' ') === false)
- {
- /* $_POST['entry_intent'] says why we're here:
- 'edit' - Editing blacklist
- 'add' - Adding to blacklist
- 'whedit' - Editing whitelist
- 'whadd' - Adding to whitelist
- */
- if(e107::getIPHandler()->whatIsThis($new_ban_ip) == 'ip')
- {
- $new_ban_ip = e107::getIPHandler()->IPencode($new_ban_ip, TRUE); // Normalise numeric IP addresses (allow wildcards)
- }
- $new_vals = array('banlist_ip' => $new_ban_ip);
- if (isset($_POST['add_ban']))
- {
- $new_vals['banlist_datestamp'] = time();
- if ($_POST['entry_intent'] == 'add') $new_vals['banlist_bantype'] = eIPHandler::BAN_TYPE_MANUAL; // Manual ban
- if ($_POST['entry_intent'] == 'whadd') $new_vals['banlist_bantype'] = eIPHandler::BAN_TYPE_WHITELIST;
- }
- $new_vals['banlist_admin'] = ADMINID;
- $new_vals['banlist_reason'] = $tp->toDB(varset($_POST['ban_reason'], ''));
- $new_vals['banlist_notes'] = $tp->toDB($_POST['ban_notes']);
- if (isset($_POST['ban_time']) && is_numeric($_POST['ban_time']) && (($_POST['entry_intent']== 'edit') || ($_POST['entry_intent'] == 'add')))
- {
- $bt = intval($_POST['ban_time']);
- $new_vals['banlist_banexpires'] = $bt ? time() + ($bt*60*60) : 0;
- }
- if (isset($_POST['add_ban']))
- { // Insert new value - can just pass an array
- e107::getMessage()->addAuto($sql->db_Insert('banlist', $new_vals), 'insert');
- if ($_POST['entry_intent'] == 'add')
- {
- banlist_adminlog('01', $new_vals['banlist_ip']); // Write to banlist
- }
- else
- {
- banlist_adminlog('04', $new_vals['banlist_ip']); // Write to whitelist
- }
- }
- else
- { // Update existing value
- $qry = '';
- $spacer = '';
- foreach ($new_vals as $k => $v)
- {
- $qry .= $spacer."`{$k}`='$v'";
- $spacer = ', ';
- }
- e107::getMessage()->addAuto($sql->db_Update('banlist', $qry." WHERE banlist_ip='".$_POST['old_ip']."'"));
- if ($_POST['entry_intent'] == 'edit')
- {
- banlist_adminlog('09',$new_vals['banlist_ip']);
- }
- else
- {
- banlist_adminlog('10',$new_vals['banlist_ip']);
- }
- }
- unset($ban_ip);
- $writeBanFile = TRUE;
- }
-}
-
-
-
-// Remove a ban
-if (($action == 'remove' || $action == 'whremove') && isset($_POST['ban_secure']))
-{
- $sql->db_Delete('generic', "gen_type='failed_login' AND gen_ip='{$sub_action}'");
- e107::getMessage()->addAuto($sql->db_Delete('banlist', "banlist_ip='{$sub_action}'"), 'delete');
- if ($action == "remove")
- {
- $action = 'list';
- banlist_adminlog('02', $sub_action);
- }
- else
- {
- $action = 'white';
- banlist_adminlog('05', $sub_action);
- }
- $writeBanFile = TRUE;
-}
-
-
-
-// Update the ban expiry time/date - timed from now (only done on banlist)
-if ($action == 'newtime')
-{
- $end_time = $id ? time() + ($id*60*60) : 0;
- e107::getMessage()->addAuto($sql->db_Update('banlist', 'banlist_banexpires='.intval($end_time)." WHERE banlist_ip='".$sub_action."'"));
- banlist_adminlog('03', $sub_action);
- $action = 'list';
- $writeBanFile = TRUE;
-}
-
-
-if ($writeBanFile)
-{
-/************************************************
- update list of banned IPs
-*************************************************/
- $ipAdministrator->writeBanListFiles('ip,htaccess');
- if (!$ipAdministrator->doesMessageFileExist())
- {
- $ipAdministrator->writeBanMessageFile(); // Message file must exist - may not on fresh site
- banlist_adminlog('08','');
- $mes->addSuccess(LAN_UPDATED);
- }
-}
-
-
-
-/**
- * @todo - eliminate extract();
- */
-// Edit modes - get existing entry
-if ($action == 'edit' || $action == 'whedit')
-{
- $sql->select('banlist', '*', "banlist_ip='{$sub_action}'");
- $row = $sql->fetch();
- extract($row); //FIXME - kill extract()
-}
-else
-{
- unset($banlist_ip, $banlist_reason);
- if (e_QUERY && ($action == 'add' || $action == 'whadd') && strpos($_SERVER["HTTP_REFERER"], "userinfo"))
- {
- $banlist_ip = $sub_action;
- }
-}
-
-
-
-/**
- * Create dropdown with options for ban time - uses internal fixed list of reasonable values
- */
-function ban_time_dropdown($click_js = '', $zero_text = LAN_NEVER, $curval = -1, $drop_name = 'ban_time')
-{
- $frm = e107::getForm();
- $intervals = array(0, 1, 2, 3, 6, 8, 12, 24, 36, 48, 72, 96, 120, 168, 336, 672);
-
- $ret = $frm->select_open($drop_name, array('other' => $click_js, 'id' => false));
- $ret .= $frm->option(' ', '');
- foreach ($intervals as $i)
- {
- if ($i == 0)
- {
- $words = $zero_text ? $zero_text : LAN_NEVER;
- }
- elseif (($i % 24) == 0)
- {
- $words = floor($i / 24).' '.BANLAN_23;
- }
- else
- {
- $words = $i.' '.BANLAN_24;
- }
- $ret .= $frm->option($words, $i, ($curval == $i));
- }
- $ret .= '';
- return $ret;
-}
-
-
-
-
-/**
- * Create generic dropdown from array of data
- */
-function select_box($name, $data, $curval = FALSE)
-{
- global $frm;
-
- $ret = $frm->select_open($name, array('class' => 'tbox', 'id' => false));
- foreach ($data as $k => $v)
- {
- $ret .= $frm->option($v, $k, ($curval !== FALSE) && ($curval == $k));
- }
- $ret .= "\n";
- return $ret;
-}
-
-
-
-/**
- * Create dropdown with options for access counts before ban - uses internal fixed list of reasonable values
- */
-function drop_box($box_name, $curval)
-{
- global $frm;
-
- $opts = array(50, 100, 150, 200, 250, 300, 400, 500);
- $ret = $frm->select_open($box_name, array('class' => 'tbox'));
- foreach ($opts as $o)
- {
- $ret .= $frm->option($o, $o, ($curval == $o));
- }
- $ret .= "\n";
- return $ret;
-}
-
-
-
-$text = '';
-
-
-switch ($action)
-{
- case 'banlog' :
- if(!getperms('0')) exit;
- if (isset($_POST['delete_ban_log']))
- {
- $message = ($ipAdministrator->deleteLogFile() ? BANLAN_89 : BANLAN_90);
- e107::getRender()->tablerender(BANLAN_88, "
".$message."
"); // FIXME
- }
- $from = 0;
- $amount = 20; // Number per page - could make configurable later if required
- if ($sub_action) $from = intval($sub_action);
-
-// @todo format form the 0.8 way
- $text = "";
-
- if (count($banLogEntries))
- {
- $text .= " ".str_replace('[y]', $num_entry, BANLAN_87);
- }
-
- echo $text;
- // e107::getRender()->tablerender(BANLAN_16.SEP.BANLAN_86, $text);
- break;
-
-
- case 'options' :
- if (!getperms('0'))
- exit();
- if (isset($_POST['update_ban_options']))
- {
- $pref['enable_rdns'] = intval($_POST['ban_rdns_on_access']);
- $pref['enable_rdns_on_ban'] = intval($_POST['ban_rdns_on_ban']);
- $pref['ban_max_online_access'] = intval($_POST['ban_access_guest']).','.intval($_POST['ban_access_member']);
- $pref['ban_retrigger'] = intval($_POST['ban_retrigger']);
- $pref['ban_date_format'] = $tp->toDB($_POST['ban_date_format']);
- save_prefs(); // @todo FIXME log detail of changes. Right prefs to use?
- $mes->addSuccess(LAN_SETSAVED);
- }
-
- if (isset($_POST['remove_expired_bans']))
- {
- $result = $sql->db_Delete('banlist',"`banlist_bantype` < ".eIPHandler::BAN_TYPE_WHITELIST." AND `banlist_banexpires` > 0 AND `banlist_banexpires` < ".time());
- banlist_adminlog('12', $result);
- $mes->addSuccess(str_replace('[y]', $result, BANLAN_48));
- }
-
- list($ban_access_guest, $ban_access_member) = explode(',', varset($pref['ban_max_online_access'], '100,200'));
- $ban_access_member = max($ban_access_guest, $ban_access_member);
- $text = "
-
- ";
-
- echo $mes->render().$text;
-
- // e107::getRender()->tablerender(BANLAN_16.SEP.LAN_OPTIONS, $mes->render().$text);
- break;
-
- case 'times' :
-
-
- // e107::getRender()->tablerender(BANLAN_16.SEP.BANLAN_77, $mes->render().$text);
- break;
-
- case 'edit' : // Edit an existing ban
- case 'add' : // Add a new ban
- case 'whedit' : // Edit existing whitelist entry
- case 'whadd' : // Add a new whitelist entry
-
- if(!E107_DEBUG_LEVEL)
- {
- break;
- }
- RETURN;
-
- if (!isset($banlist_reason)) $banlist_reason = '';
- if (!isset($banlist_ip)) $banlist_ip = '';
- if (!isset($banlist_notes)) $banlist_notes = '';
-
- $page_title = array('edit' => BANLAN_60, 'add' => BANLAN_9, 'whedit' => BANLAN_59, 'whadd' => BANLAN_58);
- $rdns_warn = vartrue($pref['enable_rdns']) ? '' : ''.BANLAN_12.'
';
- $next = ($action == 'whedit' || $action == 'whadd') ? '?white' : '?list';
- // Edit/add form first
- $text .= "
-
- ";
-
- echo $mes->render().$text;
- // e107::getRender()->tablerender($page_title[$action], $mes->render().$text);
- break; // End of 'Add' and 'Edit'
-
-
- case 'transfer' :
- $message = '';
- $error = false;
- if (isset($_POST['ban_import']))
- { // Got a file to import
- require_once(e_HANDLER.'upload_handler.php');
- if (($files = process_uploaded_files(e_UPLOAD, FALSE, array('overwrite' => TRUE, 'max_file_count' => 1, 'file_mask' => 'csv'))) === FALSE)
- { // Invalid file
- $error = true;
- $mes->addError(BANLAN_47);
- }
- if(empty($files) || vartrue($files[0]['error']))
- {
- $error = true;
- if(varset($files[0]['message']))
- $mes->addError($files[0]['message']);
- }
- if(!$error)
- { // Got a file of some sort
- $message = process_csv(e_UPLOAD.$files[0]['name'],
- intval(varset($_POST['ban_over_import'], 0)),
- intval(varset($_POST['ban_over_expiry'], 0)),
- $separator_char[intval(varset($_POST['ban_separator'], 1))],
- $quote_char[intval(varset($_POST['ban_quote'], 3))]);
- banlist_adminlog('07', 'File: '.e_UPLOAD.$files[0]['name'].' '.$message);
- }
-
- }
-
- $text = "
-
- ";
-
- // Now do the import options
- $text .= "
-
- ";
-
- echo $mes->render().$text;
- // e107::getRender()->tablerender(BANLAN_16.SEP.BANLAN_35, $mes->render().$text);
- break; // End case 'transfer'
-
- case 'list' :
- case 'white' :
- default :
-
- if(!E107_DEBUG_LEVEL)
- {
- break;
- }
-
- if (($action != 'list') && ($action != 'white'))
- $action = 'list';
-
- $edit_action = ($action == 'list' ? 'edit' : 'whedit');
- $del_action = ($action == 'list' ? 'remove' : 'whremove');
- $col_widths = array('list' => array(10, 5, 35, 30, 10, 10), 'white' => array(15, 40, 35, 10));
- $col_titles = array('list' => array(BANLAN_17, BANLAN_20, BANLAN_10, BANLAN_19, BANLAN_18, LAN_OPTIONS),
- 'white' => array(BANLAN_55, BANLAN_56, BANLAN_19, LAN_OPTIONS));
- $no_values = array('list' => BANLAN_2, 'white' => BANLAN_54);
- $col_defs = array('list' => array('banlist_datestamp' => 0, 'banlist_bantype' => 0, 'ip_reason' => BANLAN_7, 'banlist_notes' => 0, 'banlist_banexpires' => 0, 'ban_options' => 0),
- 'white' => array('banlist_datestamp' => 0, 'ip_reason' => BANLAN_57, 'banlist_notes' => 0, 'ban_options' => 0));
-
- $text = "
-
- ";
-
- echo $mes->render().$text;
- // e107::getRender()->tablerender(($action == 'list' ? BANLAN_3 : BANLAN_61), $mes->render().$text);
- // End of case 'list' and the default case
-} // End switch ($action)
-
-
-require_once(e_ADMIN.'footer.php');
-
-
-/**
- * Admin menu options
- */
-function banlist_adminmenu()
-{
- $action = (e_QUERY) ? e_QUERY : 'list';
-
- $var['list']['text'] = BANLAN_14; // List existing bans
- $var['list']['link'] = e_SELF.'?list';
- $var['list']['perm'] = '4';
-
- $var['add']['text'] = BANLAN_25; // Add a new ban
- $var['add']['link'] = e_SELF.'?add';
- $var['add']['perm'] = '4';
-
- $var['white']['text'] = BANLAN_52; // List existing whitelist entries
- $var['white']['link'] = e_SELF.'?white';
- $var['white']['perm'] = '4';
-
- $var['whadd']['text'] = BANLAN_53; // Add a new whitelist entry
- $var['whadd']['link'] = e_SELF.'?whadd';
- $var['whadd']['perm'] = '4';
-
- $var['transfer']['text'] = BANLAN_35;
- $var['transfer']['link'] = e_SELF.'?transfer';
- $var['transfer']['perm'] = '4';
-
- if (getperms('0'))
- {
- $var['times']['text'] = BANLAN_15;
- $var['times']['link'] = e_SELF.'?times';
- $var['times']['perm'] = '0';
-
- $var['options']['text'] = LAN_OPTIONS;
- $var['options']['link'] = e_SELF.'?options';
- $var['options']['perm'] = '0';
-
- $var['banlog']['text'] = BANLAN_81;
- $var['banlog']['link'] = e_SELF.'?banlog';
- $var['banlog']['perm'] = '0';
- }
- e107::getNav()->admin(BANLAN_16, $action, $var);
-}
-
-
-
-// Parse the date string used by the import/export - YYYYMMDD_HHMMSS
-function parse_date($instr)
-{
- if (strlen($instr) != 15)
- return 0;
- return mktime(substr($instr, 9, 2), substr($instr, 11, 2), substr($instr, 13, 2), substr($instr, 4, 2), substr($instr, 6, 2), substr($instr, 0, 4));
-}
-
-
-
-// Process the imported CSV file, update the database, delete the file.
-// Return a message
-function process_csv($filename, $override_imports, $override_expiry, $separator = ',', $quote = '"')
-{
- $sql = e107::getDb();
- $pref['ban_durations'] = e107::getPref('ban_durations');
- $mes = e107::getMessage();
-
- // echo "Read CSV: {$filename} separator: {$separator}, quote: {$quote} override imports: {$override_imports} override expiry: {$override_expiry} ";
- // Renumber imported bans
- if ($override_imports)
- $sql->update('banlist', "`banlist_bantype`=".eIPHandler::BAN_TYPE_TEMPORARY." WHERE `banlist_bantype` = ".eIPHandler::BAN_TYPE_IMPORTED);
- $temp = file($filename);
- $line_num = 0;
- foreach ($temp as $line)
- { // Process one entry
- $line = trim($line);
- $line_num++;
- if ($line)
- {
- $fields = explode($separator, $line);
- $field_num = 0;
- $field_list = array('banlist_bantype' => eIPHandler::BAN_TYPE_IMPORTED);
- foreach ($fields as $f)
- {
- $f = trim($f);
- if (substr($f, 0, 1) == $quote)
- {
- if (substr($f, -1, 1) == $quote)
- { // Strip quotes
- $f = substr($f, 1, -1); // Strip off the quotes
- }
- else
- {
- $mes->addError(BANLAN_49.$line_num);
- return BANLAN_49.$line_num;
- }
- }
- // Now handle the field
- $field_num++;
- switch ($field_num)
- {
- case 1 : // IP address
- $field_list['banlist_ip'] = e107::getIPHandler()->ipEncode($f);
- break;
- case 2 : // Original date of ban
- $field_list['banlist_datestamp'] = parse_date($f);
- break;
- case 3 : // Expiry of ban - depends on $override_expiry
- if ($override_expiry)
- {
- $field_list['banlist_banexpires'] = parse_date($f);
- }
- else
- { // Use default ban time from now
- $field_list['banlist_banexpires'] = $pref['ban_durations'][eIPHandler::BAN_TYPE_IMPORTED] ? time() + (60*60*$pref['ban_durations'][eIPHandler::BAN_TYPE_IMPORTED]) : 0;
- }
- break;
- case 4 : // Original ban type - we always ignore this and force to 'imported'
- break;
- case 5 : // Ban reason originally generated by E107
- $field_list['banlist_reason'] = $f;
- break;
- case 6 : // Any user notes added
- $field_list['banlist_notes'] = $f;
- break;
- default : // Just ignore any others
- }
- }
- $qry = "REPLACE INTO `#banlist` (".implode(',', array_keys($field_list)).") values ('".implode("', '", $field_list)."')";
- // echo count($field_list)." elements, query: ".$qry." ";
- if (!$sql->gen($qry))
- {
- $mes->addError(BANLAN_50.$line_num);
- return BANLAN_50.$line_num;
- }
- }
- }
- // Success here - may need to delete old imported bans
- if ($override_imports)
- $sql->delete('banlist', "`banlist_bantype` = ".eIPHandler::BAN_TYPE_TEMPORARY);
- @unlink($filename); // Delete file once done
- $mes->addSuccess(str_replace('[y]', $line_num, BANLAN_51).$filename);
- return str_replace('[y]', $line_num, BANLAN_51).$filename;
-}
-
-
-
-/**
- * Log event to admin log
- *
- * @param string $msg_num - exactly two numeric characters corresponding to a log message
- * @param string $woffle - information for the body of the log entre
- *
- * @return none
- */
-function banlist_adminlog($msg_num = '00', $woffle = '')
-{
- e107::getAdminLog()->log_event('BANLIST_'.$msg_num, $woffle, E_LOG_INFORMATIVE, '');
-}
-
-
-/**
- * Handle page DOM within the page header
- *
- * @return string JS source
- */
-function headerjs()
-{
-/*
- require_once(e_HANDLER.'js_helper.php');
- $ret = "
-
-
- ";
-
- return $ret;
-
-*/
-}
-
-require_once(e_ADMIN."footer.php");
-exit;
-?>
diff --git a/e107_admin/banlist_export.php b/e107_admin/banlist_export.php
index 96f107fba..fb89f612b 100644
--- a/e107_admin/banlist_export.php
+++ b/e107_admin/banlist_export.php
@@ -135,7 +135,7 @@ function do_export($filename, $type_list='',$format_array=array(), $sep = ',', $
// Log event to admin log
function banlist_adminlog($msg_num='00', $woffle='')
{
- e107::getAdminLog()->log_event('BANLIST_'.$msg_num, $woffle, E_LOG_INFORMATIVE, '');
+ e107::getAdminLog()->add('BANLIST_'.$msg_num, $woffle, E_LOG_INFORMATIVE, '');
}
diff --git a/e107_admin/frontpage.php b/e107_admin/frontpage.php
index 2d4d06937..456907a5f 100644
--- a/e107_admin/frontpage.php
+++ b/e107_admin/frontpage.php
@@ -716,7 +716,7 @@ require_once(e_ADMIN.'footer.php');
*/
function frontpage_adminlog($msg_num = '00', $woffle = '')
{
- e107::getAdminLog()->log_event('FRONTPG_'.$msg_num, $woffle, E_LOG_INFORMATIVE, '');
+ e107::getAdminLog()->add('FRONTPG_'.$msg_num, $woffle, E_LOG_INFORMATIVE, '');
}
diff --git a/e107_admin/image.php b/e107_admin/image.php
index 4f3168ae5..b6b30699e 100644
--- a/e107_admin/image.php
+++ b/e107_admin/image.php
@@ -2918,7 +2918,7 @@ class media_admin_ui extends e_admin_ui
{
if(!$sc_path) return array();
$path = e107::getParser()->replaceConstants($sc_path);
- $info = e107::getFile()->get_file_info($path,true);
+ $info = e107::getFile()->getFileInfo($path,true);
return array(
'media_type' => $info['mime'],
'media_datestamp' => time(),
@@ -3042,7 +3042,7 @@ class media_admin_ui extends e_admin_ui
{
$mes = e107::getMessage();
$tp = e107::getParser();
- $f = e107::getFile()->get_file_info($oldpath,TRUE);
+ $f = e107::getFile()->getFileInfo($oldpath,TRUE);
$mes->addDebug("checkDupe(): newpath=".$newpath." oldpath=".$oldpath." ".print_r($newpath,TRUE));
if(file_exists($newpath) || e107::getDb()->select("core_media","*","media_url = '".$tp->createConstants($newpath,'rel')."' LIMIT 1") )
@@ -3399,7 +3399,7 @@ class media_admin_ui extends e_admin_ui
}
// End Resize routine. ---------------------
- $f = $fl->get_file_info($oldpath);
+ $f = $fl->getFileInfo($oldpath);
if(!$f['mime'])
{
@@ -3510,27 +3510,21 @@ class media_admin_ui extends e_admin_ui
$mes = e107::getMessage();
$tmp = array();
- $tmp['image_post'] = intval($_POST['image_post']);
- $tmp['resize_method'] = $tp->toDB($_POST['resize_method']);
- $tmp['im_path'] = trim($tp->toDB($_POST['im_path']));
- $tmp['image_post_class'] = intval($_POST['image_post_class']);
- $tmp['image_post_disabled_method'] = intval($_POST['image_post_disabled_method']);
- $tmp['enable_png_image_fix'] = intval($_POST['enable_png_image_fix']);
+ $tmp['image_post'] = (int) $_POST['image_post'];
+ $tmp['resize_method'] = $tp->toDB($_POST['resize_method']);
+ $tmp['im_path'] = trim($tp->toDB($_POST['im_path']));
+ $tmp['image_post_class'] = (int) $_POST['image_post_class'];
+ $tmp['image_post_disabled_method'] = (int) $_POST['image_post_disabled_method'];
+ $tmp['enable_png_image_fix'] = (int) $_POST['enable_png_image_fix'];
if($_POST['img_import_resize_w'] && $_POST['img_import_resize_h'])
{
$tmp['img_import_resize'] = intval($_POST['img_import_resize_w'])."x".intval($_POST['img_import_resize_h']);
- }
-
- if ($admin_log->logArrayDiffs($tmp, $pref, 'IMALAN_04'))
- {
- save_prefs(); // Only save if changes
- $mes->add(IMALAN_9, E_MESSAGE_SUCCESS);
}
- else
- {
- $mes->add(IMALAN_20, E_MESSAGE_INFO);
- }
+
+ e107::getConfig()->setPref($tmp)->save(true,true,true);
+
+
}
diff --git a/e107_admin/mailout.php b/e107_admin/mailout.php
index 80d5f6c28..11e1fb410 100644
--- a/e107_admin/mailout.php
+++ b/e107_admin/mailout.php
@@ -624,7 +624,7 @@ class mailout_main_ui extends e_admin_ui
else
{
$mes->addSuccess(LAN_MAILOUT_81. ' ('.$sendto.')');
- e107::getAdminLog()->log_event('MAIL_01', $sendto, E_LOG_INFORMATIVE,'');
+ e107::getAdminLog()->add('MAIL_01', $sendto, E_LOG_INFORMATIVE,'');
}
@@ -750,7 +750,7 @@ class mailout_main_ui extends e_admin_ui
if ($this->mailAdmin->activateEmail($mailId, FALSE, $notify, $first, $last))
{
e107::getMessage()->addSuccess(LAN_MAILOUT_185);
- $log->log_event('MAIL_06','ID: '.$mailId,E_LOG_INFORMATIVE,'');
+ $log->add('MAIL_06','ID: '.$mailId,E_LOG_INFORMATIVE,'');
}
else
{
diff --git a/e107_admin/plugin.php b/e107_admin/plugin.php
index e1dc06a74..49626d3da 100755
--- a/e107_admin/plugin.php
+++ b/e107_admin/plugin.php
@@ -367,7 +367,7 @@ class plugin_ui extends e_admin_ui
// $name = deftrue($info['plugin_name'],$info['plugin_name']). " v".$info['plugin_version']. "({e_PLUGIN}".$info['plugin_path'].")";
- // $log->log_event('PLUGMAN_01', $name, E_LOG_INFORMATIVE, '');
+ // $log->add('PLUGMAN_01', $name, E_LOG_INFORMATIVE, '');
// make sure ALL plugin/addon pref lists get update and are current
e107::getPlug()->clearCache()->buildAddonPrefLists();
@@ -2804,7 +2804,7 @@ class pluginManager{
$name = deftrue($info['plugin_name'],$info['plugin_name']). " v".$info['plugin_version']. "({e_PLUGIN}".$info['plugin_path'].")";
- $log->log_event('PLUGMAN_01', $name, E_LOG_INFORMATIVE, '');
+ $log->add('PLUGMAN_01', $name, E_LOG_INFORMATIVE, '');
$this->show_message($text, E_MESSAGE_SUCCESS);
}
diff --git a/e107_admin/prefs.php b/e107_admin/prefs.php
index 2b5be4b03..d98962cab 100644
--- a/e107_admin/prefs.php
+++ b/e107_admin/prefs.php
@@ -291,7 +291,7 @@ function sendTest()
else
{
$mes->addSuccess(LAN_MAILOUT_81. ' ('.$sendto.')');
- $log->log_event('MAIL_01',$sendto,E_LOG_INFORMATIVE,'');
+ $log->add('MAIL_01',$sendto,E_LOG_INFORMATIVE,'');
}
}
diff --git a/e107_admin/themeold.php b/e107_admin/themeold.php
deleted file mode 100644
index 5411ac37f..000000000
--- a/e107_admin/themeold.php
+++ /dev/null
@@ -1,925 +0,0 @@
-getMarketplace();
- echo $mp->renderLoginForm();
- exit;
- break;
-
- /*
- case 'download':
- $string = base64_decode($_GET['src']);
- parse_str($string, $p);
- $mp = $themec->getMarketplace();
- $mp->generateAuthKey($e107SiteUsername, $e107SiteUserpass);
- // Server flush useless. It's ajax ready state 4, we can't flush (sadly) before that (at least not for all browsers)
- echo "Connecting...\n"; flush();
- // download and flush
- $mp->download($p['id'], $p['mode'], $p['type']);
- echo " "; flush();
- exit;
- break;
- */
-
- case 'info':
- if(!empty($_GET['src']))
- {
- $string = base64_decode($_GET['src']);
- parse_str($string,$p);
- $themeInfo = e107::getSession()->get('thememanager/online/'.intval($p['id']));
- echo $themec->renderThemeInfo($themeInfo);
- }
- break;
-
- case 'preview':
- // Theme Info Ajax
- $tm = (string) $_GET['id'];
- $data = $themec->getThemeInfo($tm);
- echo $themec->renderThemeInfo($data);
- // exit;
- break;
-
- }
-/*
- if(vartrue($_GET['src'])) // Process Theme Download.
- {
- $string = base64_decode($_GET['src']);
- parse_str($string,$p);
-
- if(vartrue($_GET['info']))
- {
- echo $themec->renderThemeInfo($p);
- // print_a($p);
- exit;
- }
-
- $remotefile = $p['url'];
-
- e107::getFile()->download($remotefile,'theme');
- exit;
-
- }
-*/
- // Theme Info Ajax
- // FIXME addd action=preview to the url, remove this block
- if(!empty($_GET['id']))
- {
- $tm = (string) $_GET['id'];
- $data = $themec->getThemeInfo($tm);
- echo $themec->renderThemeInfo($data);
- }
-
- require_once(e_ADMIN."footer.php");
- exit;
-
-}
-else
-{
- require_once("auth.php");
-
- /*
- echo '
-
- ';
- */
-}
-
-
-
-
-
-
-
-if($mode == 'download' && !empty($_GET['src']))
-{
- define('e_IFRAME', true);
- $frm = e107::getForm();
- $mes = e107::getMessage();
- $string = base64_decode($_GET['src']);
- parse_str($string, $data);
-
- if(!empty($data['price']))
- {
- e107::getRedirect()->go($data['url']);
- return true;
- }
-
- if(deftrue('e_DEBUG_MARKETPLACE'))
- {
- echo "DEBUG MODE ACTIVE (no downloading) ";
- echo '$_GET: ';
- print_a($_GET);
-
- echo 'base64 decoded and parsed as $data:';
- print_a($data);
- return false;
- }
-
-
- $mp = $themec->getMarketplace();
- $mes->addSuccess(TPVLAN_85);
-
- if($mp->download($data['id'], $data['mode'], 'theme')) // download and unzip theme.
- {
- // Auto install?
- // $text = e107::getPlugin()->install($data['plugin_folder']);
- // $mes->addInfo($text);
- echo $mes->render('default', 'success');
- e107::getTheme()->clearCache();
- }
- else
- {
- echo $mes->addError('Unable to continue')->render('default', 'error');
- }
-
- echo $mes->render('default', 'debug');
-
-}
-elseif(!empty($_POST['selectadmin']))
-{
- $mode = "admin";
-}
-
-if(!empty($_POST['upload']))
-{
- $mode = "upload";
-}
-elseif(!empty($_POST['selectmain']) || isset($_POST['setUploadTheme']))
-{
- $mode = "main";
-}
-
-if($mode == 'convert')
-{
- new theme_builder;
-}
-else
-{
- $themec -> showThemes($mode);
-}
-
-
-
-// Launch demo modal
-
-
-
-
-require_once("footer.php");
-
-function theme_adminmenu()
-{
- //global $mode;
-
- $mode = varset($_GET['mode'],'main');
-
- // $e107 = &e107::getInstance();
-
- $var['main']['text'] = TPVLAN_33;
- $var['main']['link'] = e_SELF;
-
- $var['admin']['text'] = TPVLAN_34;
- $var['admin']['link'] = e_SELF."?mode=admin";
-
- $var['choose']['text'] = TPVLAN_51;
- $var['choose']['link'] = e_SELF."?mode=choose";
-
- $var['online']['text'] = TPVLAN_62;
- $var['online']['link'] = e_SELF."?mode=online";
-
- $var['upload']['text'] = TPVLAN_38;
- $var['upload']['link'] = e_SELF."?mode=upload";
-
- $var['convert']['text'] = ADLAN_CL_6;
- $var['convert']['link'] = e_SELF."?mode=convert";
-
- // $selected = (e_QUERY) ? e_QUERY : "main";
- $icon = e107::getParser()->toIcon('e-themes-24');
- $caption = $icon."".TPVLAN_26." ";
-
-
- e107::getNav()->admin($caption, $mode, $var);
-}
-
-class theme_builder
-{
- var $themeName = "";
- var $remove = array();
-
- function __construct()
- {
-
- $ns = e107::getRender();
- $tp = e107::getParser();
-
- e107::getMessage()->addDebug("Disable debug to save generated files. ");
-
-
- $this->themeName = $tp->filter($_GET['newtheme'],'w');
-
- if(!empty($_GET['src']))
- {
- $this->themeSrc = $tp->filter($_GET['src'],'w');
- $this->copyTheme();
- /* $src = $tp->filter($_GET['src'],'w');
- $name = $tp->filter($_GET['f']);
- $title = $tp->filter($_GET['t']);
-
- $this->copyTheme($src,$name,$title);*/
-
- }
-
-
-
- if(vartrue($_GET['step']) == 3)
- {
- $this->step3();
- return;
- }
-
- if(vartrue($_GET['step']) == 2)
- {
- $this->step2();
- }
- else
- {
- $ret = $this->step1();
- $ret2 = $this->copyThemeForm();
-
- $tabs = array(
- 0 => array('caption'=>$ret['caption'], 'text'=>$ret['text']),
- 1 => array('caption'=>$ret2['caption'], 'text'=>$ret2['text']),
-
- );
-
- $ns->tablerender(ADLAN_140.SEP.ADLAN_CL_6,e107::getForm()->tabs($tabs));
- }
-
-
-
-
-
- }
-
- function step1()
- {
-
- $fl = e107::getFile();
- $frm = e107::getForm();
- $ns = e107::getRender();
- $mes = e107::getMessage();
-
- $plugFolders = $fl->get_dirs(e_THEME);
- foreach($plugFolders as $dir)
- {
- if(file_exists(e_THEME.$dir."/theme.xml") || $dir == 'templates')
- {
- continue;
- }
- $newDir[$dir] = $dir;
- }
-
- $mes->addInfo(' '.TPVLAN_64.'
- '.TPVLAN_65.'
-
- '.TPVLAN_66.'
- '.TPVLAN_67.'
-
- ');
-
- $text = $frm->open('createPlugin','get',e_SELF."?mode=convert");
- $text .= "
-
- ".$frm->admin_button('step', 2,'other',LAN_GO)."
-
";
-
- $text .= $frm->close();
-
- return array('caption'=>TPVLAN_88, 'text'=>$mes->render() . $text);
-
- $ns->tablerender(TPVLAN_26.SEP.TPVLAN_88.SEP. TPVLAN_CONV_1, $mes->render() . $text);
-
- }
-
- function step2()
- {
- $ns = e107::getRender();
- $mes = e107::getMessage();
- $frm = e107::getForm();
-
-
-
-
- $data = array(
- 'main' => array('name','lang','version','date', 'compatibility'),
- 'author' => array('name','url'),
- 'summary' => array('summary'),
- 'description' => array('description'),
-
- 'keywords' => array('one','two'),
- 'category' => array('category'),
- 'livedemo' => array('livedemo'),
- 'copyright' => array('copyright'),
- 'stylesheets' => array('stylesheets')
- // 'adminLinks' => array('url','description','icon','iconSmall','primary'),
- // 'sitelinks' => array('url','description','icon','iconSmall')
- );
-
- $legacyFile = e_THEME.$this->themeName."/theme.php";
-
-
-
- $newThemeXML = e_THEME.$this->themeName."/theme.xml";
- if(file_exists($newThemeXML))
- {
- $info = e107::getTheme()->getThemeInfo($this->themeName);
-
- e107::getDebug()->log($info);
-
- if($this->themeSrc) // New theme copied from another
- {
- $defaults = array(
- "main-name" => ucfirst($this->themeName),
- 'category-category' => vartrue($info['category']),
- );
- }
- else
- {
- $defaults = array(
- "main-name" => vartrue($info['name']),
- "main-date" => vartrue($info['date']),
- "main-version" => vartrue($info['version']),
- "author-name" => vartrue($info['author']),
- "author-url" => vartrue($info['website']),
- "description-description" => vartrue($info['description']),
- "summary-summary" => vartrue($info['summary']),
- 'category-category' => vartrue($info['category']),
- // "custompages" => vartrue($leg['CUSTOMPAGES']),
- );
- }
-
- if(!empty($info['keywords']['word']))
- {
- $defaults['keywords-one'] = $info['keywords']['word'][0];
- $defaults['keywords-two'] = $info['keywords']['word'][1];
- }
-
- }
- elseif(file_exists($legacyFile))
- {
- $legacyData = file_get_contents($legacyFile);
-
- $regex = '/\$([\w]*)\s*=\s*("|\')([\w @.\/:<\>,\'\[\] !()]*)("|\');/im';
- preg_match_all($regex, $legacyData, $matches);
-
- $leg = array();
-
- foreach($matches[1] as $i => $m)
- {
- $leg[$m] = strip_tags($matches[3][$i]);
- if(substr($m,0,5) == 'theme' || $m == "CUSTOMPAGES")
- {
- $search[] = $matches[0][$i];
- }
- }
-
- $defaults = array(
- "main-name" => vartrue($leg['themename']),
- "author-name" => vartrue($leg['themeauthor']),
- "author-url" => vartrue($leg['themewebsite']),
- "description-description" => '',
- "summary-summary" => vartrue($leg['themeinfo']),
- "custompages" => vartrue($leg['CUSTOMPAGES']),
- );
-
- $search[] = "Steve Dunstan";
- $search[] = "jalist@e107.org";
-
- $_SESSION['themebulder-remove'] = $search;
-
- $mes->addInfo("Loading theme.php file");
- }
-
- $text = $frm->open('newtheme-step3','post', e_SELF.'?mode=convert&src='.$this->themeSrc.'&newtheme='.$this->themeName.'&step=3');
- $text .= "";
- foreach($data as $key=>$val)
- {
- $text.= "$key
- ";
- foreach($val as $type)
- {
- $nm = $key.'-'.$type;
- $name = "xml[$nm]";
- $size = (count($val)==1) ? 'col-md-7' : 'col-md-2';
- $text .= "
".$this->xmlInput($name, $key."-". $type, vartrue($defaults[$nm]))."
";
- }
-
- $text .= "
";
-
-
- }
-
-
- $text .= "
";
- $text .= "
- "
- .$frm->hidden('newtheme', $this->themeName);
- $text .= $frm->hidden('xml[custompages]', trim(vartrue($leg['CUSTOMPAGES'])))
- .$frm->admin_button('step', 3,'other',LAN_GENERATE)."
-
";
-
- $text .= $frm->close();
-
- // return array('caption'=>TPVLAN_88.SEP. TPVLAN_CONV_2, 'text'=>$mes->render() . $text);
-
- $ns->tablerender(TPVLAN_26.SEP.ADLAN_CL_6.SEP. TPVLAN_CONV_2, $mes->render() . $text);
- }
-
-
- function step3()
- {
- $ns = e107::getRender();
- $mes = e107::getMessage();
-
- // print_a($_POST);
-
- if(!empty($_POST['xml']))
- {
- $xmlText = $this->createXml($_POST['xml']);
- $ns->tablerender("theme.xml", $mes->render(). "".$xmlText." ");
- }
-
-
- $legacyFile = e_THEME.$this->themeName."/theme.php";
- if(file_exists($legacyFile) && empty($this->themeSrc))
- {
- $legacyData = file_get_contents($legacyFile);
- $legacyData = e107::getTheme()->upgradeThemeCode($legacyData);
-
- $output = nl2br(htmlentities($legacyData));
-
- $ns->tablerender("theme.php (updated)", $output);
- }
-
-
- }
-
-
-
-
- function createXml($data)
- {
- $ns = e107::getRender();
- $mes = e107::getMessage();
- $tp = e107::getParser();
-
- foreach($data as $key=>$val)
- {
- $key = strtoupper(str_replace("-","_",$key));
- $newArray[$key] = $val;
- }
-
- if(!empty($newArray['CUSTOMPAGES']))
- {
- $newArray['CUSTOMPAGES'] = trim($newArray['CUSTOMPAGES']);
- $LAYOUTS = "\n\n";
- $LAYOUTS .= " {CUSTOMPAGES} \n";
- $LAYOUTS .= " ";
- }
- else
- {
- $LAYOUTS = "";
- }
-
- if(!empty($newArray['STYLESHEETS_STYLESHEETS']))
- {
- $STYLESHEETS = '';
- foreach($newArray['STYLESHEETS_STYLESHEETS'] as $val)
- {
- if(empty($val['file']))
- {
- continue;
- }
-
- $STYLESHEETS .= "\t\t \n";
- }
-
- if(!empty($STYLESHEETS))
- {
- $STYLESHEETS = "\n\t\n".$STYLESHEETS."\t ";
- }
-
- unset($newArray['STYLESHEETS_STYLESHEETS']);
- }
- else
- {
- $STYLESHEETS = "";
- }
-
- $newArray['STYLESHEETS'] = $STYLESHEETS;
-
- // print_a($newArray);
-
-
-$template = <<
-
-
- {SUMMARY_SUMMARY}
- {DESCRIPTION_DESCRIPTION}
- {CATEGORY_CATEGORY}
-
- {KEYWORDS_ONE}
- {KEYWORDS_TWO}
-
- {COPYRIGHT_COPYRIGHT}
-
- preview.jpg
- fullpreview.jpg
- {STYLESHEETS}
-
- {LAYOUTS}
-
-
-TEMPLATE;
-
-
- $template = str_replace("{LAYOUTS}",$LAYOUTS, $template);
-
- $result = e107::getParser()->simpleParse($template, $newArray);
- $path = e_THEME.$this->themeName."/theme.xml";
-
-
- if(E107_DEBUG_LEVEL > 0)
- {
- $mes->addDebug("Debug Mode active - no file saved. ");
- return htmlentities($result);
- }
-
-
-
- if(file_put_contents($path,$result))
- {
- $mes->addSuccess("Saved: ".$path);
- }
- else
- {
- $mes->addError("Couldn't Save: ".$path);
- }
-
-
-
- return htmlentities($result);
-
-
- }
-
-
-
- function xmlInput($name, $info, $default='')
- {
- $frm = e107::getForm();
- list($cat,$type) = explode("-",$info);
-
- $size = 30;
- $help = '';
- $sizex = '';
-
- switch ($info)
- {
-
- case 'main-name':
- $help = TPVLAN_CONV_3;
- $required = true;
- $pattern = "[A-Za-z 0-9]*";
- break;
-
- case 'main-lang':
- $help = TPVLAN_CONV_4;
- $required = false;
- $placeholder= "LAN equivalent";
- $pattern = "[A-Z0-9_]*";
- break;
-
- case 'main-date':
- $help = TPVLAN_CONV_6;
- $required = true;
- $default = (empty($default)) ? time() : strtotime($default);
- break;
-
- case 'main-version':
- $default = '1.0';
- $required = true;
- $help = TPVLAN_CONV_5;
- $pattern = "^[\d]{1,2}\.[\d]{1,2}$";
- break;
-
- case 'main-compatibility':
- $default = '2.0';
- $required = true;
- $help = TPVLAN_CONV_7;
- $pattern = "^[\d]{1,2}\.[\d]{1,2}$";
- break;
-
- case 'author-name':
- $default = (vartrue($default)) ? $default : USERNAME;
- $required = true;
- $help = TPVLAN_CONV_8;
- $pattern = "[A-Za-z \.0-9]*";
- break;
-
- case 'author-url':
- $required = true;
- $help = TPVLAN_CONV_9;
- // $pattern = "https?://.+";
- break;
-
- case 'livedemo-livedemo':
- $required = false;
- $help = TPVLAN_CONV_16;
- $placeholder= "http://demo-of-my-theme.com";
- // $pattern = "https?://.+";
- break;
-
- //case 'main-installRequired':
- // return "Installation required: ".$frm->radio_switch($name,'',LAN_YES, LAN_NO);
- //break;
-
- case 'summary-summary':
- $help = TPVLAN_CONV_10;
- $required = true;
- $size = 200;
- $placeholder= " ";
- $pattern = "[A-Za-z,() \.0-9]*";
- break;
-
- case 'keywords-one':
- case 'keywords-two':
- $help = TPVLAN_CONV_11;
- $required = true;
- $size = 20;
- $placeholder= " ";
- $pattern = '^[a-z]*$';
- break;
-
- case 'description-description':
- $help = TPVLAN_CONV_12;
- $required = true;
- $size = 100;
- $placeholder = " ";
- $pattern = "[A-Za-z \.0-9]*";
- break;
-
-
- case 'category-category':
- $help = TPVLAN_CONV_13;
- $required = true;
- $size = 20;
- break;
-
- default:
-
- break;
- }
-
- $req = ($required == true) ? "&required=1" : "";
- $placeholder = (varset($placeholder)) ? $placeholder : $type;
- $pat = ($pattern) ? "&pattern=".$pattern : "";
- $text = '';
-
- switch ($type)
- {
-
- case 'stylesheets':
- $fl = e107::getFile();
-
- $fl->setMode('full');
- $stylesheets = $fl->get_files(e_THEME.$this->themeName."/", "\.css", null, 1);
- foreach($stylesheets as $key=>$path)
- {
- $file = str_replace(e_THEME.$this->themeName."/",'',$path);
- $text .= "";
- $text .= "
";
- $text .= "
".$frm->checkbox($name.'['.$key.'][file]',$file, false, array('label'=>$file))."
-
".TPVLAN_CONV_14."
";
- $text .= "
".$frm->text($name.'['.$key.'][name]', $default, $size, 'placeholder='.$file . $req. $pat)."
-
".TPVLAN_CONV_15."
";
- // $text .= "
".$frm->checkbox('css['.$key.'][file]',$file, false, array('label'=>$file))."
";
- // $text .= "
".$frm->text('css['.$key.'][name]', $default, $size, 'placeholder='.$placeholder . $req. $pat)."
";
- $text .= "
";
- $text .= "
";
- }
-
-
- return $text;
- break;
-
-
- case 'date':
- $text = $frm->datepicker($name, $default, 'format=yyyy-mm-dd'.$req.'&size=block-level');
- break;
-
- case 'description':
- $text = $frm->textarea($name,$default, 3, 100, $req.'&size=block-level'); // pattern not supported.
- break;
-
-
- case 'category':
-
- $allowedCategories = array(
- 'generic', 'adult', 'blog', 'clan', 'children',
- 'corporate', 'forum', 'gaming', 'gallery', 'news',
- 'social', 'video', 'multimedia');
-
- sort($allowedCategories);
-
- $text = $frm->select($name, $allowedCategories,$default,'useValues=1&required=1', true);
- break;
-
-
- default:
- $text = $frm->text($name, $default, $size, 'placeholder='.$placeholder . $req. $pat.'&size=block-level');
- break;
- }
-
-
- $text .= ($help) ? "".$help." " : "";
- return $text;
-
- }
-
-
-
-
-
- function copyThemeForm()
- {
-
- $frm = e107::getForm();
-
- $list = e107::getTheme()->clearCache()->getThemeList(); // (e_THEME);
-
- $folders = array_keys($list);
-
- $text = $frm->open('copytheme','get','theme.php?mode=convert');
- $text .= "
-
- ".$frm->admin_button('step', 2,'success', LAN_CREATE)."
-
";
-
-
-
-
- $text .= $frm->close();
-
-
- // $text = "Create a new theme based on ".e->select('copytheme',$list);
-
-
- return array('caption'=>LAN_CREATE, 'text'=>$text);
-
- }
-
- private function copyTheme()
- {
- if(empty($this->themeSrc) || empty($this->themeName) || is_dir(e_THEME.$this->themeName))
- {
- return false;
- }
-
- if(e107::getFile()->copy(e_THEME.$this->themeSrc, e_THEME.$this->themeName))
- {
- $newfiles = scandir(e_THEME.$this->themeName);
-
- foreach($newfiles as $file)
- {
- if(is_dir(e_THEME.$this->themeName.'/'.$file) || $file === '.' || $file === '..')
- {
- continue;
- }
-
- if(strpos($file,"admin_") === 0)
- {
- unlink(e_THEME.$this->themeName.'/'.$file);
- }
-
-
-
- }
-
- }
-
- }
-
-
-
-
-}
-
-
-
-?>
diff --git a/e107_admin/upload.php b/e107_admin/upload.php
index 9f55b8760..6f5aad6bc 100644
--- a/e107_admin/upload.php
+++ b/e107_admin/upload.php
@@ -507,476 +507,4 @@ exit;
-
-
-
-
-$action = 'list'; // Default action
-if (e_QUERY)
-{
- $tmp = explode('.', e_QUERY);
- $action = $tmp[0];
- $id = varset($tmp[1],0);
-}
-
-
-
-if ($action == "dis" && isset($_POST['updelete']['upload_'.$id]) )
-{
- $res = $sql ->select("upload", "*", "upload_id='".intval($id)."'");
- $row = $sql ->fetch();
- if (preg_match("#Binary (.*?)/#", $row['upload_file'], $match))
- {
- $sql -> db_Delete("rbinary", "binary_id='".$tp -> toDB($match[1])."'");
- }
- else if ($row['upload_file'] && file_exists(e_UPLOAD.$row['upload_file']))
- {
- unlink(e_UPLOAD.$row['upload_file']);
- }
- if (preg_match("#Binary (.*?)/#", $row['upload_ss'], $match))
- {
- $sql ->delete("rbinary", "binary_id='".$tp -> toDB($match[1])."'");
- }
- else if ($row['upload_ss'] && file_exists(e_FILE."public/".$row['upload_ss']))
- {
- unlink(e_UPLOAD.$row['upload_ss']);
- }
- $message = ($sql->db_Delete("upload", "upload_id='".intval($id)."'")) ? UPLLAN_1 : LAN_DELETED_FAILED;
- e107::getLog()->add('UPLOAD_01',$row['upload_file'],E_LOG_INFORMATIVE,'');
-}
-
-if ($action == "dlm")
-{
- header("location: ".e_ADMIN."download.php?dlm.".$id);
- exit;
-}
-
-if ($action == "news")
-{
- header("location: ".e_ADMIN."newspost.php?create.upload.".$id);
- exit;
-}
-
-
-if ($action == "dl")
-{
- $id = str_replace("%20", " ", $id);
-
-// if (preg_match("/Binary\s(.*?)\/.*/", $id, $result))
-// {
-// $bid = $result[1];
-// $result = @mysql_query("SELECT * FROM ".MPREFIX."rbinary WHERE binary_id='$bid' ");
-// $binary_data = @mysql_result($result, 0, "binary_data");
-// $binary_filetype = @mysql_result($result, 0, "binary_filetype");
-// $binary_name = @mysql_result($result, 0, "binary_name");
-// header("Content-type: ".$binary_filetype);
-// header("Content-length: ".$download_filesize);
-// header("Content-Disposition: attachment; filename=".$binary_name);
-// header("Content-Description: PHP Generated Data");
-// echo $binary_data;
-// exit;
-// }
-// else
-// {
-// header("location:".e_UPLOAD.str_replace("dl.", "", e_QUERY));
-// exit;
-// }
-}
-
-require_once(e_HANDLER.'upload_handler.php');
-require_once("auth.php");
-require_once(e_HANDLER.'userclass_class.php');
-$gen = new convert;
-require_once(e_HANDLER.'form_handler.php');
-$rs = new form;
-
-
-// Need the userclass object for class selectors
-if (!is_object($e_userclass)) { $e_userclass = new user_class; }
-
-
-if (isset($_POST['optionsubmit']))
-{
- $temp = array();
- $temp['upload_storagetype'] = $_POST['upload_storagetype'];
- $temp['upload_maxfilesize'] = $_POST['upload_maxfilesize'];
- $temp['upload_class'] = $_POST['upload_class'];
- $temp['upload_enabled'] = (FILE_UPLOADS ? $_POST['upload_enabled'] : 0);
- if ($temp['upload_enabled'] && !$sql->select("links", "*", "link_url='upload.php' "))
- {
- $sql->db_Insert("links", "0, '".LAN_UPLOAD."', 'upload.php', '', '', 1,0,0,0,0");
- }
-
- if (!$temp['upload_enabled'] && $sql->select("links", "*", "link_url='upload.php' "))
- {
- $sql->db_Delete("links", "link_url='upload.php' ");
- }
-
- if ($admin_log->logArrayDiffs($temp, $pref, 'UPLOAD_02'))
- {
- save_prefs(); // Only save if changes
- $message = UPLLAN_2;
- }
- else
- {
- $message = UPLLAN_4;
- }
-}
-
-if (isset($message))
-{
- require_once(e_HANDLER.'message_handler.php');
- message_handler("ADMIN_MESSAGE", $message);
-}
-
-if (!FILE_UPLOADS)
-{
- message_handler("ADMIN_MESSAGE", UPLLAN_41);
-}
-
-
-switch ($action)
-{
- case 'filetypes' :
- if(!getperms('0')) exit;
-
- $definition_source = LAN_DEFAULT;
- $source_file = '';
- $edit_upload_list = varset($_POST['upload_do_edit'],FALSE);
-
- if (isset($_POST['generate_filetypes_xml']))
- { // Write back edited data to filetypes_.xml
- $file_text = "\n";
- foreach ($_POST['file_class_select'] as $k => $c)
- {
- if (!isset($_POST['file_line_delete_'.$c]) && vartrue($_POST['file_type_list'][$k]))
- {
-// echo "Key: {$k} Class: {$c} Delete: {$_POST['file_line_delete'][$k]} List: {$_POST['file_type_list'][$k]} Size: {$_POST['file_maxupload'][$k]} ";
- $file_text .= " \n";
- }
- }
- $file_text .= " \n";
- if ((($handle = fopen(e_UPLOAD_TEMP_DIR.e_SAVE_FILETYPES,'wt')) == FALSE)
- || (fwrite($handle,$file_text) == FALSE)
- || (fclose($handle) == FALSE))
- {
- $text = UPLLAN_61.e_UPLOAD_TEMP_DIR.e_SAVE_FILETYPES;
- }
- else
- {
- $text = '';
- $text .= ' '.UPLLAN_59.e_UPLOAD_TEMP_DIR.e_SAVE_FILETYPES.'. '.UPLLAN_60.e_ADMIN.e_READ_FILETYPES.' ';
- }
- $ns->tablerender(LAN_FILETYPES, $text);
- }
-
-
- $current_perms = array();
- if (($edit_upload_list && is_readable(e_UPLOAD_TEMP_DIR.e_SAVE_FILETYPES)) || (!$edit_upload_list && is_readable(e_ADMIN.e_READ_FILETYPES)))
- {
- $xml = e107::getXml();
- $source_file = $edit_upload_list ? e_UPLOAD_TEMP_DIR.e_SAVE_FILETYPES : e_ADMIN.e_READ_FILETYPES;
- $temp_vars = $xml->loadXMLfile($source_file, true, false);
- if ($temp_vars === FALSE)
- {
- echo "Error parsing XML file!";
- }
- else
- {
- foreach ($temp_vars['class'] as $v1)
- {
- $v = $v1['@attributes'];
- $current_perms[$v['name']] = array('type' => $v['type'],'maxupload' => $v['maxupload']);
- }
- }
- }
- elseif (is_readable(e_ADMIN.'filetypes.php'))
- {
- $source_file = 'filetypes.php';
- $current_perms[e_UC_MEMBER] = array('type' => implode(',',array_keys(get_allowed_filetypes('filetypes.php', ''))),'maxupload' => '2M');
- if (is_readable(e_ADMIN.'admin_filetypes.php'))
- {
- $current_perms[e_UC_ADMIN] = array('type' => implode(',',array_keys(get_allowed_filetypes('admin_filetypes.php', ''))),'maxupload' => '2M');
- $source_file .= ' + admin_filetypes.php';
- }
- }
- else
- { // Set a default
- $current_perms[e_UC_MEMBER] = array('type' => 'zip,tar,gz,jpg,png','maxupload' => '2M');
- }
- $text = "";
-
- $ns->tablerender(LAN_FILETYPES, $text);
- break;
-
- case 'options' :
- if(!getperms('0')) exit;
- $text = "";
-
- $ns->tablerender(LAN_OPTIONS, $text);
- break;
-
- case 'view' :
- $sql->select('upload', '*', "upload_id='{$id}'");
- $row = $sql->fetch();
- extract($row);
-
-
-
- $post_author_id = substr($upload_poster, 0, strpos($upload_poster, "."));
- $post_author_name = substr($upload_poster, (strpos($upload_poster, ".")+1));
- $poster = (!$post_author_id ? "".$post_author_name." " : "".$post_author_name." ");
- $upload_datestamp = $gen->convert_date($upload_datestamp, "long");
-
- $text = "
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
";
-
- $ns->tablerender(UPLLAN_18, $text);
- // Intentionally fall through into list mode
-
- case 'list' :
- default :
- $imgd = e_BASE.$IMAGES_DIRECTORY;
- $text = "
-
-
-
-
-
-
-
-
-
-
-
- ".LAN_ID."
- ".LAN_DATE."
- ".UPLLAN_5."
- ".LAN_NAME."
- ".LAN_FILE_NAME."
- ".LAN_SIZE."
- ".LAN_ACTIONS."
- ";
-
- $text .= "\n ";
- }
- else
- {
- $activeUploads = $sql -> db_getList();
-
- $text .= UPLLAN_20." ".($active_uploads == 1 ? UPLAN_IS : UPLAN_ARE).$active_uploads." ".($active_uploads == 1 ? UPLLAN_21 : UPLLAN_27)." ...";
- $text .= "";
-
- foreach($activeUploads as $row)
- {
- extract($row);
- $post_author_id = substr($upload_poster, 0, strpos($upload_poster, "."));
- $post_author_name = substr($upload_poster, (strpos($upload_poster, ".")+1));
- $poster = (!$post_author_id ? "".$post_author_name." " : "".$post_author_name." ");
- $upload_datestamp = $gen->convert_date($upload_datestamp, "short");
- $text .= "
-
-
-
-
-
-
-
- ";
- }
- }
- $text .= "
\n
";
-
- $ns->tablerender(LAN_UPLOADS, $text);
-} // end - switch($action)
-
-
-
-
-function upload_adminmenu()
-{
- $action = (e_QUERY) ? e_QUERY : "list";
-
- $var['list']['text'] = UPLLAN_51;
- $var['list']['link'] = e_SELF."?list";
- $var['list']['perm'] = "V";
-
- if(getperms("0"))
- {
- $var['filetypes']['text'] = LAN_FILETYPES;
- $var['filetypes']['link'] = e_SELF."?filetypes";
- $var['filetypes']['perm'] = "0";
-
- $var['options']['text'] = LAN_OPTIONS;
- $var['options']['link'] = e_SELF."?options";
- $var['options']['perm'] = "0";
- }
- show_admin_menu(LAN_UPLOADS, $action, $var);
-}
-
-
-
-require_once("footer.php");
diff --git a/e107_admin/users.php b/e107_admin/users.php
index 934aa07a6..f7d41c45f 100644
--- a/e107_admin/users.php
+++ b/e107_admin/users.php
@@ -613,7 +613,7 @@ class users_admin_ui extends e_admin_ui
$vars = array('x'=>$sysuser->getId(), 'y'=> $sysuser->getName(), 'z'=> $sysuser->getValue('email'));
- e107::getAdminLog()->log_event('USET_06', $tp->lanVars( USRLAN_162, $vars), E_LOG_INFORMATIVE);
+ e107::getAdminLog()->add('USET_06', $tp->lanVars( USRLAN_162, $vars), E_LOG_INFORMATIVE);
e107::getMessage()->addSuccess("(".$sysuser->getId().".".$sysuser->getName()." - ".$sysuser->getValue('email').") ".USRLAN_9);
// List data reload
@@ -786,7 +786,7 @@ class users_admin_ui extends e_admin_ui
// TODO - lan
$lan = 'Administrator --ADMIN_EMAIL-- (#--ADMIN_UID--, --ADMIN_NAME--) has logged in as the user --EMAIL-- (#--UID--, --NAME--)';
- e107::getLog()->log_event('USET_100', str_replace($search, $replace, $lan), E_LOG_INFORMATIVE);
+ e107::getLog()->add('USET_100', str_replace($search, $replace, $lan), E_LOG_INFORMATIVE);
$eventData = array('user_id' => $sysuser->getId(), 'admin_id' => $user->getId());
e107::getEvent()->trigger('loginas', $eventData); // BC
@@ -814,7 +814,7 @@ class users_admin_ui extends e_admin_ui
// TODO - lan
$lan = 'Administrator --ADMIN_EMAIL-- (#--ADMIN_UID--, --ADMIN_NAME--) has logged out as the user --EMAIL-- (#--UID--, --NAME--)';
- e107::getAdminLog()->log_event('USET_101', str_replace($search, $replace, $lan), E_LOG_INFORMATIVE);
+ e107::getAdminLog()->add('USET_101', str_replace($search, $replace, $lan), E_LOG_INFORMATIVE);
$eventData = array('user_id' => $sysuser->getId(), 'admin_id' => $user->getId());
e107::getEvent()->trigger('logoutas', $eventData); //BC
@@ -855,7 +855,7 @@ class users_admin_ui extends e_admin_ui
'z' => $user->getValue('email')
);
- e107::getAdminLog()->log_event('USET_08', $tp->lanVars(USRLAN_244,$vars), E_LOG_INFORMATIVE);
+ e107::getAdminLog()->add('USET_08', $tp->lanVars(USRLAN_244,$vars), E_LOG_INFORMATIVE);
$this->redirect('list', 'main', true);
}
@@ -869,7 +869,7 @@ class users_admin_ui extends e_admin_ui
{
$vars = array('x'=>$sysuser->getId(), 'y'=>$sysuser->getName(), 'z'=>$sysuser->getValue('email'));
- e107::getAdminLog()->log_event('USET_09',$tp->lanVars(USRLAN_165, $vars), E_LOG_INFORMATIVE);
+ e107::getAdminLog()->add('USET_09',$tp->lanVars(USRLAN_165, $vars), E_LOG_INFORMATIVE);
$mes->addSuccess($sysuser->getName()." (".$sysuser->getValue('email').") ".USRLAN_6);
$this->getTreeModel()->loadBatch(true);
}
@@ -1057,7 +1057,7 @@ class users_admin_ui extends e_admin_ui
if ($messaccess == '') $messaccess = UCSLAN_12."\n";
$message = USRLAN_256." ".$sysuser->getName().",\n\n".UCSLAN_4." ".SITENAME."\n( ".SITEURL." )\n\n".UCSLAN_5.": \n\n".$messaccess."\n".UCSLAN_10."\n".SITEADMIN;
- // $admin_log->e_log_event(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","User class change",str_replace("\n"," ",$message),FALSE,LOG_TO_ROLLING);
+ // $admin_log->addEvent(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","User class change",str_replace("\n"," ",$message),FALSE,LOG_TO_ROLLING);
$options['mail_subject'] = UCSLAN_2;
$options['mail_body'] = nl2br($message);
@@ -2639,10 +2639,7 @@ class users_admin_form_ui extends e_admin_form_ui
if($controller->getMode() != 'main' || $controller->getAction() != 'list') return;
$row = $controller->getListModel()->getData();
- if(!getperms('4'))
- {
- // return;
- }
+
// extract($row);
@@ -2749,14 +2746,14 @@ class users_admin_form_ui extends e_admin_form_ui
$opts['usersettings'] = LAN_EDIT;
}
- if ($row['user_perms'] == "0" && !getperms("0"))
- {
+ // if ($row['user_perms'] == "0" && !getperms("0"))
+ // {
// $text .= "";
- }
- elseif ($user_id != USERID || getperms("0"))
- {
+ // }
+ // elseif ($user_id != USERID || getperms("0"))
+ // {
// $text .= "".USRLAN_36." \n"; // DEPRECATED. inline & batch should be enough.
- }
+ // }
if ($row['user_perms'] != "0")
{
// $text .= "".LAN_DELETE." \n";
diff --git a/e107_core/shortcodes/batch/news_shortcodes.php b/e107_core/shortcodes/batch/news_shortcodes.php
index 5c63adc05..e6f66310a 100644
--- a/e107_core/shortcodes/batch/news_shortcodes.php
+++ b/e107_core/shortcodes/batch/news_shortcodes.php
@@ -108,8 +108,7 @@ class news_shortcodes extends e_shortcode
function sc_newsicon($parm=null)
{
-
- return $this->sc_newscaticon('url');
+ return $this->sc_news_category_icon('url');
}
function sc_newsauthor($parm)
@@ -128,6 +127,7 @@ class news_shortcodes extends e_shortcode
return "e107 ";
}
+
function sc_newscomments($parm=null)
{
@@ -236,7 +236,7 @@ class news_shortcodes extends e_shortcode
function sc_newsheader($parm=null)
{
- return $this->sc_newscaticon('src');
+ return $this->sc_news_category_icon('src');
}
@@ -249,7 +249,50 @@ class news_shortcodes extends e_shortcode
function sc_news_category_icon($parm=null)
{
- return $this->sc_newscaticon($parm);
+ if(is_string($parm))
+ {
+ $parm = array('type'=>$parm);
+ }
+ // BC
+ $category_icon = str_replace('../', '', trim($this->news_item['category_icon']));
+ if (!$category_icon) { return ''; }
+
+ // We store SC path in DB now + BC
+ if($category_icon[0] == '{')
+ {
+ $src = e107::getParser()->replaceConstants($category_icon, 'abs');
+ }
+ else
+ {
+ //Backwards Compatible Link.
+ $src = (is_readable(e_IMAGE_ABS."newspost_images/".$category_icon)) ? e_IMAGE_ABS."newspost_images/".$category_icon : e_IMAGE_ABS."icons/".$category_icon;
+ }
+
+
+ // if($this->param['caticon'] == ''){$this->param['caticon'] = 'border:0px';}
+
+ $parm['alt'] = e107::getParser()->toHTML($this->news_item['category_name'], FALSE ,'defs');
+ $parm['legacy'] = array('{e_IMAGE}newspost_images/', '{e_IMAGE}icons/');
+ $parm['class'] = 'icon news_image news-category-icon';
+
+ $icon = e107::getParser()->toIcon($category_icon, $parm);
+
+ switch($parm['type'])
+ {
+ /* @deprecated - Will cause issues with glyphs */
+ case 'src':
+ return $src;
+ break;
+
+ case 'tag':
+ return $icon;
+ break;
+
+ case 'url':
+ default:
+ return "news_item)."'>".$icon." ";
+ break;
+ }
}
@@ -1064,50 +1107,7 @@ class news_shortcodes extends e_shortcode
/* @deprecated - use {NEWS_CATEGORY_ICON} instead */
function sc_newscaticon($parm = array())
{
- if(is_string($parm))
- {
- $parm = array('type'=>$parm);
- }
- // BC
- $category_icon = str_replace('../', '', trim($this->news_item['category_icon']));
- if (!$category_icon) { return ''; }
-
- // We store SC path in DB now + BC
- if($category_icon[0] == '{')
- {
- $src = e107::getParser()->replaceConstants($category_icon, 'abs');
- }
- else
- {
- //Backwards Compatible Link.
- $src = (is_readable(e_IMAGE_ABS."newspost_images/".$category_icon)) ? e_IMAGE_ABS."newspost_images/".$category_icon : e_IMAGE_ABS."icons/".$category_icon;
- }
-
-
- // if($this->param['caticon'] == ''){$this->param['caticon'] = 'border:0px';}
-
- $parm['alt'] = e107::getParser()->toHTML($this->news_item['category_name'], FALSE ,'defs');
- $parm['legacy'] = array('{e_IMAGE}newspost_images/', '{e_IMAGE}icons/');
- $parm['class'] = 'icon news_image news-category-icon';
-
- $icon = e107::getParser()->toIcon($category_icon, $parm);
-
- switch($parm['type'])
- {
- /* @deprecated - Will cause issues with glyphs */
- case 'src':
- return $src;
- break;
-
- case 'tag':
- return $icon;
- break;
-
- case 'url':
- default:
- return "news_item)."'>".$icon." ";
- break;
- }
+ return $this->sc_news_category_icon($parm);
}
/**
diff --git a/e107_handlers/admin_log_class.php b/e107_handlers/admin_log_class.php
index 13e831562..8b1fb64a8 100644
--- a/e107_handlers/admin_log_class.php
+++ b/e107_handlers/admin_log_class.php
@@ -58,6 +58,10 @@ class e_admin_log
protected $_current_plugin = null;
+
+ private $_roll_log_active = false;
+
+ private $_roll_log_days = 0;
/**
@@ -76,35 +80,40 @@ class e_admin_log
}
}
- define("E_LOG_INFORMATIVE", 0); // Minimal Log Level, including really minor stuff
- define("E_LOG_NOTICE", 1); // More important than informative, but less important than notice
- define("E_LOG_WARNING", 2); // Not anything serious, but important information
- define("E_LOG_FATAL", 3); // An event so bad your site ceased execution.
- define("E_LOG_PLUGIN", 4); // Plugin information
+ if(!defined('E_LOG_INFORMATIVE'))
+ {
- // Logging actions
- define("LOG_TO_ADMIN", 1);
- define("LOG_TO_AUDIT", 2);
- define("LOG_TO_ROLLING", 4);
- // User audit logging (intentionally start at 10 - stick to 2 digits)
- // The last two digits must match that for the corresponding log message
- define('USER_AUDIT_ADMIN', 10); // User data changed by admin
- define('USER_AUDIT_SIGNUP', 11); // User signed up
- define('USER_AUDIT_EMAILACK', 12); // User responded to registration email
- define('USER_AUDIT_LOGIN', 13); // User logged in
- define('USER_AUDIT_LOGOUT', 14); // User logged out
- define('USER_AUDIT_NEW_DN', 15); // User changed display name
- define('USER_AUDIT_NEW_PW', 16); // User changed password
- define('USER_AUDIT_NEW_EML', 17); // User changed email
- define('USER_AUDIT_PW_RES', 18); // Password reset/resent activation email
- define('USER_AUDIT_NEW_SET', 19); // User changed other settings
- define('USER_AUDIT_ADD_ADMIN', 20); // User added by admin
- define('USER_AUDIT_MAIL_BOUNCE', 21); // User mail bounce
- define('USER_AUDIT_BANNED', 22); // User banned
- define('USER_AUDIT_BOUNCE_RESET', 23); // User bounce reset
- define('USER_AUDIT_TEMP_ACCOUNT', 24); // User temporary account
+ define('E_LOG_INFORMATIVE', 0); // Minimal Log Level, including really minor stuff
+ define('E_LOG_NOTICE', 1); // More important than informative, but less important than notice
+ define('E_LOG_WARNING', 2); // Not anything serious, but important information
+ define('E_LOG_FATAL', 3); // An event so bad your site ceased execution.
+ define('E_LOG_PLUGIN', 4); // Plugin information
+ // Logging actions
+ define('LOG_TO_ADMIN', 1);
+ define('LOG_TO_AUDIT', 2);
+ define('LOG_TO_ROLLING', 4);
+
+ // User audit logging (intentionally start at 10 - stick to 2 digits)
+ // The last two digits must match that for the corresponding log message
+ define('USER_AUDIT_ADMIN', 10); // User data changed by admin
+ define('USER_AUDIT_SIGNUP', 11); // User signed up
+ define('USER_AUDIT_EMAILACK', 12); // User responded to registration email
+ define('USER_AUDIT_LOGIN', 13); // User logged in
+ define('USER_AUDIT_LOGOUT', 14); // User logged out
+ define('USER_AUDIT_NEW_DN', 15); // User changed display name
+ define('USER_AUDIT_NEW_PW', 16); // User changed password
+ define('USER_AUDIT_NEW_EML', 17); // User changed email
+ define('USER_AUDIT_PW_RES', 18); // Password reset/resent activation email
+ define('USER_AUDIT_NEW_SET', 19); // User changed other settings
+ define('USER_AUDIT_ADD_ADMIN', 20); // User added by admin
+ define('USER_AUDIT_MAIL_BOUNCE', 21); // User mail bounce
+ define('USER_AUDIT_BANNED', 22); // User banned
+ define('USER_AUDIT_BOUNCE_RESET', 23); // User bounce reset
+ define('USER_AUDIT_TEMP_ACCOUNT', 24); // User temporary account
+
+ }
// Init E_MESSAGE_* constants if not already done
// e107::getMessage(); - just include, message handler is creating session in construct
// it breaks stuff (see class2 - language detection and comments)
@@ -112,11 +121,15 @@ class e_admin_log
$this->_messages = array();
$this->_allMessages = array();
- return null;
+ $pref = e107::getPref();
+ $this->_roll_log_active = (bool) varset($pref['roll_log_active']);
+ $this->_roll_log_days = (int) varset($pref['roll_log_days']);
+
+
}
/**
- * @DEPRECATED
+ * @deprecated
* BC Alias of add();
*/
public function log_event($event_title, $event_detail, $event_type = E_LOG_INFORMATIVE , $event_code = '')
@@ -167,7 +180,7 @@ class e_admin_log
*/
public function add($event_title, $event_detail, $event_type = E_LOG_INFORMATIVE , $event_code = '', $target = LOG_TO_ADMIN, $userData=null )
{
- if ($event_code == '')
+ if (empty($event_code))
{
if (strlen($event_title) <= 12)
{ // Assume the title is actually a reference to the event
@@ -182,8 +195,8 @@ class e_admin_log
if (!is_array($event_detail))
{
- // auto-format long details - TODO - shrink details on administration log page, expand/show in DHTML window full details.
- $event_detail = str_replace("\n", "[!br!]", $event_detail);
+ // auto-format long details -
+ $event_detail = str_replace("\n", '[!br!]', $event_detail);
}
if ($this->_options['backtrace'] == true)
@@ -192,69 +205,50 @@ class e_admin_log
}
- $this->e_log_event($event_type, -1, $event_code, $event_title, $event_detail, FALSE, $target, $userData);
+ $this->addEvent($event_type, -1, $event_code, $event_title, $event_detail, FALSE, $target, $userData);
return $this;
}
/**
- * Alias for deprecated e_log_event
- * @param $importance
- * @param $source_call
- * @param string $eventcode
- * @param string $event_title
- * @param string $explain
- * @param bool $finished
- * @param int $target_logs
- * @param null $userData
- * @return null
+ * Enable/Disable the Rolling Log.
+ * @param $bool
*/
- public function addEvent($importance, $source_call, $eventcode = "GEN", $event_title = "Untitled", $explain = "", $finished = FALSE, $target_logs = LOG_TO_AUDIT, $userData=null )
+ public function rollingLog($bool)
{
- return $this->e_log_event($importance, $source_call, $eventcode, $event_title, $explain, $finished, $target_logs, $userData);
-
+ $this->_roll_log_active = (bool) $bool;
}
/**
- Generic log entry point
- -----------------------
- Example call: (Deliberately pick separators that shouldn't be in file names)
- e_log_event(E_LOG_NOTICE,__FILE__."|".__FUNCTION__."@".__LINE__,"ECODE","Event Title","explanatory message",FALSE,LOG_TO_ADMIN);
- or:
- e_log_event(E_LOG_NOTICE,debug_backtrace(),"ECODE","Event Title","explanatory message",TRUE,LOG_TO_ROLLING);
- *
- * @param int $importance - importance of event - 0..4 or so
- * @param mixed $source_call - either: string identifying calling file/routine
- * or: a number 0..9 identifying info to log from debug_backtrace()
+ * Alias for deprecated e_log_event
+ * @param int $importance - importance of event - 0..4 or so
+ * @param mixed $source_call - either: string identifying calling file/routine
+ * or: a number 0..9 identifying info to log from debug_backtrace()
* or: empty string, in which case first entry from debug_backtrace() logged
* or: an array, assumed to be from passing debug_backtrace() as a parameter, in which case relevant
* information is extracted and the argument list from the first entry logged
* or: -1, in which case no information logged
- * @param string $eventcode - abbreviation listing event type
- * @param string $event_title - title of event - pass standard 'LAN_ERROR_nn' defines to allow language translation
- * @param string $explain - detail of event
- * @param bool $finished - if TRUE, aborts execution
- * @param int $target_logs - flags indicating which logs to update - if entry to be posted in several logs, add (or 'OR') their defines:
- * LOG_TO_ADMIN - admin log
- * LOG_TO_AUDIT - audit log
- * LOG_TO_ROLLING - rolling log
- * @param array $userData - attribute user to log entry. array('user_id'=>2, 'user_name'=>'whatever');
- * @return null
-
- * @todo - check microtime() call
- * @deprecated - use add() method instead or addEvent() as a direct replacement.
+ * @param string $eventcode - abbreviation listing event type
+ * @param string $event_title - title of event - pass standard 'LAN_ERROR_nn' defines to allow language translation
+ * @param string $explain - detail of event
+ * @param bool $finished - if TRUE, aborts execution
+ * @param int $target_logs - table to save to : LOG_TO_ADMIN, LOG_TO_AUDIT, LOG_TO_ROLLING
+ * @param null $userData - attribute user to log entry. array('user_id'=>2, 'user_name'=>'whatever');
+ *
+ * @return null
*/
- public function e_log_event($importance, $source_call, $eventcode = "GEN", $event_title = "Untitled", $explain = "", $finished = FALSE, $target_logs = LOG_TO_AUDIT, $userData=null )
+ public function addEvent($importance, $source_call, $eventcode = 'GEN', $event_title = 'Untitled', $explain = '', $finished = FALSE, $target_logs = LOG_TO_AUDIT, $userData=null )
{
$e107 = e107::getInstance();
- $pref = e107::getPref();
$tp = e107::getParser();
- list($time_usec, $time_sec) = explode(" ", microtime(FALSE)); // Log event time immediately to minimise uncertainty
+ list($time_usec, $time_sec) = explode(' ', microtime(FALSE)); // Log event time immediately to minimise uncertainty
$time_usec = $time_usec * 1000000;
- if ($this->rldb == NULL)
- $this->rldb = e107::getDb('adminlog'); // Better use our own db - don't know what else is going on
+ if ($this->rldb === null) // Better use our own db - don't know what else is going on
+ {
+ $this->rldb = e107::getDb('adminlog');
+ }
if (is_bool($target_logs))
{ // Handle the legacy stuff for now - some old code used a boolean to select admin or rolling logs
@@ -301,10 +295,10 @@ class e_admin_log
unset($line);
*/
$explain = str_replace("\n",'[!br!]',print_r($explain,true));
-
+
}
-
-
+
+
$explain = e107::getDb()->escape($tp->toDB($explain, true, false, 'no_html'));
$event_title = $tp->toDB($event_title, true, false, 'no_html');
@@ -312,22 +306,22 @@ class e_admin_log
// Admin Log
//---------------------------------------
if ($target_logs & LOG_TO_ADMIN) // Admin log - assume all fields valid
- {
+ {
// $qry = " null, ".intval($time_sec).','.intval($time_usec).", '{$importance}', '{$eventcode}', {$userid}, '{$userIP}', '{$event_title}', '{$explain}' ";
-
+
$adminLogInsert = array(
'dblog_id' => null,
'dblog_type' => $importance,
'dblog_eventcode' => $eventcode,
'dblog_datestamp' => time(),
- 'dblog_microtime' => intval($time_usec),
+ 'dblog_microtime' => (int) $time_usec,
'dblog_user_id' => $userid,
'dblog_ip' => $userIP,
'dblog_title' => $event_title,
'dblog_remarks' => $explain
);
-
- $this->rldb->insert("admin_log", $adminLogInsert);
+
+ $this->rldb->insert('admin_log', $adminLogInsert);
}
//---------------------------------------
@@ -338,7 +332,7 @@ class e_admin_log
//---------------------------------------
// Rolling Log
//---------------------------------------
- if (($target_logs & LOG_TO_ROLLING) && vartrue($pref['roll_log_active']))
+ if (($target_logs & LOG_TO_ROLLING) && $this->_roll_log_active)
{ // Rolling log
// Process source_call info
@@ -347,7 +341,7 @@ class e_admin_log
{
$back_count = 1;
$i = 0;
- if (is_numeric($source_call) || ($source_call == ''))
+ if (($source_call == ''))
{
$back_count = $source_call + 1;
$source_call = debug_backtrace();
@@ -360,46 +354,85 @@ class e_admin_log
while ($i < $back_count)
{
$source_call[$i]['file'] = $e107->fix_windows_paths($source_call[$i]['file']); // Needed for Windoze hosts.
- $source_call[$i]['file'] = str_replace($e107->file_path, "", $source_call[$i]['file']); // We really just want a e107 root-relative path. Strip out the root bit
- $tmp = $source_call[$i]['file']."|".$source_call[$i]['class'].$source_call[$i]['type'].$source_call[$i]['function']."@".$source_call[$i]['line'];
+ $source_call[$i]['file'] = str_replace($e107->file_path, '', $source_call[$i]['file']); // We really just want a e107 root-relative path. Strip out the root bit
+ $tmp = $source_call[$i]['file']. '|' .$source_call[$i]['class'].$source_call[$i]['type'].$source_call[$i]['function']. '@' .$source_call[$i]['line'];
foreach ($source_call[$i]['args'] as $k=>$v)
{ // Add in the arguments
- $explain .= "[!br!]".$k."=".$v;
+ $explain .= '[!br!]' .$k. '=' .$v;
}
$i++;
if ($i < $back_count)
+ {
$explain .= "[!br!]-------------------";
+ }
if (!isset($tmp1))
- $tmp1 = $tmp; // Pick off the immediate caller as the source
+ {
+ $tmp1 = $tmp;
+ } // Pick off the immediate caller as the source
+ }
+ if (isset($tmp1))
+ {
+ $source_call = $tmp1;
+ }
+ else
+ {
+ $source_call = 'Root level';
}
- if (isset($tmp1)) $source_call = $tmp1;
- else $source_call = 'Root level';
}
else
{
$source_call = $e107->fix_windows_paths($source_call); // Needed for Windoze hosts.
- $source_call = str_replace($e107->file_path, "", $source_call); // We really just want a e107 root-relative path. Strip out the root bit
+ $source_call = str_replace($e107->file_path, '', $source_call); // We really just want a e107 root-relative path. Strip out the root bit
$source_call = $tp->toDB($source_call, true, false, 'no_html');
}
// else $source_call is a string
// Save new rolling log record
- $this->rldb->insert("dblog", "0, ".intval($time_sec).', '.intval($time_usec).", '{$importance}', '{$eventcode}', {$userid}, '{$userstring}', '{$userIP}', '{$source_call}', '{$event_title}', '{$explain}' ");
+
+ $insertArr = array(
+ 'dblog_id' => 0,
+ 'dblog_datestamp' => 0,
+ 'dblog_microtime' => 0,
+ 'dblog_type' => '',
+ 'dblog_eventcode' => '',
+ 'dblog_user_id' => '',
+ 'dblog_user_name' => '',
+ 'dblog_ip' => '',
+ 'dblog_caller' => '',
+ 'dblog_title' => '',
+ 'dblog_remarks' => ''
+ );
+
+
+
+
+ $this->rldb->insert('dblog', '0, ' .intval($time_sec).', '.intval($time_usec).", '{$importance}', '{$eventcode}', {$userid}, '{$userstring}', '{$userIP}', '{$source_call}', '{$event_title}', '{$explain}' ");
// Now delete any old stuff
- if(!empty($pref['roll_log_days']))
+ if(!empty($this->_roll_log_days))
{
- $days = intval($pref['roll_log_days']);
- $this->rldb->delete("dblog", "dblog_datestamp < '".intval(time() - ($days * 86400))."' ");
+ $this->rldb->delete('dblog', "dblog_datestamp < '".intval(time() - ($this->_roll_log_days * 86400))."' ");
}
}
if ($finished)
- exit; // Optional abort for all logs
+ {
+ exit;
+ } // Optional abort for all logs
return null;
+
}
+ /**
+ * @deprecated - use add() method instead or addEvent() as a direct replacement.
+ */
+ public function e_log_event($importance, $source_call, $eventcode = 'GEN', $event_title = 'Untitled', $explain = '', $finished = FALSE, $target_logs = LOG_TO_AUDIT, $userData=null )
+ {
+ return addEvent($importance, $source_call, $eventcode, $event_title, $explain, $finished, $target_logs, $userData);
+ }
+
+
public function setCurrentPlugin($plugdir)
{
$this->_current_plugin = $plugdir;
@@ -421,18 +454,18 @@ class e_admin_log
*/
function user_audit($event_type, $event_data, $id = '', $u_name = '')
{
- list($time_usec, $time_sec) = explode(" ", microtime()); // Log event time immediately to minimise uncertainty
+ list($time_usec, $time_sec) = explode(' ', microtime()); // Log event time immediately to minimise uncertainty
$time_usec = $time_usec * 1000000;
if(!is_numeric($event_type))
{
- $title = "User Audit Event-Type Failure: ";
+ $title = 'User Audit Event-Type Failure: ';
$title .= (string) $event_type;
$debug = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS,4);
$debug[0] = e_REQUEST_URI;
- $this->e_log_event(4, $debug[1]['file']."|".$debug[1]['function']."@".$debug[1]['line'], "USERAUDIT", $title, $debug, FALSE);
+ $this->addEvent(4, $debug[1]['file']. '|' .$debug[1]['function']. '@' .$debug[1]['line'], 'USERAUDIT', $title, $debug, FALSE);
return false;
}
@@ -471,7 +504,7 @@ class e_admin_log
}
else
{
- $userstring = (USER === true ? USERNAME : "LAN_ANONYMOUS");
+ $userstring = (USER === true ? USERNAME : 'LAN_ANONYMOUS');
}
$userIP = e107::getIPHandler()->getIP(false);
@@ -492,7 +525,7 @@ class e_admin_log
'dblog_remarks' => print_r($event_data,true),
);
- if($this->rldb->insert("audit_log", $insertQry))
+ if($this->rldb->insert('audit_log', $insertQry))
{
return true;
}
@@ -523,14 +556,14 @@ class e_admin_log
global $sql;
if ($days == false)
{ // $days is false, so truncate the log table
- $sql->gen("TRUNCATE TABLE #dblog ");
+ $sql->gen('TRUNCATE TABLE #dblog ');
}
else
{ // $days is set, so remove all entries older than that.
$days = intval($days);
$mintime = $days * 24 * 60 * 60;
$time = time() - $mintime;
- $sql->db_Delete("dblog", "WHERE `dblog_datestamp` < {$time}", true);
+ $sql->delete('dblog', "WHERE `dblog_datestamp` < {$time}", true);
}
}
@@ -641,12 +674,18 @@ class e_admin_log
elseif(empty($text))
{
$bt = debug_backtrace(true);
- e107::getMessage()->addDebug("Log Message was empty: ".print_a($bt[1],true));
+ e107::getMessage()->addDebug('Log Message was empty: ' .print_a($bt[1],true));
return $this; // changing to text will break chained methods.
}
- if(!$type) $type = E_MESSAGE_INFO;
- if($logLevel === TRUE) $logLevel = $type;
+ if(!$type)
+ {
+ $type = E_MESSAGE_INFO;
+ }
+ if($logLevel === TRUE)
+ {
+ $logLevel = $type;
+ }
$logArray = array('message' => $text, 'dislevel' => $type, 'loglevel' => $logLevel, 'session' => $session, 'time'=>time());
@@ -748,7 +787,7 @@ class e_admin_log
$text = array_diff_recursive($array,$oldArray); // Located in core_functions.php
if(count($text) < 1)
{
- $text = "No differences found";
+ $text = 'No differences found';
}
}
@@ -760,6 +799,35 @@ class e_admin_log
return $this->logMessage($text, $type, $type, $session);
}
+ /**
+ * Return the last row added to the log table.
+ * @param int $type
+ * @return array|string
+ */
+ public function getLastLog($type=LOG_TO_ADMIN)
+ {
+
+ switch ($type)
+ {
+ case LOG_TO_AUDIT:
+ $table = 'audit_log';
+ break;
+
+ case LOG_TO_ROLLING:
+ $table = 'dblog';
+ break;
+
+ case LOG_TO_ADMIN:
+ default:
+ $table = 'admin_log';
+ }
+
+ $query = 'SELECT * FROM #'.$table.' ORDER BY dblog_id DESC LIMIT 1';
+ return e107::getDb()->retrieve($query);
+
+ }
+
+
/**
* Empty the messages - pass to both admin log and message handler
*
@@ -797,7 +865,10 @@ class e_admin_log
$mes->addStack($m['message'], $mstack, $m['dislevel'], $m['session']);
// move to main stack OUTSIDE if needed
}
- else $mes->add($m['message'], $m['dislevel'], $m['session']);
+ else
+ {
+ $mes->add($m['message'], $m['dislevel'], $m['session']);
+ }
}
}
$this->add($logTitle, $logString, $logImportance, $logEventCode, $target);
@@ -833,7 +904,7 @@ class e_admin_log
if(count($this->_allMessages))
{
- $head = " e107 CMS Log file : ".$logTitle." ".date('Y-m-d_H-i-s')."\n";
+ $head = ' e107 CMS Log file : ' .$logTitle. ' ' .date('Y-m-d_H-i-s')."\n";
$head .= "-------------------------------------------------------------------------------------------\n\n";
}
else
@@ -845,7 +916,7 @@ class e_admin_log
foreach($this->_allMessages as $m)
{
- $text .= date('Y-m-d H:i:s', $m['time'])." \t".str_pad($m['loglevel'],10," ",STR_PAD_RIGHT)."\t".strip_tags($m['message'])."\n";
+ $text .= date('Y-m-d H:i:s', $m['time'])." \t".str_pad($m['loglevel'],10, ' ',STR_PAD_RIGHT)."\t".strip_tags($m['message'])."\n";
}
$date = ($append == true) ? date('Y-m-d') : date('Y-m-d_H-i-s').'_'.crc32($text);
@@ -861,15 +932,18 @@ class e_admin_log
if(!empty($this->_current_plugin)) // If it's a plugin, create a subfolder.
{
- $dir = e_LOG.$this->_current_plugin."/";
+ $dir = e_LOG.$this->_current_plugin. '/';
if(!is_dir($dir))
{
- mkdir($dir,0755);
+ if (!mkdir($dir, 0755) && !is_dir($dir))
+ {
+ $this->add('Directory creation Failed', sprintf('Directory "%s" was not created', $dir));
+ }
}
}
- $fileName = $dir.$date."_".$this->logFile.".log";
+ $fileName = $dir.$date. '_' .$this->logFile. '.log';
if(!empty($opts['filename']))
{
@@ -889,17 +963,18 @@ class e_admin_log
$app = null;
$text = $head . $text;
}
-
- if(file_put_contents($fileName, $text, $app))
+
+ if (file_put_contents($fileName, $text, $app))
{
$this->_allMessages = array();
$this->_current_plugin = null;
return $this->logFile;
}
- elseif(getperms('0') && E107_DEBUG_LEVEL > 0)
+
+ if(E107_DEBUG_LEVEL > 0 && getperms('0'))
{
e107::getMessage()->addDebug("Couldn't Save to Log File: ".$fileName);
- }
+ }
$this->_current_plugin = null;
diff --git a/e107_handlers/cron_class.php b/e107_handlers/cron_class.php
index 9b68f7600..ebce4fb3e 100644
--- a/e107_handlers/cron_class.php
+++ b/e107_handlers/cron_class.php
@@ -235,7 +235,7 @@ class _system_cron
if (CRON_MAIL_DEBUG)
{
- e107::getLog()->e_log_event(10,debug_backtrace(),'DEBUG','CRON Email','Email run started',FALSE,LOG_TO_ROLLING);
+ e107::getLog()->addEvent(10,debug_backtrace(),'DEBUG','CRON Email','Email run started',FALSE,LOG_TO_ROLLING);
}
$mailManager = e107::getBulkEmail();
@@ -249,7 +249,7 @@ class _system_cron
if (CRON_MAIL_DEBUG)
{
- e107::getLog()->e_log_event(10,debug_backtrace(),'DEBUG','CRON Email','Email run completed',FALSE,LOG_TO_ROLLING);
+ e107::getLog()->addEvent(10,debug_backtrace(),'DEBUG','CRON Email','Email run completed',FALSE,LOG_TO_ROLLING);
}
}
@@ -259,14 +259,14 @@ class _system_cron
if (CRON_MAIL_DEBUG)
{
$e107 = e107::getInstance();
- $e107->admin_log->e_log_event(10,debug_backtrace(),'DEBUG','CRON Bounce','Bounce processing started',FALSE,LOG_TO_ROLLING);
+ $e107->admin_log->addEvent(10,debug_backtrace(),'DEBUG','CRON Bounce','Bounce processing started',FALSE,LOG_TO_ROLLING);
}
require_once(e_HANDLER.'pop_bounce_handler.php');
$mailBounce = new pop3BounceHandler();
$mailBounce->processBounces();
if (CRON_MAIL_DEBUG)
{
- $e107->admin_log->e_log_event(10,debug_backtrace(),'DEBUG','CRON Bounce','Bounce processing completed',FALSE,LOG_TO_ROLLING);
+ $e107->admin_log->addEvent(10,debug_backtrace(),'DEBUG','CRON Bounce','Bounce processing completed',FALSE,LOG_TO_ROLLING);
}
}
@@ -276,14 +276,14 @@ class _system_cron
if (CRON_RETRIGGER_DEBUG)
{
$e107 = e107::getInstance();
- $e107->admin_log->e_log_event(10,debug_backtrace(),'DEBUG','CRON Ban retrigger','Retrigger processing started',FALSE,LOG_TO_ROLLING);
+ $e107->admin_log->addEvent(10,debug_backtrace(),'DEBUG','CRON Ban retrigger','Retrigger processing started',FALSE,LOG_TO_ROLLING);
}
require_once(e_HANDLER.'iphandler_class.php');
$ipManager = new banlistManager();
$ipManager->banRetriggerAction();
if (CRON_RETRIGGER_DEBUG)
{
- e107::getLog()->e_log_event(10,debug_backtrace(),'DEBUG','CRON Ban Retrigger','Retrigger processing completed',FALSE,LOG_TO_ROLLING);
+ e107::getLog()->addEvent(10,debug_backtrace(),'DEBUG','CRON Ban Retrigger','Retrigger processing completed',FALSE,LOG_TO_ROLLING);
}
}
diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php
index 27a1c30e8..2a0ac7f58 100644
--- a/e107_handlers/e107_class.php
+++ b/e107_handlers/e107_class.php
@@ -4192,7 +4192,7 @@ class e107
{
if(!defined('MAGIC_QUOTES_GPC'))
{
- define('MAGIC_QUOTES_GPC', (ini_get('magic_quotes_gpc') ? true : false));
+ define('MAGIC_QUOTES_GPC', false); // (Removed in PHP 5.4 ini_get('magic_quotes_gpc') ? true : false));
}
define('MPREFIX', self::getMySQLConfig('prefix')); // mysql prefix
diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php
index 6fe02f449..cd89a0caa 100644
--- a/e107_handlers/e_parse_class.php
+++ b/e107_handlers/e_parse_class.php
@@ -464,7 +464,7 @@ class e_parse extends e_parser
* @param boolean|string $mod [optional] model = admin-ui usage. The 'no_html' and 'no_php' modifiers blanket prevent HTML and PHP posting regardless of posting permissions. (used in logging)
* The 'pReFs' value is for internal use only, when saving prefs, to prevent sanitisation of HTML.
* @param mixed $parm [optional]
- * @return string|array
+ * @return mixed
* @todo complete the documentation of this essential method
*/
public function toDB($data = null, $nostrip =false, $no_encode = false, $mod = false, $parm = null)
diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php
index 81755687d..288c90eb4 100644
--- a/e107_handlers/form_handler.php
+++ b/e107_handlers/form_handler.php
@@ -2592,15 +2592,15 @@ class e_form
{
$style = " style='text-indent:" . (1.2 * $nest_level) . "em'";
}
- $descr = varset($field_options['description']) ? ' ('.$this->_uc->uc_get_classdescription($classnum).') ' : '';
+ $descr = varset($field_options['description']) ? ' ('.$this->_uc->getDescription($classnum).') ' : '';
- return "".$this->checkbox($treename.'[]', $classnum, in_array($classnum, $tmp), $field_options).$this->label($this->_uc->uc_get_classname($classIndex).$descr, $treename.'[]', $classnum)."
\n";
+ return "".$this->checkbox($treename.'[]', $classnum, in_array($classnum, $tmp), $field_options).$this->label($this->_uc->getName($classIndex).$descr, $treename.'[]', $classnum)."
\n";
}
function uc_label($classnum)
{
- return $this->_uc->uc_get_classname($classnum);
+ return $this->_uc->getName($classnum);
}
/**
@@ -3181,7 +3181,7 @@ var_dump($select_options);*/
$prefix = ' '.str_repeat('--', $nest_level - 1).'>';
$style = '';
}
- return $this->option($prefix.$this->_uc->uc_get_classname($classnum), $classSign.$classIndex, ($current_value !== '' && in_array($classnum, $tmp)), array("style"=>"{$style}"))."\n";
+ return $this->option($prefix.$this->_uc->getName($classnum), $classSign.$classIndex, ($current_value !== '' && in_array($classnum, $tmp)), array("style"=>"{$style}"))."\n";
}
diff --git a/e107_handlers/iphandler_class.php b/e107_handlers/iphandler_class.php
index 5d10a3f12..c8f57b74e 100644
--- a/e107_handlers/iphandler_class.php
+++ b/e107_handlers/iphandler_class.php
@@ -940,14 +940,14 @@ class eIPHandler
$tp = e107::getParser();
$admin_log = e107::getAdminLog();
- //$admin_log->e_log_event(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","Check for Ban",$query,FALSE,LOG_TO_ROLLING);
+ //$admin_log->addEvent(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","Check for Ban",$query,FALSE,LOG_TO_ROLLING);
if ($sql->select('banlist', '*', $query.' ORDER BY `banlist_bantype` DESC'))
{
// Any whitelist entries will be first, because they are positive numbers - so we can answer based on the first DB record read
$row = $sql->fetch();
if($row['banlist_bantype'] >= eIPHandler::BAN_TYPE_WHITELIST)
{
- //$admin_log->e_log_event(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","Whitelist hit",$query,FALSE,LOG_TO_ROLLING);
+ //$admin_log->addEvent(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","Whitelist hit",$query,FALSE,LOG_TO_ROLLING);
return true; // Whitelisted entry
}
@@ -972,9 +972,9 @@ class eIPHandler
$sql->update('banlist', $updateQry);
$this->regenerateFiles();
- //$admin_log->e_log_event(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","Retrigger Ban",$row['banlist_ip'],FALSE,LOG_TO_ROLLING);
+ //$admin_log->addEvent(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","Retrigger Ban",$row['banlist_ip'],FALSE,LOG_TO_ROLLING);
}
- //$admin_log->e_log_event(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","Active Ban",$query,FALSE,LOG_TO_ROLLING);
+ //$admin_log->addEvent(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","Active Ban",$query,FALSE,LOG_TO_ROLLING);
if ($show_error)
{
header('HTTP/1.1 403 Forbidden', true);
@@ -990,7 +990,7 @@ class eIPHandler
echo $tp->toHTML(varset($pref['ban_messages'][$row['banlist_bantype']])); // Show message if one set
}
- //$admin_log->e_log_event(4, __FILE__."|".__FUNCTION__."@".__LINE__, 'BAN_03', 'LAN_AUDIT_LOG_003', $query, FALSE, LOG_TO_ROLLING);
+ //$admin_log->addEvent(4, __FILE__."|".__FUNCTION__."@".__LINE__, 'BAN_03', 'LAN_AUDIT_LOG_003', $query, FALSE, LOG_TO_ROLLING);
if($this->debug)
{
@@ -1014,7 +1014,7 @@ class eIPHandler
}
- //$admin_log->e_log_event(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","No ban found",$query,FALSE,LOG_TO_ROLLING);
+ //$admin_log->addEvent(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","No ban found",$query,FALSE,LOG_TO_ROLLING);
return true; // Email address OK
}
@@ -1071,7 +1071,7 @@ class eIPHandler
if ($banType >= eIPHandler::BAN_TYPE_WHITELIST)
{ // Got a whitelist entry for this
- //$admin_log->e_log_event(4, __FILE__."|".__FUNCTION__."@".__LINE__, "BANLIST_11", 'LAN_AL_BANLIST_11', $ban_ip, FALSE, LOG_TO_ROLLING);
+ //$admin_log->addEvent(4, __FILE__."|".__FUNCTION__."@".__LINE__, "BANLIST_11", 'LAN_AL_BANLIST_11', $ban_ip, FALSE, LOG_TO_ROLLING);
return FALSE;
}
return 1; // Already in ban list
@@ -1080,7 +1080,7 @@ class eIPHandler
// See if the address is in the whitelist
if ($sql->select('banlist', '*', "`banlist_ip`='{$ban_ip}' AND `banlist_bantype` >= ".eIPHandler::BAN_TYPE_WHITELIST))
{ // Got a whitelist entry for this
- //$admin_log->e_log_event(4, __FILE__."|".__FUNCTION__."@".__LINE__, "BANLIST_11", 'LAN_AL_BANLIST_11', $ban_ip, FALSE, LOG_TO_ROLLING);
+ //$admin_log->addEvent(4, __FILE__."|".__FUNCTION__."@".__LINE__, "BANLIST_11", 'LAN_AL_BANLIST_11', $ban_ip, FALSE, LOG_TO_ROLLING);
return FALSE;
} */
if(vartrue($pref['enable_rdns_on_ban']))
diff --git a/e107_handlers/login.php b/e107_handlers/login.php
index d5208c362..b8cb00217 100644
--- a/e107_handlers/login.php
+++ b/e107_handlers/login.php
@@ -90,7 +90,7 @@ class userlogin
return $this->invalidLogin($username,LOGIN_BLANK_FIELD);
}
-// $this->e107->admin_log->e_log_event(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","User login",'IP: '.$fip,FALSE,LOG_TO_ROLLING);
+// $this->e107->admin_log->addEvent(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","User login",'IP: '.$fip,FALSE,LOG_TO_ROLLING);
// $this->e107->check_ban("banlist_ip='{$this->userIP}' ",FALSE); // This will exit if a ban is in force
e107::getIPHandler()->checkBan("banlist_ip='{$this->userIP}' ",FALSE); // This will exit if a ban is in force
@@ -205,7 +205,7 @@ class userlogin
// User is OK as far as core is concerned
-// $this->e107->admin_log->e_log_event(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","User login",'User passed basics',FALSE,LOG_TO_ROLLING);
+// $this->e107->admin_log->addEvent(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","User login",'User passed basics',FALSE,LOG_TO_ROLLING);
if (($this->passResult !== FALSE) && ($this->passResult !== PASSWORD_VALID))
{ // May want to rewrite password using salted hash (or whatever the preferred method is) - $pass_result has the value to write
// If login by email address also allowed, will have to write that value too
@@ -277,7 +277,7 @@ class userlogin
if (time() > ($this->userData['user_join'] + (varset($pref['user_new_period'],0)*86400)))
{ // 'New user' probationary period expired - we can take them out of the class
$this->userData['user_class'] = $this->e107->user_class->ucRemove(e_UC_NEWUSER, $this->userData['user_class']);
-// $this->e107->admin_log->e_log_event(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","Login new user complete",$this->userData['user_class'],FALSE,FALSE);
+// $this->e107->admin_log->addEvent(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","Login new user complete",$this->userData['user_class'],FALSE,FALSE);
/**
* issue e107inc/e107#3657: Third argument of update() function is for debugging purposes and NOT used for the WHERE clause.
@@ -298,7 +298,7 @@ class userlogin
if (isset($pref['frontpage_force']) && is_array($pref['frontpage_force']))
{ // See if we're to force a page immediately following login - assumes $pref['frontpage_force'] is an ordered list of rules
// $log_info = "New user: ".$this->userData['user_name']." Class: ".$this->userData['user_class']." Admin: ".$this->userData['user_admin']." Perms: ".$this->userData['user_perms'];
-// $this->e107->admin_log->e_log_event(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","Login Start",$log_info,FALSE,FALSE);
+// $this->e107->admin_log->addEvent(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","Login Start",$log_info,FALSE,FALSE);
// FIXME - front page now supports SEF URLs - make a check here
foreach ($pref['frontpage_force'] as $fk=>$fp)
{
@@ -313,7 +313,7 @@ class userlogin
}
//$redir = ((strpos($fp, 'http') === FALSE) ? SITEURL : '').$tp->replaceConstants($fp, TRUE, FALSE);
$redir = e107::getParser()->replaceConstants($fp, TRUE, FALSE);
- // $this->e107->admin_log->e_log_event(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","Redirect active",$redir,FALSE,FALSE);
+ // $this->e107->admin_log->addEvent(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","Redirect active",$redir,FALSE,FALSE);
}
break;
}
@@ -462,7 +462,7 @@ class userlogin
//$aLogVal = "U: {$username}, P: ******, C: ".$session->get('challenge')." R:{$response} S: {$this->userData['user_password']} Prf: {$pref['password_CHAP']}/{$gotChallenge}";
if ((($pref['password_CHAP'] > 0) && ($response && $gotChallenge) && ($response != $session->get('challenge'))) || ($pref['password_CHAP'] == 2))
{ // Verify using CHAP
- //$this->e107->admin_log->e_log_event(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","CHAP login",$aLogVal, FALSE, LOG_TO_ROLLING);
+ //$this->e107->admin_log->addEvent(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","CHAP login",$aLogVal, FALSE, LOG_TO_ROLLING);
if (($pass_result = $this->userMethods->CheckCHAP($session->get('challenge'), $response, $username, $this->userData['user_password'])) === PASSWORD_INVALID)
{
return $this->invalidLogin($username,LOGIN_CHAP_FAIL);
@@ -669,8 +669,8 @@ class userlogin
$debug[0] = e_REQUEST_URI;
// $array = debug_backtrace();
- // e107::getLog()->e_log_event(4, $array, "LOGIN", $title, $text, FALSE, LOG_TO_ROLLING);
- e107::getLog()->e_log_event(4, $debug[1]['file']."|".$debug[1]['function']."@".$debug[1]['line'], "LOGIN", $title, $debug, FALSE, LOG_TO_ROLLING);
+ // e107::getLog()->addEvent(4, $array, "LOGIN", $title, $text, FALSE, LOG_TO_ROLLING);
+ e107::getLog()->addEvent(4, $debug[1]['file']."|".$debug[1]['function']."@".$debug[1]['line'], "LOGIN", $title, $debug, FALSE, LOG_TO_ROLLING);
}
diff --git a/e107_handlers/mail_manager_class.php b/e107_handlers/mail_manager_class.php
index 8b38c5517..3f5be2d4c 100644
--- a/e107_handlers/mail_manager_class.php
+++ b/e107_handlers/mail_manager_class.php
@@ -1563,13 +1563,13 @@ class e107MailManager
$logErrors['email'] = $emailAddress;
$logErrors['bounceString'] = $bounceString;
$logString = $bounceString.' ('.$emailAddress.')[!br!]'.implode('[!br!]',$errors).implode('[!br!]',$bounceInfo);
- // e107::getAdminLog()->e_log_event(10,-1,'BOUNCE','Bounce receive error',$logString, FALSE,LOG_TO_ROLLING);
+ // e107::getAdminLog()->addEvent(10,-1,'BOUNCE','Bounce receive error',$logString, FALSE,LOG_TO_ROLLING);
e107::getAdminLog()->add('Bounce receive error',$logErrors, E_LOG_WARNING, 'BOUNCE', LOG_TO_ROLLING);
return $errors;
}
else
{
- // e107::getAdminLog()->e_log_event(10,-1,'BOUNCE','Bounce received/logged',$bounceInfo, FALSE,LOG_TO_ROLLING);
+ // e107::getAdminLog()->addEvent(10,-1,'BOUNCE','Bounce received/logged',$bounceInfo, FALSE,LOG_TO_ROLLING);
e107::getAdminLog()->add('Bounce received/logged',$bounceInfo, E_LOG_INFORMATIVE, 'BOUNCE',LOG_TO_ROLLING);
}
diff --git a/e107_handlers/mailout_admin_class.php b/e107_handlers/mailout_admin_class.php
index c91d1d349..f881bf11f 100644
--- a/e107_handlers/mailout_admin_class.php
+++ b/e107_handlers/mailout_admin_class.php
@@ -1554,7 +1554,7 @@ class mailoutAdminClass extends e107MailManager
}
$counters = $this->mailRetrieveCounters($mailMainID);
- // $this->e107->admin_log->log_event('MAIL_02','ID: '.$mailMainID.'
+ // $this->e107->admin_log->add('MAIL_02','ID: '.$mailMainID.'
// '.$counters['add'].'[!br!]'.$_POST['email_from_name']."
// <".$_POST['email_from_email'],E_LOG_INFORMATIVE,'');
}
diff --git a/e107_handlers/mailout_class.php b/e107_handlers/mailout_class.php
index 9daaf9db8..e02480065 100644
--- a/e107_handlers/mailout_class.php
+++ b/e107_handlers/mailout_class.php
@@ -303,7 +303,7 @@ class core_mailout
if (is_numeric($selectVals['email_to']))
{
- $_to = LAN_MAILOUT_23.e107::getUserClass()->uc_get_classname(intval($selectVals['email_to']));
+ $_to = LAN_MAILOUT_23.e107::getUserClass()->getName(intval($selectVals['email_to']));
}
else
{
diff --git a/e107_handlers/media_class.php b/e107_handlers/media_class.php
index 50206fc69..647806e99 100644
--- a/e107_handlers/media_class.php
+++ b/e107_handlers/media_class.php
@@ -613,7 +613,7 @@ class e_media
/**
* Generate Simple Thumbnail window for image -selection
- * @deprecated Currently used only by ren_help PreImage_Select
+ * Currently used only by ren_help PreImage_Select
* @param string $cat
* @param string $formid
* @return string
diff --git a/e107_handlers/news_class.php b/e107_handlers/news_class.php
index 2f3c474e8..a7350ce5e 100644
--- a/e107_handlers/news_class.php
+++ b/e107_handlers/news_class.php
@@ -170,7 +170,7 @@ class news {
{
- e107::getAdminLog()->logArrayAll('NEWS_09', $logData);
+ e107::getAdminLog()->addArray($logData)->save('NEWS_09');
$data['data']['news_id'] = $news['news_id'];
@@ -224,7 +224,7 @@ class news {
e107::getCache()->clear('news.php');
//moved down - prevent wrong mysql_insert_id
- e107::getAdminLog()->logArrayAll('NEWS_08', $logData);
+ e107::getAdminLog()->addArray($logData)->save('NEWS_08');
e107::getEvent()->trigger('newspost', $data['data']);
e107::getEvent()->trigger('admin_news_created', $data['data']);
diff --git a/e107_handlers/pclzip.lib.php b/e107_handlers/pclzip.lib.php
index e1ab9e326..67e5688a6 100644
--- a/e107_handlers/pclzip.lib.php
+++ b/e107_handlers/pclzip.lib.php
@@ -5084,12 +5084,12 @@ class PclZip
}
// ----- Get and memorize the magic_quote value
- $this->magic_quotes_status = ini_get('magic_quotes_runtime'); // @get_magic_quotes_runtime();
+ $this->magic_quotes_status = false; // ini_get('magic_quotes_runtime'); // @get_magic_quotes_runtime();
// ----- Disable magic_quotes
- if ($this->magic_quotes_status == 1) {
- @ini_set('magic_quotes_runtime', 0);
- }
+ // if ($this->magic_quotes_status == 1) {
+ // @ini_set('magic_quotes_runtime', 0);
+ // }
// ----- Return
return $v_result;
@@ -5117,9 +5117,9 @@ class PclZip
}
// ----- Swap back magic_quotes
- if ($this->magic_quotes_status == 1) {
+ /* if ($this->magic_quotes_status == 1) {
@ini_set('magic_quotes_runtime', 0); // set_magic_quotes_runtime($this->magic_quotes_status);
- }
+ }*/
// ----- Return
return $v_result;
diff --git a/e107_handlers/plugin_class.php b/e107_handlers/plugin_class.php
index 11087ba28..28a1c8cab 100644
--- a/e107_handlers/plugin_class.php
+++ b/e107_handlers/plugin_class.php
@@ -1257,7 +1257,7 @@ class e_plugin
/**
- * @deprecated in part. To eventually be replaced with e_plugin above.
+ * @outdated in part. To eventually be replaced with e_plugin above.
*/
class e107plugin
{
@@ -2311,7 +2311,7 @@ class e107plugin
// Update prefs array according to $action
// $prefType specifies the storage type - may be 'pref', 'listPref' or 'arrayPref'
/**
- * @deprecated See XmlPrefs(); Left for BC.
+ * @outdated See XmlPrefs(); Left for BC.
* @param $action
* @param $var
* @param string $prefType
@@ -4046,10 +4046,10 @@ class e107plugin
return FALSE;
}
}
- else
- {
+ // else
+ // {
//$mes->add("Optional Setup File NOT Found ".$path."_setup.php ", E_MESSAGE_DEBUG);
- }
+ // }
return FALSE; // IMPORTANT.
}
@@ -4647,7 +4647,7 @@ class e107plugin
}
$core->save(FALSE, false, false);
-
+/*
if ($this->manage_icons())
{
// echo 'IT WORKED';
@@ -4655,7 +4655,8 @@ class e107plugin
else
{
// echo "didn't work!";
- }
+ }*/
+
return null;
}
@@ -4777,7 +4778,7 @@ class e107plugin
/**
* Check Plugin Addon for errors.
- * @return array or numeric. 0 = OK, 1 = Fail, 2 = inaccessible
+ * @return array|int array or numeric. 0 = OK, 1 = Fail, 2 = inaccessible
*/
function checkAddon($plugin_path, $e_xxx)
{
@@ -4890,10 +4891,6 @@ class e107plugin
}
- if(!$plugin_icon)
- {
- //
- }
return $plugin_icon;
}
@@ -4918,13 +4915,14 @@ class e107plugin
$eplug_icon = null;
$eplug_icon_small = null;
- e107::getDebug()->log("Legacy Plugin Parse (php): ".$plugName);
+ e107::getDebug()->log("Legacy Plugin Parse (php): ".$plugName);
ob_start();
- if (include(e_PLUGIN.$plugName.'/plugin.php'))
- {
+ include(e_PLUGIN.$plugName.'/plugin.php');
+ // if (include(e_PLUGIN.$plugName.'/plugin.php'))
+ // {
//$mes->add("Loading ".e_PLUGIN.$plugName.'/plugin.php', E_MESSAGE_DEBUG);
- }
+ // }
ob_end_clean();
$ret = array();
diff --git a/e107_handlers/session_handler.php b/e107_handlers/session_handler.php
index 34762a358..dc335f8e0 100644
--- a/e107_handlers/session_handler.php
+++ b/e107_handlers/session_handler.php
@@ -235,10 +235,11 @@ class e_session
$hashes = hash_algos();
- if ((e_SECURITY_LEVEL >= self::SECURITY_LEVEL_BALANCED) && in_array('sha512', $hashes))
+ // if ((e_SECURITY_LEVEL >= self::SECURITY_LEVEL_BALANCED) && in_array('sha512', $hashes))
{
- ini_set('session.hash_function', 'sha512');
- ini_set('session.hash_bits_per_character', 5);
+
+ // ini_set('session.hash_function', 'sha512'); Removed in PHP 7.1
+ // ini_set('session.hash_bits_per_character', 5); Removed in PHP 7.1
}
$this->fixSessionFileGarbageCollection();
@@ -678,7 +679,7 @@ class e_session
// TODO event trigger
- // e107::getAdminLog()->log_event('Session validation failed!', $details, E_LOG_FATAL);
+ // e107::getAdminLog()->add('Session validation failed!', $details, E_LOG_FATAL);
// TODO session exception, handle it proper on live site
// throw new Exception('');
diff --git a/e107_handlers/upload_handler.php b/e107_handlers/upload_handler.php
index 1a5067df0..7f193d0b2 100644
--- a/e107_handlers/upload_handler.php
+++ b/e107_handlers/upload_handler.php
@@ -131,10 +131,10 @@ function process_uploaded_files($uploaddir, $fileinfo = FALSE, $options = NULL)
if (UH_DEBUG)
{
- e107::getLog()->e_log_event(10, debug_backtrace(), "DEBUG", "Upload Handler test", "Process uploads to {$uploaddir}, fileinfo ".$fileinfo, FALSE, LOG_TO_ROLLING);
+ e107::getLog()->addEvent(10, debug_backtrace(), "DEBUG", "Upload Handler test", "Process uploads to {$uploaddir}, fileinfo ".$fileinfo, FALSE, LOG_TO_ROLLING);
}
- // $admin_log->e_log_event(10,__FILE__."|".__FUNCTION__."@".__LINE__,"DEBUG","Upload Handler test","Intermediate directory: {$ul_temp_dir} ",FALSE,LOG_TO_ROLLING);
+ // $admin_log->addEvent(10,__FILE__."|".__FUNCTION__."@".__LINE__,"DEBUG","Upload Handler test","Intermediate directory: {$ul_temp_dir} ",FALSE,LOG_TO_ROLLING);
$overwrite = varset($options['overwrite'], FALSE);
@@ -144,14 +144,14 @@ function process_uploaded_files($uploaddir, $fileinfo = FALSE, $options = NULL)
{
if (UH_DEBUG)
{
- e107::getLog()->e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Invalid directory: ".$uploaddir, FALSE, FALSE);
+ e107::getLog()->addEvent(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Invalid directory: ".$uploaddir, FALSE, FALSE);
}
return FALSE; // Need a valid directory
}
if (UH_DEBUG)
{
- e107::getLog()->e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Destination directory: ".$uploaddir, FALSE, FALSE);
+ e107::getLog()->addEvent(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Destination directory: ".$uploaddir, FALSE, FALSE);
}
$final_chmod = varset($options['final_chmod'], 0644);
@@ -171,7 +171,7 @@ function process_uploaded_files($uploaddir, $fileinfo = FALSE, $options = NULL)
{
if (UH_DEBUG)
{
- e107::getLog()->e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "No files uploaded", FALSE, FALSE);
+ e107::getLog()->addEvent(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "No files uploaded", FALSE, FALSE);
}
return FALSE;
}
@@ -186,7 +186,7 @@ function process_uploaded_files($uploaddir, $fileinfo = FALSE, $options = NULL)
if (UH_DEBUG)
{
- e107::getLog()->e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Start individual files: ".count($files['name'])." Max upload: ".$max_upload_size, FALSE, FALSE);
+ e107::getLog()->addEvent(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Start individual files: ".count($files['name'])." Max upload: ".$max_upload_size, FALSE, FALSE);
}
$c = 0;
@@ -212,7 +212,7 @@ function process_uploaded_files($uploaddir, $fileinfo = FALSE, $options = NULL)
if (UH_DEBUG)
{
- e107::getLog()->e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Process file {$name}, size ".$files['size'][$key], FALSE, FALSE);
+ e107::getLog()->addEvent(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Process file {$name}, size ".$files['size'][$key], FALSE, FALSE);
}
if ($max_file_count && ($c >= $max_file_count))
@@ -285,7 +285,7 @@ function process_uploaded_files($uploaddir, $fileinfo = FALSE, $options = NULL)
if (UH_DEBUG)
{
- e107::getLog()->e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Move {$tempfilename} to {$uploadfile} ", FALSE, LOG_TO_ROLLING);
+ e107::getLog()->addEvent(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Move {$tempfilename} to {$uploadfile} ", FALSE, LOG_TO_ROLLING);
}
@move_uploaded_file($tempfilename, $uploadfile); // This should work on all hosts
@@ -322,7 +322,7 @@ function process_uploaded_files($uploaddir, $fileinfo = FALSE, $options = NULL)
if (UH_DEBUG)
{
- e107::getLog()->e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Final chmod() file {$destination_file} to {$final_chmod} ", FALSE, FALSE);
+ e107::getLog()->addEvent(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Final chmod() file {$destination_file} to {$final_chmod} ", FALSE, FALSE);
}
$uploaded[$c]['size'] = $files['size'][$key];
@@ -330,7 +330,7 @@ function process_uploaded_files($uploaddir, $fileinfo = FALSE, $options = NULL)
if (UH_DEBUG)
{
- e107::getLog()->e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Saved file {$c} OK: ".$uploaded[$c]['name'], FALSE, FALSE);
+ e107::getLog()->addEvent(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Saved file {$c} OK: ".$uploaded[$c]['name'], FALSE, FALSE);
}
}
@@ -403,7 +403,7 @@ function process_uploaded_files($uploaddir, $fileinfo = FALSE, $options = NULL)
if (UH_DEBUG) // If we need to abort on first error, do so here - could check for specific error codes
{
- e107::getLog()->e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Main routine error {$first_error} file {$c}: ".$uploaded[$c]['message'], FALSE, FALSE);
+ e107::getLog()->addEvent(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Main routine error {$first_error} file {$c}: ".$uploaded[$c]['message'], FALSE, FALSE);
}
}
@@ -516,7 +516,7 @@ function file_upload($uploaddir, $avatar = FALSE, $fileinfo = "", $overwrite = "
if (UH_DEBUG)
$admin_log->
- e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Legacy call, directory ".$uploaddir, FALSE, FALSE);
+ addEvent(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Legacy call, directory ".$uploaddir, FALSE, FALSE);
$ret = process_uploaded_files(getcwd()."/".$uploaddir, $avatar, $options); // Well, that's the way it was done before
@@ -524,13 +524,13 @@ function file_upload($uploaddir, $avatar = FALSE, $fileinfo = "", $overwrite = "
{
if (UH_DEBUG)
$admin_log->
- e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Legacy return FALSE", FALSE, FALSE);
+ addEvent(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Legacy return FALSE", FALSE, FALSE);
return FALSE;
}
if (UH_DEBUG)
$admin_log->
- e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Legacy return with ".count($ret)." files", FALSE, FALSE);
+ addEvent(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Legacy return with ".count($ret)." files", FALSE, FALSE);
$messages = handle_upload_messages($ret, FALSE, TRUE); // Show all the error and acknowledgment messages
define(F_MESSAGE, $messages);
@@ -898,7 +898,7 @@ function get_image_mime($filename, $extended = false)
if (deftrue('UH_DEBUG'))
{
$admin_log->
- e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "File size limits - user set: ".$pref['upload_maxfilesize']." Post_max_size: ".ini_get('post_max_size')." upload_max_size: ".ini_get('upload_max_size'), FALSE, FALSE);
+ addEvent(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "File size limits - user set: ".$pref['upload_maxfilesize']." Post_max_size: ".ini_get('post_max_size')." upload_max_size: ".ini_get('upload_max_size'), FALSE, FALSE);
}
$max_upload_size = file_size_decode(ini_get('post_max_size'));
$max_upload_size = file_size_decode(ini_get('upload_max_filesize'), $max_upload_size, 'lt');
@@ -913,7 +913,7 @@ function get_image_mime($filename, $extended = false)
}
if (deftrue('UH_DEBUG'))
$admin_log->
- e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Final max upload size: {$max_upload_size}", FALSE, FALSE);
+ addEvent(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Final max upload size: {$max_upload_size}", FALSE, FALSE);
return $max_upload_size;
}
diff --git a/e107_handlers/user_model.php b/e107_handlers/user_model.php
index 95ab85f08..7e63f5b33 100644
--- a/e107_handlers/user_model.php
+++ b/e107_handlers/user_model.php
@@ -1659,7 +1659,7 @@ class e_user extends e_user_model
}
// TODO - lan
- e107::getAdminLog()->log_event('Head Admin used Login As feature', 'Head Admin [#'.$this->getId().'] '.$this->getName().' logged in user account #'.$user_id);
+ e107::getAdminLog()->add('Head Admin used Login As feature', 'Head Admin [#'.$this->getId().'] '.$this->getName().' logged in user account #'.$user_id);
//$this->loadAs(); - shouldn't be called here - loginAs should be called in Admin area only, loadAs - front-end
return true;
}
diff --git a/e107_handlers/userclass_class.php b/e107_handlers/userclass_class.php
index e6a15603c..db6d11a11 100644
--- a/e107_handlers/userclass_class.php
+++ b/e107_handlers/userclass_class.php
@@ -636,7 +636,7 @@ class user_class
{
// $c = (in_array($k,$curArray)) ? " checked='checked'" : '';
$c = (in_array($k,$curArray)) ? true : false;
- if ($showdescription) $v .= ' ('.$this->uc_get_classdescription($k).')';
+ if ($showdescription) $v .= ' ('.$this->getDescription($k).')';
//$ret[] = "".$v."
\n";
$name = $fieldname.'['.$k.']';
$ret[] = $frm->checkbox($name,$k,$c,$v);
@@ -1313,7 +1313,7 @@ function r_userclass_name($id)
// echo "Call r_userclass_name ";
global $e_userclass;
if (!is_object($e_userclass)) $e_userclass = new user_class;
- return $e_userclass->uc_get_classname($id);
+ return $e_userclass->getName($id);
}
diff --git a/e107_plugins/alt_auth/alt_auth_conf.php b/e107_plugins/alt_auth/alt_auth_conf.php
index 887632ac9..bf5ff386b 100755
--- a/e107_plugins/alt_auth/alt_auth_conf.php
+++ b/e107_plugins/alt_auth/alt_auth_conf.php
@@ -72,8 +72,8 @@ if(isset($_POST['updateeufs']))
$au = implode(',',$authExtended);
if ($au != $pref['auth_extended'])
{
- $pref['auth_extended'] = $au; // @TODO:
- save_prefs();
+
+ e107::getConfig()->set('auth_extended', $au)->save(true,true,true);
e107::getLog()->add('AUTH_02',$au,'');
}
}
@@ -85,14 +85,23 @@ if (!isset($pref['auth_noconn'])) $pref['auth_noconn'] = 0;
// Convert prefs
if (isset($pref['auth_nouser']))
{
- $pref['auth_method2'] = 'none'; // Default to no fallback
- if ($pref['auth_nouser'])
+ $cfg = e107::getConfig();
+ $cfg->set('auth_method2', 'none');
+
+ if($pref['auth_nouser'])
{
- $pref['auth_method2'] = 'e107';
+ $cfg->set('auth_method2', 'e107');
}
- unset($pref['auth_nouser']);
- if (!isset($pref['auth_badpassword'])) $pref['auth_badpassword'] = 0;
- save_prefs(); // @TODO
+
+ $cfg->remove('auth_nouser');
+
+ if (!isset($pref['auth_badpassword']))
+ {
+ $cfg->set('auth_badpassword', 0);
+ }
+
+ $cfg->save(false, true, true);
+
}
diff --git a/e107_plugins/alt_auth/alt_auth_login_class.php b/e107_plugins/alt_auth/alt_auth_login_class.php
index 1c554e3eb..9f3438819 100755
--- a/e107_plugins/alt_auth/alt_auth_login_class.php
+++ b/e107_plugins/alt_auth/alt_auth_login_class.php
@@ -121,7 +121,7 @@ class alt_login
if (isset($_login->copyMethods[$k]))
{
$newvals[$k] = $this->translate($_login->copyMethods[$k], $v);
- if (AA_DEBUG1) $this->e107->admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Alt auth convert",$k.': '.$v.'=>'.$newvals[$k],FALSE,LOG_TO_ROLLING);
+ if (AA_DEBUG1) $this->e107->admin_log->addEvent(10,debug_backtrace(),"DEBUG","Alt auth convert",$k.': '.$v.'=>'.$newvals[$k],FALSE,LOG_TO_ROLLING);
}
}
}
@@ -147,7 +147,7 @@ class alt_login
$qry = "SELECT u.user_id,u.".implode(',u.',array_keys($db_vals)).", ue.user_extended_id, ue.".implode(',ue.',array_keys($xFields))." FROM `#user` AS u
LEFT JOIN `#user_extended` AS ue ON ue.user_extended_id = u.user_id
WHERE ".$ulogin->getLookupQuery($username, FALSE, 'u.');
- if (AA_DEBUG) $this->e107->admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Alt auth login","Query: {$qry}[!br!]".print_r($xFields,TRUE),FALSE,LOG_TO_ROLLING);
+ if (AA_DEBUG) $this->e107->admin_log->addEvent(10,debug_backtrace(),"DEBUG","Alt auth login","Query: {$qry}[!br!]".print_r($xFields,TRUE),FALSE,LOG_TO_ROLLING);
}
else
{
@@ -167,14 +167,14 @@ class alt_login
validatorClass::addFieldTypes($userMethods->userVettingInfo,$newUser);
$newUser['WHERE'] = '`user_id`='.$row['user_id'];
$aa_sql->update('user',$newUser);
- if (AA_DEBUG1) $this->e107->admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Alt auth login","User data update: ".print_r($newUser,TRUE),FALSE,LOG_TO_ROLLING);
+ if (AA_DEBUG1) $this->e107->admin_log->addEvent(10,debug_backtrace(),"DEBUG","Alt auth login","User data update: ".print_r($newUser,TRUE),FALSE,LOG_TO_ROLLING);
}
foreach ($xFields as $k => $v)
{
if ($row[$k] == $v) unset($xFields[$k]);
}
- if (AA_DEBUG1) $this->e107->admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Alt auth login","User data read: ".print_r($row,TRUE)."[!br!]".print_r($xFields,TRUE),FALSE,LOG_TO_ROLLING);
- if (AA_DEBUG) $this->e107->admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Alt auth login","User xtnd read: ".print_r($xFields,TRUE),FALSE,LOG_TO_ROLLING);
+ if (AA_DEBUG1) $this->e107->admin_log->addEvent(10,debug_backtrace(),"DEBUG","Alt auth login","User data read: ".print_r($row,TRUE)."[!br!]".print_r($xFields,TRUE),FALSE,LOG_TO_ROLLING);
+ if (AA_DEBUG) $this->e107->admin_log->addEvent(10,debug_backtrace(),"DEBUG","Alt auth login","User xtnd read: ".print_r($xFields,TRUE),FALSE,LOG_TO_ROLLING);
if (count($xFields))
{
$xArray = array();
@@ -183,14 +183,14 @@ class alt_login
{
$ue->addFieldTypes($xArray); // Add in the data types for storage
$xArray['WHERE'] = '`user_extended_id`='.intval($row['user_id']);
- if (AA_DEBUG) $this->e107->admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Alt auth login","User xtnd update: ".print_r($xFields,TRUE),FALSE,LOG_TO_ROLLING);
+ if (AA_DEBUG) $this->e107->admin_log->addEvent(10,debug_backtrace(),"DEBUG","Alt auth login","User xtnd update: ".print_r($xFields,TRUE),FALSE,LOG_TO_ROLLING);
$aa_sql->update('user_extended',$xArray );
}
else
{ // Never been an extended user fields record for this user
$xArray['data']['user_extended_id'] = $row['user_id'];
$ue->addDefaultFields($xArray); // Add in the data types for storage, plus any default values
- if (AA_DEBUG) $this->e107->admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Alt auth login","Write new extended record".print_r($xFields,TRUE),FALSE,LOG_TO_ROLLING);
+ if (AA_DEBUG) $this->e107->admin_log->addEvent(10,debug_backtrace(),"DEBUG","Alt auth login","Write new extended record".print_r($xFields,TRUE),FALSE,LOG_TO_ROLLING);
$aa_sql->insert('user_extended',$xArray);
}
}
@@ -198,7 +198,7 @@ class alt_login
else
{ // Just add a new user
- if (AA_DEBUG) $this->e107->admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Alt auth login","Add new user: ".print_r($db_vals,TRUE)."[!br!]".print_r($xFields,TRUE),FALSE,LOG_TO_ROLLING);
+ if (AA_DEBUG) $this->e107->admin_log->addEvent(10,debug_backtrace(),"DEBUG","Alt auth login","Add new user: ".print_r($db_vals,TRUE)."[!br!]".print_r($xFields,TRUE),FALSE,LOG_TO_ROLLING);
if (!isset($db_vals['user_name'])) $db_vals['user_name'] = $username;
if (!isset($db_vals['user_loginname'])) $db_vals['user_loginname'] = $username;
if (!isset($db_vals['user_join'])) $db_vals['user_join'] = time();
@@ -224,12 +224,12 @@ class alt_login
e107::getUserExt()->addDefaultFields($xArray); // Add in the data types for storage, plus any default values
$result = $aa_sql->insert('user_extended',$xArray);
- if (AA_DEBUG) e107::getLog()->e_log_event(10,debug_backtrace(),'DEBUG','Alt auth login',"Add extended: UID={$newID} result={$result}",FALSE,LOG_TO_ROLLING);
+ if (AA_DEBUG) e107::getLog()->addEvent(10,debug_backtrace(),'DEBUG','Alt auth login',"Add extended: UID={$newID} result={$result}",FALSE,LOG_TO_ROLLING);
}
}
else
{ // Error adding user to database - possibly a conflict on unique fields
- $this->e107->admin_log->e_log_event(10,__FILE__.'|'.__FUNCTION__.'@'.__LINE__,'ALT_AUTH','Alt auth login','Add user fail: DB Error '.$aa_sql->getLastErrorText()."[!br!]".print_r($db_vals,TRUE),FALSE,LOG_TO_ROLLING);
+ $this->e107->admin_log->addEvent(10,__FILE__.'|'.__FUNCTION__.'@'.__LINE__,'ALT_AUTH','Alt auth login','Add user fail: DB Error '.$aa_sql->getLastErrorText()."[!br!]".print_r($db_vals,TRUE),FALSE,LOG_TO_ROLLING);
$this->loginResult = LOGIN_DB_ERROR;
return;
}
diff --git a/e107_plugins/download/admin_download.php b/e107_plugins/download/admin_download.php
index 3148953d1..80eb4ce19 100644
--- a/e107_plugins/download/admin_download.php
+++ b/e107_plugins/download/admin_download.php
@@ -142,10 +142,17 @@ if (isset($_POST['updatedownlaodoptions']))
if (isset($_POST['updateuploadoptions']))
{
unset($temp);
- $temp['upload_enabled'] = intval($_POST['upload_enabled']);
+/* $temp['upload_enabled'] = intval($_POST['upload_enabled']);
$temp['upload_maxfilesize'] = $_POST['upload_maxfilesize'];
- $temp['upload_class'] = intval($_POST['upload_class']);
- if ($admin_log->logArrayDiffs($temp, $pref, 'DOWNL_02'))
+ $temp['upload_class'] = intval($_POST['upload_class']);*/
+
+ $cfg = e107::getConfig();
+ $cfg->set('upload_enabled', (int) $_POST['upload_enabled']);
+ $cfg->set('upload_maxfilesize', $_POST['upload_maxfilesize']);
+ $cfg->set('upload_class', (int) $_POST['upload_class']);
+ $cfg->save(true, true, true);
+
+ /*if ($admin_log->logArrayDiffs($temp, $pref, 'DOWNL_02'))
{
save_prefs();
$message = DOWLAN_65;
@@ -153,7 +160,7 @@ if (isset($_POST['updateuploadoptions']))
else
{
$message = DOWLAN_8;
- }
+ }*/
}
$targetFields = array('gen_datestamp', 'gen_user_id', 'gen_ip', 'gen_intdata', 'gen_chardata'); // Fields for download limits
diff --git a/e107_plugins/download/includes/admin.php b/e107_plugins/download/includes/admin.php
index 5a25a3592..5187abc4d 100644
--- a/e107_plugins/download/includes/admin.php
+++ b/e107_plugins/download/includes/admin.php
@@ -314,10 +314,6 @@ class download_main_admin_ui extends e_admin_ui
// default - true - TODO - move to displaySettings
protected $batchDelete = true;
- /** @deprecated see writeParms() on download_id below. */
- // protected $url = array('route'=>'download/view/item', 'vars' => array('id' => 'download_id', 'name' => 'download_sef'), 'name' => 'download_name', 'description' => ''); // 'link' only needed if profile not provided.
-
-
protected $fields = array(
'checkboxes' => array('title'=> '', 'type' => null, 'data' => null, 'width'=>'5%', 'thclass' =>'center', 'forced'=> TRUE, 'class'=>'center', 'toggle' => 'e-multiselect'),
diff --git a/e107_plugins/forum/forum_admin.php b/e107_plugins/forum/forum_admin.php
index fa839de96..e4ba80239 100644
--- a/e107_plugins/forum/forum_admin.php
+++ b/e107_plugins/forum/forum_admin.php
@@ -2037,7 +2037,7 @@ class forumAdmin
$text .= "
".$parent['forum_name']."
- ".FORLAN_140.": ".e107::getUserClass()->uc_get_classname($parent['forum_class'])." ".LAN_FORUM_2015.": ".e107::getUserClass()->uc_get_classname($parent['forum_postclass'])."
+ ".FORLAN_140.": ".e107::getUserClass()->getName($parent['forum_class'])." ".LAN_FORUM_2015.": ".e107::getUserClass()->getName($parent['forum_postclass'])."
";
$text .= "";
@@ -2083,7 +2083,7 @@ class forumAdmin
$text .= "
".$tp->toHTML($forum['forum_description'])."
- ".FORLAN_140.": ".e107::getUserClass()->uc_get_classname($forum['forum_class'])." ".LAN_FORUM_2015.": ".e107::getUserClass()->uc_get_classname($forum['forum_postclass'])."
+ ".FORLAN_140.": ".e107::getUserClass()->getName($forum['forum_class'])." ".LAN_FORUM_2015.": ".e107::getUserClass()->getName($forum['forum_postclass'])."
diff --git a/e107_plugins/gsitemap/admin_config.php b/e107_plugins/gsitemap/admin_config.php
index a9c3bbbf5..1d7cb0fad 100644
--- a/e107_plugins/gsitemap/admin_config.php
+++ b/e107_plugins/gsitemap/admin_config.php
@@ -891,7 +891,7 @@ class gsitemap
$this->message = LAN_UPDATED;
// Log update
- $log->logArrayAll('GSMAP_04', $gmap);
+ $log->addArray($gmap)->save('GSMAP_04');
}
else
{
@@ -910,7 +910,7 @@ class gsitemap
$this->message = LAN_CREATED;
// Log insert
- $log->logArrayAll('GSMAP_03',$gmap);
+ $log->addArray($gmap)->save('GSMAP_03');
}
else
{
@@ -930,7 +930,7 @@ class gsitemap
if($sql->delete("gsitemap", "gsitemap_id='".$d_idt[0]."'"))
{
$this->message = LAN_DELETED;
- $log->log_event('GSMAP_02', $this->message.': '.$d_idt[0]);
+ $log->add('GSMAP_02', $this->message.': '.$d_idt[0]);
}
else
{
@@ -1127,7 +1127,7 @@ class gsitemap
}
$this->message = count($_POST['importid'])." link(s) imported.";
- $log->log_event('GSMAP_01',$this->message);
+ $log->add('GSMAP_01',$this->message);
}
diff --git a/e107_plugins/log/stats.php b/e107_plugins/log/stats.php
index 39765496d..4b877f369 100644
--- a/e107_plugins/log/stats.php
+++ b/e107_plugins/log/stats.php
@@ -2062,7 +2062,7 @@ class siteStats
$dbPageInfo = unserialize($row[2]);
unset($dbPageInfo[$toremove]);
$dbPageDone = serialize($dbPageInfo);
- $sql -> db_Update("logstats", "log_data='{$dbPageDone}' WHERE log_id='pageTotal' ");
+ $sql ->update("logstats", "log_data='{$dbPageDone}' WHERE log_id='pageTotal' ");
return TRUE;
}
return FALSE;
diff --git a/e107_plugins/login_menu/login_menu.php b/e107_plugins/login_menu/login_menu.php
index 11ba1c8fe..cb14ef7d6 100644
--- a/e107_plugins/login_menu/login_menu.php
+++ b/e107_plugins/login_menu/login_menu.php
@@ -144,7 +144,7 @@ if (USER == TRUE || ADMIN == TRUE)
}
// ------------ Pass the data & parse ------------
- cachevars('login_menu_data', $menu_data);
+ e107::setRegistry('login_menu_data', $menu_data);
$text = $tp->parseTemplate($LOGIN_MENU_LOGGED, true, $login_menu_shortcodes);
//menu caption
diff --git a/e107_plugins/login_menu/login_menu_class.php b/e107_plugins/login_menu/login_menu_class.php
index 8e81d8fc3..e61f84235 100644
--- a/e107_plugins/login_menu/login_menu_class.php
+++ b/e107_plugins/login_menu/login_menu_class.php
@@ -117,7 +117,7 @@ class login_menu_class
function parse_external_list($active=false, $order=true)
{
//prevent more than 1 call
- if(($tmp = getcachedvars('loginbox_elist')) !== FALSE) return $tmp;
+ if(($tmp = e107::getRegistry('loginbox_elist')) !== FALSE) return $tmp;
$ret = array();
//$lbox_admin = varsettrue($eplug_admin, false);
@@ -164,7 +164,8 @@ class login_menu_class
}
}
- cachevars('loginbox_elist', $ret);
+
+ e107::setRegistry('loginbox_elist', $ret);
return $ret;
}
@@ -214,8 +215,10 @@ class login_menu_class
$lbox_stats[0]['stat_items'] = LAN_LOGINMENU_17;
$lbox_stats[0]['stat_new'] = 0;
$lbox_stats[0]['stat_nonew'] = LAN_LOGINMENU_26.' '.LAN_LOGINMENU_17;
- if(vartrue($get_stats)) {
- $lbox_stats['chatbox_menu'][0]['stat_new'] = $sql->db_Count('chatbox', '(*)', 'WHERE `cb_datestamp` > '.USERLV);
+
+ if(!empty($get_stats))
+ {
+ $lbox_stats['chatbox_menu'][0]['stat_new'] = $sql->count('chatbox', '(*)', 'WHERE `cb_datestamp` > '.USERLV);
}
return $lbox_stats;
@@ -346,7 +349,7 @@ class login_menu_class
*/
function get_plugin_data($plugid)
{
- if(($tmp = getcachedvars('loginbox_eplug_data_'.$plugid)) !== FALSE) return $tmp;
+ if(($tmp = e107::getRegistry('loginbox_eplug_data_'.$plugid)) !== FALSE) return $tmp;
$ret = array();
if (is_readable(e_PLUGIN.$plugid.'/plugin.xml'))
@@ -370,7 +373,8 @@ class login_menu_class
return array();
}
// Valid data here
- cachevars('loginbox_eplug_data_'.$plugid, $ret);
+ e107::setRegistry('loginbox_eplug_data_'.$plugid, $ret);
+
return $ret;
}
diff --git a/e107_plugins/login_menu/login_menu_shortcodes.php b/e107_plugins/login_menu/login_menu_shortcodes.php
index 70c3f8da5..4c82cfe12 100755
--- a/e107_plugins/login_menu/login_menu_shortcodes.php
+++ b/e107_plugins/login_menu/login_menu_shortcodes.php
@@ -250,7 +250,7 @@ e107::getLanguage()->bcDefs($bcDefs);
{
if(ADMIN)
{
- $data = getcachedvars('login_menu_data');
+ $data = e107::getRegistry('login_menu_data');
return $parm == 'src' ? $data['link_bullet_src'] : $data['link_bullet'];
}
return '';
@@ -274,7 +274,7 @@ e107::getLanguage()->bcDefs($bcDefs);
function sc_lm_bullet($parm='')
{
- $data = getcachedvars('login_menu_data');
+ $data = e107::getRegistry('login_menu_data');
return $parm == 'src' ? $data['link_bullet_src'] : $data['link_bullet'];
}
@@ -348,7 +348,7 @@ e107::getLanguage()->bcDefs($bcDefs);
foreach($lbox_items as $num => $lbox_item)
{
$lbox_item['link_id'] = $stackid . '_' . $num;
- cachevars('login_menu_linkdata', $lbox_item);
+ e107::setRegistry('login_menu_linkdata', $lbox_item);
$ret .= $tp->parseTemplate($LOGIN_MENU_EXTERNAL_LINK, false, $login_menu_shortcodes);
}
}
@@ -358,13 +358,13 @@ e107::getLanguage()->bcDefs($bcDefs);
function sc_lm_external_link($parm='')
{
- $lbox_item = getcachedvars('login_menu_linkdata');
+ $lbox_item = e107::getRegistry('login_menu_linkdata');
return $parm == 'href' ? $lbox_item['link_url'] : '';
}
function sc_lm_external_link_label($parm='')
{
- $lbox_item = getcachedvars('login_menu_linkdata');
+ $lbox_item = e107::getRegistry('login_menu_linkdata');
return vartrue($lbox_item['link_label'], '['.LAN_LOGINMENU_44.']');
}
@@ -372,7 +372,7 @@ e107::getLanguage()->bcDefs($bcDefs);
{
$tp = e107::getParser();
global $LOGIN_MENU_STATS;
- $data = getcachedvars('login_menu_data');
+ $data = e107::getRegistry('login_menu_data');
if(!$data['enable_stats']) return '';
return $tp -> parseTemplate($LOGIN_MENU_STATS, true, $this);
}
@@ -381,7 +381,7 @@ e107::getLanguage()->bcDefs($bcDefs);
{
$tp = e107::getParser();
global $LOGIN_MENU_STATITEM;
- $data = getcachedvars('login_menu_data');
+ $data = e107::getRegistry('login_menu_data');
if(!isset($data['new_news'])) return '';
$tmp = array();
if($data['new_news']){
@@ -399,7 +399,7 @@ e107::getLanguage()->bcDefs($bcDefs);
function sc_lm_new_comments($parm='')
{
global $LOGIN_MENU_STATITEM, $tp;
- $data = getcachedvars('login_menu_data');
+ $data = e107::getRegistry('login_menu_data');
if(!isset($data['new_comments'])) return '';
$tmp = array();
if($data['new_comments']){
@@ -417,7 +417,7 @@ e107::getLanguage()->bcDefs($bcDefs);
function sc_lm_new_users($parm='')
{
global $LOGIN_MENU_STATITEM, $tp;
- $data = getcachedvars('login_menu_data');
+ $data = e107::getRegistry('login_menu_data');
if(!isset($data['new_users'])) return '';
$tmp = array();
if($data['new_users']){
@@ -483,7 +483,7 @@ e107::getLanguage()->bcDefs($bcDefs);
function sc_lm_listnew_link($parm='')
{
- $data = getcachedvars('login_menu_data');
+ $data = e107::getRegistry('login_menu_data');
if($parm == 'href') return $data['listnew_link'];
return $data['listnew_link'] ? '' : '';
}
diff --git a/e107_plugins/newsfeed/newsfeed_functions.php b/e107_plugins/newsfeed/newsfeed_functions.php
index 98ed62964..b812d22ae 100644
--- a/e107_plugins/newsfeed/newsfeed_functions.php
+++ b/e107_plugins/newsfeed/newsfeed_functions.php
@@ -154,7 +154,7 @@ class newsfeedClass
if (NEWSFEED_DEBUG)
{
- e107::getLog()->e_log_event(10,debug_backtrace(),"DEBUG","Newsfeed update","Refresh item: ".$feedID,FALSE,LOG_TO_ROLLING);
+ e107::getLog()->addEvent(10,debug_backtrace(),"DEBUG","Newsfeed update","Refresh item: ".$feedID,FALSE,LOG_TO_ROLLING);
}
require_once(e_HANDLER.'xml_class.php');
diff --git a/e107_plugins/pm/admin_config.php b/e107_plugins/pm/admin_config.php
index d1b87dabc..47367bd2a 100644
--- a/e107_plugins/pm/admin_config.php
+++ b/e107_plugins/pm/admin_config.php
@@ -177,12 +177,12 @@ class private_msg_ui extends e_admin_ui
if($sql->insert('generic', $limArray))
{
- e107::getLog()->logArrayAll('PM_ADM_05', $limArray);
+ e107::getLog()->addArray($limArray)->save('PM_ADM_05');
$mes->addSuccess(ADLAN_PM_6);
}
else
{
- e107::getLog()->log_event('PM_ADM_08', '');
+ e107::getLog()->add('PM_ADM_08', '');
$mes->addError(ADLAN_PM_7);
}
}
@@ -214,12 +214,12 @@ class private_msg_ui extends e_admin_ui
//All entries empty - Remove record
if($sql->delete('generic','gen_id = '.$id))
{
- e107::getLog()->log_event('PM_ADM_07', 'ID: '.$id);
+ e107::getLog()->add('PM_ADM_07', 'ID: '.$id);
$mes->addSuccess($id.ADLAN_PM_9);
}
else
{
- e107::getLog()->log_event('PM_ADM_10', '');
+ e107::getLog()->add('PM_ADM_10', '');
$mes->addError($id.ADLAN_PM_10);
}
}
@@ -235,12 +235,12 @@ class private_msg_ui extends e_admin_ui
if ($sql->update('generic',array('data' => $limArray, 'WHERE' => 'gen_id = '.$id)))
{
- e107::getLog()->logArrayAll('PM_ADM_06', $limArray);
+ e107::getLog()->addArray($limArray)->save('PM_ADM_06');
$mes->addSuccess($id.ADLAN_PM_11);
}
else
{
- e107::getLog()->log_event('PM_ADM_09', '');
+ e107::getLog()->add('PM_ADM_09', '');
$mes->addError($id.ADLAN_PM_7);
}
}
@@ -328,7 +328,7 @@ class private_msg_ui extends e_admin_ui
{
$txt .= "
- ".e107::getUserClass()->uc_get_classname($row['limit_classnum'])."
+ ".e107::getUserClass()->getName($row['limit_classnum'])."
".LAN_PLUGIN_PM_INBOX.":
@@ -575,7 +575,7 @@ class private_msg_ui extends e_admin_ui
$results = array(E_MESSAGE_INFO => array(ADLAN_PM_67)); // 'Maintenance started' - primarily for a log entry to mark start time
$logResults = array();
$e107 = e107::getInstance();
- e107::getLog()->log_event('PM_ADM_04', implode(', ',array_keys($opts)));
+ e107::getLog()->add('PM_ADM_04', implode(', ',array_keys($opts)));
$pmHandler = new private_message($pmPrefs);
$db2 =e107::getDb('sql2'); // Will usually need a second DB object to avoid over load
$start = 0; // Use to ensure we get different log times
@@ -741,7 +741,7 @@ class private_msg_ui extends e_admin_ui
}
- e107::getLog()->logArrayAll('PM_ADM_03', $this->makeLogEntry($results));
+ e107::getLog()->addArray($this->makeLogEntry($results))->save('PM_ADM_03');
foreach ($results as $k => $r)
{
diff --git a/e107_plugins/pm/pm_class.php b/e107_plugins/pm/pm_class.php
index 181eae5a7..98f13b549 100755
--- a/e107_plugins/pm/pm_class.php
+++ b/e107_plugins/pm/pm_class.php
@@ -183,7 +183,7 @@ class private_message
{
if(!empty($vars['pm_userclass']))
{
- $toclass = e107::getUserClass()->uc_get_classname($vars['pm_userclass']);
+ $toclass = e107::getUserClass()->getName($vars['pm_userclass']);
$tolist = $this->get_users_inclass($vars['pm_userclass']);
$ret .= LAN_PM_38.": {$toclass}
";
$class = TRUE;
diff --git a/e107_plugins/pm/pm_conf.php b/e107_plugins/pm/pm_conf.php
index b68448f6a..9fbead085 100755
--- a/e107_plugins/pm/pm_conf.php
+++ b/e107_plugins/pm/pm_conf.php
@@ -69,7 +69,7 @@ if(!is_array($pm_prefs))
$pm_prefs = pm_set_default_prefs(); // Use the default settings
$sysprefs->setArray('pm_prefs');
$emessage->add(ADLAN_PM_3, E_MESSAGE_INFO);
- $e107->admin_log->log_event('PM_ADM_01', '');
+ $e107->admin_log->add('PM_ADM_01', '');
}
*/
@@ -192,12 +192,12 @@ if(isset($_POST['addlimit']))
if($sql->insert('generic', $limArray))
{
- e107::getLog()->logArrayAll('PM_ADM_05', $limArray);
+ e107::getLog()->addArray($limArray)->save('PM_ADM_05');
$mes->addSuccess(ADLAN_PM_6);
}
else
{
- e107::getLog()->log_event('PM_ADM_08', '');
+ e107::getLog()->add('PM_ADM_08', '');
$mes->addError(ADLAN_PM_7);
}
}
@@ -220,12 +220,12 @@ if(isset($_POST['updatelimits']))
//All entries empty - Remove record
if($sql->delete('generic','gen_id = '.$id))
{
- e107::getLog()->log_event('PM_ADM_07', 'ID: '.$id);
+ e107::getLog()->add('PM_ADM_07', 'ID: '.$id);
$mes->addSuccess($id.ADLAN_PM_9);
}
else
{
- e107::getLog()->log_event('PM_ADM_10', '');
+ e107::getLog()->add('PM_ADM_10', '');
$mes->addError($id.ADLAN_PM_10);
}
}
@@ -239,12 +239,12 @@ if(isset($_POST['updatelimits']))
);
if ($sql->update('generic',array('data' => $limArray, 'WHERE' => 'gen_id = '.$id)))
{
- e107::getLog()->logArrayAll('PM_ADM_06', $limArray);
+ e107::getLog()->addArray($limArray)->save('PM_ADM_06');
$mes->addSuccess($id.ADLAN_PM_11);
}
else
{
- e107::getLog()->log_event('PM_ADM_09', '');
+ e107::getLog()->add('PM_ADM_09', '');
$mes->addError($id.ADLAN_PM_7);
}
}
@@ -439,7 +439,7 @@ function show_limits($pm_prefs)
{
$txt .= "
- ".e107::getUserClass()->uc_get_classname($row['limit_classnum'])."
+ ".e107::getUserClass()->getName($row['limit_classnum'])."
".LAN_PLUGIN_PM_INBOX.":
".LAN_PLUGIN_PM_OUTBOX.":
@@ -631,7 +631,7 @@ function doMaint($opts, $pmPrefs)
$results = array(E_MESSAGE_INFO => array(ADLAN_PM_67)); // 'Maintenance started' - primarily for a log entry to mark start time
$logResults = array();
$e107 = e107::getInstance();
- $e107->admin_log->log_event('PM_ADM_04', implode(', ',array_keys($opts)));
+ $e107->admin_log->add('PM_ADM_04', implode(', ',array_keys($opts)));
$pmHandler = new private_message($pmPrefs);
$db2 = new db(); // Will usually need a second DB object to avoid over load
$start = 0; // Use to ensure we get different log times
@@ -796,8 +796,8 @@ function doMaint($opts, $pmPrefs)
$results[E_MESSAGE_SUCCESS][$start] = $attachMessage;
}
+ e107::getLog()->addArray(makeLogEntry($results))->save('PM_ADM_03');
- $e107->admin_log->logArrayAll('PM_ADM_03',makeLogEntry($results));
foreach ($results as $k => $r)
{
foreach ($r as $sk => $s)
diff --git a/e107_plugins/poll/admin_config.php b/e107_plugins/poll/admin_config.php
index 5218b558a..30e2aaaf9 100644
--- a/e107_plugins/poll/admin_config.php
+++ b/e107_plugins/poll/admin_config.php
@@ -159,11 +159,11 @@ function poll_list()
$frm = e107::getForm();
$mes = e107::getMessage();
- global $user_pref;
+// global $user_pref;
if(isset($_POST['etrigger_ecolumns'])) //TODO User
{
- $user_pref['admin_poll_columns'] = $_POST['e-columns'];
- save_prefs('user');
+ // $user_pref['admin_poll_columns'] = $_POST['e-columns'];
+ e107::getConfig('user')->setPref('admin_poll_columns',$_POST['e-columns'])->save(true,true,false);
}
$fieldpref = (varset($user_pref['admin_poll_columns'])) ? $user_pref['admin_poll_columns'] : array("poll_id","poll_title","poll_options","poll_vote_userclass"); ;
diff --git a/e107_plugins/tinymce4/admin_config.php b/e107_plugins/tinymce4/admin_config.php
index 595c095e4..e5206d3d3 100644
--- a/e107_plugins/tinymce4/admin_config.php
+++ b/e107_plugins/tinymce4/admin_config.php
@@ -146,11 +146,6 @@ else
$ef->listRecords();
}
-if(isset($_POST['etrigger_ecolumns']))
-{
- $user_pref['admin_release_columns'] = $_POST['e-columns'];
- save_prefs('user');
-}
require_once(e_ADMIN."footer.php");
@@ -568,18 +563,11 @@ class tinymce
function saveSettings()
{
- global $pref, $admin_log, $emessage;
+ $temp = array();
$temp['listPages'] = $_POST['listPages'];
$temp['pageCookieExpire'] = $_POST['pageCookieExpire'];
- if ($admin_log->logArrayDiffs($temp, $pref, 'CPAGE_04'))
- {
- save_prefs(); // Only save if changes
- $emessage->add(CUSLAN_45, E_MESSAGE_SUCCESS);
- }
- else
- {
- $emessage->add(CUSLAN_46);
- }
+
+ e107::getConfig()->setPref($temp)->save(true, true, true);
}
diff --git a/e107_plugins/user/e_mailout.php b/e107_plugins/user/e_mailout.php
index 8f151358b..77aed5d01 100644
--- a/e107_plugins/user/e_mailout.php
+++ b/e107_plugins/user/e_mailout.php
@@ -325,7 +325,7 @@ class user_mailout
if (is_numeric($selectVals['email_to']))
{
- $_to = LAN_MAILOUT_23.e107::getUserClass()->uc_get_classname(intval($selectVals['email_to']));
+ $_to = LAN_MAILOUT_23.e107::getUserClass()->getName(intval($selectVals['email_to']));
}
else
{
diff --git a/e107_plugins/user/usertheme_menu_config.php b/e107_plugins/user/usertheme_menu_config.php
index ad1a9cd86..7c256513f 100644
--- a/e107_plugins/user/usertheme_menu_config.php
+++ b/e107_plugins/user/usertheme_menu_config.php
@@ -56,9 +56,11 @@ if (isset($_POST['update_theme']))
$themeeditclass = intval($_POST['themeeditclass']);
if (($newThemes != $pref['allowed_themes']) || ($themeeditclass != $pref['allow_theme_select']))
{
- $pref['allowed_themes'] = $newThemes;
- $pref['allow_theme_select'] = $themeeditclass;
- save_prefs();
+ $cfg = e107::getConfig();
+ $cfg->set('allowed_themes', $newThemes);
+ $cfg->set('allow_theme_select', $themeeditclass);
+ $cfg->save(true,true,true);
+
$woffle = LAN_UMENU_THEME_8.$pref['allowed_themes'].'[!br!]'.LAN_UMENU_THEME_9.$pref['allow_theme_select'];
e107::getLog()->add('UTHEME_01',$woffle,E_LOG_INFORMATIVE,'');
}
diff --git a/e107_tests/tests/unit/e_admin_logTest.php b/e107_tests/tests/unit/e_admin_logTest.php
index 73e1be5c5..f2424081a 100644
--- a/e107_tests/tests/unit/e_admin_logTest.php
+++ b/e107_tests/tests/unit/e_admin_logTest.php
@@ -28,6 +28,7 @@
$this->assertTrue(false, "Couldn't load e_admin_log object");
}
+ $this->log->__construct();
}
/*
public function testAddSuccess()
@@ -54,12 +55,20 @@
{
}
-
+*/
public function testAddArray()
{
+ $arr = array('one'=>'two', 'three'=>'four');
+ $this->log->addArray($arr)->save('ADD_ARRAY');
+
+ $result = $this->log->getLastLog();
+
+ $this->assertNotEmpty($result['dblog_eventcode']);
+ $this->assertSame('ADD_ARRAY', $result['dblog_eventcode']);
+ $this->assertSame("Array[!br!]([!br!] [one] => two[!br!] [three] => four[!br!])[!br!]",$result['dblog_remarks']);
}
-
+/*
public function testLogMessage()
{
@@ -84,12 +93,21 @@
{
}
-
+*/
public function testLogArrayAll()
{
+ $arr = array('one'=>'test', 'two'=>'testing');
+ $this->log->logArrayAll('TEST',$arr);
+
+ $result = $this->log->getLastLog();
+
+ $this->assertNotEmpty($result['dblog_eventcode']);
+
+ $this->assertSame('TEST', $result['dblog_eventcode']);
+ $this->assertSame("Array[!br!]([!br!] [one] => test[!br!] [two] => testing[!br!])[!br!]", $result['dblog_remarks']);
}
-
+/*
public function testFlushMessages()
{
@@ -104,12 +122,32 @@
{
}
-
+*/
public function testAdd()
{
+ // add to admin_log
+ $this->log->add('testAdd Title', "testAdd Message", E_LOG_INFORMATIVE, 'TEST_ADD');
+ $result = $this->log->getLastLog();
+
+ $this->assertNotEmpty($result['dblog_eventcode']);
+
+ $this->assertSame('TEST_ADD', $result['dblog_eventcode']);
+ $this->assertSame("testAdd Message", $result['dblog_remarks']);
+ $this->assertSame('testAdd Title', $result['dblog_title']);
+
+ // add to rolling log (dblog)
+ $this->log->rollingLog(true);
+ $this->log->add('Rolling Title', "Rolling Message", E_LOG_INFORMATIVE, 'TEST_ROLL', LOG_TO_ROLLING);
+ $result = $this->log->getLastLog(LOG_TO_ROLLING);
+
+ $this->assertNotEmpty($result['dblog_eventcode']);
+ $this->assertSame('TEST_ROLL', $result['dblog_eventcode']);
+ $this->assertSame("Rolling Message", $result['dblog_remarks']);
+
+ $this->log->rollingLog(false);
}
-
+/*
public function testToFile()
{
diff --git a/e107_web/utilities/resetcore.php b/e107_web/utilities/resetcore.php
deleted file mode 100644
index c9736bfdb..000000000
--- a/e107_web/utilities/resetcore.php
+++ /dev/null
@@ -1,398 +0,0 @@
-Currently disabled. To enable please open this file in a text editor and follow the instructions to activate.";
- exit;
-}
-
-$register_globals = true;
-if(function_exists('ini_get'))
-{
- $register_globals = ini_get('register_globals');
-}
-if($register_globals == true)
-{
- foreach($GLOBALS as $global=>$tmp);
- {
- if (!preg_match('/^(_POST|_GET|_COOKIE|_SERVER|_FILES|GLOBALS|HTTP.*|_REQUEST|eTimingStart)$/', $global))
- {
- unset($$global);
- }
- }
- unset($global,$tmp);
-}
-
-
-// build e_CACHE and other constants from e107_config.php - resetcore.php is a stand alone page
-$siteRoot = realpath(dirname(__FILE__).'./../../').'/';
-require_once($siteRoot.'e107_config.php');
-if (!isset($mySQLdefaultdb)) return FALSE;
-if (!isset($mySQLprefix)) return FALSE;
-
-$hash = substr(md5($mySQLdefaultdb.".".$mySQLprefix),0,10);
-
-
-//mysql_connect($mySQLserver, $mySQLuser, $mySQLpassword);
-//mysql_select_db($mySQLdefaultdb);
-define("MAGIC_QUOTES_GPC", (ini_get('magic_quotes_gpc') ? TRUE : FALSE));
-
-define('e_CACHE', $siteRoot.$SYSTEM_DIRECTORY.$hash.'/cache/');
-define('e_CORE', $siteRoot.'core/'); // @TODO: Allow for override
-
-define('e107_INIT', TRUE);
-
-
-require_once('../../'.$HANDLERS_DIRECTORY.'core_functions.php');
-$eArrayStorage = new e_array();
-
-?>
-
-
-e107 resetcore
-
-
-
-
-
-
-
-
-
-
-
-
-
- echo "
-
- ";
-
- $END = TRUE;
- } else {
- $message = "
Administrator not found in database / incorrect password / insufficient permissions - aborting. ";
- $END = TRUE;
- }
-}
-
-
-if (isset($_POST['reset_core_sub']) && $_POST['mode'] == 2)
-{
- if (($at = e_verify()) === FALSE)
- {
- exit;
- }
-
- $tmpr = substr(str_replace($_SERVER['DOCUMENT_ROOT'], "", $_SERVER['SCRIPT_FILENAME']), 1);
- $root = "/".substr($tmpr, 0, strpos($tmpr, "/"))."/";
- $e_HTTP = $root;
- $admin_directory = "e107_admin";
- $url_prefix = substr($_SERVER['PHP_SELF'], strlen($e_HTTP), strrpos($_SERVER['PHP_SELF'], "/")+1-strlen($e_HTTP));
- $num_levels = substr_count($url_prefix, "/");
- $link_prefix = '';
- for($i = 1; $i <= $num_levels; $i++) {
- $link_prefix .= "../";
- }
-
- define("e_ADMIN", $e_HTTP.$admin_directory."/");
- define("e_SELF", "http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']);
- define("e_QUERY", preg_replace("#&|/?PHPSESSID.*#i", "", $_SERVER['QUERY_STRING']));
- define('e_BASE', $link_prefix);
- $e_path = (!strpos($_SERVER['SCRIPT_FILENAME'], ".php") ? $_SERVER['PATH_TRANSLATED'] : $_SERVER['SCRIPT_FILENAME']);
- define("e_PATH", $e_path);
-
-
- $pref_language = "English";
- include_once("../../".$LANGUAGES_DIRECTORY.'English/lan_prefs.php');
- require_once(e_CORE.'def_e107_prefs.php');
-
- $PrefOutput = $eArrayStorage->WriteArray($pref);
-
- mysql_query("DELETE FROM ".$mySQLprefix."core WHERE e107_name='SitePrefs' OR e107_name='SitePrefs_Backup'");
- if (!mysql_query("INSERT INTO ".$mySQLprefix."core VALUES ('SitePrefs', '{$PrefOutput}')"))
- {
- $message = "Rebuild failed ...";
- $END = TRUE;
- }
- else
- {
- mysql_query("INSERT INTO ".$mySQLprefix."core VALUES ('SitePrefs_Backup', '{$PrefOutput}')");
- $message = "Core reset.
Click here to continue ";
- $END = TRUE;
- }
-}
-
-
-
-function recurse_pref($ppost)
-{
- $search = array("\"", "'", "\\", '\"', "\'", "$", "?");
- $replace = array(""", "'", "\", """, "'", "$", "©");
- foreach ($ppost as $key => $value) {
- if(!is_array($value)){
- $ret[$key] = str_replace($search, $replace, $text);
- } else {
- $ret[$key] = recurse_pref($value);
- }
- }
- return $ret;
-}
-
-if (isset($_POST['coreedit_sub']))
-{
- if (($at = e_verify()) === FALSE) {
- exit;
- }
-
- $pref = recurse_pref($_POST);
-
- $PrefOutput = $eArrayStorage->WriteArray($pref);
-
- mysql_query("DELETE FROM ".$mySQLprefix."core WHERE e107_name='SitePrefs' OR e107_name='SitePrefs_Backup'");
- mysql_query("INSERT INTO ".$mySQLprefix."core VALUES ('SitePrefs', '{$PrefOutput}')");
- mysql_query("INSERT INTO ".$mySQLprefix."core VALUES ('SitePrefs_Backup', '{$PrefOutput}')");
-
- $message = "Core settings successfully updated.
Click here to continue ";
- $END = TRUE;
-}
-
-if (isset($_POST['reset_core_sub']) && $_POST['mode'] == 3) {
- if (($at = e_verify()) === FALSE) {
- exit;
- }
-
- $result = mysql_query("SELECT * FROM ".$mySQLprefix."core WHERE e107_name='pref_backup'");
- $row = mysql_fetch_array($result);
-
- $pref = unserialize(base64_decode($row['e107_value']));
-
- $PrefOutput = $eArrayStorage->WriteArray($pref);
-
- mysql_query("DELETE FROM ".$mySQLprefix."core WHERE `e107_name` = 'SitePrefs' OR `e107_name` = 'SitePrefs_Backup'");
- mysql_query("INSERT INTO ".$mySQLprefix."core VALUES ('SitePrefs', '{$PrefOutput}')");
- mysql_query("INSERT INTO ".$mySQLprefix."core VALUES ('SitePrefs_Backup', '{$PrefOutput}')");
-
- $message = "Core backup successfully restored.
Click here to continue ";
- $END = TRUE;
-}
-
-
-if (isset($_POST['reset_core_sub']) && $_POST['mode'] == 1)
-{
- if (($at = e_verify()) === FALSE) {
- exit;
- }
-
- $result = @mysql_query("SELECT * FROM ".$mySQLprefix."core WHERE e107_name='SitePrefs'");
- $row = @mysql_fetch_array($result);
-
- $pref = $eArrayStorage->ReadArray($row['e107_value']);
-
- echo "
-
-
";
- $END = TRUE;
-}
-
-if (isset($message)) {
- echo "
";
-}
-
-if (isset($END)) {
- echo "
";
- exit;
-}
-
-echo "
-
-
-