本文整理汇总了PHP中e107::getAdminLog方法的典型用法代码示例。如果您正苦于以下问题:PHP e107::getAdminLog方法的具体用法?PHP e107::getAdminLog怎么用?PHP e107::getAdminLog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类e107
的用法示例。
在下文中一共展示了e107::getAdminLog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
// DO Not translate - debug info only.
$log = e107::getAdminLog();
if (E107_DEBUG_LEVEL > 0 || e107::getPref('developer')) {
$dep = debug_backtrace(false);
foreach ($dep as $d) {
$log->addDebug("Deprecated ArrayStorage Class called by " . str_replace(e_ROOT, "", $d['file']) . " on line " . $d['line']);
}
$log->save('DEPRECATED', E_LOG_NOTICE, '', false, LOG_TO_ROLLING);
e107::getMessage()->addDebug("Please remove references to <b>arraystorage_class.php</b> and use e107::serialize() and e107::unserialize() instead.");
}
}
示例2: parseXmlContents
function parseXmlContents()
{
$log = e107::getAdminLog();
foreach ($this->xmlData as $key => $value) {
unset($this->xmlData[$key]);
}
foreach ($this->counterArray as $key => $value) {
unset($this->counterArray[$key]);
}
if (!function_exists('xml_parser_create')) {
$log->addDebug("No XML source specified")->save('XML', E_LOG_WARNING);
return FALSE;
}
if (!$this->xmlLegacyContents) {
$log->addDebug("No XML source specified")->save('XML');
return FALSE;
}
$this->parser = xml_parser_create('');
xml_set_object($this->parser, $this);
xml_set_element_handler($this->parser, 'startElement', 'endElement');
xml_set_character_data_handler($this->parser, 'characterData');
$array = explode("\n", $this->xmlLegacyContents);
foreach ($array as $data) {
if (strlen($data == 4096)) {
$log->addDebug("The XML cannot be parsed as it is badly formed.")->save('XML');
return FALSE;
}
if (!xml_parse($this->parser, $data)) {
$error = sprintf('XML error: %s at line %d, column %d', xml_error_string(xml_get_error_code($this->parser)), xml_get_current_line_number($this->parser), xml_get_current_column_number($this->parser));
$log->addDebug($error)->save('XML');
return FALSE;
}
}
xml_parser_free($this->parser);
return $this->xmlData;
}
示例3: maintenanceProcess
function maintenanceProcess()
{
$mes = e107::getMessage();
$ns = e107::getRender();
$log = e107::getAdminLog();
$frm = e107::getForm();
$sql = e107::getDb();
// print_a($_POST);
if (!empty($_POST['deleteoldadmin']) && isset($_POST['rolllog_clearadmin'])) {
$back_count = intval($_POST['rolllog_clearadmin']);
$_POST['backdeltype'] = 'confdel';
$action = 'backdel';
} elseif (!empty($_POST['deleteoldaudit']) && isset($_POST['rolllog_clearaudit'])) {
$back_count = intval($_POST['rolllog_clearaudit']);
$action = 'backdel';
$_POST['backdeltype'] = 'auditdel';
}
/*
if(isset($back_count))
{
if(($back_count >= 1) && ($back_count <= 90))
{
$temp_date = getdate();
$old_date = intval(mktime(0, 0, 0, $temp_date['mon'], $temp_date['mday'] - $back_count, $temp_date['year']));
$old_string = strftime("%d %B %Y", $old_date);
// $message = "Back delete ".$back_count." days. Oldest date = ".$old_string;
$action = $next_action;
$qs[1] = $old_date;
$qs[2] = $back_count;
}
else
{
$mes->addWarning(RL_LAN_050);
}
}
*/
$old_date = strtotime($back_count . ' days ago');
// Actually delete back events - admin or user audit log
if ($action == "backdel" && isset($_POST['backdeltype'])) {
// $old_date = intval($qs[1]);
$old_string = strftime("%d %B %Y", $old_date);
$qry = "dblog_datestamp < " . $old_date;
// Same field for both logs
switch ($_POST['backdeltype']) {
case 'confdel':
$db_table = 'admin_log';
$db_name = RL_LAN_052;
$db_msg = "ADLOG_02";
break;
case 'auditdel':
$db_table = 'audit_log';
$db_name = RL_LAN_053;
$db_msg = "ADLOG_03";
break;
default:
exit;
// Someone fooling around!
}
e107::getMessage()->addDebug("Back delete, oldest date = {$old_string} Query = {$qry}");
if ($del_count = $sql->delete($db_table, $qry)) {
// Add in a log event
$message = $db_name . str_replace(array('--OLD--', '--NUM--'), 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, '');
} else {
$mes->addWarning(RL_LAN_054 . " : " . $sql->mySQLresult);
}
}
// Prompt to delete back events
/*
if(($action == "confdel") || ($action == "auditdel"))
{
$old_string = strftime("%d %B %Y", $qs[1]);
$text = "
<form method='post' action='".e_SELF."?backdel.{$qs[1]}.{$qs[2]}'>
<fieldset id='core-admin-log-confirm-delete'>
<legend class='e-hideme'>".LAN_CONFDELETE."</legend>
<table class='table adminform'>
<tr>
<td class='center'>
<strong>".(($action == "confdel") ? RL_LAN_047 : RL_LAN_065).$old_string."</strong>
</td>
</tr>
</table>
<div class='buttons-bar center'>
<input type='hidden' name='backdeltype' value='{$action}' />
".$frm->admin_button('confirmdeleteold', 'no-value', 'delete', RL_LAN_049)."
".$frm->admin_button('confirmcancelold', 'no-value', 'delete', LAN_CANCEL)."
</div>
</fieldset>
</form>
";
$ns->tablerender(LAN_CONFDELETE, $text);
}
*/
}
示例4: submit_item
function submit_item($news, $smessages = false)
{
$tp = e107::getParser();
$sql = e107::getDb();
$admin_log = e107::getAdminLog();
$pref = e107::getPref();
$e_event = e107::getEvent();
$e107cache = e107::getCache();
$emessage = e107::getMessage();
$error = false;
if (empty($news['news_title'])) {
$error = true;
$emessage->add('Validation error: News title can\'t be empty!', E_MESSAGE_ERROR, $smessages);
if (!empty($news['news_sef'])) {
$news['news_sef'] = eHelper::secureSef($news['news_sef']);
}
} else {
// first format sef...
if (empty($news['news_sef'])) {
$news['news_sef'] = eHelper::title2sef($news['news_title']);
} else {
$news['news_sef'] = eHelper::secureSef($news['news_sef']);
}
}
// ...then check it
if (empty($news['news_sef'])) {
$error = true;
$emessage->add('Validation error: News SEF URL value is required field and can\'t be empty!', E_MESSAGE_ERROR, $smessages);
} elseif ($sql->db_Count('news', '(news_id)', ($news['news_sef'] ? 'news_id<>' . intval($news['news_id']) . ' AND ' : '') . "news_sef='" . $tp->toDB($news['news_sef']) . "'")) {
$error = true;
$emessage->add('Validation error: News SEF URL is unique field - current value already in use! Please choose another SEF URL value.', E_MESSAGE_ERROR, $smessages);
}
if (empty($news['news_category'])) {
$error = true;
$emessage->add('Validation error: News category can\'t be empty!', E_MESSAGE_ERROR, $smessages);
}
$data = array();
//DB Array
$data['data']['news_title'] = $news['news_title'];
$data['_FIELD_TYPES']['news_title'] = 'todb';
$data['data']['news_sef'] = $news['news_sef'];
$data['_FIELD_TYPES']['news_sef'] = 'todb';
$data['data']['news_body'] = $news['news_body'];
$data['_FIELD_TYPES']['news_body'] = 'todb';
$data['data']['news_extended'] = $news['news_extended'];
$data['_FIELD_TYPES']['news_extended'] = 'todb';
$data['data']['news_datestamp'] = $news['news_datestamp'];
$data['_FIELD_TYPES']['news_datestamp'] = 'int';
$data['data']['news_author'] = $news['news_author'] ? $news['news_author'] : USERID;
$data['_FIELD_TYPES']['news_author'] = 'int';
$data['data']['news_category'] = $news['news_category'];
$data['_FIELD_TYPES']['news_category'] = 'int';
$data['data']['news_allow_comments'] = $news['news_allow_comments'];
$data['_FIELD_TYPES']['news_allow_comments'] = 'int';
$data['data']['news_start'] = $news['news_start'];
$data['_FIELD_TYPES']['news_start'] = 'int';
$data['data']['news_end'] = $news['news_end'];
$data['_FIELD_TYPES']['news_end'] = 'int';
$data['data']['news_class'] = $news['news_class'];
$data['_FIELD_TYPES']['news_class'] = 'todb';
$data['data']['news_render_type'] = $news['news_render_type'];
$data['_FIELD_TYPES']['news_render_type'] = 'todb';
//news_comment_total
$data['data']['news_summary'] = $news['news_summary'];
$data['_FIELD_TYPES']['news_summary'] = 'todb';
$data['data']['news_thumbnail'] = $news['news_thumbnail'];
$data['_FIELD_TYPES']['news_thumbnail'] = 'todb';
$data['data']['news_sticky'] = $news['news_sticky'];
$data['_FIELD_TYPES']['news_sticky'] = 'int';
$data['data']['news_meta_keywords'] = eHelper::formatMetaKeys($news['news_meta_keywords']);
$data['_FIELD_TYPES']['news_meta_keywords'] = 'todb';
$data['data']['news_meta_description'] = eHelper::formatMetaDescription($news['news_meta_description']);
//handle bbcodes
$data['_FIELD_TYPES']['news_meta_description'] = 'todb';
if ($error) {
$data['error'] = true;
return $data;
}
// Calculate short strings for admin logging - no need to clog up the log with potentially long items
$logData = $data['data'];
if (isset($logData['news_body'])) {
$logData['news_body'] = $tp->text_truncate($tp->toDB($logData['news_body']), 300, '...');
}
if (isset($logData['news_extended'])) {
$logData['news_extended'] = $tp->text_truncate($tp->toDB($logData['news_extended']), 300, '...');
}
//XXX - Now hooks are executed only if no mysql error is found. Should it stay so? Seems sensible to me!
if ($news['news_id']) {
// Updating existing item
$data['WHERE'] = 'news_id=' . intval($news['news_id']);
//$vals = "news_datestamp = '".intval($news['news_datestamp'])."', ".$author_insert." news_title='".$news['news_title']."', news_body='".$news['news_body']."', news_extended='".$news['news_extended']."', news_category='".intval($news['cat_id'])."', news_allow_comments='".intval($news['news_allow_comments'])."', news_start='".intval($news['news_start'])."', news_end='".intval($news['news_end'])."', news_class='".$tp->toDB($news['news_class'])."', news_render_type='".intval($news['news_rendertype'])."' , news_summary='".$news['news_summary']."', news_thumbnail='".$tp->toDB($news['news_thumbnail'])."', news_sticky='".intval($news['news_sticky'])."' WHERE news_id='".intval($news['news_id'])."' ";
if ($sql->db_Update('news', $data)) {
e107::getAdminLog()->logArrayAll('NEWS_09', $logData);
$data['data']['news_id'] = $news['news_id'];
e107::getEvent()->trigger('newsupd', $data['data']);
e107::getEvent()->trigger('admin_news_updated', $data['data']);
$message = LAN_UPDATED;
$emessage->add(LAN_UPDATED, E_MESSAGE_SUCCESS, $smessages);
e107::getCache()->clear('news.php');
//FIXME - triggerHook should return array(message, message_type)
//.........这里部分代码省略.........
示例5: runFix
/**
* Fix tables
* FixArray eg. [core][table][field] = alter|create|index| etc.
*/
function runFix($fixArray = '')
{
$mes = e107::getMessage();
$log = e107::getAdminLog();
if (!is_array($fixArray)) {
$fixArray = $this->fixList;
// Fix All
}
foreach ($fixArray as $j => $file) {
foreach ($file as $table => $val) {
$id = $this->getId($this->tables[$j]['tables'], $table);
foreach ($val as $field => $fixes) {
foreach ($fixes as $mode) {
if (substr($mode, 0, 5) == 'index') {
$fdata = $this->getIndex($this->tables[$j]['data'][$id]);
$newval = $this->toMysql($fdata[$field], 'index');
} else {
$fdata = $this->getFields($this->tables[$j]['data'][$id]);
$newval = $this->toMysql($fdata[$field]);
}
switch ($mode) {
case 'alter':
$query = "ALTER TABLE `" . MPREFIX . $table . "` CHANGE `{$field}` `{$field}` {$newval}";
break;
case 'insert':
$after = ($aft = $this->getPrevious($fdata, $field)) ? " AFTER {$aft}" : "";
$query = "ALTER TABLE `" . MPREFIX . $table . "` ADD `{$field}` {$newval}{$after}";
break;
case 'drop':
$query = "ALTER TABLE `" . MPREFIX . $table . "` DROP `{$field}` ";
break;
case 'index':
$query = "ALTER TABLE `" . MPREFIX . $table . "` ADD {$newval} ";
break;
case 'indexdrop':
$query = "ALTER TABLE `" . MPREFIX . $table . "` DROP INDEX `{$field}`";
break;
case 'create':
$query = "CREATE TABLE `" . MPREFIX . $table . "` (" . $this->tables[$j]['data'][$id] . ") ENGINE=MyISAM;";
break;
}
// $mes->addDebug("Query: ".$query);
// continue;
if (e107::getDb()->gen($query) !== false) {
$log->addDebug(LAN_UPDATED . ' [' . $query . ']');
} else {
$log->addWarning(LAN_UPDATED_FAILED . ' [' . $query . ']');
$log->addWarning(e107::getDb()->getLastErrorText());
// PDO compatible.
/*if(mysql_errno())
{
$log->addWarning('SQL #'.mysql_errno().': '.mysql_error());
}*/
}
}
}
}
//
}
$log->flushMessages("Database Table(s) Modified");
}
示例6: userStatusUpdate
/**
* Updates user status, primarily the user_ban field, to reflect outside events
*
* @param string $start - 'ban', 'bounce'
* @param integer $uid - internal user ID, zero if not known
* @param string $emailAddress - email address (optional)
*
* @return boolean | string - FALSE if user found, error message if not
*/
public function userStatusUpdate($action, $uid, $emailAddress = '')
{
$db = e107::getDb('user');
$qry = '';
$error = FALSE;
// Assume no error to start with
$uid = intval($uid);
// Precautionary - should have already been done
switch ($action) {
case 'ban':
$newVal = USER_BANNED;
$logEvent = USER_AUDIT_BANNED;
break;
case 'bounce':
$newVal = USER_EMAIL_BOUNCED;
$logEvent = USER_AUDIT_MAIL_BOUNCE;
break;
case 'reset':
$newVal = USER_BOUNCED_RESET;
$logEvent = USER_AUDIT_BOUNCE_RESET;
break;
case 'temp':
$newVal = USER_TEMPORARY_ACCOUNT;
$logEvent = USER_AUDIT_TEMP_ACCOUNT;
break;
default:
return 'Invalid action: ' . $action;
}
if ($uid) {
$qry = '`user_id`=' . $uid;
}
if ($emailAddress) {
if ($qry) {
$qry .= ' OR ';
}
$qry .= "`user_email` = '{$emailAddress}'";
}
if (FALSE === $db->select('user', 'user_id, user_email, user_ban, user_loginname', $qry . ' LIMIT 1')) {
$error = 'User not found: ' . $uid . '/' . $emailAddress;
} else {
$row = $db->db_Fetch(MYSQL_ASSOC);
if ($uid && $uid != $row['user_id']) {
$error = 'UID mismatch: ' . $uid . '/' . $row['user_id'];
} elseif ($emailAddress && $emailAddress != $row['user_email']) {
$error = 'User email mismatch: ' . $emailAddress . '/' . $row['user_email'];
} else {
// Valid user!
if ($row['user_ban'] != $newVal) {
// Only update if needed
$db->db_Update('user', '`user_ban` = ' . $newVal . ', `user_email` = \'\' WHERE `user_id` = ' . $row['user_id'] . ' LIMIT 1');
// Add to user audit log TODO: Should we log to admin log as well?
$adminLog = e107::getAdminLog();
$adminLog->user_audit($logEvent, array('user_ban' => $newVal, 'user_email' => $row['user_email']), $row['user_id'], $row['user_loginname']);
}
}
}
return $error;
}
示例7: saveMailPrefs
function saveMailPrefs(&$mes)
{
if (!getperms('0')) {
return;
}
//$pref = e107::getPref();
$e107 = e107::getInstance();
$tp = e107::getParser();
$mes = e107::getMessage();
$bounceOpts = array('none' => LAN_MAILOUT_232, 'auto' => LAN_MAILOUT_233, 'mail' => LAN_MAILOUT_234);
unset($temp);
if (!in_array($_POST['mailer'], array('smtp', 'sendmail', 'php'))) {
$_POST['mailer'] = 'php';
}
$temp['mailer'] = $_POST['mailer'];
// Allow qmail as an option as well - works much as sendmail
if (strpos($_POST['sendmail'], 'sendmail') !== FALSE || strpos($_POST['sendmail'], 'qmail') !== FALSE) {
$temp['sendmail'] = $tp->toDB($_POST['sendmail']);
} else {
$temp['sendmail'] = '';
}
$temp['smtp_server'] = $tp->toDB($_POST['smtp_server']);
$temp['smtp_username'] = $tp->toDB($_POST['smtp_username']);
$temp['smtp_password'] = $tp->toDB($_POST['smtp_password']);
$smtp_opts = array();
switch (trim($_POST['smtp_options'])) {
case 'smtp_ssl':
$smtp_opts[] = 'secure=SSL';
break;
case 'smtp_tls':
$smtp_opts[] = 'secure=TLS';
break;
case 'smtp_pop3auth':
$smtp_opts[] = 'pop3auth';
break;
}
if (vartrue($_POST['smtp_keepalive'])) {
$smtp_opts[] = 'keepalive';
}
if (vartrue($_POST['smtp_useVERP'])) {
$smtp_opts[] = 'useVERP';
}
$temp['smtp_options'] = implode(',', $smtp_opts);
$temp['mail_sendstyle'] = $tp->toDB($_POST['mail_sendstyle']);
$temp['mail_pause'] = intval($_POST['mail_pause']);
$temp['mail_pausetime'] = intval($_POST['mail_pausetime']);
$temp['mail_workpertick'] = intval($_POST['mail_workpertick']);
$temp['mail_workpertick'] = min($temp['mail_workpertick'], 1000);
$temp['mail_bounce'] = isset($bounceOpts[$_POST['mail_bounce']]) ? $_POST['mail_bounce'] : 'none';
$temp['mail_bounce_auto'] = 0;
// Make sure this is always defined
switch ($temp['mail_bounce']) {
case 'none':
$temp['mail_bounce_email'] = '';
break;
case 'auto':
$temp['mail_bounce_email'] = $tp->toDB($_POST['mail_bounce_email2']);
break;
case 'mail':
$temp['mail_bounce_email'] = $tp->toDB($_POST['mail_bounce_email']);
$temp['mail_bounce_auto'] = intval($_POST['mail_bounce_auto']);
break;
}
$temp['mail_bounce_pop3'] = $tp->toDB($_POST['mail_bounce_pop3']);
$temp['mail_bounce_user'] = $tp->toDB($_POST['mail_bounce_user']);
$temp['mail_bounce_pass'] = $tp->toDB($_POST['mail_bounce_pass']);
$temp['mail_bounce_type'] = $tp->toDB($_POST['mail_bounce_type']);
$temp['mail_bounce_delete'] = intval(varset($_POST['mail_bounce_delete'], 0));
$temp['mailout_enabled'] = implode(',', varset($_POST['mail_mailer_enabled'], ''));
$temp['mail_log_options'] = intval($_POST['mail_log_option']) . ',' . intval($_POST['mail_log_email']);
foreach ($temp as &$t) {
if ($t === NULL) {
$t = '';
}
}
$pref = e107::pref('core');
// Core Prefs Array.
if (e107::getAdminLog()->logArrayDiffs($temp, $pref, 'MAIL_03')) {
e107::getConfig()->updatePref($temp);
e107::getConfig()->save(false);
// Only save if changes - generates its own message
} else {
$mes->addInfo(LAN_NO_CHANGE);
}
}
示例8: menuPageSave
private function menuPageSave()
{
$temp = array();
$tp = e107::getParser();
$log = e107::getAdminLog();
$menu_pref = e107::getConfig('menu')->getPref('');
$temp['banner_caption'] = $tp->toDB($_POST['banner_caption']);
$temp['banner_amount'] = intval($_POST['banner_amount']);
$temp['banner_rendertype'] = intval($_POST['banner_rendertype']);
if (isset($_POST['multiaction_cat_active'])) {
$cat = implode('|', $tp->toDB($_POST['multiaction_cat_active']));
$temp['banner_campaign'] = $cat;
}
if ($log->logArrayDiffs($temp, $menu_pref, 'BANNER_01')) {
$menuPref = e107::getConfig('menu');
//e107::getConfig('menu')->setPref('', $menu_pref);
//e107::getConfig('menu')->save(false, true, false);
foreach ($temp as $k => $v) {
$menuPref->setPref($k, $v);
}
$menuPref->save(false, true, false);
e107::getMessage()->addSuccess(LAN_SAVED);
$menu_pref = e107::getConfig('menu')->getPref('');
//banners_adminlog('01', $menu_pref['banner_caption'].'[!br!]'.$menu_pref['banner_amount'].', '.$menu_pref['banner_rendertype'].'[!br!]'.$menu_pref['banner_campaign']);
}
}
示例9: print_a
if (getperms('0')) {
$ns->tablerender("Testing Mode", print_a($message, true));
require_once FOOTERF;
exit;
}
// Try to send the email
if (sendemail($clean_email, "" . LAN_09 . "" . SITENAME, $message)) {
e107::getMessage()->addInfo(LAN_FPW6);
$do_log['password_result'] = LAN_FPW20;
} else {
//$text = "<div style='text-align:center'>".LAN_02."</div>";
$do_log['password_result'] = LAN_FPW19;
fpw_error(LAN_02);
}
// Log to user audit log
e107::getAdminLog()->user_audit(USER_AUDIT_PW_RES, $do_log, $row['user_id'], $row['user_name']);
$ns->tablerender(LAN_03, $text . e107::getMessage()->render());
require_once FOOTERF;
exit;
} else {
//$text = LAN_213;
//$ns->tablerender(LAN_214, "<div style='text-align:center'>".$text."</div>");
e107::getMessage()->addError(LAN_213);
$ns->tablerender(LAN_214, e107::getMessage()->render());
}
}
$sc = array();
// needed?
/*
if (USE_IMAGECODE)
{
示例10: zip
/**
* Zip up folders and files
* @param array $filePaths
* @param string $newFile
*/
public function zip($filePaths = null, $newFile = '', $options = array())
{
if (empty($newFile)) {
$newFile = e_BACKUP . eHelper::title2sef(SITENAME) . "_" . date("Y-m-d-H-i-s") . ".zip";
}
if (is_null($filePaths)) {
return "No file-paths set!";
}
require_once e_HANDLER . 'pclzip.lib.php';
$archive = new PclZip($newFile);
$removePath = !empty($options['remove_path']) ? $options['remove_path'] : e_BASE;
if ($archive->create($filePaths, PCLZIP_OPT_REMOVE_PATH, $removePath) == 0) {
$error = $archive->errorInfo(true);
e107::getAdminLog()->addError($error)->save('FILE', E_LOG_NOTICE);
return false;
} else {
return $newFile;
}
}
示例11: calc_max_upload_size
/**
* Calculate 'global' maximum upload size - the maximum before extension-specific restrictions taken into account
*
* @param int $max_up - if > 0, its a global maximum permitted. If < 0, $pref['upload_maxfilesize'] is used (if set)
*
* @return int maximum allowed upload size for file
*/
function calc_max_upload_size($max_up = -1)
{
global $pref;
$admin_log = e107::getAdminLog();
// Work out maximum allowable file size
if (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);
}
$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');
if ($max_up > 0) {
$max_upload_size = file_size_decode($max_up, $max_upload_size, 'lt');
} else {
if (varset($pref['upload_maxfilesize'], 0) > 0) {
$max_upload_size = file_size_decode($pref['upload_maxfilesize'], $max_upload_size, 'lt');
}
}
if (UH_DEBUG) {
$admin_log->e_log_event(10, __FILE__ . "|" . __FUNCTION__ . "@" . __LINE__, "DEBUG", "Upload Handler test", "Final max upload size: {$max_upload_size}", FALSE, FALSE);
}
return $max_upload_size;
}
示例12: AddSubmitTrigger
/**
* Quick Add user submit trigger
*/
public function AddSubmitTrigger()
{
$e107cache = e107::getCache();
$userMethods = e107::getUserSession();
$mes = e107::getMessage();
$sql = e107::getDb();
$e_event = e107::getEvent();
$admin_log = e107::getAdminLog();
if (!$_POST['ac'] == md5(ADMINPWCHANGE)) {
exit;
}
$e107cache->clear('online_menu_member_total');
$e107cache->clear('online_menu_member_newest');
$error = false;
if (isset($_POST['generateloginname'])) {
$_POST['loginname'] = $userMethods->generateUserLogin($pref['predefinedLoginName']);
}
$_POST['password2'] = $_POST['password1'] = $_POST['password'];
// Now validate everything
$allData = validatorClass::validateFields($_POST, $userMethods->userVettingInfo, true);
// Fix Display and user name
if (!check_class($pref['displayname_class'], $allData['data']['user_class'])) {
if ($allData['data']['user_name'] != $allData['data']['user_loginname']) {
$allData['data']['user_name'] = $allData['data']['user_loginname'];
$mes->addWarning(str_replace('[x]', $allData['data']['user_loginname'], USRLAN_237));
//$allData['errors']['user_name'] = ERR_FIELDS_DIFFERENT;
}
}
// Do basic validation
validatorClass::checkMandatory('user_name, user_loginname', $allData);
// Check for missing fields (email done in userValidation() )
validatorClass::dbValidateArray($allData, $userMethods->userVettingInfo, 'user', 0);
// Do basic DB-related checks
$userMethods->userValidation($allData);
// Do user-specific DB checks
if (!isset($allData['errors']['user_password'])) {
// No errors in password - keep it outside the main data array
$savePassword = $allData['data']['user_password'];
// Delete the password value in the output array
unset($allData['data']['user_password']);
}
// Restrict the scope of this
unset($_POST['password2'], $_POST['password1']);
if (count($allData['errors'])) {
$temp = validatorClass::makeErrorList($allData, 'USER_ERR_', '%n - %x - %t: %v', '<br />', $userMethods->userVettingInfo);
$mes->addError($temp);
$error = true;
}
// Always save some of the entered data - then we can redisplay on error
$user_data =& $allData['data'];
if ($error) {
$this->setParam('user_data', $user_data);
return;
}
if (varset($_POST['perms'])) {
$allData['data']['user_admin'] = 1;
$allData['data']['user_perms'] = implode('.', $_POST['perms']);
}
$user_data['user_password'] = $userMethods->HashPassword($savePassword, $user_data['user_login']);
$user_data['user_join'] = time();
if ($userMethods->needEmailPassword()) {
// Save separate password encryption for use with email address
$user_prefs = e107::getArrayStorage()->unserialize($user_data['user_prefs']);
$user_prefs['email_password'] = $userMethods->HashPassword($savePassword, $user_data['user_email']);
$user_data['user_prefs'] = e107::getArrayStorage()->serialize($user_prefs);
unset($user_prefs);
}
$userMethods->userClassUpdate($allData['data'], 'userall');
//FIXME - (SecretR) there is a better way to fix this (missing default value, sql error in strict mode - user_realm is to be deleted from DB later)
$allData['data']['user_realm'] = '';
// Set any initial classes
$userMethods->addNonDefaulted($user_data);
validatorClass::addFieldTypes($userMethods->userVettingInfo, $allData);
$userid = $sql->insert('user', $allData);
if ($userid) {
$sysuser = e107::getSystemUser(false, false);
$sysuser->setData($allData['data']);
$sysuser->setId($userid);
$user_data['user_id'] = $userid;
// Add to admin log
e107::getLog()->add('USET_02', "UName: {$user_data['user_name']}; Email: {$user_data['user_email']}", E_LOG_INFORMATIVE);
// Add to user audit trail
e107::getLog()->user_audit(USER_AUDIT_ADD_ADMIN, $user_data, 0, $user_data['user_loginname']);
e107::getEvent()->trigger('userfull', $user_data);
e107::getEvent()->trigger('admin_user_created', $user_data);
// send everything available for user data - bit sparse compared with user-generated signup
if (isset($_POST['sendconfemail'])) {
$check = false;
// Send confirmation email to user
switch ((int) $_POST['sendconfemail']) {
case 0:
// activate, don't notify
$check = -1;
break;
case 1:
// activate and send password
$check = $sysuser->email('quickadd', array('user_password' => $savePassword, 'mail_subject' => USRLAN_187 . SITENAME, 'activation_url' => USRLAN_238));
//.........这里部分代码省略.........
示例13: __get
public function __get($name)
{
switch ($name) {
case 'tp':
$ret = e107::getParser();
break;
case 'sql':
$ret = e107::getDb();
break;
case 'ecache':
$ret = e107::getCache();
break;
case 'arrayStorage':
$ret = e107::getArrayStorage();
break;
case 'e_event':
$ret = e107::getEvent();
break;
case 'ns':
$ret = e107::getRender();
break;
case 'url':
$ret = e107::getUrl();
break;
case 'admin_log':
$ret = e107::getAdminLog();
break;
case 'override':
$ret = e107::getSingleton('override', e_HANDLER . 'override_class.php');
break;
case 'notify':
$ret = e107::getNotify();
break;
case 'e_online':
$ret = e107::getOnline();
break;
case 'eIPHandler':
$ret = e107::getIPHandler();
break;
case 'user_class':
$ret = e107::getUserClass();
break;
default:
trigger_error('$e107->$' . $name . ' not defined', E_USER_WARNING);
return null;
break;
}
$this->{$name} = $ret;
return $ret;
}
示例14: submit_item
function submit_item($news, $smessages = false)
{
$tp = e107::getParser();
$sql = e107::getDb();
$admin_log = e107::getAdminLog();
$pref = e107::getPref();
$e_event = e107::getEvent();
$e107cache = e107::getCache();
$emessage = e107::getMessage();
$error = false;
if (empty($news['news_title'])) {
$error = true;
$emessage->add('Validation error: News title can\'t be empty!', E_MESSAGE_ERROR, $smessages);
if (!empty($news['news_sef'])) {
$news['news_sef'] = eHelper::secureSef($news['news_sef']);
}
} else {
// first format sef...
if (empty($news['news_sef'])) {
$news['news_sef'] = eHelper::title2sef($news['news_title']);
} else {
$news['news_sef'] = eHelper::secureSef($news['news_sef']);
}
}
// ...then check it
if (empty($news['news_sef'])) {
$error = true;
$emessage->add('Validation error: News SEF URL value is required field and can\'t be empty!', E_MESSAGE_ERROR, $smessages);
} elseif ($sql->db_Count('news', '(news_id)', ($news['news_sef'] ? 'news_id<>' . intval($news['news_id']) . ' AND ' : '') . "news_sef='" . $tp->toDB($news['news_sef']) . "'")) {
$error = true;
$emessage->add('Validation error: News SEF URL is unique field - current value already in use! Please choose another SEF URL value.', E_MESSAGE_ERROR, $smessages);
}
if (empty($news['news_category'])) {
$error = true;
$emessage->add('Validation error: News category can\'t be empty!', E_MESSAGE_ERROR, $smessages);
}
$data = array();
//DB Array
$data['data']['news_title'] = $news['news_title'];
$data['_FIELD_TYPES']['news_title'] = 'todb';
$data['data']['news_sef'] = $news['news_sef'];
$data['_FIELD_TYPES']['news_sef'] = 'todb';
$data['data']['news_body'] = $news['news_body'];
$data['_FIELD_TYPES']['news_body'] = 'todb';
$data['data']['news_extended'] = $news['news_extended'];
$data['_FIELD_TYPES']['news_extended'] = 'todb';
$data['data']['news_datestamp'] = $news['news_datestamp'];
$data['_FIELD_TYPES']['news_datestamp'] = 'int';
$data['data']['news_author'] = $news['news_author'] ? $news['news_author'] : USERID;
$data['_FIELD_TYPES']['news_author'] = 'int';
$data['data']['news_category'] = $news['news_category'];
$data['_FIELD_TYPES']['news_category'] = 'int';
$data['data']['news_allow_comments'] = $news['news_allow_comments'];
$data['_FIELD_TYPES']['news_allow_comments'] = 'int';
$data['data']['news_start'] = $news['news_start'];
$data['_FIELD_TYPES']['news_start'] = 'int';
$data['data']['news_end'] = $news['news_end'];
$data['_FIELD_TYPES']['news_end'] = 'int';
$data['data']['news_class'] = $news['news_class'];
$data['_FIELD_TYPES']['news_class'] = 'todb';
$data['data']['news_render_type'] = $news['news_render_type'];
$data['_FIELD_TYPES']['news_render_type'] = 'todb';
//news_comment_total
$data['data']['news_summary'] = $news['news_summary'];
$data['_FIELD_TYPES']['news_summary'] = 'todb';
$data['data']['news_thumbnail'] = $news['news_thumbnail'];
$data['_FIELD_TYPES']['news_thumbnail'] = 'todb';
$data['data']['news_sticky'] = $news['news_sticky'];
$data['_FIELD_TYPES']['news_sticky'] = 'int';
$data['data']['news_meta_keywords'] = eHelper::formatMetaKeys($news['news_meta_keywords']);
$data['_FIELD_TYPES']['news_meta_keywords'] = 'todb';
$data['data']['news_meta_description'] = eHelper::formatMetaDescription($news['news_meta_description']);
//handle bbcodes
$data['_FIELD_TYPES']['news_meta_description'] = 'todb';
if ($error) {
$data['error'] = true;
return $data;
}
// Calculate short strings for admin logging - no need to clog up the log with potentially long items
$logData = $data['data'];
if (isset($logData['news_body'])) {
$logData['news_body'] = $tp->text_truncate($tp->toDB($logData['news_body']), 300, '...');
}
if (isset($logData['news_extended'])) {
$logData['news_extended'] = $tp->text_truncate($tp->toDB($logData['news_extended']), 300, '...');
}
//XXX - Now hooks are executed only if no mysql error is found. Should it stay so? Seems sensible to me!
if ($news['news_id']) {
// Updating existing item
$data['WHERE'] = 'news_id=' . intval($news['news_id']);
//$vals = "news_datestamp = '".intval($news['news_datestamp'])."', ".$author_insert." news_title='".$news['news_title']."', news_body='".$news['news_body']."', news_extended='".$news['news_extended']."', news_category='".intval($news['cat_id'])."', news_allow_comments='".intval($news['news_allow_comments'])."', news_start='".intval($news['news_start'])."', news_end='".intval($news['news_end'])."', news_class='".$tp->toDB($news['news_class'])."', news_render_type='".intval($news['news_rendertype'])."' , news_summary='".$news['news_summary']."', news_thumbnail='".$tp->toDB($news['news_thumbnail'])."', news_sticky='".intval($news['news_sticky'])."' WHERE news_id='".intval($news['news_id'])."' ";
if ($sql->db_Update('news', $data)) {
e107::getAdminLog()->logArrayAll('NEWS_09', $logData);
$data['data']['news_id'] = $news['news_id'];
e107::getEvent()->trigger('newsupd', $data['data']);
$message = LAN_NEWS_21;
$emessage->add(LAN_NEWS_21, E_MESSAGE_SUCCESS, $smessages);
e107::getCache()->clear('news.php');
//FIXME - triggerHook should return array(message, message_type)
$evdata = array('method' => 'update', 'table' => 'news', 'id' => $news['news_id'], 'plugin' => 'news', 'function' => 'submit_item');
//.........这里部分代码省略.........
示例15: ping
function ping($xml_rpc_server, $xml_rpc_port, $xml_rpc_path, $weblog_name, $weblog_url, $changes_url, $cat_or_rss = '', $extended = false)
{
$mes = e107::getMessage();
$log = e107::getAdminLog();
$mes->addDebug("Attempting to ping: " . $xml_rpc_server, 'default', true);
$name_param = new xmlrpcval($weblog_name, 'string');
$url_param = new xmlrpcval($weblog_url, 'string');
$changes_param = new xmlrpcval($changes_url, 'string');
$cat_or_rss_param = new xmlrpcval($cat_or_rss, 'string');
$method_name = $extended ? "weblogUpdates.extendedPing" : "weblogUpdates.ping";
if ($cat_or_rss != "") {
$params = array($name_param, $url_param, $changes_param, $cat_or_rss_param);
$call_text = "{$method_name}(\"{$weblog_name}\", \"{$weblog_url}\", \"{$changes_url}\", \"{$cat_or_rss}\")";
} else {
if ($changes_url != "") {
$params = array($name_param, $url_param, $changes_param);
$call_text = "{$method_name}(\"{$weblog_name}\", \"{$weblog_url}\", \"{$changes_url}\")";
} else {
$params = array($name_param, $url_param);
$call_text = "{$method_name}(\"{$weblog_name}\", \"{$weblog_url}\")";
}
}
// create the message
$message = new xmlrpcmsg($method_name, $params);
$client = new xmlrpc_client($xml_rpc_path, $xml_rpc_server, $xml_rpc_port);
$response = $client->send($message);
$this->log_ping("Request: " . $call_text);
$this->log_ping($message->serialize(), true);
if ($response == 0) {
$error_text = "Error: " . $xml_rpc_server . ": " . $client->errno . " " . $client->errstring;
$this->report_error($error_text);
$this->log_ping($error_text);
$log->addArray(array('status' => LAN_ERROR, 'service' => $xml_rpc_server, 'url' => $changes_url, 'response' => $client->errstring))->save('PING_01');
return false;
}
if ($response->faultCode() != 0) {
$error_text = "Error: " . $xml_rpc_server . ": " . $response->faultCode() . " " . $response->faultString();
$this->report_error($error_text);
$log->addArray(array('status' => LAN_ERROR, 'service' => $xml_rpc_server, 'url' => $changes_url, 'response' => $response->faultString()))->save('PING_01');
return false;
}
$response_value = $response->value();
if ($this->debug) {
$this->report_error($response_value->serialize());
}
$this->log_ping($response_value->serialize(), true);
$fl_error = $response_value->structmem('flerror');
$message = $response_value->structmem('message');
// read the response
if ($fl_error->scalarval() != false) {
$error_text = "Error: " . $xml_rpc_server . ": " . $message->scalarval();
$this->report_error($error_text);
$log->addArray(array('status' => LAN_ERROR, 'service' => $xml_rpc_server, 'url' => $changes_url, 'response' => $message->scalarval()))->save('PING_01');
// $this->log_ping($error_text);
return false;
}
$log->addArray(array('status' => LAN_OK, 'service' => $xml_rpc_server, 'url' => $changes_url, 'response' => $message->scalarval()))->save('PING_01');
return true;
}