当前位置: 首页>>代码示例>>PHP>>正文


PHP UpdateConfig函数代码示例

本文整理汇总了PHP中UpdateConfig函数的典型用法代码示例。如果您正苦于以下问题:PHP UpdateConfig函数的具体用法?PHP UpdateConfig怎么用?PHP UpdateConfig使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了UpdateConfig函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: EXISTS

if ($Config['DaysDate'] != $CurrentDate) {
    if (!strtotime($Config['DaysDate'])) {
        $Config['DaysDate'] = $CurrentDate;
    }
    $DB->query('INSERT INTO `' . $Prefix . 'statistics` 
		(`DaysUsers`, `DaysPosts`, `DaysTopics`, `TotalUsers`, `TotalPosts`, `TotalTopics`, `DaysDate`, `DateCreated`) 
		SELECT 
		:DaysUsers, :DaysPosts, :DaysTopics, :TotalUsers, :TotalPosts, :TotalTopics, :DaysDate, :DateCreated 
		FROM dual  
		WHERE NOT EXISTS(  
			SELECT *  FROM `' . $Prefix . 'statistics`  
			WHERE DaysDate = :DaysDate2
		)
		', array('DaysUsers' => $Config['DaysUsers'], 'DaysPosts' => $Config['DaysPosts'], 'DaysTopics' => $Config['DaysTopics'], 'TotalUsers' => $Config['NumUsers'], 'TotalPosts' => $Config['NumPosts'], 'TotalTopics' => $Config['NumTopics'], 'DaysDate' => $Config['DaysDate'], 'DateCreated' => $TimeStamp, 'DaysDate2' => $Config['DaysDate']));
    UpdateConfig(array('DaysDate' => $CurrentDate, 'DaysTopics' => 0, 'DaysPosts' => 0, 'DaysUsers' => 0, 'CacheHotTags' => json_encode($DB->query('SELECT ID,Name,Icon,TotalPosts,Followers FROM ' . $Prefix . 'tags 
			WHERE IsEnabled=1 
			ORDER BY TotalPosts DESC 
			LIMIT ' . $Config['TopicsPerPage']))));
}
// Get the infomation of current user
$CurUserInfo = null;
//当前用户信息,Array,以后判断是否登陆使用if($CurUserID)
$CurUserRole = 0;
$CurUserID = intval(GetCookie('UserID'));
$CurUserExpirationTime = intval(GetCookie('UserExpirationTime'));
$CurUserCode = GetCookie('UserCode');
if ($CurUserExpirationTime > $TimeStamp && $CurUserExpirationTime < $TimeStamp + 2678400 && $CurUserID && $CurUserCode) {
    $TempUserInfo = array();
    if ($MCache) {
        $TempUserInfo = $MCache->get(MemCachePrefix . 'UserInfo_' . $CurUserID);
    }
    if (!$TempUserInfo) {
开发者ID:MrMoDoor,项目名称:Carbon-Forum,代码行数:32,代码来源:common.php

示例2: array

     $NewConfig = array("NumTags" => $Config["NumTags"] + count($NewTags));
     //var_dump($NewTags);
 }
 $TagsArray = array_merge($TagsExist, $NewTags);
 //往Topics表插入数据
 $TopicData = array("ID" => null, "Topic" => htmlspecialchars($Title), "Tags" => implode("|", $TagsArray), "UserID" => $CurUserID, "UserName" => $CurUserName, "LastName" => "", "PostTime" => $TimeStamp, "LastTime" => $TimeStamp, "IsGood" => 0, "IsTop" => 0, "IsLocked" => 0, "IsDel" => 0, "IsVote" => 0, "Views" => 0, "Replies" => 0, "Favorites" => 0, "RatingSum" => 0, "TotalRatings" => 0, "LastViewedTime" => 0, "PostsTableName" => null, "ThreadStyle" => "", "Lists" => "", "ListsTime" => $TimeStamp, "Log" => "");
 $NewTopicResult = $DB->query("INSERT INTO `" . $Prefix . "topics` \r\n\t\t\t\t\t(\r\n\t\t\t\t\t\t`ID`, \r\n\t\t\t\t\t\t`Topic`, \r\n\t\t\t\t\t\t`Tags`, \r\n\t\t\t\t\t\t`UserID`, \r\n\t\t\t\t\t\t`UserName`, \r\n\t\t\t\t\t\t`LastName`, \r\n\t\t\t\t\t\t`PostTime`, \r\n\t\t\t\t\t\t`LastTime`, \r\n\t\t\t\t\t\t`IsGood`, \r\n\t\t\t\t\t\t`IsTop`, \r\n\t\t\t\t\t\t`IsLocked`, \r\n\t\t\t\t\t\t`IsDel`, \r\n\t\t\t\t\t\t`IsVote`, \r\n\t\t\t\t\t\t`Views`, \r\n\t\t\t\t\t\t`Replies`, \r\n\t\t\t\t\t\t`Favorites`, \r\n\t\t\t\t\t\t`RatingSum`, \r\n\t\t\t\t\t\t`TotalRatings`, \r\n\t\t\t\t\t\t`LastViewedTime`, \r\n\t\t\t\t\t\t`PostsTableName`, \r\n\t\t\t\t\t\t`ThreadStyle`, \r\n\t\t\t\t\t\t`Lists`, \r\n\t\t\t\t\t\t`ListsTime`, \r\n\t\t\t\t\t\t`Log`\r\n\t\t\t\t\t) \r\n\t\t\t\t\tVALUES \r\n\t\t\t\t\t(\r\n\t\t\t\t\t\t:ID,\r\n\t\t\t\t\t\t:Topic,\r\n\t\t\t\t\t\t:Tags,\r\n\t\t\t\t\t\t:UserID,\r\n\t\t\t\t\t\t:UserName,\r\n\t\t\t\t\t\t:LastName,\r\n\t\t\t\t\t\t:PostTime,\r\n\t\t\t\t\t\t:LastTime,\r\n\t\t\t\t\t\t:IsGood,\r\n\t\t\t\t\t\t:IsTop,\r\n\t\t\t\t\t\t:IsLocked,\r\n\t\t\t\t\t\t:IsDel,\r\n\t\t\t\t\t\t:IsVote,\r\n\t\t\t\t\t\t:Views,\r\n\t\t\t\t\t\t:Replies,\r\n\t\t\t\t\t\t:Favorites,\r\n\t\t\t\t\t\t:RatingSum,\r\n\t\t\t\t\t\t:TotalRatings,\r\n\t\t\t\t\t\t:LastViewedTime,\r\n\t\t\t\t\t\t:PostsTableName,\r\n\t\t\t\t\t\t:ThreadStyle,\r\n\t\t\t\t\t\t:Lists,\r\n\t\t\t\t\t\t:ListsTime,\r\n\t\t\t\t\t\t:Log\r\n\t\t\t\t\t)", $TopicData);
 $TopicID = $DB->lastInsertId();
 //往Posts表插入数据
 $PostData = array("ID" => null, "TopicID" => $TopicID, "IsTopic" => 1, "UserID" => $CurUserID, "UserName" => $CurUserName, "Subject" => htmlspecialchars($Title), "Content" => XssEscape($Content), "PostIP" => $CurIP, "PostTime" => $TimeStamp);
 $NewPostResult = $DB->query("INSERT INTO `" . $Prefix . "posts` \r\n\t\t\t\t\t(`ID`, `TopicID`, `IsTopic`, `UserID`, `UserName`, `Subject`, `Content`, `PostIP`, `PostTime`) \r\n\t\t\t\t\tVALUES (:ID,:TopicID,:IsTopic,:UserID,:UserName,:Subject,:Content,:PostIP,:PostTime)", $PostData);
 $PostID = $DB->lastInsertId();
 if ($NewTopicResult && $NewPostResult) {
     //更新全站统计数据
     $NewConfig = array("NumTopics" => $Config["NumTopics"] + 1, "DaysTopics" => $Config["DaysTopics"] + 1);
     UpdateConfig($NewConfig);
     //更新用户自身统计数据
     UpdateUserInfo(array("Topics" => $CurUserInfo['Topics'] + 1, "LastPostTime" => $TimeStamp));
     //标记附件所对应的帖子标签
     $DB->query("UPDATE `" . $Prefix . "upload` SET PostID=? WHERE `PostID`=0 and `UserName`=?", array($PostID, $CurUserName));
     //记录标签与TopicID的对应关系
     foreach ($TagsID as $TagID) {
         $DB->query("INSERT INTO `" . $Prefix . "posttags` \r\n\t\t\t\t\t\t\t(`TagID`, `TopicID`, `PostID`) \r\n\t\t\t\t\t\t\tVALUES (?,?,?)", array($TagID, $TopicID, $PostID));
     }
     //更新标签统计数据
     if ($TagsExist) {
         $DB->query("UPDATE `" . $Prefix . "tags` SET TotalPosts=TotalPosts+1, MostRecentPostTime=" . $TimeStamp . " WHERE `Name` in (?)", $TagsExist);
     }
     //添加提醒消息
     AddingNotifications($Content, $TopicID, $PostID);
     //清理首页内存缓存
开发者ID:npk,项目名称:Carbon-Forum,代码行数:31,代码来源:new.php

示例3: date

$CurrentDate = date('Y-m-d');
if ($Config['DaysDate'] != $CurrentDate) {
    if (!strtotime($Config['DaysDate'])) {
        $Config['DaysDate'] = $CurrentDate;
    }
    $DB->query('INSERT INTO `' . $Prefix . 'statistics` 
		(`DaysUsers`, `DaysPosts`, `DaysTopics`, `TotalUsers`, `TotalPosts`, `TotalTopics`, `DaysDate`, `DateCreated`) 
		SELECT 
		:DaysUsers, :DaysPosts, :DaysTopics, :TotalUsers, :TotalPosts, :TotalTopics, :DaysDate, :DateCreated 
		FROM dual  
		WHERE NOT EXISTS(  
			SELECT *  FROM `' . $Prefix . 'statistics`  
			WHERE DaysDate = :DaysDate2
		)
		', array('DaysUsers' => $Config['DaysUsers'], 'DaysPosts' => $Config['DaysPosts'], 'DaysTopics' => $Config['DaysTopics'], 'TotalUsers' => $Config['NumUsers'], 'TotalPosts' => $Config['NumPosts'], 'TotalTopics' => $Config['NumTopics'], 'DaysDate' => $Config['DaysDate'], 'DateCreated' => $TimeStamp, 'DaysDate2' => $Config['DaysDate']));
    UpdateConfig(array('DaysDate' => $CurrentDate, 'DaysTopics' => 0, 'DaysPosts' => 0, 'DaysUsers' => 0));
}
// Get the infomation of current user
$CurUserInfo = null;
//当前用户信息,Array,以后判断是否登陆使用if($CurUserID)
$CurUserRole = 0;
$CurUserID = intval(GetCookie('UserID'));
$CurUserExpirationTime = intval(GetCookie('UserExpirationTime'));
$CurUserCode = GetCookie('UserCode');
if ($CurUserExpirationTime > $TimeStamp && $CurUserExpirationTime < $TimeStamp + 2678400 && $CurUserID && $CurUserCode) {
    $TempUserInfo = array();
    if ($MCache) {
        $TempUserInfo = $MCache->get(MemCachePrefix . 'UserInfo_' . $CurUserID);
    }
    if (!$TempUserInfo) {
        $TempUserInfo = $DB->row("SELECT * FROM " . $Prefix . "users WHERE ID = :UserID", array("UserID" => $CurUserID));
开发者ID:Tycheo,项目名称:Carbon-Forum,代码行数:31,代码来源:common.php

示例4: ShowConfig

function ShowConfig()
{
    global $tpl, $pf, $error_list, $site_name, $site_url, $site_mail, $protect_path, $protect_url, $notify_email, $notify_from, $notify_expire, $success;
    $pf = $_REQUEST['pf'];
    $process = $_REQUEST['process'];
    if ($process == 'edit') {
        $site_name = stripslashes($_REQUEST['site_name']);
        $site_mail = stripslashes($_REQUEST['site_mail']);
        $protect_path = stripslashes($_REQUEST['protect_path']);
        $protect_url = stripslashes($_REQUEST['protect_url']);
        $notify_email = stripslashes($_REQUEST['notify_email']);
        $notify_from = stripslashes($_REQUEST['notify_from']);
        $notify_expire = stripslashes($_REQUEST['notify_expire']);
        $i = 0;
        if ($site_name == "" || $site_mail == "" || $protect_path == "" || $protect_url == "" || $notify_email == "" || $notify_from == "") {
            if ($site_name == "") {
                $error_list[$i] = "Site name is required";
                $i++;
            }
            if ($site_mail == "") {
                $error_list[$i] = "Site email is required";
                $i++;
            }
            if ($protect_path == "") {
                $error_list[$i] = "Protected path is required";
                $i++;
            }
            if ($protect_url == "") {
                $error_list[$i] = "Protected url is required";
                $i++;
            }
            if ($notify_from == "") {
                $error_list[$i] = "Notify from is required";
                $i++;
            }
            if ($notify_email == "") {
                $error_list[$i] = "Notify email is required";
                $i++;
            }
        } elseif (!IsDigit($notify_expire)) {
            $error_list[$i] = "Notify expire must be digit";
            $i++;
        } elseif (!IsEmailAddress($site_mail)) {
            $error_list[$i] = "Site email is not valid format";
            $i++;
        } elseif (!IsEmailAddress($notify_email)) {
            $error_list[$i] = "Notify email is not valid format";
            $i++;
        }
        if (!is_array($error_list)) {
            UpdateConfig($site_name, "site_name");
            UpdateConfig($site_mail, "site_mail");
            UpdateConfig($protect_path, "protect_path");
            UpdateConfig($protect_url, "protect_url");
            UpdateConfig($notify_email, "notify_email");
            UpdateConfig($notify_from, "notify_from");
            UpdateConfig($notify_expire, "notify_expire");
            $success = true;
        }
    } else {
        $site_name = CFG_SITE_NAME;
        $site_mail = CFG_SITE_MAIL;
        $protect_path = CFG_PROTECT_PATH;
        $protect_url = CFG_PROTECT_URL;
        $notify_email = CFG_NOTIFY_EMAIL;
        $notify_from = CFG_NOTIFY_FROM;
        $notify_expire = CFG_NOTIFY_EXPIRE;
    }
}
开发者ID:HoffmannMich,项目名称:ArchReactorOS,代码行数:69,代码来源:config.php


注:本文中的UpdateConfig函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。