本文整理汇总了PHP中content::updateScore方法的典型用法代码示例。如果您正苦于以下问题:PHP content::updateScore方法的具体用法?PHP content::updateScore怎么用?PHP content::updateScore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类content
的用法示例。
在下文中一共展示了content::updateScore方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switch
$cmd = $_GET['cmd'];
}
switch ($cmd) {
case 'recordVote':
if ($isSessionValid and isset($_GET['siteContentId'])) {
$siteContentId = $_GET['siteContentId'];
// record story read by this user
require_once PATH_CORE . '/classes/log.class.php';
$logObj = new log($db);
$logItem = $logObj->serialize(0, $userid, 'vote', $siteContentId);
//$db->log('recordvote '.$userid.' '.$siteContentId.' '.$session->votePower);
$inLog = $logObj->update($logItem);
if ($inLog) {
require_once PATH_CORE . '/classes/content.class.php';
$cObj = new content($db);
$cObj->updateScore($siteContentId, $session->votePower);
$code = $cObj->getScore($siteContentId) . ' votes';
$filename = PATH_CACHE . '/read_' . $siteContentId . '_top.cac';
if (file_exists($filename)) {
unlink($filename);
}
} else {
$code = 'You already voted.';
}
} else {
$code = fetchSmallAlert($session->isExpired);
}
break;
}
break;
}
示例2: define
define("INIT_SESSION", true);
include_once 'initialize.php';
switch ($cmd) {
case 'recordVote':
if (isset($_GET['siteContentId'])) {
$siteContentId = $_GET['siteContentId'];
// record story read by this user
if ($db->ui->isLoggedIn) {
require_once PATH_CORE . '/classes/log.class.php';
$logObj = new log($db);
$logItem = $logObj->serialize(0, $db->ui->userid, 'vote', $siteContentId);
$inLog = $logObj->update($logItem);
if ($inLog) {
require_once PATH_CORE . '/classes/content.class.php';
$cObj = new content($db);
$cObj->updateScore($siteContentId, $db->ui->votePower);
$code = $cObj->getScore($siteContentId) . ' votes';
} else {
$code = 'You already voted.';
}
} else {
$code = SIGNIN_LINK;
}
} else {
$error = true;
}
break;
case 'addToJournal':
if (isset($_GET['siteContentId'])) {
$siteContentId = $_GET['siteContentId'];
if ($db->ui->isLoggedIn) {