本文整理汇总了PHP中cot_extrafield_movefiles函数的典型用法代码示例。如果您正苦于以下问题:PHP cot_extrafield_movefiles函数的具体用法?PHP cot_extrafield_movefiles怎么用?PHP cot_extrafield_movefiles使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cot_extrafield_movefiles函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
} elseif ($rtplmode == 3) {
$rstructure['structure_tpl'] = cot_import('rtplforced', 'P', 'TXT');
} elseif ($rtplmode == 2) {
$rstructure['structure_tpl'] = 'same_as_parent';
} else {
$rstructure['structure_tpl'] = '';
}
/* === Hook === */
foreach (cot_getextplugins('admin.structure.add.first') as $pl) {
include $pl;
}
/* ===== */
if (!cot_error_found()) {
$res = cot_structure_add($n, $rstructure, $is_module);
if ($res === true) {
cot_extrafield_movefiles();
/* === Hook === */
foreach (cot_getextplugins('admin.structure.add.done') as $pl) {
include $pl;
}
/* ===== */
cot_message('Added');
} elseif (is_array($res)) {
cot_error($res[0], $res[1]);
} else {
cot_error('Error');
}
}
cot_redirect(cot_url('admin', 'm=structure&n=' . $n . '&mode=' . $mode . '&d=' . $durl, '', true));
} elseif ($a == 'delete') {
cot_check_xg();
示例2: cot_page_update
/**
* Updates a page in the CMS.
* @param integer $id Page ID
* @param array $rpage Page data
* @param array $auth Permissions array
* @return boolean TRUE on success, FALSE on error
*/
function cot_page_update($id, &$rpage, $auth = array())
{
global $cache, $cfg, $db, $db_pages, $db_structure, $structure, $L;
if (cot_error_found()) {
return false;
}
if (count($auth) == 0) {
$auth = cot_page_auth($rpage['page_cat']);
}
if (!empty($rpage['page_alias'])) {
$page_count = $db->query("SELECT COUNT(*) FROM {$db_pages} WHERE page_alias = ? AND page_id != ?", array($rpage['page_alias'], $id))->fetchColumn();
if ($page_count > 0) {
$rpage['page_alias'] = $rpage['page_alias'] . rand(1000, 9999);
}
}
$row_page = $db->query("SELECT * FROM {$db_pages} WHERE page_id = ?", $id)->fetch();
if ($row_page['page_cat'] != $rpage['page_cat'] && $row_page['page_state'] == 0) {
$db->query("UPDATE {$db_structure} SET structure_count=structure_count-1 WHERE structure_code = ? AND structure_area = 'page'", $row_page['page_cat']);
}
//$usr['isadmin'] = cot_auth('page', $rpage['page_cat'], 'A');
if ($rpage['page_state'] == 0) {
if ($auth['isadmin'] && $cfg['page']['autovalidate']) {
if ($row_page['page_state'] != 0 || $row_page['page_cat'] != $rpage['page_cat']) {
$db->query("UPDATE {$db_structure} SET structure_count=structure_count+1 WHERE structure_code = ? AND structure_area = 'page'", $rpage['page_cat']);
}
} else {
$rpage['page_state'] = 1;
}
}
if ($rpage['page_state'] != 0 && $row_page['page_state'] == 0) {
$db->query("UPDATE {$db_structure} SET structure_count=structure_count-1 WHERE structure_code = ?", $rpage['page_cat']);
}
$cache && $cache->db->remove('structure', 'system');
if (!$db->update($db_pages, $rpage, 'page_id = ?', $id)) {
return false;
}
cot_extrafield_movefiles();
/* === Hook === */
foreach (cot_getextplugins('page.edit.update.done') as $pl) {
include $pl;
}
/* ===== */
if (($rpage['page_state'] == 0 || $rpage['page_cat'] != $row_page['page_cat']) && $cache) {
if ($cfg['cache_page']) {
$cache->page->clear('page/' . str_replace('.', '/', $structure['page'][$rpage['page_cat']]['path']));
if ($rpage['page_cat'] != $row_page['page_cat']) {
$cache->page->clear('page/' . str_replace('.', '/', $structure['page'][$row_page['page_cat']]['path']));
}
}
if ($cfg['cache_index']) {
$cache->page->clear('index');
}
}
return true;
}
示例3: cot_market_update
/**
* Updates a product in the CMS.
* @param integer $id Product ID
* @param array $ritem Product data
* @param array $auth Permissions array
* @return boolean TRUE on success, FALSE on error
*/
function cot_market_update($id, &$ritem, $auth = array())
{
global $cache, $cfg, $db, $db_market, $db_structure, $structure, $L;
if (cot_error_found()) {
return false;
}
if (count($auth) == 0) {
$auth = cot_market_auth($ritem['item_cat']);
}
if (!empty($ritem['item_alias'])) {
$prd_count = $db->query("SELECT COUNT(*) FROM {$db_market} WHERE item_alias = ? AND item_id != ?", array($ritem['item_alias'], $id))->fetchColumn();
if ($prd_count > 0) {
$ritem['item_alias'] = $ritem['item_alias'] . rand(1000, 9999);
}
}
$item = $db->query("SELECT * FROM {$db_market} WHERE item_id = ?", $id)->fetch();
if (!$cfg['market']['preview']) {
$ritem['item_state'] = !$cfg['market']['prevalidate'] || $auth['isadmin'] ? 0 : 2;
} else {
$ritem['item_state'] = 1;
}
if (!$db->update($db_market, $ritem, 'item_id = ?', $id)) {
return false;
}
cot_market_sync($item['item_cat']);
cot_market_sync($ritem['item_cat']);
cot_extrafield_movefiles();
/* === Hook === */
foreach (cot_getextplugins('market.edit.update.done') as $pl) {
include $pl;
}
/* ===== */
return true;
}
示例4: cot_add_user
/**
* Adds new user
*
* @param array $ruser User data array
* @param string $email Email address
* @param string $name User name; defaults to $email if omitted
* @param string $password Password; randomly generated if omitted
* @param string $maingrp Custom main grp
* @param float $sendemail Send email if need activation
* @return int New user ID or false
* @global CotDB $db
*/
function cot_add_user($ruser, $email = null, $name = null, $password = null, $maingrp = null, $sendemail = true)
{
global $cfg, $cot_extrafields, $db, $db_users, $db_groups_users, $db_x, $L, $R, $sys, $uploadfiles, $usr;
$ruser['user_email'] = !empty($email) ? $email : $ruser['user_email'];
$ruser['user_name'] = !empty($name) ? $name : $ruser['user_name'];
$ruser['user_password'] = !empty($password) ? $password : $ruser['user_password'];
empty($ruser['user_password']) && ($ruser['user_password'] = cot_randomstring());
empty($ruser['user_name']) && ($ruser['user_name'] = $ruser['user_email']);
$password = $ruser['user_password'];
$user_exists = (bool) $db->query("SELECT user_id FROM {$db_users} WHERE user_name = ? LIMIT 1", array($ruser['user_name']))->fetch();
$email_exists = (bool) $db->query("SELECT user_id FROM {$db_users} WHERE user_email = ? LIMIT 1", array($ruser['user_email']))->fetch();
if (!cot_check_email($ruser['user_email']) || $user_exists || !$cfg['useremailduplicate'] && $email_exists) {
return false;
}
$ruser['user_gender'] = in_array($ruser['user_gender'], array('M', 'F')) ? $ruser['user_gender'] : 'U';
$ruser['user_country'] = mb_strlen($ruser['user_country']) < 4 ? $ruser['user_country'] : '';
$ruser['user_timezone'] = !$ruser['user_timezone'] ? 'GMT' : $ruser['user_timezone'];
$ruser['user_maingrp'] = $db->countRows($db_users) == 0 ? 5 : $cfg['users']['regnoactivation'] ? 4 : 2;
$ruser['user_maingrp'] = (int) $maingrp > 0 ? $maingrp : $ruser['user_maingrp'];
$ruser['user_passsalt'] = cot_unique(16);
$ruser['user_passfunc'] = empty($cfg['hashfunc']) ? 'sha256' : $cfg['hashfunc'];
$ruser['user_password'] = cot_hash($ruser['user_password'], $ruser['user_passsalt'], $ruser['user_passfunc']);
$ruser['user_birthdate'] = is_null($ruser['user_birthdate']) || $ruser['user_birthdate'] > $sys['now'] ? '0000-00-00' : cot_stamp2date($ruser['user_birthdate']);
$ruser['user_lostpass'] = md5(microtime());
cot_shield_update(20, "Registration");
$ruser['user_hideemail'] = 1;
$ruser['user_theme'] = $cfg['defaulttheme'];
$ruser['user_scheme'] = $cfg['defaultscheme'];
$ruser['user_lang'] = empty($ruser['user_lang']) ? $cfg['defaultlang'] : $ruser['user_lang'];
$ruser['user_regdate'] = (int) $sys['now'];
$ruser['user_logcount'] = 0;
$ruser['user_lastip'] = empty($ruser['user_lastip']) ? $usr['ip'] : $ruser['user_lastip'];
$ruser['user_token'] = cot_unique(16);
if (!$db->insert($db_users, $ruser)) {
return;
}
$userid = $db->lastInsertId();
$db->insert($db_groups_users, array('gru_userid' => (int) $userid, 'gru_groupid' => (int) $ruser['user_maingrp']));
cot_extrafield_movefiles();
/* === Hook for the plugins === */
foreach (cot_getextplugins('users.adduser.done') as $pl) {
include $pl;
}
/* ===== */
if ($ruser['user_maingrp'] == 2 && $sendemail) {
if ($cfg['users']['regrequireadmin']) {
$subject = $L['aut_regrequesttitle'];
$body = sprintf($L['aut_regrequest'], $ruser['user_name']);
$body .= "\n\n" . $L['aut_contactadmin'];
cot_mail($ruser['user_email'], $subject, $body);
$subject = $L['aut_regreqnoticetitle'];
$inactive = $cfg['mainurl'] . '/' . cot_url('users', 'gm=2&s=regdate&w=desc', '', true);
$body = sprintf($L['aut_regreqnotice'], $ruser['user_name'], $inactive);
cot_mail($cfg['adminemail'], $subject, $body);
} else {
$subject = $L['Registration'];
$activate = $cfg['mainurl'] . '/' . cot_url('users', 'm=register&a=validate&token=' . $ruser['user_token'] . '&v=' . $ruser['user_lostpass'] . '&y=1', '', true);
$deactivate = $cfg['mainurl'] . '/' . cot_url('users', 'm=register&a=validate&token=' . $ruser['user_token'] . '&v=' . $ruser['user_lostpass'] . '&y=0', '', true);
$body = sprintf($L['aut_emailreg'], $ruser['user_name'], $activate, $deactivate);
$body .= "\n\n" . $L['aut_contactadmin'];
cot_mail($ruser['user_email'], $subject, $body);
}
}
return $userid;
}