本文整理汇总了PHP中cot_log函数的典型用法代码示例。如果您正苦于以下问题:PHP cot_log函数的具体用法?PHP cot_log怎么用?PHP cot_log使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cot_log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cot_file_check
/**
* Checks a file to be sure it is valid
*
* @param string $path File path
* @param string $name File name
* @param string $ext File extension
* @return bool
*/
function cot_file_check($path, $name, $ext)
{
global $L, $cfg;
if ($cfg['pfs']['pfsfilecheck']) {
require './datas/mimetype.php';
$fcheck = FALSE;
if (in_array($ext, array('jpg', 'jpeg', 'png', 'gif'))) {
$img_size = @getimagesize($path);
switch ($ext) {
case 'gif':
$fcheck = isset($img_size['mime']) && $img_size['mime'] == 'image/gif';
break;
case 'png':
$fcheck = isset($img_size['mime']) && $img_size['mime'] == 'image/png';
break;
default:
$fcheck = isset($img_size['mime']) && $img_size['mime'] == 'image/jpeg';
break;
}
$fcheck = $fcheck !== FALSE;
} else {
if (!empty($mime_type[$ext])) {
foreach ($mime_type[$ext] as $mime) {
$content = file_get_contents($path, 0, NULL, $mime[3], $mime[4]);
$content = $mime[2] ? bin2hex($content) : $content;
$mime[1] = $mime[2] ? strtolower($mime[1]) : $mime[1];
$i++;
if ($content == $mime[1]) {
$fcheck = TRUE;
break;
}
}
} else {
$fcheck = $cfg['pfs']['pfsnomimepass'] ? 1 : 2;
cot_log(sprintf($L['pfs_filechecknomime'], $ext, $name), 'sec');
}
}
if (!$fcheck) {
cot_log(sprintf($L['pfs_filecheckfail'], $ext, $name), 'sec');
}
} else {
$fcheck = true;
}
return $fcheck;
}
示例2: cot_shield_hammer
/**
* Anti-hammer protection
*
* @param int $hammer Hammer rate
* @param string $action Action type
* @param int $lastseen User last seen timestamp
* @return int
*/
function cot_shield_hammer($hammer, $action, $lastseen)
{
global $cfg, $sys;
if ($action == 'Hammering') {
cot_shield_protect();
cot_shield_clearaction();
cot_plugin_active('hits') && cot_stat_inc('totalantihammer');
}
if ($sys['now'] - $lastseen < 4) {
$hammer++;
if ($hammer > $cfg['shieldzhammer']) {
cot_shield_update(180, 'Hammering');
cot_log('IP banned 3 mins, was hammering', 'sec');
$hammer = 0;
}
} else {
if ($hammer > 0) {
$hammer--;
}
}
return $hammer;
}
示例3: foreach
$notfoundet = '';
foreach ($s as $i => $k) {
if ($s[$i] == '1' || $s[$i] == 'on') {
/* === Hook === */
foreach (cot_getextplugins('page.admin.checked_delete') as $pl) {
include $pl;
}
/* ===== */
$sql_page = $db->query("SELECT * FROM {$db_pages} WHERE page_id=" . (int) $i . " LIMIT 1");
if ($row = $sql_page->fetch()) {
$id = $row['page_id'];
if ($row['page_state'] == 0) {
$sql_page = $db->query("UPDATE {$db_structure} SET structure_count=structure_count-1 WHERE structure_code=" . $db->quote($row['page_cat']));
}
$sql_page = $db->delete($db_pages, "page_id={$id}");
cot_log($L['Page'] . ' #' . $id . ' - ' . $L['Deleted'], 'adm');
if ($cache && $cfg['cache_page']) {
$cache->page->clear('page/' . str_replace('.', '/', $structure['page'][$row['page_cat']]['path']));
}
/* === Hook === */
foreach (cot_getextplugins('page.admin.delete.done') as $pl) {
include $pl;
}
/* ===== */
$perelik .= '#' . $id . ', ';
} else {
$notfoundet .= '#' . $id . ' - ' . $L['Error'] . '<br />';
}
}
}
$cache && $cache->db->remove('structure', 'system');
示例4: cot_redirect
cot_redirect(cot_url($url_area, $url_params, '#comments', true));
} elseif ($a == 'delete' && $usr['isadmin']) {
cot_check_xg();
$sql = $db->query("SELECT * FROM {$db_com} WHERE com_id={$id} AND com_area='{$area}' LIMIT 1");
if ($row = $sql->fetch()) {
$sql->closeCursor();
$sql = $db->delete($db_com, "com_id={$id}");
foreach ($cot_extrafields[$db_com] as $exfld) {
cot_extrafield_unlinkfiles($row['com_' . $exfld['field_name']], $exfld);
}
if ($cache && $row['com_area'] == 'page') {
if ($cfg['cache_page']) {
$cache->page->clear('page/' . str_replace('.', '/', $structure['page'][$url_params['c']]['path']));
}
if ($cfg['cache_index']) {
$cache->page->clear('index');
}
}
/* == Hook == */
foreach (cot_getextplugins('comments.delete') as $pl) {
include $pl;
}
/* ===== */
cot_log('Deleted comment #' . $id . ' in "' . $item . '"', 'adm');
}
cot_redirect(cot_url($url_area, $url_params, '#comments', true));
} elseif ($a == 'enable' && $usr['isadmin']) {
$area = cot_import('area', 'P', 'ALP');
$state = cot_import('state', 'P', 'INT');
}
cot_display_messages($t);
示例5: cot_log
$timeago = $sys['now'] - $cfg['plugin']['cleaner']['refprune'] * 86400;
$db->delete($db_referers, "ref_date < {$timeago}");
if ($db->affectedRows > 0) {
cot_log('Cleaner plugin deleted ' . $db->affectedRows . ' referers entries older than ' . $cfg['plugin']['cleaner']['refprune'] . ' days', 'adm');
}
}
if (cot_module_active('pm')) {
require_once cot_incfile('pm', 'module');
if ($cfg['plugin']['cleaner']['pmnotread'] > 0) {
$timeago = $sys['now'] - $cfg['plugin']['cleaner']['pmnotread'] * 86400;
$sqltmp = $db->delete($db_pm, "pm_date < {$timeago} AND pm_tostate=0");
if ($db->affectedRows > 0) {
cot_log("Cleaner plugin deleted " . $db->affectedRows . " PM not read since " . $cfg['plugin']['cleaner']['pmnotread'] . " days", 'adm');
}
}
if ($cfg['plugin']['cleaner']['pmnotarchived'] > 0) {
$timeago = $sys['now'] - $cfg['plugin']['cleaner']['pmnotarchived'] * 86400;
$sqltmp = $db->delete($db_pm, "pm_date < {$timeago} AND pm_tostate=1");
if ($db->affectedRows > 0) {
cot_log("Cleaner plugin deleted " . $db->affectedRows . " PM not archived since " . $cfg['plugin']['cleaner']['pmnotarchived'] . " days", 'adm');
}
}
if ($cfg['plugin']['cleaner']['pmold'] > 0) {
$timeago = $sys['now'] - $cfg['plugin']['cleaner']['pmold'] * 86400;
$sqltmp = $db->delete($db_pm, "pm_date < {$timeago}");
$deleted = $db->affectedRows;
if ($deleted > 0) {
cot_log("Cleaner plugin deleted " . $deleted . " PM older than " . $cfg['plugin']['cleaner']['pmold'] . " days", 'adm');
}
}
}
示例6: foreach
foreach (cot_getextplugins('folio.first') as $pl) {
include $pl;
}
/* ===== */
if ($id > 0 || !empty($al)) {
$where = !empty($al) ? "item_alias='" . $al . "'" : 'item_id=' . $id;
$sql = $db->query("SELECT f.*, u.* FROM {$db_folio} AS f \n\t\tLEFT JOIN {$db_users} AS u ON u.user_id=f.item_userid WHERE {$where} LIMIT 1");
}
if (!$id && empty($al) || !$sql || $sql->rowCount() == 0) {
cot_die_message(404, TRUE);
}
$item = $sql->fetch();
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('folio', $item['item_cat'], 'RWA');
cot_block($usr['auth_read']);
if ($item['item_state'] != 0 && !$usr['isadmin'] && $usr['id'] != $item['item_userid']) {
cot_log("Attempt to directly access an un-validated", 'sec');
cot_redirect(cot_url('message', "msg=930", '', true));
exit;
}
if ($usr['id'] != $item['item_userid'] && (!$usr['isadmin'] || $cfg['folio']['count_admin'])) {
$item['item_count']++;
$db->update($db_folio, array('item_count' => $item['item_count']), "item_id=" . (int) $item['item_id']);
}
$title_params = array('TITLE' => empty($item['item_metatitle']) ? $item['item_title'] : $item['item_metatitle'], 'CATEGORY' => $structure['folio'][$item['item_cat']]['title']);
$out['subtitle'] = cot_title($cfg['folio']['title_folio'], $title_params);
$out['desc'] = !empty($item['item_metadesc']) ? $item['item_metadesc'] : cot_cutstring(strip_tags(cot_parse($item['item_text'], $cfg['folio']['markup'], $item['item_parser'])), 160);
$out['meta_keywords'] = !empty($item['item_keywords']) ? $item['item_keywords'] : $structure['folio'][$item['item_cat']]['keywords'];
// Building the canonical URL
$pageurl_params = array('c' => $item['item_cat']);
empty($al) ? $pageurl_params['id'] = $id : ($pageurl_params['al'] = $al);
$out['canonical_uri'] = cot_url('folio', $pageurl_params);
示例7: cot_market_delete
/**
* Removes a product from the CMS.
* @param int $id Product ID
* @param array $rpage Product data
* @return boolean TRUE on success, FALSE on error
*/
function cot_market_delete($id, $ritem = array())
{
global $db, $db_market, $db_structure, $cache, $cfg, $cot_extrafields, $structure, $L;
if (!is_numeric($id) || $id <= 0) {
return false;
}
$id = (int) $id;
if (count($ritem) == 0) {
$ritem = $db->query("SELECT * FROM {$db_market} WHERE item_id = ?", $id)->fetch();
if (!$ritem) {
return false;
}
}
foreach ($cot_extrafields[$db_market] as $exfld) {
cot_extrafield_unlinkfiles($ritem['item_' . $exfld['field_name']], $exfld);
}
$db->delete($db_market, "item_id = ?", $id);
cot_log("Deleted product #" . $id, 'adm');
cot_market_sync($ritem['item_cat']);
/* === Hook === */
foreach (cot_getextplugins('market.edit.delete.done') as $pl) {
include $pl;
}
/* ===== */
return true;
}
示例8: cot_page_delete
/**
* Removes a page from the CMS.
* @param int $id Page ID
* @param array $rpage Page data
* @return boolean TRUE on success, FALSE on error
*/
function cot_page_delete($id, $rpage = array())
{
global $db, $db_pages, $db_structure, $cache, $cfg, $cot_extrafields, $structure, $L;
if (!is_numeric($id) || $id <= 0) {
return false;
}
$id = (int) $id;
if (count($rpage) == 0) {
$rpage = $db->query("SELECT * FROM {$db_pages} WHERE page_id = ?", $id)->fetch();
if (!$rpage) {
return false;
}
}
if ($rpage['page_state'] == 0) {
$db->query("UPDATE {$db_structure} SET structure_count=structure_count-1 WHERE structure_area='page' AND structure_code = ?", $rpage['page_cat']);
}
foreach ($cot_extrafields[$db_pages] as $exfld) {
cot_extrafield_unlinkfiles($rpage['page_' . $exfld['field_name']], $exfld);
}
$db->delete($db_pages, "page_id = ?", $id);
cot_log("Deleted page #" . $id, 'adm');
/* === Hook === */
foreach (cot_getextplugins('page.edit.delete.done') as $pl) {
include $pl;
}
/* ===== */
if ($cache) {
if ($cfg['cache_page']) {
$cache->page->clear('page/' . str_replace('.', '/', $structure['page'][$rpage['page_cat']]['path']));
}
if ($cfg['cache_index']) {
$cache->page->clear('index');
}
}
return true;
}
示例9: foreach
$cfg['cache_index'] && $cache->page->clear('index');
}
if ($db->query("SELECT COUNT(*) FROM {$db_forum_posts} WHERE fp_topicid= {$q}")->fetchColumn() == 0) {
$sql_forums = $db->query("SELECT * FROM {$db_forum_topics} WHERE ft_id = {$q}");
if ($row = $sql_forums->fetch()) {
$sql_forums = $db->delete($db_forum_topics, "ft_movedto = {$q}");
$sql_forums = $db->delete($db_forum_topics, "ft_id = {$q}");
foreach ($cot_extrafields[$db_forum_topics] as $exfld) {
cot_extrafield_unlinkfiles($row['ft_' . $exfld['field_name']], $exfld);
}
/* === Hook === */
foreach (cot_getextplugins('forums.posts.emptytopicdel') as $pl) {
include $pl;
}
/* ===== */
cot_log('Delete topic #' . $q . " (no post left)", 'for');
cot_forums_sectionsetlast($s, 'fs_postcount-1', 'fs_topiccount-1');
}
cot_redirect(cot_url('forums', 'm=topics&s=' . $s, '', true));
} else {
// There's at least 1 post left, let's resync
$sql_forums = $db->query("SELECT fp_id, fp_posterid, fp_postername, fp_updated, fp_topicid FROM {$db_forum_posts}\n\t\t\tWHERE fp_topicid = ? AND fp_cat = ? ORDER BY fp_id DESC LIMIT 1", array($q, $s));
if ($row = $sql_forums->fetch()) {
$sql_forums = $db->query("UPDATE {$db_forum_topics} SET\n\t\t\t\tft_postcount=ft_postcount-1, ft_lastposterid=" . (int) $row['fp_posterid'] . ",\n\t\t\t\tft_lastpostername=" . $db->quote($row['fp_postername']) . ", ft_updated=" . (int) $row['fp_updated'] . "\n\t\t\t\tWHERE ft_id = {$q}");
cot_forums_sectionsetlast($s, 'fs_postcount-1');
cot_redirect(cot_url('forums', 'm=posts&q=' . $row['fp_topicid'] . '&d=' . $durl, '#' . $row['fp_id'], true));
}
}
}
$sql_forums = $db->query("SELECT * FROM {$db_forum_topics} WHERE ft_id= {$q}");
if ($rowt = $sql_forums->fetch()) {
示例10: adView
/**
* Просмотр одного объявления
*/
public function adView()
{
global $structure, $Ls;
list(cot::$usr['auth_read'], cot::$usr['auth_write'], cot::$usr['isadmin']) = cot_auth('advboard', 'any');
cot_block(cot::$usr['auth_read']);
$id = cot_import('id', 'G', 'INT');
$al = cot_import('al', 'G', 'TXT');
$c = cot_import('c', 'G', 'TXT');
/* === Hook === */
foreach (cot_getextplugins('advboard.first') as $pl) {
include $pl;
}
/* ===== */
if (empty($id) && empty($al)) {
cot_die_message(404, TRUE);
}
if (!empty($al)) {
$advert = advboard_model_Advert::fetchOne(array(array('alias', $al)));
} else {
$advert = advboard_model_Advert::getById($id);
}
if (!$advert) {
cot_die_message(404, TRUE);
}
list(cot::$usr['auth_read'], cot::$usr['auth_write'], cot::$usr['isadmin'], cot::$usr['auth_upload']) = cot_auth('advboard', $advert->rawValue('category'), 'RWA1');
cot_block(cot::$usr['auth_read']);
$al = empty($advert->alias) ? '' : $advert->alias;
$id = (int) $advert->id;
$category = array('config' => array());
if (isset($structure['advboard'][$advert->rawValue('category')])) {
$category = $structure['advboard'][$advert->rawValue('category')];
$category['config'] = cot::$cfg['advboard']['cat_' . $advert->rawValue('category')];
}
$category['code'] = $advert->rawValue('category');
cot::$sys['sublocation'] = $advert->title;
if (($advert->state == advboard_model_Advert::AWAITING_MODERATION || $advert->state == advboard_model_Advert::DRAFT || $advert->begin > cot::$sys['now'] || $advert->expire > 0 && cot::$sys['now'] > $advert->expire) && !$advert->canEdit()) {
cot_log("Attempt to directly access an un-validated or future/expired advboard", 'sec');
cot_die_message(403, TRUE);
}
if (!cot::$usr['isadmin'] || cot::$cfg['advboard']['count_admin']) {
$advert->inc('views');
}
$title_params = array('TITLE' => $advert->title, 'CATEGORY' => $category['title']);
cot::$out['subtitle'] = cot_title(cot::$cfg['page']['title_page'], $title_params);
cot::$out['desc'] = $advert->description;
cot::$out['keywords'] = strip_tags($category['config']['keywords']);
// Building the canonical URL
cot::$out['canonical_uri'] = $advert->url;
$template = array('advboard', 'advert', $category['tpl']);
if (!empty($advert->updated)) {
cot::$env['last_modified'] = strtotime($advert->updated);
}
$allowComments = cot_plugin_active('comments');
if ($allowComments) {
if (!isset(cot::$cfg['advboard']['cat_' . $advert->category])) {
$allowComments = false;
}
$allowComments = cot::$cfg['advboard']['cat_' . $advert->category]['enable_comments'];
}
/* === Hook === */
foreach (cot_getextplugins('advboard.main') as $pl) {
include $pl;
}
/* ===== */
// Сообщение об истечении срока публикации
$expDays = null;
if ($advert->expire > 0 && $advert->state == advboard_model_Advert::PUBLISHED) {
$diff = $advert->expire - cot::$sys['now'];
$expDays = floor($diff / 86400);
if ($advert->canEdit()) {
if (cot::$cfg['advboard']['expNotifyPeriod'] > 0) {
if ($diff < 86400 * cot::$cfg['advboard']['expNotifyPeriod'] && $diff > 0) {
if ($expDays >= 1) {
cot_message(sprintf(cot::$L['advboard_expire_soon'], cot_declension($expDays, $Ls['Days'], false, true)), 'warning');
} else {
cot_message(cot::$L['advboard_expire_today'], 'warning');
}
} elseif ($diff <= 0) {
cot_message(cot::$L['advboard_expired'], 'warning');
}
}
}
}
// Если незарег может редактировать объявление, не кешировать эту страницу
if (cot::$usr['id'] == 0 && !empty($_SESSION['advboard']) && in_array($advert->id, $_SESSION['advboard'])) {
cot::$cfg['cache_advert'] = cot::$cfg['cache_index'] = false;
}
$crumbs = cot_structure_buildpath('advboard', $advert->category);
if (cot::$cfg['advboard']['firstCrumb']) {
array_unshift($crumbs, array(cot_url('advboard'), cot::$L['advboard_ads']));
}
$crumbs[] = !empty($advert->title) ? $advert->title : cot::$L['advboard_advert'] . " #" . $advert->id;
$urlParams = array('c' => $advert->category);
if ($advert->alias != '') {
$urlParams['al'] = $advert->alias;
} else {
$urlParams['id'] = $advert->id;
//.........这里部分代码省略.........
示例11: array
case 'announcement':
$db->update($db_forum_topics, array("ft_state" => 1, "ft_sticky" => 1), "ft_id={$q}");
cot_log("Announcement topic #" . $q, 'for');
break;
case 'bump':
cot_check_xg();
$db->update($db_forum_topics, array("ft_updated" => $sys['now']), "ft_id={$q}");
cot_forums_sectionsetlast($s);
cot_log("Bumped topic #" . $q, 'for');
break;
case 'private':
cot_log("Made topic #" . $q . " private", 'for');
$db->update($db_forum_topics, array("ft_mode" => 1), "ft_id={$q}");
break;
case 'clear':
cot_log("Resetted topic #" . $q, 'for');
$db->update($db_forum_topics, array("ft_state" => 0, "ft_sticky" => 0, "ft_mode" => 0), "ft_id={$q}");
break;
}
cot_redirect(cot_url('forums', "m=topics&s=" . $s, '', true));
}
/* === Hook === */
foreach (cot_getextplugins('forums.topics.first') as $pl) {
include $pl;
}
/* ===== */
require_once cot_incfile('forms');
$structure['forums'][$s]['desc'] = cot_parse_autourls($structure['forums'][$s]['desc']);
$title_params = array('FORUM' => $L['Forums'], 'SECTION' => $structure['forums'][$s]['title']);
$out['subtitle'] = cot_title($cfg['forums']['title_topics'], $title_params);
$out['desc'] = htmlspecialchars(strip_tags($structure['forums'][$s]['desc']));
示例12: cot_die_message
}
if (!$id && empty($al) || !$sql_page || $sql_page->rowCount() == 0) {
cot_die_message(404, TRUE);
}
$pag = $sql_page->fetch();
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin'], $usr['auth_download']) = cot_auth('page', $pag['page_cat'], 'RWA1');
cot_block($usr['auth_read']);
$al = empty($pag['page_alias']) ? '' : $pag['page_alias'];
$id = (int) $pag['page_id'];
$cat = $structure['page'][$pag['page_cat']];
$sys['sublocation'] = $pag['page_title'];
$pag['page_begin_noformat'] = $pag['page_begin'];
$pag['page_tab'] = empty($pg) ? 0 : $pg;
$pag['page_pageurl'] = empty($al) ? cot_url('page', array('c' => $pag['page_cat'], 'id' => $id)) : cot_url('page', array('c' => $pag['page_cat'], 'al' => $al));
if (($pag['page_state'] == 1 || $pag['page_state'] == 2 || $pag['page_begin'] > $sys['now'] || $pag['page_expire'] > 0 && $sys['now'] > $pag['page_expire']) && (!$usr['isadmin'] && $usr['id'] != $pag['page_ownerid'])) {
cot_log("Attempt to directly access an un-validated or future/expired page", 'sec');
cot_die_message(403, TRUE);
}
if (mb_substr($pag['page_text'], 0, 6) == 'redir:') {
$env['status'] = '303 See Other';
$redir = trim(str_replace('redir:', '', $pag['page_text']));
$sql_page_update = $db->query("UPDATE {$db_pages} SET page_filecount=page_filecount+1 WHERE page_id={$id}");
header('Location: ' . (preg_match('#^(http|ftp)s?://#', $redir) ? '' : COT_ABSOLUTE_URL) . $redir);
exit;
} elseif (mb_substr($pag['page_text'], 0, 8) == 'include:') {
$pag['page_text'] = cot_readraw('datas/html/' . trim(mb_substr($pag['page_text'], 8, 255)));
}
if ($pag['page_file'] && $a == 'dl' && ($pag['page_file'] == 2 && $usr['auth_download'] || $pag['page_file'] == 1)) {
/* === Hook === */
foreach (cot_getextplugins('page.download.first') as $pl) {
include $pl;
示例13: afterUpdate
protected function afterUpdate()
{
global $structure;
cot_log("Edited banner # {$this->_data['id']} - {$this->_data['title']}", 'adm');
// Обновить структуру, если она изменилась
if (!empty($this->_oldData['category'])) {
$count = brs_model_Banner::count(array(array('category', $this->_data['category'])));
static::$_db->update(cot::$db->structure, array('structure_count' => $count), "structure_area='brs' AND structure_code=?", $this->_data['category']);
if (!empty($structure['brs'][$this->_oldData['category']])) {
$count = brs_model_Banner::count(array(array('category', $this->_oldData['category'])));
static::$_db->update(cot::$db->structure, array('structure_count' => $count), "structure_area='brs' AND structure_code = ?", $this->_oldData['category']);
}
cot::$cache && cot::$cache->db->remove('structure', 'system');
}
return parent::afterUpdate();
}
示例14: cot_setcookie
cot_setcookie($sys['site_id'], $u, time() + $cfg['cookielifetime'], $cfg['cookiepath'], $cfg['cookiedomain'], $sys['secure'], true);
unset($_SESSION[$sys['site_id']]);
} else {
$_SESSION[$sys['site_id']] = $u;
}
/* === Hook === */
foreach (cot_getextplugins('users.auth.check.done') as $pl) {
include $pl;
}
/* ===== */
cot_uriredir_apply($cfg['redirbkonlogin']);
cot_uriredir_redirect(empty($redirect) ? cot_url('index') : base64_decode($redirect));
} else {
$env['status'] = '401 Unauthorized';
cot_shield_update(7, "Log in");
cot_log("Log in failed, user : " . $rusername, 'usr');
/* === Hook === */
foreach (cot_getextplugins('users.auth.check.fail') as $pl) {
include $pl;
}
/* ===== */
cot_redirect(cot_url('message', 'msg=151', '', true));
}
}
/* === Hook === */
foreach (cot_getextplugins('users.auth.main') as $pl) {
include $pl;
}
/* ===== */
$out['subtitle'] = $L['aut_logintitle'];
$out['head'] .= $R['code_noindex'];
示例15: md5
$validationkey = md5(microtime());
$newpass = cot_randomstring();
$ruserpass = array();
$ruserpass['user_passsalt'] = cot_unique(16);
$ruserpass['user_passfunc'] = empty($cfg['hashfunc']) ? 'sha256' : $cfg['hashfunc'];
$ruserpass['user_password'] = cot_hash($newpass, $ruserpass['user_passsalt'], $ruserpass['user_passfunc']);
$ruserpass['user_lostpass'] = $validationkey;
$sql = $db->update($db_users, $ruserpass, "user_id={$ruserid}");
$rsubject = $L['pasrec_title'];
$rbody = $L['Hi'] . " " . $rusername . ",\n\n" . $L['pasrec_email2'] . "\n\n" . $newpass . "\n\n" . $L['aut_contactadmin'];
cot_mail($rusermail, $rsubject, $rbody);
$msg = 'auth';
} else {
$env['status'] = '403 Forbidden';
cot_shield_update(7, "Log in");
cot_log("Pass recovery failed, user : " . $rusername);
cot_redirect(cot_url('message', 'msg=151', '', true));
}
}
$out['subtitle'] = $L['pasrec_title'];
$out['head'] .= $R['code_noindex'];
$title[] = $L['pasrec_title'];
$mskin = cot_tplfile('users.passrecover', 'module');
/* === Hook === */
foreach (cot_getextplugins('users.passrecover.main') as $pl) {
include $pl;
}
/* ===== */
require_once $cfg['system_dir'] . '/header.php';
$t = new XTemplate($mskin);
$t->assign(array('PASSRECOVER_TITLE' => cot_breadcrumbs($title, $cfg['homebreadcrumb']), 'PASSRECOVER_URL_FORM' => cot_url('users', 'm=passrecover&a=request')));