本文整理汇总了PHP中log::serialize方法的典型用法代码示例。如果您正苦于以下问题:PHP log::serialize方法的具体用法?PHP log::serialize怎么用?PHP log::serialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类log
的用法示例。
在下文中一共展示了log::serialize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postNextTopStory
function postNextTopStory()
{
// only post one story every three hours
$tstamp = $this->statusObj->getState('lastTwitterPost');
if (!isset($_GET['test']) and time() - $tstamp < 60 * TWITTER_INTERVAL_MINUTES) {
return;
}
//echo 'continuing';
require_once PATH_CORE . '/classes/content.class.php';
$cObj = new content($this->db);
require_once PATH_CORE . '/classes/log.class.php';
$logObj = new log($this->db);
$topStories = $cObj->fetchUpcomingStories();
$uid = 1;
while ($data = $this->db->readQ($topStories)) {
if (!$this->checkLog($uid, $data->siteContentId) and $data->score >= TWITTER_SCORE_THRESHOLD) {
// post to twitter
$result = $this->update($data->siteContentId, $data->title);
if ($result) {
$logItem = $logObj->serialize(0, $uid, 'postTwitter', $data->siteContentId);
$logObj->add($logItem);
$this->statusObj->setState('lastTwitterPost', time());
}
// only do one at a time
return;
}
}
}
示例2: logHourlyStats
function logHourlyStats()
{
require_once PATH_CORE . '/classes/log.class.php';
$logObj = new log($this->db);
// record recentSessions
$q = $this->db->query("SELECT count(id) as cnt FROM fbSessions WHERE fb_sig_time>=date_sub(NOW(), INTERVAL 10 MINUTE);");
$data = $this->db->readQ($q);
$cnt = $data->cnt;
$logItem = $logObj->serialize(0, 0, 'sessionsRecent', $cnt);
$logObj->add($logItem);
// record sessions in last hour
$q = $this->db->query("SELECT count(id) as cnt FROM fbSessions WHERE fb_sig_time>=date_sub(NOW(), INTERVAL 60 MINUTE);");
$data = $this->db->readQ($q);
$cnt = $data->cnt;
$logItem = $logObj->serialize(0, 0, 'sessionsHour', $cnt);
$logObj->add($logItem);
}
示例3: makePost
function makePost($mode)
{
require_once PATH_CORE . '/classes/log.class.php';
$logObj = new log($this->db);
switch ($mode) {
case 'wall':
if (isset($_GET['self'])) {
$idName = 'tbId_publishSelf';
} else {
$idName = 'tbId_publish';
}
require_once PATH_CORE . '/classes/systemStatus.class.php';
$ssObj = new systemStatus($this->db);
$templateId = $ssObj->getState($idName);
if (isset($_POST['app_params']['selId']) || $_POST['app_params']['pubType'] == 'invite') {
if (isset($_POST['app_params']) && trim($_POST['app_params']['comment_text']) != '') {
$msg = $_POST['app_params']['comment_text'];
}
$feedElements = $this->fetchFeedElements($_POST['app_params']['pubType'], $_POST['app_params']['selId'], $_POST['fb_sig_user']);
$fbmlArray = array("content" => array("feed" => array("template_id" => $templateId, "template_data" => array("title" => $feedElements['title'], "headline" => $feedElements['title'], "storyLink" => $feedElements['storyLink'] . '?&referfbid=' . $_POST['fb_sig_user'], "url" => URL_CANVAS . '/?referfbid=' . $_POST['fb_sig_user'], "story" => $feedElements['story'] . '<br><br>' . $msg, "pubType" => $feedElements['pubType'], "appName" => SITE_TITLE, "refId" => $_POST['fb_sig_user'], "storyImage" => $feedElements['image'], "images" => array(array('src' => $feedElements['image'], 'href' => $feedElements['storyLink']))))), "method" => "publisher_getFeedStory");
$logObj->updateFromPublisher($logObj->serialize(0, $this->fetchUseridFromFbid($_POST['fb_sig_user']), 'publisherPost', $_POST['app_params']['selId']));
} else {
$fbmlArray = array("errorCode" => 1, "errorTitle" => 'Wait!', "errorMessage" => 'You must select a story to post. Post cancelled.');
}
$fbml = json_encode($fbmlArray);
break;
case 'email':
if (isset($_POST['selId']) || $_POST['pubType'] == 'invite') {
//fb_sig_user
if ($_POST['pubType'] == 'invite') {
$idForLog = 0;
} else {
$idForLog = $_POST['selId'];
}
$logObj->updateFromPublisher($logObj->serialize(0, $this->fetchUseridFromFbid($_POST['fb_sig_user']), 'messageAttach', $idForLog));
$feedElements = $this->fetchFeedElements($_POST['pubType'], $_POST['selId'], $_POST['fb_sig_user']);
$fbml .= $feedElements['story'];
if ($feedElements['storyLink'] != '') {
$fbml .= '<br /><a href="' . $feedElements['storyLink'] . '?&referfbid=' . $_POST['fb_sig_user'] . '">Read More</a>';
}
} else {
$fbml = 'No content selected';
}
break;
}
return $fbml;
}
示例4: recordReferral
function recordReferral($referid = 0, $action = '', $itemid = 0)
{
// record the referral in the log
// $this->session->userid was referred to $action page by $referid userid, $itemid may be siteContentId
// action may be referReader or referToSite
if ($this->session->isLoaded and $this->session->userid != 0) {
// log referid as having referred this user
require_once PATH_CORE . '/classes/log.class.php';
$logObj = new log($this->db);
$logItem = $logObj->serialize(0, $referid, $action, $itemid, $this->session->userid);
$inLog = $logObj->update($logItem);
// check if UserInfo.refuid has not been set before
if ($this->session->u->refuid == 0) {
// load the userinfo for this user
$this->session->ui->refuid = $referid;
$this->session->ui->update();
}
// sign up page will use refuid to mark invites as accepted
}
}
示例5: unlink
$siteCommentId = $result;
$filename = PATH_CACHE . '/read_' . $cid . '_com_m.cac';
if (file_exists($filename)) {
unlink($filename);
}
$filename = PATH_CACHE . '/read_' . $cid . '_com_n.cac';
if (file_exists($filename)) {
unlink($filename);
}
}
$cObj->updateCommentCount($cid);
}
if (!$error) {
require_once PATH_CORE . '/classes/log.class.php';
$logObj = new log($db);
$logItem = $logObj->serialize(0, $userid, 'comment', $siteCommentId, 0, $cid);
$inLog = $logObj->add($logItem);
$code = '<div id="dialogMessage"><h2>Your comment has been published successfully.</h2><p>What would you like to do next?</p>';
$code .= '<ul class="bullet_list">' . $storyOption . '<li><a href="#" onclick="hideDialog(); return shareStory(this,' . $cid . ');">Share story with friends</a></li><li><a href="?p=invite" onclick="hideDialog(); return switchPage(\'invite\');">Invite friends to ' . SITE_TITLE . '</a></li></ul></div>';
} else {
$code = '<div id="dialogMessage">Sorry, there was a problem publishing your comment. Error: ' . $errorMsg . '</div>';
}
break;
case 'requestVerify':
// send it
// to do - this code is duped in pagesignup, move to account.class.php
global $init;
// ask NewsCloud to send an email verification request
/*
require_once (PATH_CORE.'/classes/systemStatus.class.php');
$ssObj=new systemStatus($db);
示例6: ajaxIdeaRecordLike
function ajaxIdeaRecordLike($isSessionValid = false, $userid = 0, $id = 0)
{
//$this->db->log('inside ajaxidearecordlike');
if ($isSessionValid) {
require_once PATH_CORE . '/classes/log.class.php';
$logObj = new log($this->db);
// record the like in the log
$logItem = $logObj->serialize(0, $userid, 'likeIdea', $id);
$inLog = $logObj->update($logItem);
if ($inLog) {
$iTable = new ideasTable($this->db);
$ir = $iTable->getRowObject();
$ir->load($id);
$ir->numLikes += 1;
$ir->update();
$code = '<a href="#" class="voteLink" onclick="return ideaRecordLike(' . $id . ');" title="like this idea">Like</a> ' . $ir->numLikes;
} else {
$code = 'You already liked this!';
}
} else {
$code = '<a href="' . URL_CANVAS . '?p=ideas" requirelogin="1">Please authorize ' . SITE_TITLE . ' with Facebook before continuing.</a>';
}
return $code;
}
示例7: updateUserLevels
function updateUserLevels($limit = 100)
{
// scan every use account and adjust the user level to match their cached points
require_once PATH_CORE . '/classes/user.class.php';
if ($limit == 0) {
$useridList = $this->db->query("SELECT SQL_CALC_FOUND_ROWS\tuserid FROM UserInfo;");
// $this->page->rowsPerPage
} else {
$useridList = $this->db->query("SELECT SQL_CALC_FOUND_ROWS\tuserid FROM UserInfo ORDER BY lastUpdateLevels ASC LIMIT 0,{$limit}");
// $this->page->rowsPerPage
}
$userTable = new UserTable($this->db);
$userInfoTable = new UserInfoTable($this->db);
$user = $userTable->getRowObject();
$userinfo = $userInfoTable->getRowObject();
$userLevels = $this->setUserLevels();
$pointLevels = $userLevels->pointLevels;
$nameLevels = array_keys($userLevels->nameLevels);
$this->log('<pre>' . print_r($pointLevels, true) . print_r($nameLevels, true) . '</pre>');
$levels = array_combine($pointLevels, $nameLevels);
$this->log('updateUserLevels...');
if ($this->db->countQ($useridList) > 0) {
while ($data = $this->db->readQ($useridList)) {
if ($user->load($data->userid) && $userinfo->load($data->userid)) {
$x = 0;
if (is_array($levels)) {
foreach ($levels as $val => $name) {
if ($user->cachedPointsEarned >= $val) {
$userLevel = $name;
$pointLevel = $val;
$votePower = $userLevels->votePowerLevels[$x];
}
$x += 1;
}
}
// minor hack: assume user levels only increase. deducting earned points would require revoking challenges
// also, the limit on redemptions of the levelIncrease challenge should limit potential for abuse
// AND checking for duplicate log entries with itemid=pts will also prevent multiple level ups at the same level
if ($user->userLevel != $userLevel && $userLevel != $nameLevels[0]) {
require_once PATH_CORE . '/classes/log.class.php';
$log = new log($this->db);
$log->update($log->serialize(0, $user->userid, 'levelIncrease', array_search($pointLevel, $pointLevels), 0));
$user->votePower = $votePower;
$this->db->log('VotePower increase ' . $user->userid . ' ' . $userLevel . ' ' . $votePower);
}
$user->userLevel = $userLevel;
$user->update();
$userinfo->lastUpdateLevels = date('Y-m-d H:i:s', time());
$userinfo->update();
//$this->log('updated user '. $data->userid.'<br/>');
} else {
$this->log('updateUserLevels: couldnt load user ' . $data->userid);
}
}
} else {
$this->log('updateUserLevels: got no user records!');
}
}
示例8: buildSend
function buildSend()
{
$code .= '<div >';
if (isset($_GET['submit'])) {
$this->db->log($_POST);
//validate form
$errorMessage = '';
if (sizeof($_POST['ids']) < 1) {
$errorMessage = 'Please specify someone to send the ' . CARDS_NAME . ' to!';
} else {
if ($_POST['pickCard'] == '' or $_POST['pickCard'] == 0) {
$errorMessage = ' You must select a ' . CARDS_NAME . '!';
}
}
if ($errorMessage != '') {
$msgType = 'error';
$title = 'There was a problem...';
$message = $errorMessage;
} else {
$postMsg = $_POST['msg'];
if ($postMsg == $defaultMsg) {
$postMsg = '';
}
// reset default msg to blank
$checkDuplicate = $this->cardsObj->checkResubmit($this->session->userid, $_POST['pickCard'], $_POST['ids']);
if (!$checkDuplicate) {
// look up card name
$q = $this->db->query("SELECT name FROM Cards WHERE id={$_POST['pickCard']};");
$ci = $this->db->readQ($q);
require_once PATH_CORE . '/classes/log.class.php';
$logObj = new log($this->db);
foreach ($_POST['ids'] as $id) {
// record sendCard in log table
$logItem = $logObj->serialize(0, $this->session->userid, 'sendCard', $_POST['pickCard'], $id);
$inLog = $logObj->update($logItem);
$lastId = $logObj->db->getId();
if (is_numeric($lastId)) {
// add postMsg to logExtra
$xTable = new LogExtraTable($this->db);
$le = $xTable->getRowObject();
$le->logid = $lastId;
$le->txt = $postMsg;
$le->insert();
}
$noteMsg = ' sent you a <a href="' . URL_CANVAS . '?p=cards&o=display&id=' . $lastId . '&sid=' . $this->session->userid . '">' . $ci->name . ' ' . CARDS_NAME . '</a> via <a href="' . URL_CANVAS . '">' . SITE_TITLE . '</a>';
$apiResult = $this->page->app->facebook->api_client->notifications_send($id, $noteMsg, 'user_to_user');
}
$message = '';
// success - display msg in $code directly
$code .= $this->cardsObj->makeFancyTitle(CARDS_NAME . ' SENT SUCCESSFULLY', '500px');
$rxList = $this->templateObj->buildFacebookUserList('', $_POST['ids']);
$code .= $this->cardsObj->makeOneCard($_POST['pickCard'], $postMsg, $rxList);
$code .= '<h2><a href="?p=cards&o=send" requirelogin="1">Click here to send another ' . CARDS_NAME . '</h2></a>';
$code .= '<br><h2><a href="?p=cards&o=tx">Click here to see all the ' . CARDS_NAME . 's you have sent.</h2></a>';
$code .= '</div>';
return $code;
} else {
$msgType = 'error';
$title = 'There was a problem...';
$message = "<b>You have already sent that " . CARDS_NAME . " to one or more of these people.</b>";
}
}
}
if ($message != '') {
$code .= $this->page->buildMessage($msgType, $title, $message);
}
// prefill is user to send to
if (isset($_GET['prefillId'])) {
$prefillId = $_GET['prefillId'];
} else {
$prefillId = 0;
}
$code .= $this->cardsObj->buildSendForm($prefillId);
$code .= '</div>';
return $code;
}
示例9: autoFeature
//.........这里部分代码省略.........
}
$autoLog = PATH_SERVER_LOGS . 'auto.log';
// log changes to auto.log
$this->db->log('Time: ' . date('H:i') . ' on ' . date('m-d'), $autoLog);
$this->db->log('Template: ' . $template, $autoLog);
// from story arrays, determine best template e.g. images
// no images
$story_1_id = 0;
$story_2_id = 0;
$story_3_id = 0;
$story_4_id = 0;
$story_5_id = 0;
$story_6_id = 0;
if ($primaryStories[0]->imageUrl == '') {
// first always likeliest to have image due to sort
$template = 'template_1';
$story_1_id = $primaryStories[0]->siteContentId;
$this->db->log($primaryStories[0], $autoLog);
} else {
if ($primaryStories[0]->imageUrl != '' and $primaryStories[1]->imageUrl != '') {
// two images
// less than two secondary stories
$x = rand(0, 1);
if ($x == 0) {
$template = 'template_3';
} else {
$template = 'template_4';
}
// two images version 2
$story_1_id = $primaryStories[0]->siteContentId;
$story_4_id = $primaryStories[1]->siteContentId;
$this->db->log($primaryStories[0], $autoLog);
$this->db->log($primaryStories[1], $autoLog);
/*if ($numSecondaryStories<4) {
} else {
// 4 secondary stories
$template='template_5';
$story_1_id=$primaryStories[0]->siteContentId;
$story_4_id=$primaryStories[1]->siteContentId;
$story_2_id=$secondaryStories[0]->siteContentId;
$story_3_id=$secondaryStories[1]->siteContentId;
$story_5_id=$secondaryStories[2]->siteContentId;
$story_6_id=$secondaryStories[3]->siteContentId;
$this->db->log($primaryStories[0],$autoLog);
$this->db->log($primaryStories[1],$autoLog);
$this->db->log($secondaryStories,$autoLog);
}
*/
} else {
// one image if ($primaryStories[0]->imageUrl<>'') - first always likeliest to have image due to sort
if ($numSecondaryStories >= 2) {
$template = 'template_2';
// one image, two story links
$story_1_id = $primaryStories[0]->siteContentId;
$story_2_id = $secondaryStories[0]->siteContentId;
$story_3_id = $secondaryStories[1]->siteContentId;
$this->db->log($primaryStories[0], $autoLog);
$this->db->log($secondaryStories[0], $autoLog);
$this->db->log($secondaryStories[1], $autoLog);
} else {
$template = 'template_1';
// less than two secondaryStories
$story_1_id = $primaryStories[0]->siteContentId;
$this->db->log($primaryStories[0], $autoLog);
}
}
}
// add top two to the log as having been featured
require_once PATH_CORE . '/classes/log.class.php';
$logObj = new log($this->db);
for ($i = 1; $i <= 6; $i++) {
$str = '$story_' . $i . '_id';
eval("\$storyid = \"{$str}\";");
if ($storyid > 0) {
// only log new ones
$q = $this->db->queryC("SELECT id FROM Log WHERE action='storyFeatured' AND itemid={$storyid} LIMIT 1;");
if ($q === false) {
$logItem = $logObj->serialize(0, 0, 'storyFeatured', $storyid);
$logObj->add($logItem);
}
}
}
// taken from save_template.php in console
$this->db->query("UPDATE Content set isFeatured = 0 WHERE isFeatured = 1");
// set new features
$sql = sprintf("REPLACE INTO FeaturedTemplate SET id = 1, template = '%s', story_1_id = %s, story_2_id = %s, story_3_id = %s, story_4_id = %s, story_5_id = %s, story_6_id = %s", $template, $story_1_id, $story_2_id, $story_3_id, $story_4_id, $story_5_id, $story_6_id);
$this->db->query($sql);
$this->db->query("UPDATE Content set isFeatured = 1 WHERE siteContentId IN ({$story_1_id}, {$story_2_id}, {$story_3_id}, {$story_4_id}, {$story_5_id}, {$story_6_id})");
// clear out the cache of the home top stories
require_once PATH_CORE . '/classes/template.class.php';
$templateObj = new template($this->db);
$templateObj->resetCache('home_feature');
// update twitter feed
if (USE_TWITTER) {
require_once PATH_CORE . 'classes/twitter.class.php';
$twitterObj = new twitter_old($this->db);
$twitterObj->postFeaturedStories();
}
return true;
}
示例10: comments
require_once PATH_PHP . '/classes/comments.class.php';
$commentsObj = new comments($db);
/* process request variables */
if (isset($_GET['permalink'])) {
$permalink = $_GET['permalink'];
} else {
// go to 404 error page
header("Location: " . URL_ROOT);
exit;
}
$story = $cObj->getByPermalink($permalink);
// 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, 'readStory', $story->siteContentId);
// note this is the local contentid
$logObj->update($logItem);
}
/* begin building the page */
$page->setTitle($story->title);
$page->pkgStyles(CACHE_PREFIX . 'nrStory', array(PATH_PHP_STYLES . '/newsroom.css', PATH_PHP_STYLES . '/tabs.css'));
$page->pkgScripts(CACHE_PREFIX . 'nrStory', array(PATH_PHP_SCRIPTS . '/comments.js', PATH_PHP_SCRIPTS . '/voting.js', PATH_PHP_SCRIPTS . '/journal.js'));
$page->addToHeader($common->buildHeader() . $common->buildNavigation('Read Story'));
$page->addToFooter($common->buildFooter());
$page->addRSSFeed(URL_HOME . '?p=rss');
$code = '';
$code .= '<div id="pageBody">';
$code .= '<div id="pageContent">';
$templateObj->registerTemplates('PHP');
/* fetch story */
示例11: log
<?php
/* Process incoming variable requests */
if (isset($_GET['action'])) {
$action = $_GET['action'];
} else {
$action = 'unknown';
}
if (isset($_GET['userid'])) {
$userid = $_GET['userid'];
} else {
$userid = 0;
}
if (isset($_GET['itemid'])) {
$itemid = $_GET['itemid'];
} else {
$id = 0;
}
/* begin building ajax response */
switch ($action) {
case 'readWire':
require_once PATH_CORE . "/classes/log.class.php";
$logObj = new log($db);
$info = $logObj->serialize(0, $userid, 'readWire', $itemid);
$logObj->update($info);
require_once PATH_CORE . "/classes/newswire.class.php";
$nwObj = new newswire($db);
$url = $nwObj->getWebpage($itemid);
header("Location: " . $url);
break;
}
示例12: logWinner
function logWinner($userid, $prizeid)
{
require_once PATH_CORE . '/classes/log.class.php';
$log = new log();
$db = $log->db;
$log->update($log->serialize(0, $userid, 'wonPrize', $prizeid, 0));
}
示例13: fetch
function fetch($option = 'comments', $cid = 0)
{
// to do - remove, temp for vanishteam
if (CACHE_PREFIX == 'van' and !$this->session->isAppAuthorized) {
$fHandle = fopen(PATH_SERVER_LOGS . 'edr.log', 'a');
fwrite($fHandle, 'Required to authorize:' . $_SERVER['HTTP_X_FB_USER_REMOTE_ADDR'] . "\n");
$this->facebook = $this->session->app->loadFacebookLibrary();
$user = $this->facebook->require_login();
}
// build the read story page
require_once PATH_CORE . '/classes/read.class.php';
$readObj = new read($this->db, $this->session);
$readObj->setPageLink($this);
require_once PATH_FACEBOOK . '/classes/actionTeam.class.php';
$this->teamObj = new actionTeam($this->page);
if (isset($_GET['cid']) and !is_numeric($_GET['cid'])) {
$this->page->decloak();
}
if ($cid == 0) {
// need for ajax readStory script
if (isset($_GET['cid']) and is_numeric($_GET['cid'])) {
$cid = $_GET['cid'];
} else {
exit('error2');
}
}
$referid = $this->page->fetchReferral();
if ($referid !== false && is_numeric($referid)) {
// record chat action
if (isset($_GET['chat'])) {
if (!$this->session->isAppAuthorized) {
// require authorization so we can get their fbId - redirs to signup
$this->facebook = $this->session->app->loadFacebookLibrary();
$user = $this->facebook->require_login();
}
if (isset($_POST['fb_sig_added']) and $_POST['fb_sig_added'] == 1) {
$targetfbId = $_POST['fb_sig_user'];
} else {
if (isset($_POST['fb_sig_canvas_user'])) {
$targetfbId = $_POST['fb_sig_canvas_user'];
} else {
$targetfbId = 0;
}
}
// make sure the referer is not clicking on the link themselves
if ($targetfbId != 0 and $referid != $this->session->userid) {
// log referid as having referred this user
require_once PATH_CORE . '/classes/log.class.php';
$logObj = new log($this->db);
$logItem = $logObj->serialize(0, $referid, 'chatStory', $cid, $targetfbId);
$inLog = $logObj->update($logItem);
}
}
// check for notification and display it
if ($this->session->isLoaded and $referid != $this->session->userid) {
// reader was referred here by someone
require_once PATH_CORE . '/classes/notifications.class.php';
$notificationsTable = new NotificationsTable($this->db);
$msgid = $notificationsTable->lookupReferral($referid, $cid, $this->session->fbId);
if ($msgid !== false and $msgid != '' and !is_null($msgid)) {
$notificationsTable->setStatus($msgid, $this->session->fbId, 'opened');
// get fbId from userid
require_once PATH_CORE . '/classes/user.class.php';
$uit = new UserInfoTable($this->db);
$ui = $uit->getRowObject();
$ui->load($referid);
$msgTable = new NotificationMessagesTable($this->db);
$msg = $msgTable->getRowObject();
// load the message
$msg->load($msgid);
// cast msg object into comment property array for token replacement
$referObj = array();
$referObj[fbId] = $ui->fbId;
$referObj[userid] = $referid;
$referObj[comments] = $msg->message;
$referObj[date] = $msg->dateCreated;
$referMsg = $readObj->fetchReferComment($referObj);
}
}
$this->page->recordReferral($referid, 'referReader', $cid);
}
if (isset($_GET['viaBookmarklet'])) {
//$inside.='<script type="text/javascript">function closeWindow() {window.opener = self;window.close();}</script><a href="#" onclick="closeWindow();">test</a>';
//$inside.=$this->page->buildMessage('success','Your story has been posted','Click here if you wish to <a href="#" onclick="closeWindow();">close this window</a>.');
} else {
if (isset($_GET['justPosted'])) {
// to do: put some options here
}
}
$inside .= '<div id="col_left"><!-- begin left side -->';
$inside .= $referMsg;
$inside .= $readObj->fetchReadStory($cid, $option);
$inside .= '</div><!-- end left side -->';
$inside .= '<div id="col_right">';
if ($this->session->isAdmin) {
$inside .= '<div class="panel_1"><div class="panelBar clearfix">';
$inside .= '<h2>Administrative Options</h2>';
$inside .= '</div><!-- end panelBar -->';
$inside .= '<div class="panel_block">';
$inside .= '<ul><li><span id="banStoryPoster"><a href="#" onclick="banStoryPoster(' . $cid . ');return false;">Ban Member</a></span></li></ul>';
//.........这里部分代码省略.........
示例14: log
$code = 'Story already added!';
}
} else {
$code .= SIGNIN_LINK;
}
} else {
$error = true;
}
break;
case 'publishWire':
if (isset($_GET['itemid'])) {
$itemid = $_GET['itemid'];
if ($db->ui->isLoggedIn) {
require_once PATH_CORE . '/classes/log.class.php';
$logObj = new log($db);
$logItem = $logObj->serialize(0, $db->ui->userid, 'publishWire', $itemid);
$inLog = $logObj->update($logItem);
if ($inLog) {
$code = 'Story published!';
} else {
$code = 'Story already published!';
}
// create temporary content item, temp permalink
require_once PATH_CORE . '/classes/newswire.class.php';
$nwObj = new newswire($db);
$db->log('call tempcontent');
$siteContentId = $nwObj->createTempContent($db->ui, $itemid);
// add to user's journal
if ($siteContentId !== false) {
// add to journal
$logItem = $logObj->serialize(0, $db->ui->userid, 'publishStory', $siteContentId);
示例15: ajaxAskRecordLike
function ajaxAskRecordLike($isSessionValid = false, $mode = 'question', $userid = 0, $id = 0)
{
if ($isSessionValid) {
require_once PATH_CORE . '/classes/log.class.php';
$logObj = new log($this->db);
if ($mode == 'question') {
// record the like in the log
$logItem = $logObj->serialize(0, $userid, 'likeQuestion', $id);
$inLog = $logObj->update($logItem);
if ($inLog) {
$aqTable = new askQuestionsTable($this->db);
$qr = $aqTable->getRowObject();
$qr->load($id);
$qr->numLikes += 1;
$qr->update();
$code = '<a href="#" class="voteLink" onclick="return askRecordLike(\'' . $mode . '\',' . $id . ');" title="like this question">Like</a> ' . $qr->numLikes;
} else {
$code = 'You already liked this!';
}
} else {
// mode : answer
$logItem = $logObj->serialize(0, $userid, 'likeAnswer', $id);
$inLog = $logObj->update($logItem);
if ($inLog) {
$aaTable = new askAnswersTable($this->db);
$ar = $aaTable->getRowObject();
$ar->load($id);
$ar->numLikes += 1;
$ar->update();
$code = '<a href="#" class="voteLink" onclick="return askRecordLike(\'' . $mode . '\',' . $id . ');" title="like this question">Like</a> ' . $ar->numLikes;
} else {
$code = 'You already liked this!';
}
}
} else {
$code = '<a href="' . URL_CANVAS . '?p=ask" requirelogin="1">Please authorize ' . SITE_TITLE . ' with Facebook before continuing.</a>';
}
return $code;
}