本文整理汇总了PHP中fireEvent函数的典型用法代码示例。如果您正苦于以下问题:PHP fireEvent函数的具体用法?PHP fireEvent怎么用?PHP fireEvent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fireEvent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: logout
function logout()
{
fireEvent("Logout");
Acl::clearAcl();
Transaction::clear();
session_destroy();
}
示例2: printMobileEntryListView
function printMobileEntryListView($entries, $listid, $title, $paging, $count = 0, $header = true)
{
$context = Model_Context::getInstance();
$itemsView = '<ul data-role="listview" class="posts" id="' . $listid . '" title="' . $title . '" selected="false" data-inset="true">' . CRLF;
if ($header) {
$itemsView .= '<li class="group ui-bar ui-bar-e">' . CRLF;
$itemsView .= ' <h3>' . $title . '</h3>' . CRLF;
$itemsView .= ' <span class="ui-li-count">' . $count . '</span>' . CRLF;
$itemsView .= ' <span class="ui-li-aside">' . _text('페이지') . ' ' . $paging['page'] . ' / ' . $paging['pages'] . '</span>' . CRLF;
$itemsView .= '</li>' . CRLF;
}
foreach ($entries as $item) {
$author = User::getName($item['userid']);
if ($imageName = printMobileAttachmentExtract($item['content'])) {
$imageSrc = printMobileImageResizer($context->getProperty('blog.id'), $imageName, 80);
} else {
$imageSrc = $context->getProperty('service.path') . '/resources/style/iphone/images/noPostThumb.png';
}
$itemsView .= '<li data-role="list-divider" role="heading" class="ui-li ui-li-divider ui-bar-b ui-btn-up-c" style="font-size:8pt;font-weight:normal">';
$itemsView .= ' ' . Timestamp::format5($item['published']) . '</li>' . CRLF;
$itemsView .= '<li class="post_item">' . CRLF;
$itemsView .= ' <a href="' . $context->getProperty('uri.blog') . '/entry/' . $item['id'] . '" class="link">' . CRLF;
$itemsView .= ' <img src="' . $imageSrc . '" />' . CRLF;
$itemsView .= ' <h3>' . fireEvent('ViewListTitle', htmlspecialchars($item['title'])) . '</h3>' . CRLF;
$itemsView .= ' <p class="ui-li-count"> ' . _textf('댓글 %1개', $item['comments'] > 0 ? $item['comments'] : 0) . '</p>' . CRLF;
if (!empty($item['content'])) {
$itemsView .= ' <p>' . htmlspecialchars(Utils_Unicode::lessenAsEm(removeAllTags(stripHTML($item['content'])), 150)) . '</p>' . CRLF;
}
$itemsView .= ' </a>' . CRLF;
$itemsView .= '</li>' . CRLF;
}
$itemsView .= '</ul>' . CRLF;
return $itemsView;
}
示例3: replace
function replace($matches)
{
$keyword = $matches[0];
if (!$this->_replaceOnce || !array_key_exists($keyword, $this->_binded)) {
$this->_binded[$keyword] = null;
$keyword = fireEvent('BindKeyword', $keyword);
}
return $keyword;
}
示例4: RecentRP_getRecentCommentsView
function RecentRP_getRecentCommentsView($comments, $template)
{
global $contentContainer;
$context = Model_Context::getInstance();
ob_start();
foreach ($comments as $comment) {
$view = "{$template}";
Utils_Misc::dress('rctrp_rep_link', $context->getProperty('uri.blog') . "/{$comment['entry']}#comment{$comment['id']}", $view);
$contentContainer["recent_comment_{$comment['id']}"] = htmlspecialchars(Utils_Unicode::lessenAsEm(strip_tags($comment['comment']), 30));
Utils_Misc::dress('rctrp_rep_desc', setTempTag("recent_comment_{$comment['id']}"), $view);
Utils_Misc::dress('rctrp_rep_desc', htmlspecialchars(Utils_Unicode::lessenAsEm(strip_tags($comment['comment']), 30)), $view);
Utils_Misc::dress('rctrp_rep_time', fireEvent('ViewRecentCommentDate', Timestamp::format3($comment['written'])), $view);
Utils_Misc::dress('rctrp_rep_name', htmlspecialchars(Utils_Unicode::lessenAsEm(strip_tags($comment['name']), 10)) . $comment['secret'] . $comment['replier'], $view);
print $view;
}
$view = ob_get_contents();
ob_end_clean();
return $view;
}
示例5: dumbCronScheduler
function dumbCronScheduler($checkOnly = true)
{
$context = Model_Context::getInstance();
$now = Timestamp::getUNIXtime();
$dumbCronStamps = Setting::getServiceSetting('dumbCronStamps', serialize(array('1m' => 0, '5m' => 0, '30m' => 0, '1h' => 0, '2h' => 0, '6h' => 0, '12h' => 0, '24h' => 0, 'Daily' => 0)), true);
$dumbCronStamps = unserialize($dumbCronStamps);
$schedules = array('1m' => 60, '5m' => 60 * 5, '10m' => 60 * 10, '30m' => 60 * 30, '1h' => 60 * 60, '2h' => 60 * 60 * 2, '6h' => 60 * 60 * 6, '12h' => 60 * 60 * 12, '24h' => 60 * 60 * 24, 'Daily' => 60 * 60 * 24, '1w' => 60 * 60 * 24 * 7);
/* Events: Cron1m, Cron5m, Cron30m, Cron1h, Cron2h, Cron6h, Cron12h */
$log_file = __TEXTCUBE_CACHE_DIR__ . '/cronlog.txt';
$log = fopen($log_file, "a");
foreach ($schedules as $d => $diff) {
if (!isset($dumbCronStamps[$d])) {
$dumbCronStamps[$d] = 0;
}
if ($now > $diff + $dumbCronStamps[$d]) {
if ($checkOnly && eventExists("Cron{$d}")) {
fclose($log);
return true;
}
fireEvent("Cron{$d}", null, $now);
if ($d == '6h') {
importlib('model.blog.trash');
trashVan();
}
fwrite($log, date('Y-m-d H:i:s') . ' ' . $context->getProperty('blog.name') . " Cron{$d} executed ({$_SERVER['REQUEST_URI']})\r\n");
$dumbCronStamps[$d] = $now;
}
}
fclose($log);
/* Keep just 1000 lines */
$logcontent = explode("\r\n", file_get_contents($log_file));
$logcontent = implode("\r\n", array_slice($logcontent, -1000));
$log = fopen($log_file, "w");
fwrite($log, $logcontent);
fclose($log);
Setting::setServiceSetting('dumbCronStamps', serialize($dumbCronStamps), true);
return false;
}
示例6: pretty_dress
function pretty_dress($view)
{
global $blogid, $blog, $database, $service, $stats, $skinSetting;
$context = Model_Context::getInstance();
/* local static */
global $pd_category, $pd_categoryXhtml, $pd_archive, $pd_calendar, $pd_tags, $pd_notices, $pd_recentEntry;
global $pd_recentComment, $pd_recentTrackback, $pd_link, $pd_authorList;
if (isset($_REQUEST['safe'])) {
// safe mode
return '<div class="coverpage-element-safebox">…</div>';
}
if (isset($_REQUEST['tag'])) {
// safe mode
return '<div class="coverpage-element-safebox"><p>' . nl2br(htmlspecialchars($view, ENT_QUOTES)) . '</p></div>';
}
$writer = User::getBlogOwnerName($blogid);
$pageTitle = _t('페이지 제목');
dress('page_title', htmlspecialchars($pageTitle), $view);
dress('blogger', htmlspecialchars($writer), $view);
dress('title', htmlspecialchars($context->getProperty('blog.title')), $view);
dress('desc', htmlspecialchars($context->getProperty('blog.description')), $view);
if ($context->getProperty('blog.logo') != null) {
dress('image', $context->getProperty('service.path') . "/attach/{$blogid}/" . $context->getProperty('blog.logo'), $view);
} else {
dress('image', $context->getProperty('service.path') . "/resources/image/spacer.gif", $view);
}
dress('blog_link', $context->getProperty('uri.blog') . "/", $view);
dress('keylog_link', $context->getProperty('uri.blog') . "/keylog", $view);
dress('localog_link', $context->getProperty('uri.blog') . "/location", $view);
dress('taglog_link', $context->getProperty('uri.blog') . "/tag", $view);
dress('guestbook_link', $context->getProperty('uri.blog') . "/guestbook", $view);
list($view, $searchView) = Skin::cutSkinTag($view, 'search');
dress('search_name', 'search', $searchView);
dress('search_text', isset($search) ? htmlspecialchars($search) : '', $searchView);
dress('search_onclick_submit', 'searchBlog()', $searchView);
dress('search', '<form id="TTSearchForm" action="' . parseURL($context->getProperty('uri.blog') . '/search/') . '" method="get" onsubmit="return searchBlog()">' . $searchView . '</form>', $view);
dress('category', $pd_category, $view);
dress('category_list', $pd_categoryXhtml, $view);
dress('count_total', $stats['total'], $view);
dress('count_today', $stats['today'], $view);
dress('count_yesterday', $stats['yesterday'], $view);
list($view, $archiveView) = Skin::cutSkinTag($view, 'archive_rep');
dress('archive_rep', getArchivesView($pd_archive, $archiveView), $view);
dress('calendar', $pd_calendar, $view);
list($view, $randomView) = Skin::cutSkinTag($view, 'random_tags');
dress('random_tags', getRandomTagsView($pd_tags, $randomView), $view);
list($view, $recentNoticeItem) = Skin::cutSkinTag($view, 'rct_notice_rep');
list($view, $noticeView) = Skin::cutSkinTag($view, 'rct_notice');
$notices = $pd_notices;
if (sizeof($notices) == 0) {
$notices = array(array('title' => _t('공지 제목'), 'id' => -1));
}
if (sizeof($notices) > 0) {
$itemsView = '';
foreach ($notices as $notice) {
$itemView = $recentNoticeItem;
dress('notice_rep_title', htmlspecialchars(fireEvent('ViewNoticeTitle', Utils_Unicode::lessenAsEm($notice['title'], $skinSetting['recentNoticeLength']), $notice['id'])), $itemView);
dress('notice_rep_link', "{$context->getProperty}('uri.blog')/notice/{$notice['id']}", $itemView);
$itemsView .= $itemView;
}
dress('rct_notice_rep', $itemsView, $noticeView);
dress('rct_notice', $noticeView, $view);
}
list($view, $authorList) = Skin::cutSkinTag($view, 'author_rep');
dress('author_rep', getAuthorListView($pd_authorList, $authorList), $view);
list($view, $recentEntry) = Skin::cutSkinTag($view, 'rctps_rep');
dress('rctps_rep', getRecentEntriesView($pd_recentEntry, null, $recentEntry), $view);
list($view, $recentComments) = Skin::cutSkinTag($view, 'rctrp_rep');
dress('rctrp_rep', getRecentCommentsView($pd_recentComment, null, $recentComments), $view);
list($view, $recentTrackback) = Skin::cutSkinTag($view, 'rcttb_rep');
dress('rcttb_rep', getRecentTrackbacksView($pd_recentTrackback, null, $recentTrackback), $view);
list($view, $s_link_rep) = Skin::cutSkinTag($view, 'link_rep');
dress('link_rep', getLinksView($pd_link, $s_link_rep), $view);
dress('rss_url', "{$context->getProperty}('uri.blog')/rss", $view);
dress('owner_url', "{$context->getProperty}('uri.blog')/owner", $view);
dress('textcube_name', TEXTCUBE_NAME, $view);
dress('textcube_version', TEXTCUBE_VERSION, $view);
$tagSearches = array('@<a @i', '@</a *>@i', '@ id *= *".*"@isU', '@ onkey(down|up|press) *="@i', '@ on(click|load|unload) *="@i', '@<input +@i', '@<script.*</script *>@siU', '@<form @siU', '@</form>@siU');
$tagReplaces = array('<span ', '</span>', '', ' onnothing="', ' onnothing="', '<input disabled="disabled" ', '', '<div ', '</div>');
$view = preg_replace($tagSearches, $tagReplaces, $view);
return correctCoverpageImage($view);
}
示例7: fireEvent
<?php
/// Copyright (c) 2004-2016, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
require ROOT . '/library/preprocessor.php';
fireEvent($suri['directive'] . '/' . $suri['value']);
if (!headers_sent()) {
Respond::NotFoundPage();
}
示例8: array
<?php
/// Copyright (c) 2004-2015, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
$IV = array('POST' => array('id' => array('int', 'min' => 1)));
require ROOT . '/library/preprocessor.php';
requireStrictRoute();
$line = Model_Line::getInstance();
$line->reset();
$line->setFilter(array('blogid', 'equals', getBlogId()));
$line->setFilter(array('id', 'equals', $_POST['id']));
if ($line->remove()) {
fireEvent('DeleteLine', 0, $line);
Respond::ResultPage(0);
} else {
fireEvent('DeleteLine', -1, $line);
Respond::ResultPage(-1);
}
示例9: htmlspecialchars
<?php
}
?>
</select></dd>
</dl>
<div id="formatbox-container" class="container"></div>
<textarea id="editWindow" name="content" cols="80" rows="20"><?php
echo htmlspecialchars($entry['content']);
?>
</textarea>
<div id="status-container" class="container"><span id="pathStr"><?php
echo _t('path');
?>
</span><span class="divider"> : </span><span id="pathContent"></span></div>
<?php
$view = fireEvent('AddPostEditorToolbox', '');
if (!empty($view)) {
?>
<div id="toolbox-container" class="container"><?php
echo $view;
?>
</div>
<?php
}
?>
<div id="templateDialog" class="entry-editor-property<?php
echo defined('__TEXTCUBE_POST__') ? NULL : ' hidden';
?>
">
<div class="temp-box">
示例10: empty
if ($_POST['permalink'] == '') {
$entry['slogan'] = '';
}
}
$entry['acceptcomment'] = empty($_POST['acceptcomment']) ? 0 : 1;
$entry['accepttrackback'] = empty($_POST['accepttrackback']) ? 0 : 1;
$entry['published'] = empty($_POST['published']) ? 0 : $_POST['published'];
$entry['draft'] = 0;
if (strpos($entry['slogan'], 'TCDraftPost') === 0) {
$entry['slogan'] = $entry['title'];
}
if (empty($suri['id'])) {
if ($id = addEntry($blogid, $entry)) {
fireEvent('AddPost', $id, $entry);
Setting::setBlogSetting('LatestEditedEntry_user' . getUserId(), $id, true);
$result = array();
$result['error'] = ($id !== false) === true ? 0 : 1;
$result['entryId'] = $id;
Respond::PrintResult($result);
exit;
}
} else {
if ($id = updateEntry($blogid, $entry, $updateDraft)) {
fireEvent('UpdatePost', $id, $entry);
Setting::setBlogSetting('LatestEditedEntry_user' . getUserId(), $suri['id'], true);
Respond::ResultPage(0);
exit;
}
}
}
Respond::ResultPage(-1);
示例11: array
$IV = array('POST' => array('visibility' => array('int', 0, 3), 'starred' => array('int', 0, 2), 'category' => array('int', 'default' => 0), 'title' => array('string'), 'content' => array('string'), 'contentformatter' => array('string'), 'contenteditor' => array('string'), 'permalink' => array('string', 'default' => ''), 'location' => array('string', 'default' => '/'), 'latitude' => array('number', 'default' => null, 'min' => -90.0, 'max' => 90.0, 'bypass' => true), 'longitude' => array('number', 'default' => null, 'min' => -180.0, 'max' => 180.0, 'bypass' => true), 'tag' => array('string', 'default' => ''), 'acceptcomment' => array(array('0', '1'), 'default' => '0'), 'accepttrackback' => array(array('0', '1'), 'default' => '0'), 'published' => array('int', 0, 'default' => 1), 'draft' => array(array('0', '1'), 'default' => '0')));
require ROOT . '/library/preprocessor.php';
importlib("model.blog.entry");
requireStrictRoute();
$entry = array();
$entry['visibility'] = $_POST['visibility'];
$entry['starred'] = $_POST['starred'];
$entry['category'] = empty($_POST['category']) ? 0 : $_POST['category'];
$entry['title'] = $_POST['title'];
if (isset($_POST['permalink']) && $_POST['permalink'] != '') {
$entry['slogan'] = $_POST['permalink'];
}
$entry['content'] = $_POST['content'];
$entry['contentformatter'] = $_POST['contentformatter'];
$entry['contenteditor'] = $_POST['contenteditor'];
$entry['location'] = empty($_POST['location']) ? '/' : $_POST['location'];
$entry['latitude'] = empty($_POST['latitude']) || $_POST['latitude'] == "null" ? null : $_POST['latitude'];
$entry['longitude'] = empty($_POST['longitude']) || $_POST['longitude'] == "null" ? null : $_POST['longitude'];
$entry['tag'] = empty($_POST['tag']) ? '' : $_POST['tag'];
$entry['acceptcomment'] = empty($_POST['acceptcomment']) ? 0 : 1;
$entry['accepttrackback'] = empty($_POST['accepttrackback']) ? 0 : 1;
$entry['published'] = empty($_POST['published']) ? 1 : $_POST['published'];
$entry['draft'] = empty($_POST['draft']) ? 0 : $_POST['draft'];
if ($id = addEntry($blogid, $entry)) {
fireEvent('AddPost', $id, $entry);
Setting::setBlogSettingGlobal('LatestEditedEntry_user' . getUserId(), $id);
}
$result = array();
$result['error'] = ($id !== false) === true ? 0 : 1;
$result['entryId'] = $id;
Respond::PrintResult($result);
示例12: define
define('__TEXTCUBE_ADMINPANEL__', true);
$IV = array('GET' => array('requestURI' => array('url', 'mandatory' => false)));
require ROOT . '/library/preprocessor.php';
global $openid_session;
global $openid_session_id;
$context = Model_Context::getInstance();
if (empty($_GET['requestURI'])) {
$requestURI = $context->getProperty('uri.blog');
} else {
$requestURI = filterJavaScript($_GET['requestURI']);
if (Acl::getIdentity('openid')) {
header("Location: {$requestURI}");
exit;
}
}
list($openid_help_link, $openid_signup_link) = fireEvent('OpenIDAffiliateLinks', $requestURI);
$img_url = $context->getProperty('uri.host') . $context->getProperty('service.path') . "/plugins/" . basename(dirname(__FILE__)) . "/login-bg.gif";
if (!empty($_COOKIE['openid'])) {
$openid_remember_check = "checked";
$cookie_openid = $_COOKIE['openid'];
} else {
$openid_remember_check = "";
$cookie_openid = '';
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><?php
echo _text('텍스트큐브') . ":" . _text('오픈아이디 인증');
示例13: updateVisitorStatistics
static function updateVisitorStatistics($blogid)
{
global $database, $blogURL;
if (!fireEvent('UpdatingVisitorStatistics', true)) {
return;
}
if (doesHaveOwnership()) {
return;
}
$id = session_id();
if (POD::queryCount("SELECT blogid FROM {$database['prefix']}SessionVisits WHERE id = '{$id}' AND address = '{$_SERVER['REMOTE_ADDR']}' AND blogid = {$blogid}") > 0) {
return;
}
if (POD::queryCount("INSERT INTO {$database['prefix']}SessionVisits values('{$id}', '{$_SERVER['REMOTE_ADDR']}', {$blogid})") > 0) {
if (POD::queryCount("UPDATE {$database['prefix']}BlogStatistics SET visits = visits + 1 WHERE blogid = {$blogid}") < 1) {
POD::execute("INSERT into {$database['prefix']}BlogStatistics values({$blogid}, 1)");
}
$period = Timestamp::getDate();
if (POD::queryCount("UPDATE {$database['prefix']}DailyStatistics SET visits = visits + 1 WHERE blogid = {$blogid} AND datemark = {$period}") < 1) {
POD::execute("INSERT INTO {$database['prefix']}DailyStatistics VALUES ({$blogid}, {$period}, 1)");
}
if (!empty($_SERVER['HTTP_REFERER'])) {
$referer = parse_url($_SERVER['HTTP_REFERER']);
if (!empty($referer['host']) && ($referer['host'] != $_SERVER['HTTP_HOST'] || strncmp($referer['path'], $blogURL, strlen($blogURL)) != 0)) {
if (Filter::isFiltered('ip', $_SERVER['REMOTE_ADDR']) || Filter::isFiltered('url', $_SERVER['HTTP_REFERER'])) {
return;
}
if (!fireEvent('AddingRefererLog', true, array('host' => $referer['host'], 'url' => $_SERVER['HTTP_REFERER']))) {
return;
}
$host = POD::escapeString(Utils_Unicode::lessenAsEncoding($referer['host'], 64));
$url = POD::escapeString(Utils_Unicode::lessenAsEncoding($_SERVER['HTTP_REFERER'], 255));
POD::query("INSERT INTO {$database['prefix']}RefererLogs values({$blogid}, '{$host}', '{$url}', UNIX_TIMESTAMP())");
// POD::query("DELETE FROM {$database['prefix']}RefererLogs WHERE referred < UNIX_TIMESTAMP() - 604800"); // Moved to trashVan
if (!POD::queryCount("UPDATE {$database['prefix']}RefererStatistics SET count = count + 1 WHERE blogid = {$blogid} AND host = '{$host}' LIMIT 1")) {
POD::execute("INSERT into {$database['prefix']}RefererStatistics values({$blogid}, '{$host}', 1)");
}
}
}
}
}
示例14: receiveNotifiedComment
function receiveNotifiedComment($post)
{
if (empty($post['mode']) || $post['mode'] != 'fb') {
return 1;
}
global $database;
CacheControl::flushCommentNotifyRSS();
$post = fireEvent('ReceiveNotifiedComment', $post);
if ($post === false) {
return 7;
}
$blogid = getBlogId();
$title = POD::escapeString(UTF8::lessenAsEncoding($post['s_home_title'], 255));
$name = POD::escapeString(UTF8::lessenAsEncoding($post['s_name'], 255));
$entryId = POD::escapeString($post['s_no']);
$homepage = POD::escapeString(UTF8::lessenAsEncoding($post['url'], 255));
$entryurl = POD::escapeString($post['s_url']);
$entrytitle = POD::escapeString($post['s_post_title']);
$parent_id = $post['r1_no'];
$parent_name = POD::escapeString(UTF8::lessenAsEncoding($post['r1_name'], 80));
$parent_parent = $post['r1_rno'];
$parent_homepage = POD::escapeString(UTF8::lessenAsEncoding($post['r1_homepage'], 80));
$parent_written = $post['r1_regdate'];
$parent_comment = POD::escapeString($post['r1_body']);
$parent_url = POD::escapeString(UTF8::lessenAsEncoding($post['r1_url'], 255));
$child_id = $post['r2_no'];
$child_name = POD::escapeString(UTF8::lessenAsEncoding($post['r2_name'], 80));
$child_parent = $post['r2_rno'];
$child_homepage = POD::escapeString(UTF8::lessenAsEncoding($post['r2_homepage'], 80));
$child_written = $post['r2_regdate'];
$child_comment = POD::escapeString($post['r2_body']);
$child_url = POD::escapeString(UTF8::lessenAsEncoding($post['r2_url'], 255));
$siteid = POD::queryCell("SELECT id FROM {$database['prefix']}CommentsNotifiedSiteInfo WHERE url = '{$homepage}'");
if (empty($siteid)) {
$insertId = getCommentsNotifiedSiteInfoMaxId() + 1;
if (POD::execute("INSERT INTO {$database['prefix']}CommentsNotifiedSiteInfo\n\t\t\t( id, title, name, url, modified)\n\t\t\tVALUES ({$insertId}, '{$title}', '{$name}', '{$homepage}', UNIX_TIMESTAMP());")) {
$siteid = $insertId;
} else {
return 2;
}
}
$parentId = POD::queryCell("SELECT id\n\t\tFROM {$database['prefix']}CommentsNotified\n\t\tWHERE entry = {$entryId}\n\t\t\tAND siteid = {$siteid}\n\t\t\tAND blogid = {$blogid}\n\t\t\tAND remoteid = {$parent_id}");
if (empty($parentId)) {
$insertId = getCommentsNotifiedMaxId() + 1;
$sql = "INSERT INTO {$database['prefix']}CommentsNotified\n\t\t\t( blogid , replier , id , entry , parent , name , password , homepage , secret , comment , ip , written, modified , siteid , isnew , url , remoteid ,entrytitle , entryurl )\n\t\t\tVALUES (\n\t\t\t\t{$blogid}, NULL , {$insertId}, " . $entryId . ", " . (empty($parent_parent) ? 'null' : $parent_parent) . ", '" . $parent_name . "', '', '" . $parent_homepage . "', '', '" . $parent_comment . "', '', " . $parent_written . ",UNIX_TIMESTAMP(), " . $siteid . ", 1, '" . $parent_url . "'," . $parent_id . ", '" . $entrytitle . "', '" . $entryurl . "'\n)";
if (!POD::execute($sql)) {
return 3;
}
$parentId = $insertId;
}
if (POD::queryCell("SELECT count(*) FROM {$database['prefix']}CommentsNotified WHERE siteid={$siteid} AND remoteid={$child_id}") > 0) {
return 4;
}
$insertId = getCommentsNotifiedMaxId() + 1;
$sql = "INSERT INTO {$database['prefix']}CommentsNotified\n\t\t( blogid , replier , id , entry , parent , name , password , homepage , secret , comment , ip , written, modified , siteid , isnew , url , remoteid ,entrytitle , entryurl )\n\t\tVALUES (\n\t\t\t{$blogid}, NULL , {$insertId}, " . $entryId . ", {$parentId}, '{$child_name}', '', '{$child_homepage}', '', '{$child_comment}', '', {$child_written}, UNIX_TIMESTAMP(), {$siteid}, 1, '{$child_url}', {$child_id}, '{$entrytitle}', '{$entryurl}')";
if (!POD::execute($sql)) {
return 5;
}
$sql = "UPDATE {$database['prefix']}CommentsNotified SET modified = UNIX_TIMESTAMP() WHERE blogid = {$blogid} AND id = {$parentId}";
if (!POD::execute($sql)) {
return 6;
}
return 0;
}
示例15: receiveNotifiedComment
function receiveNotifiedComment($post)
{
if (empty($post['mode']) || $post['mode'] != 'fb') {
return 1;
}
$context = Model_Context::getInstance();
CacheControl::flushCommentNotifyRSS();
$post = fireEvent('ReceiveNotifiedComment', $post);
if ($post === false) {
return 7;
}
$pool = DBModel::getInstance();
$blogid = getBlogId();
$title = Utils_Unicode::lessenAsEncoding($post['s_home_title'], 255);
$name = Utils_Unicode::lessenAsEncoding($post['s_name'], 255);
$entryId = $post['s_no'];
$homepage = Utils_Unicode::lessenAsEncoding($post['url'], 255);
$entryurl = $post['s_url'];
$entrytitle = $post['s_post_title'];
$parent_id = $post['r1_no'];
$parent_name = Utils_Unicode::lessenAsEncoding($post['r1_name'], 80);
$parent_parent = $post['r1_rno'];
$parent_homepage = Utils_Unicode::lessenAsEncoding($post['r1_homepage'], 80);
$parent_written = $post['r1_regdate'];
$parent_comment = $post['r1_body'];
$parent_url = Utils_Unicode::lessenAsEncoding($post['r1_url'], 255);
$child_id = $post['r2_no'];
$child_name = Utils_Unicode::lessenAsEncoding($post['r2_name'], 80);
$child_parent = $post['r2_rno'];
$child_homepage = Utils_Unicode::lessenAsEncoding($post['r2_homepage'], 80);
$child_written = $post['r2_regdate'];
$child_comment = $post['r2_body'];
$child_url = Utils_Unicode::lessenAsEncoding($post['r2_url'], 255);
$pool->reset('CommentsNotifiedSiteInfo');
$pool->setQualifier('url', 'eq', $homepage);
$siteid = $pool->getCell('id');
if (empty($siteid)) {
$insertId = getCommentsNotifiedSiteInfoMaxId() + 1;
$pool->reset('CommentsNotifiedSiteInfo');
$pool->setAttribute('id', $insertId);
$pool->setAttribute('title', $title, true);
$pool->setAttribute('name', $name, true);
$pool->setAttribute('url', $homepage, true);
$pool->setAttribute('modified', Timestamp::getUNIXtime());
if ($pool->insert()) {
$siteid = $insertId;
} else {
return 2;
}
}
$pool->reset('CommentsNotified');
$pool->setQualifier('entry', 'eq', $entryId);
$pool->setQualifier('siteid', 'eq', $siteid);
$pool->setQualifier('blogid', 'eq', $blogid);
$pool->setQualifier('remoteid', 'eq', $parent_id);
$parentId = $pool->getCell('id');
if (empty($parentId)) {
$insertId = getCommentsNotifiedMaxId() + 1;
$pool->reset('CommentsNotified');
$pool->setAttribute('blogid', $blogid);
$pool->setAttribute('replier', NULL);
$pool->setAttribute('id', $insertId);
$pool->setAttribute('entry', $entryId);
$pool->setAttribute('parent', empty($parent_parent) ? NULL : $parent_parent);
$pool->setAttribute('name', $parent_name, true);
$pool->setAttribute('password', '', true);
$pool->setAttribute('homepage', $parent_homepage, true);
$pool->setAttribute('secret', '', true);
$pool->setAttribute('comment', $parent_comment, true);
$pool->setAttribute('ip', '', true);
$pool->setAttribute('written', $parent_written, true);
$pool->setAttribute('modified', Timestamp::getUNIXtime());
$pool->setAttribute('siteid', $siteid);
$pool->setAttribute('isnew', 1);
$pool->setAttribute('url', $parent_url, true);
$pool->setAttribute('remoteid', $parent_id);
$pool->setAttribute('entrytitle', $entrytitle, true);
$pool->setAttribute('entryurl', $entryurl, true);
if (!$pool->insert()) {
return 3;
}
$parentId = $insertId;
}
$pool->reset('CommentsNotified');
$pool->setQualifier('siteid', 'eq', $siteid);
$pool->setQualifier('remoteid', 'eq', $child_id);
if ($pool->getCount() > 0) {
return 4;
}
$insertId = getCommentsNotifiedMaxId() + 1;
$pool->reset('CommentsNotified');
$pool->setAttribute('blogid', $blogid);
$pool->setAttribute('replier', NULL);
$pool->setAttribute('id', $insertId);
$pool->setAttribute('entry', $entryId);
$pool->setAttribute('parent', $parentId);
$pool->setAttribute('name', $child_name, true);
$pool->setAttribute('password', '', true);
$pool->setAttribute('homepage', $child_homepage, true);
$pool->setAttribute('secret', '', true);
//.........这里部分代码省略.........