mirror of
https://github.com/e107inc/e107.git
synced 2025-01-16 20:28:28 +01:00
Updating of deprecated method usage. Removal of old files. Log tests added.
This commit is contained in:
parent
582c48fc21
commit
f5153bf640
12
class2.php
12
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;
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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 "<script type='text/javascript'>document.location.href='../index.php'</script>\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);
|
||||
*/
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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, '');
|
||||
}
|
||||
|
||||
|
||||
|
@ -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, '');
|
||||
}
|
||||
|
||||
|
||||
|
@ -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."<br />oldpath=".$oldpath."<br />".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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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,'');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,925 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
require_once("../class2.php");
|
||||
|
||||
if (!getperms("1"))
|
||||
{
|
||||
e107::redirect('admin');
|
||||
exit;
|
||||
}
|
||||
|
||||
e107::coreLan('theme', true);
|
||||
|
||||
$e_sub_cat = 'theme_manage';
|
||||
|
||||
e107::css("inline","
|
||||
.block-text h2.caption { text-align: right; margin-bottom: -30px; padding-right: 10px; }
|
||||
.hide { display: none }
|
||||
|
||||
|
||||
|
||||
");
|
||||
|
||||
|
||||
require_once(e_HANDLER."theme_handler.php");
|
||||
$themec = new themeHandler;
|
||||
|
||||
// print_a($_GET);
|
||||
|
||||
$mode = varset($_GET['mode'],'main'); // (e_QUERY) ? e_QUERY :"main" ;
|
||||
|
||||
|
||||
if(!empty($_GET['action']))
|
||||
{
|
||||
define('e_IFRAME',true);
|
||||
}
|
||||
|
||||
if(!empty($_GET['action']))
|
||||
{
|
||||
require_once("auth.php");
|
||||
switch ($_GET['action'])
|
||||
{
|
||||
case 'login':
|
||||
$mp = $themec->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 "<pre>Connecting...\n"; flush();
|
||||
// download and flush
|
||||
$mp->download($p['id'], $p['mode'], $p['type']);
|
||||
echo "</pre>"; 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 '
|
||||
|
||||
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Loading…</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#" data-dismiss="modal" class="btn btn-primary">Close</a>
|
||||
</div>
|
||||
</div>';
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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 "<b>DEBUG MODE ACTIVE (no downloading)</b><br />";
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// <a data-toggle="modal" href="'.e_SELF.'" data-target="#myModal" class="btn" >Launch demo modal</a>
|
||||
|
||||
|
||||
|
||||
|
||||
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."<span>".TPVLAN_26."</span>";
|
||||
|
||||
|
||||
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.' <br />
|
||||
'.TPVLAN_65.'
|
||||
<ul>
|
||||
<li> '.TPVLAN_66.'</li>
|
||||
<li> '.TPVLAN_67.'</li>
|
||||
</ul>
|
||||
');
|
||||
|
||||
$text = $frm->open('createPlugin','get',e_SELF."?mode=convert");
|
||||
$text .= "<table class='table adminform'>
|
||||
<colgroup>
|
||||
<col class='col-label' />
|
||||
<col class='col-control' />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td> ".TPVLAN_68."</td>
|
||||
<td>".$frm->select("newtheme",$newDir)."</td>
|
||||
</tr>";
|
||||
|
||||
/*
|
||||
$text .= "
|
||||
<tr>
|
||||
<td>Create Files</td>
|
||||
<td>".$frm->checkbox('createFiles',1,1)."</td>
|
||||
</tr>";
|
||||
*/
|
||||
|
||||
$text .= "</tbody>
|
||||
</table>
|
||||
<div class='buttons-bar center'>
|
||||
".$frm->admin_button('step', 2,'other',LAN_GO)."
|
||||
</div>";
|
||||
|
||||
$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 .= "<table class='table adminlist'>";
|
||||
foreach($data as $key=>$val)
|
||||
{
|
||||
$text.= "<tr><td>$key</td><td>
|
||||
<div class='controls'>";
|
||||
foreach($val as $type)
|
||||
{
|
||||
$nm = $key.'-'.$type;
|
||||
$name = "xml[$nm]";
|
||||
$size = (count($val)==1) ? 'col-md-7' : 'col-md-2';
|
||||
$text .= "<div class='{$size}'>".$this->xmlInput($name, $key."-". $type, vartrue($defaults[$nm]))."</div>";
|
||||
}
|
||||
|
||||
$text .= "</div></td></tr>";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
$text .= "</table>";
|
||||
$text .= "
|
||||
<div class='buttons-bar center'>"
|
||||
.$frm->hidden('newtheme', $this->themeName);
|
||||
$text .= $frm->hidden('xml[custompages]', trim(vartrue($leg['CUSTOMPAGES'])))
|
||||
.$frm->admin_button('step', 3,'other',LAN_GENERATE)."
|
||||
</div>";
|
||||
|
||||
$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(). "<pre>".$xmlText."</pre>");
|
||||
}
|
||||
|
||||
|
||||
$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<layout name='custom' title='Custom'>\n";
|
||||
$LAYOUTS .= " <custompages>{CUSTOMPAGES}</custompages>\n";
|
||||
$LAYOUTS .= " </layout>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$LAYOUTS = "";
|
||||
}
|
||||
|
||||
if(!empty($newArray['STYLESHEETS_STYLESHEETS']))
|
||||
{
|
||||
$STYLESHEETS = '';
|
||||
foreach($newArray['STYLESHEETS_STYLESHEETS'] as $val)
|
||||
{
|
||||
if(empty($val['file']))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$STYLESHEETS .= "\t\t<css file=\"".$val['file']."\" name=\"".$val['name']."\" />\n";
|
||||
}
|
||||
|
||||
if(!empty($STYLESHEETS))
|
||||
{
|
||||
$STYLESHEETS = "\n\t<stylesheets>\n".$STYLESHEETS."\t</stylesheets>";
|
||||
}
|
||||
|
||||
unset($newArray['STYLESHEETS_STYLESHEETS']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$STYLESHEETS = "";
|
||||
}
|
||||
|
||||
$newArray['STYLESHEETS'] = $STYLESHEETS;
|
||||
|
||||
// print_a($newArray);
|
||||
|
||||
|
||||
$template = <<<TEMPLATE
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<e107Theme name="{MAIN_NAME}" lan="{MAIN_LANG}" version="{MAIN_VERSION}" date="{MAIN_DATE}" compatibility="{MAIN_COMPATIBILITY}" livedemo="{LIVEDEMO_LIVEDEMO}">
|
||||
<author name="{AUTHOR_NAME}" url="{AUTHOR_URL}" />
|
||||
<summary lan="">{SUMMARY_SUMMARY}</summary>
|
||||
<description lan="">{DESCRIPTION_DESCRIPTION}</description>
|
||||
<category>{CATEGORY_CATEGORY}</category>
|
||||
<keywords>
|
||||
<word>{KEYWORDS_ONE}</word>
|
||||
<word>{KEYWORDS_TWO}</word>
|
||||
</keywords>
|
||||
<copyright>{COPYRIGHT_COPYRIGHT}</copyright>
|
||||
<screenshots>
|
||||
<image>preview.jpg</image>
|
||||
<image>fullpreview.jpg</image>
|
||||
</screenshots>{STYLESHEETS}
|
||||
<layouts>
|
||||
<layout name='default' title='Default' default='true' />{LAYOUTS}
|
||||
</layouts>
|
||||
</e107Theme>
|
||||
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 .= "<div class='row-fluid'>";
|
||||
$text .= "<div class='controls'>";
|
||||
$text .= "<div class='col-md-3'>".$frm->checkbox($name.'['.$key.'][file]',$file, false, array('label'=>$file))."
|
||||
<div class='field-help'>".TPVLAN_CONV_14."</div></div>";
|
||||
$text .= "<div class='col-md-3'>".$frm->text($name.'['.$key.'][name]', $default, $size, 'placeholder='.$file . $req. $pat)."
|
||||
<div class='field-help'>".TPVLAN_CONV_15."</div></div>";
|
||||
// $text .= "<div class='span2'>".$frm->checkbox('css['.$key.'][file]',$file, false, array('label'=>$file))."</div>";
|
||||
// $text .= "<div class='span2'>".$frm->text('css['.$key.'][name]', $default, $size, 'placeholder='.$placeholder . $req. $pat)."</div>";
|
||||
$text .= "</div>";
|
||||
$text .= "</div>";
|
||||
}
|
||||
|
||||
|
||||
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) ? "<span class='field-help'>".$help."</span>" : "";
|
||||
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 .= "<table class='table adminform'>
|
||||
<colgroup>
|
||||
<col class='col-label' />
|
||||
<col class='col-control' />
|
||||
</colgroup>
|
||||
<tr>
|
||||
<td>".TPVLAN_91."</td>
|
||||
<td>".$frm->select("src",$folders,'',array('useValues'=>1))."</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>".TPVLAN_92."</td>
|
||||
<td>".$frm->text("newtheme",'',25, array('pattern'=>'[a-z_0-9]*', 'required'=>1))."</td>
|
||||
</tr>
|
||||
|
||||
";
|
||||
|
||||
/*
|
||||
$text .= "
|
||||
<tr>
|
||||
<td>Create Files</td>
|
||||
<td>".$frm->checkbox('createFiles',1,1)."</td>
|
||||
</tr>";
|
||||
*/
|
||||
|
||||
$text .= "
|
||||
</table>
|
||||
<div class='buttons-bar center'>
|
||||
".$frm->admin_button('step', 2,'success', LAN_CREATE)."
|
||||
</div>";
|
||||
|
||||
|
||||
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
@ -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 = "<e107Filetypes>\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]}<br />";
|
||||
$file_text .= " <class name='{$c}' type='{$_POST['file_type_list'][$k]}' maxupload='".vartrue($_POST['file_maxupload'][$k],ini_get('upload_max_filesize'))."' />\n";
|
||||
}
|
||||
}
|
||||
$file_text .= "</e107Filetypes>\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 .= '<br />'.UPLLAN_59.e_UPLOAD_TEMP_DIR.e_SAVE_FILETYPES.'. '.UPLLAN_60.e_ADMIN.e_READ_FILETYPES.'<br />';
|
||||
}
|
||||
$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 = "<div style='text-align:center'>
|
||||
<form method='post' action='".e_SELF."?filetypes'>
|
||||
<table style='".ADMIN_WIDTH."' class='fborder'>
|
||||
<colgroup>
|
||||
<col style='width:30%' />
|
||||
<col style='width:40%' />
|
||||
<col style='width:25%' />
|
||||
<col style='width:5%' />
|
||||
</colgroup>
|
||||
<tr>
|
||||
<td class='forumheader3' colspan='4'><input type='hidden' name='upload_do_edit' value='1'>".
|
||||
str_replace(array('[x]', '[y]'),array(e_UPLOAD_TEMP_DIR.e_SAVE_FILETYPES,e_ADMIN.e_READ_FILETYPES),UPLLAN_52)."</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='forumheader3' colspan='4'>".UPLLAN_57.$source_file."</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='fcaption'>".LAN_USERCLASS."</td>
|
||||
<td class='fcaption'>".UPLLAN_54."</td>
|
||||
<td class='fcaption' style='text-align:center'>".UPLLAN_55."</td>
|
||||
<td class='fcaption' style='text-align:center'>".LAN_DELETE."</td>
|
||||
</tr>";
|
||||
foreach ($current_perms as $uclass => $uinfo)
|
||||
{
|
||||
$text .= "
|
||||
<tr>
|
||||
<td class='forumheader3'><select name='file_class_select[]' class='tbox'>
|
||||
".$e_userclass->vetted_tree('file_class_select',array($e_userclass,'select'), $uclass,'member,main,classes,admin, no-excludes')."
|
||||
</select></td>
|
||||
<td class='forumheader3'><input type='text' name='file_type_list[]' value='{$uinfo['type']}' class='tbox' size='40' /></td>
|
||||
<td class='forumheader3' style='text-align:center'><input type='text' name='file_maxupload[]' value='{$uinfo['maxupload']}' class='tbox' size='10' /></td>
|
||||
<td class='forumheader3'><input type='checkbox' value='1' name='file_line_delete_{$uclass}' /></td>
|
||||
</tr>";
|
||||
}
|
||||
// Now put up a box to add a new setting
|
||||
$text .= "
|
||||
<tr>
|
||||
<td class='forumheader3'><select name='file_class_select[]' class='tbox'>
|
||||
".$e_userclass->vetted_tree('file_class_select',array($e_userclass,'select'), '','member,main,classes,admin,blank, no-excludes')."
|
||||
</select></td>
|
||||
<td class='forumheader3'><input type='text' name='file_type_list[]' value='' class='tbox' size='40' /></td>
|
||||
<td class='forumheader3' style='text-align:center'><input type='text' name='file_maxupload[]' value='".ini_get('upload_max_filesize')."' class='tbox' size='10' /></td>
|
||||
<td class='forumheader3'> </td>
|
||||
</tr>";
|
||||
$text .= "
|
||||
<tr>
|
||||
<td class='forumheader3' style='text-align:center' colspan='4'>
|
||||
<input class='btn btn-default btn-secondary button' type='submit' name='generate_filetypes_xml' value='".UPLLAN_56."' />
|
||||
</td>
|
||||
</tr>
|
||||
</table></form>
|
||||
</div>";
|
||||
|
||||
$ns->tablerender(LAN_FILETYPES, $text);
|
||||
break;
|
||||
|
||||
case 'options' :
|
||||
if(!getperms('0')) exit;
|
||||
$text = "<div style='text-align:center'>
|
||||
<form method='post' action='".e_SELF."?options'>
|
||||
<table style='".ADMIN_WIDTH."' class='fborder'>
|
||||
<tr>
|
||||
<td style='width:50%' class='forumheader3'>".UPLLAN_25."<br />
|
||||
<span class='smalltext'>".UPLLAN_26."</span></td>
|
||||
<td style='width:50%' class='forumheader3'>". ($pref['upload_enabled'] == 1 ? $rs->form_radio("upload_enabled", 1, 1)." ".LAN_YES.$rs->form_radio("upload_enabled", 0)." ".LAN_NO : $rs->form_radio("upload_enabled", 1)." ".LAN_YES.$rs->form_radio("upload_enabled", 0, 1)." ".LAN_NO)."
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style='width:70%' class='forumheader3'>".UPLLAN_33."<br />
|
||||
<span class='smalltext'>".UPLLAN_34." (upload_max_filesize = ".ini_get('upload_max_filesize').", post_max_size = ".ini_get('post_max_size')." )</span></td>
|
||||
<td style='width:30%' class='forumheader3'>". $rs->form_text("upload_maxfilesize", 10, $pref['upload_maxfilesize'], 10)."
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style='width:70%' class='forumheader3'>".UPLLAN_37."<br />
|
||||
<span class='smalltext'>".UPLLAN_38."</span></td>
|
||||
<td style='width:30%' class='forumheader3'>".r_userclass("upload_class", $pref['upload_class'],"off","nobody,public,guest,member,admin,classes")."
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan='2' class='forumheader' style='text-align:center'>". $rs->form_button("submit", "optionsubmit", LAN_SUBMIT)."
|
||||
</td>
|
||||
</tr>
|
||||
</table>". $rs->form_close()."
|
||||
</div>";
|
||||
|
||||
$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 ? "<b>".$post_author_name."</b>" : "<a href='".e_BASE."user.php?id.".$post_author_id."'><b>".$post_author_name."</b></a>");
|
||||
$upload_datestamp = $gen->convert_date($upload_datestamp, "long");
|
||||
|
||||
$text = "<div style='text-align:center'>
|
||||
<table style='".ADMIN_WIDTH."' class='fborder'>
|
||||
<colgroup>
|
||||
<col style='width:30%' />
|
||||
<col style='width:70%' />
|
||||
</colgroup>
|
||||
|
||||
<tr>
|
||||
<td class='forumheader3'>".LAN_ID."</td>
|
||||
<td class='forumheader3'>{$upload_id}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class='forumheader3'>".LAN_DATE."</td>
|
||||
<td class='forumheader3'>{$upload_datestamp}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class='forumheader3'>".UPLLAN_5."</td>
|
||||
<td class='forumheader3'>{$poster}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class='forumheader3'>".UPLLAN_6."</td>
|
||||
<td class='forumheader3'><a href='mailto:{$upload_email}'>{$upload_email}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class='forumheader3'>".UPLLAN_7."</td>
|
||||
<td class='forumheader3'>".($upload_website ? "<a href='{$upload_website}'>{$upload_website}</a>" : " - ")."</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class='forumheader3'>".LAN_FILE_NAME."</td>
|
||||
<td class='forumheader3'>".($upload_name ? $upload_name: " - ")."</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class='forumheader3'>".LAN_VERSION."</td>
|
||||
<td class='forumheader3'>".($upload_version ? $upload_version : " - ")."</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class='forumheader3'>".LAN_FILE."</td>
|
||||
<td class='forumheader3'>".(is_numeric($upload_file) ? "Binary file ID ".$upload_file : "<a href='".e_SELF."?dl.{$upload_file}'>$upload_file</a>")."</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class='forumheader3'>".LAN_SIZE."</td>
|
||||
<td class='forumheader3'>".$e107->parseMemorySize($upload_filesize)."</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class='forumheader3'>".LAN_SCREENSHOT."</td>
|
||||
<td class='forumheader3'>".($upload_ss ? "<a href='".e_BASE."request.php?upload.".$upload_id."'>".$upload_ss."</a>" : " - ")."</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class='forumheader3'>".LAN_DESCRIPTION."</td>
|
||||
<td class='forumheader3'>{$upload_description}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class='forumheader3'>".UPLLAN_14."</td>
|
||||
<td class='forumheader3'>".($upload_demo ? $upload_demo : " - ")."</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class='forumheader3'>".LAN_OPTIONS."</td>
|
||||
<td class='forumheader3'><a href='".e_SELF."?dlm.{$upload_id}'>".UPLAN_COPYTODLM."</a> | <a href='".e_SELF."?news.{$upload_id}'>".UPLLAN_16."</a> | <a href='".e_SELF."?dis.{$upload_id}'>".UPLLAN_17."</a></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>";
|
||||
|
||||
$ns->tablerender(UPLLAN_18, $text);
|
||||
// Intentionally fall through into list mode
|
||||
|
||||
case 'list' :
|
||||
default :
|
||||
$imgd = e_BASE.$IMAGES_DIRECTORY;
|
||||
$text = "<div style='text-align:center'>
|
||||
<table style='".ADMIN_WIDTH."' class='fborder'>
|
||||
<colgroup>
|
||||
<col style='width:5%' />
|
||||
<col style='width:20%' />
|
||||
<col style='width:15%' />
|
||||
<col style='width:20%' />
|
||||
<col style='width:25%' />
|
||||
<col style='width:10%' />
|
||||
<col style='width:50px;white-space:nowrap' />
|
||||
</colgroup>
|
||||
<tr>
|
||||
<td class='fcaption'>".LAN_ID."</td>
|
||||
<td class='fcaption'>".LAN_DATE."</td>
|
||||
<td class='fcaption'>".UPLLAN_5."</td>
|
||||
<td class='fcaption'>".LAN_NAME."</td>
|
||||
<td class='fcaption'>".LAN_FILE_NAME."</td>
|
||||
<td class='fcaption'>".LAN_SIZE."</td>
|
||||
<td class='fcaption'>".LAN_ACTIONS."</td>
|
||||
</tr>";
|
||||
|
||||
$text .= "<tr><td class='forumheader3' style='text-align:center' colspan='6'>";
|
||||
|
||||
if (!$active_uploads = $sql->select("upload", "*", "upload_active=0 ORDER BY upload_id ASC"))
|
||||
{
|
||||
$text .= UPLLAN_19.".\n</td>\n</tr>";
|
||||
}
|
||||
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 .= "</td></tr>";
|
||||
|
||||
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 ? "<b>".$post_author_name."</b>" : "<a href='".e_BASE."user.php?id.".$post_author_id."'><b>".$post_author_name."</b></a>");
|
||||
$upload_datestamp = $gen->convert_date($upload_datestamp, "short");
|
||||
$text .= "<tr>
|
||||
<td class='forumheader3'>".$upload_id ."</td>
|
||||
<td class='forumheader3'>".$upload_datestamp."</td>
|
||||
<td class='forumheader3'>".$poster."</td>
|
||||
<td class='forumheader3'><a href='".e_SELF."?view.".$upload_id."'>".$upload_name ."</a></td>
|
||||
<td class='forumheader3'>".$upload_file ."</td>
|
||||
<td class='forumheader3'>".$e107->parseMemorySize($upload_filesize)."</td>
|
||||
<td class='forumheader3'>
|
||||
<form action='".e_SELF."?dis.{$upload_id}' id='uploadform_{$upload_id}' method='post'>
|
||||
<div><a href='".e_SELF."?dlm.{$upload_id}'><img src='".e_IMAGE."admin_images/downloads_16.png' alt='".UPLAN_COPYTODLS."' title='".UPLAN_COPYTODLS."' style='border:0' /></a>
|
||||
<a href='".e_SELF."?news.{$upload_id}'><img src='".e_IMAGE."admin_images/news_16.png' alt='".UPLLAN_16."' title='".UPLLAN_16."' style='border:0' /></a>
|
||||
<input type='image' title='".LAN_DELETE."' name='updelete[upload_{$upload_id}]' src='".ADMIN_DELETE_ICON_PATH."' onclick=\"return jsconfirm('".$tp->toJS(UPLLAN_45." [ {$upload_name} ]")."') \"/>
|
||||
</div></form></td>
|
||||
</tr>";
|
||||
}
|
||||
}
|
||||
$text .= "</table>\n</div>";
|
||||
|
||||
$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");
|
||||
|
||||
|
@ -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","<br />",$message),FALSE,LOG_TO_ROLLING);
|
||||
// $admin_log->addEvent(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","User class change",str_replace("\n","<br />",$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 .= "<option value='userclass'>".USRLAN_36."</option>\n"; // DEPRECATED. inline & batch should be enough.
|
||||
}
|
||||
// }
|
||||
if ($row['user_perms'] != "0")
|
||||
{
|
||||
// $text .= "<option value='deluser'>".LAN_DELETE."</option>\n";
|
||||
|
@ -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 "<a href='http://e107.org'>e107</a>";
|
||||
}
|
||||
|
||||
|
||||
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 "<a href='".e107::getUrl()->create('news/list/category', $this->news_item)."'>".$icon."</a>";
|
||||
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 "<a href='".e107::getUrl()->create('news/list/category', $this->news_item)."'>".$icon."</a>";
|
||||
break;
|
||||
}
|
||||
return $this->sc_news_category_icon($parm);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -2592,15 +2592,15 @@ class e_form
|
||||
{
|
||||
$style = " style='text-indent:" . (1.2 * $nest_level) . "em'";
|
||||
}
|
||||
$descr = varset($field_options['description']) ? ' <span class="smalltext">('.$this->_uc->uc_get_classdescription($classnum).')</span>' : '';
|
||||
$descr = varset($field_options['description']) ? ' <span class="smalltext">('.$this->_uc->getDescription($classnum).')</span>' : '';
|
||||
|
||||
return "<div class='field-spacer{$class}'{$style}>".$this->checkbox($treename.'[]', $classnum, in_array($classnum, $tmp), $field_options).$this->label($this->_uc->uc_get_classname($classIndex).$descr, $treename.'[]', $classnum)."</div>\n";
|
||||
return "<div class='field-spacer{$class}'{$style}>".$this->checkbox($treename.'[]', $classnum, in_array($classnum, $tmp), $field_options).$this->label($this->_uc->getName($classIndex).$descr, $treename.'[]', $classnum)."</div>\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";
|
||||
}
|
||||
|
||||
|
||||
|
@ -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']))
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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,'');
|
||||
}
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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']);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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('');
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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[] = "<div class='field-spacer'><input type='checkbox' class='checkbox' name='{$fieldname}[{$k}]' id='{$fieldname}-{$k}' value='{$k}'{$c} /><label for='{$fieldname}-{$k}'>".$v."</label></div>\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<br />";
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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'),
|
||||
|
@ -2037,7 +2037,7 @@ class forumAdmin
|
||||
$text .= "
|
||||
<tr>
|
||||
<td colspan='2'>".$parent['forum_name']."
|
||||
<br /><b>".FORLAN_140.":</b> ".e107::getUserClass()->uc_get_classname($parent['forum_class'])." <b>".LAN_FORUM_2015.":</b> ".e107::getUserClass()->uc_get_classname($parent['forum_postclass'])."
|
||||
<br /><b>".FORLAN_140.":</b> ".e107::getUserClass()->getName($parent['forum_class'])." <b>".LAN_FORUM_2015.":</b> ".e107::getUserClass()->getName($parent['forum_postclass'])."
|
||||
</td>";
|
||||
|
||||
$text .= "<td style='text-align:center'>";
|
||||
@ -2083,7 +2083,7 @@ class forumAdmin
|
||||
|
||||
$text .= "
|
||||
<br /><span class='smallblacktext'>".$tp->toHTML($forum['forum_description'])." </span>
|
||||
<br /><b>".FORLAN_140.":</b> ".e107::getUserClass()->uc_get_classname($forum['forum_class'])." <b>".LAN_FORUM_2015.":</b> ".e107::getUserClass()->uc_get_classname($forum['forum_postclass'])."
|
||||
<br /><b>".FORLAN_140.":</b> ".e107::getUserClass()->getName($forum['forum_class'])." <b>".LAN_FORUM_2015.":</b> ".e107::getUserClass()->getName($forum['forum_postclass'])."
|
||||
|
||||
</td>
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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'] : '<a href="'.$lbox_item['link_url'].'" class="login_menu_link external" id="login_menu_link_external_'.$lbox_item['link_id'].'">'.vartrue($lbox_item['link_label'], '['.LAN_LOGINMENU_44.']').'</a>';
|
||||
}
|
||||
|
||||
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'] ? '<a href="'.$data['listnew_link'].'" class="login_menu_link listnew" id="login_menu_link_listnew">'.LAN_LOGINMENU_24.'</a>' : '';
|
||||
}
|
||||
|
@ -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');
|
||||
|
@ -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 .= "
|
||||
<tr>
|
||||
<td>".e107::getUserClass()->uc_get_classname($row['limit_classnum'])."</td>
|
||||
<td>".e107::getUserClass()->getName($row['limit_classnum'])."</td>
|
||||
<td>
|
||||
<div class='row'>
|
||||
<div class='col-md-2'>".LAN_PLUGIN_PM_INBOX.":</div><div class='col-md-10'><input type='text' class='tbox' size='5' name='inbox_count[{$row['limit_id']}]' value='{$row['inbox_count']}' /></div>
|
||||
@ -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)
|
||||
{
|
||||
|
@ -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}<br />";
|
||||
$class = TRUE;
|
||||
|
@ -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 .= "
|
||||
<tr>
|
||||
<td>".e107::getUserClass()->uc_get_classname($row['limit_classnum'])."</td>
|
||||
<td>".e107::getUserClass()->getName($row['limit_classnum'])."</td>
|
||||
<td>
|
||||
".LAN_PLUGIN_PM_INBOX.": <input type='text' class='tbox' size='5' name='inbox_count[{$row['limit_id']}]' value='{$row['inbox_count']}' /> <br />
|
||||
".LAN_PLUGIN_PM_OUTBOX.": <input type='text' class='tbox' size='5' name='outbox_count[{$row['limit_id']}]' value='{$row['outbox_count']}' />
|
||||
@ -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)
|
||||
|
@ -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"); ;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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,'');
|
||||
}
|
||||
|
@ -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()
|
||||
{
|
||||
|
||||
|
@ -1,398 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| Copyright (C) 2008-2009 e107 Inc
|
||||
| http://e107.org/
|
||||
|
|
||||
| Standalone page aimed to reset core preferences
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_files/utilities/resetcore.php,v $
|
||||
| $Revision$
|
||||
| $Date$
|
||||
| $Author$
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
@TODO: Needs detailed review/fixing:
|
||||
- Handle XML-based default prefs
|
||||
- Review existing definitions of constants
|
||||
- Define new constants (e_CORE, etc) properly
|
||||
*/
|
||||
|
||||
/* ####################################################
|
||||
|
||||
|
||||
To use this file, you must edit the following line, removing the // so it reads:
|
||||
define("ACTIVE", true);
|
||||
If you don't, the script will not be usable.
|
||||
|
||||
When you have finished with resetcore you should swap true for false so it can't be used by
|
||||
people it shouldn't be used by.
|
||||
|
||||
*/
|
||||
|
||||
define('ACTIVE', false);
|
||||
//define('ACTIVE', TRUE);
|
||||
|
||||
|
||||
/* #################################################### */
|
||||
|
||||
|
||||
|
||||
if(ACTIVE !== true)
|
||||
{
|
||||
echo "<span class='headertext2'>Currently disabled. To enable please open this file in a text editor and follow the instructions to activate.</span>";
|
||||
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();
|
||||
|
||||
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>e107 resetcore</title>
|
||||
<link rel="stylesheet" href="style.css" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="content-style-type" content="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class='mainbox'>
|
||||
<a href="http://e107.org"><img src="../../<?php echo($IMAGES_DIRECTORY); ?>logo_template_large.png" alt="Logo" style="border: 0px; vertical-align: middle;" /></a> <span class='headertext'>e107 Reset Core Utility</span>
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<?php
|
||||
|
||||
|
||||
if (isset($_POST['usubmit']))
|
||||
{
|
||||
if (($row = e_verify()) !== FALSE)
|
||||
{
|
||||
extract($row);
|
||||
|
||||
$result = mysql_query("SELECT * FROM ".$mySQLprefix."core WHERE e107_name='pref_backup' ");
|
||||
$bu_exist = ($row = mysql_fetch_array($result) ? TRUE : FALSE);
|
||||
|
||||
$admin_directory = "e107_admin";
|
||||
|
||||
// <input type='radio' name='mode' value='1' /> <span class='headertext2'>Manually edit core values</span><br />
|
||||
|
||||
echo "<span class='headertext2'><b>Please select which method you want to use, then click the button to proceed ...</b></span><br /><br /><br /><br />
|
||||
<table style='width: auto; margin-left:auto; margin-right: auto;'>
|
||||
<tr>
|
||||
<td>
|
||||
<form method='post' action='".$_SERVER['PHP_SELF']."'>
|
||||
<input type='radio' name='mode' value='2' /> <span class='headertext2'>Reset core to default values</span><br />". ($bu_exist ? "<input type='radio' name='mode' value='3' /> <span class='headertext2'>Restore core backup</span>" : "<br />( There is no backed-up core - unable to offer option to restore backup )")."<br /><br /><input class='btn button' type='submit' name='reset_core_sub' value='Select method then click here to continue' />
|
||||
|
||||
<input type='hidden' name='a_name' value='".$_POST['a_name']."' />
|
||||
<input type='hidden' name='a_password' value='".$_POST['a_password']."' />
|
||||
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
";
|
||||
|
||||
$END = TRUE;
|
||||
} else {
|
||||
$message = "<b>Administrator not found in database / incorrect password / insufficient permissions - aborting.</b><br />";
|
||||
$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. <br /><br /><a href='../../index.php'>Click here to continue</a>";
|
||||
$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. <br /><br /><a href='../../index.php'>Click here to continue</a>";
|
||||
$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. <br /><br /><a href='../../index.php'>Click here to continue</a>";
|
||||
$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 "
|
||||
<span class='headertext2'><b>Edit your individual core items and click the button to save - <span class='headertext'>use this script with caution</span>.</b></span><br /><br />
|
||||
<form method='post' action='".$_SERVER['PHP_SELF']."'>
|
||||
<table style='width:95%'>\n";
|
||||
|
||||
while (list($key, $prefr) = each($pref)) {
|
||||
if (is_array($prefr)) {
|
||||
foreach ($prefr as $akey => $apref) {
|
||||
echo "<tr><td class='headertext2' style='width:50%; text-align:right;'>{$key}[{$akey}] </td>
|
||||
<td style='width:50%'><input type='text' name='{$key}[{$akey}]' value='{$apref}' size='50' maxlength='100' /></td></tr>\n";
|
||||
|
||||
}
|
||||
} else {
|
||||
echo "<tr><td class='headertext2' style='width:50%; text-align:right;'>{$key} </td>
|
||||
<td style='width:50%'><input type='text' name='{$key}' value='{$prefr}' size='50' maxlength='100' /></td></tr>\n";
|
||||
}
|
||||
}
|
||||
echo "
|
||||
<tr>
|
||||
<td colspan='2' style='text-align:center'><br /><input class='btn btn-default btn-secondary button' type='submit' name='coreedit_sub' value='Save Core Settings' /></td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type='hidden' name='a_name' value='".$_POST['a_name']."' />
|
||||
<input type='hidden' name='a_password' value='".preg_replace("/\W/", '', $_POST['a_password'])."' />
|
||||
</form>";
|
||||
$END = TRUE;
|
||||
}
|
||||
|
||||
if (isset($message)) {
|
||||
echo "<br /><br /><div style='text-align:center'><span class='headertext2'>{$message}</span></div><br />";
|
||||
}
|
||||
|
||||
if (isset($END)) {
|
||||
echo "<br /></div></body></html>";
|
||||
exit;
|
||||
}
|
||||
|
||||
echo "<span class='headertext2'>
|
||||
This is the e107 resetcore utility. It allows you to completely rebuild your core if it becomes corrupt, or to restore a backup. <br />It won't affect your actual content (news posts, forum posts, articles etc).<br />
|
||||
<b>Only run this utility if your site is failing to load due to a critical core error, or if you need to change a setting and can't log into your admin area.</b></span><br /><br /><br /><br />
|
||||
|
||||
<span class='headertext'>Please enter your main administrator username and password to continue ...</span><br /><br />
|
||||
<form method='post' action='".$_SERVER['PHP_SELF']."'>
|
||||
<table style='width:95%'>
|
||||
<tr>
|
||||
<td style='width:50%; text-align:right;' class='mediumtext'>Main administrator name:</td>
|
||||
<td style='width:50%'>
|
||||
<input class='tbox' type='text' name='a_name' size='30' value='' maxlength='100' />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style='width:50%; text-align:right;' class='mediumtext'>Main administrator Password:</td>
|
||||
<td style='width:50%'>
|
||||
<input class='tbox' type='password' name='a_password' size='30' value='' maxlength='100' />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2' style='text-align:center'>
|
||||
<br />
|
||||
<input class='btn btn-default btn-secondary button' type='submit' name='usubmit' value='Continue' />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
</div>
|
||||
</body>
|
||||
</html>";
|
||||
|
||||
|
||||
/**
|
||||
* Verify main admin data
|
||||
*/
|
||||
function e_verify() {
|
||||
global $mySQLprefix;
|
||||
if (ACTIVE !== TRUE)
|
||||
{
|
||||
exit();
|
||||
}
|
||||
if (MAGIC_QUOTES_GPC == FALSE)
|
||||
{
|
||||
$a_name = addslashes($_POST['a_name']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$a_name = $_POST['a_name'];
|
||||
}
|
||||
|
||||
$a_name = str_replace('/*', '', $a_name);
|
||||
|
||||
$result = mysql_query("SELECT * FROM ".$mySQLprefix."user WHERE user_name='".$a_name."'");
|
||||
$row = mysql_fetch_array($result);
|
||||
|
||||
// @TODO: Will need to handle other password encodings as well
|
||||
if (($row['user_password'] === md5($_POST['a_password'])) && ($row['user_perms'] === '0') && (ACTIVE === TRUE))
|
||||
{
|
||||
clear_cache();
|
||||
return $row;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Clear all cache files
|
||||
*/
|
||||
function clear_cache()
|
||||
{
|
||||
// $dir = "../cache/";
|
||||
$dir = e_CACHE;
|
||||
$pattern = "*.cache.php";
|
||||
$deleted = false;
|
||||
$pattern = str_replace(array("\*", "\?"), array(".*", "."), preg_quote($pattern));
|
||||
if (substr($dir, -1) != "/") {
|
||||
$dir .= "/";
|
||||
}
|
||||
if (is_dir($dir)) {
|
||||
$d = opendir($dir);
|
||||
while ($file = readdir($d)) {
|
||||
if (is_file($dir.$file) && preg_match("/^{$pattern}$/", $file)) {
|
||||
if (unlink($dir.$file)) {
|
||||
$deleted[] = $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($d);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -179,7 +179,7 @@ if (function_exists('date_default_timezone_set'))
|
||||
date_default_timezone_set('UTC');
|
||||
}
|
||||
|
||||
define('MAGIC_QUOTES_GPC', (ini_get('magic_quotes_gpc') ? true : false));
|
||||
define('MAGIC_QUOTES_GPC', false); // (ini_get('magic_quotes_gpc') ? true : false));
|
||||
|
||||
$php_version = phpversion();
|
||||
if(version_compare($php_version, MIN_PHP_VERSION, "<"))
|
||||
|
@ -419,7 +419,7 @@ if (isset($_POST['register']) && intval($pref['user_reg']) === 1)
|
||||
|
||||
// if (SIGNUP_DEBUG)
|
||||
// {
|
||||
// $admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Signup new user",array_merge($allData['data'],$eufVals) ,FALSE,LOG_TO_ROLLING);
|
||||
// $admin_log->addEvent(10,debug_backtrace(),"DEBUG","Signup new user",array_merge($allData['data'],$eufVals) ,FALSE,LOG_TO_ROLLING);
|
||||
// }
|
||||
|
||||
// Log to user audit log if enabled
|
||||
@ -535,7 +535,7 @@ if (isset($_POST['register']) && intval($pref['user_reg']) === 1)
|
||||
|
||||
if($user_class_update === FALSE)
|
||||
{
|
||||
//$admin_log->e_log_event(10,debug_backtrace(),'USER','Userclass update fail',print_r($row,TRUE),FALSE,LOG_TO_ROLLING);
|
||||
//$admin_log->addEvent(10,debug_backtrace(),'USER','Userclass update fail',print_r($row,TRUE),FALSE,LOG_TO_ROLLING);
|
||||
require_once(HEADERF);
|
||||
$ns->tablerender(LAN_SIGNUP_75, LAN_SIGNUP_101);
|
||||
require_once(FOOTERF);
|
||||
|
@ -519,7 +519,7 @@ class usersettings_front // Begin Usersettings rewrite.
|
||||
{
|
||||
if (US_DEBUG)
|
||||
{
|
||||
e107::getLog()->e_log_event(10, debug_backtrace(), "DEBUG", "Usersettings test", "Write back classes; old list: {$udata['user_class']}; new list: ".$nid, false, LOG_TO_ROLLING);
|
||||
e107::getLog()->addEvent(10, debug_backtrace(), "DEBUG", "Usersettings test", "Write back classes; old list: {$udata['user_class']}; new list: ".$nid, false, LOG_TO_ROLLING);
|
||||
}
|
||||
$changedUserData['user_class'] = $nid;
|
||||
}
|
||||
@ -664,7 +664,7 @@ class usersettings_front // Begin Usersettings rewrite.
|
||||
|
||||
|
||||
// We can update the basic user record now - can just update fields from $changedUserData
|
||||
if (US_DEBUG) { e107::getLog()->e_log_event(10, debug_backtrace(), "DEBUG", "Usersettings test", "Changed data:<br /> ".var_export($changedUserData, true), false, LOG_TO_ROLLING); }
|
||||
if (US_DEBUG) { e107::getLog()->addEvent(10, debug_backtrace(), "DEBUG", "Usersettings test", "Changed data:<br /> ".var_export($changedUserData, true), false, LOG_TO_ROLLING); }
|
||||
if (isset($changedUserData) && count($changedUserData))
|
||||
{
|
||||
$changedData['data'] = $changedUserData;
|
||||
|
Loading…
x
Reference in New Issue
Block a user