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


PHP Comments::get_comment方法代码示例

本文整理汇总了PHP中Comments::get_comment方法的典型用法代码示例。如果您正苦于以下问题:PHP Comments::get_comment方法的具体用法?PHP Comments::get_comment怎么用?PHP Comments::get_comment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Comments的用法示例。


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

示例1: foreach

 function action_toggle($input)
 {
     global $user, $tikilib, $prefs, $artlib;
     if (!$user) {
         throw new Services_Exception(tr('Must be authenticated'), 403);
     }
     $type = $input->type->none();
     $object = $input->object->none();
     $target = $input->target->int();
     if (!$type || !$object) {
         throw new Services_Exception(tr('Invalid input'), 400);
     }
     $relationlib = TikiLib::lib('relation');
     $relations = $this->action_list($input);
     if ($target) {
         if (!in_array("{$type}:{$object}", $relations) && ($relationId = $relationlib->add_relation('tiki.user.favorite', 'user', $user, $type, $object))) {
             $relations[$relationId] = "{$type}:{$object}";
             TikiLib::lib('tiki')->refresh_index($type, $object);
         }
     } else {
         foreach ($relations as $id => $key) {
             if ($key === "{$type}:{$object}") {
                 $relationlib->remove_relation($id);
                 unset($relations[$id]);
                 TikiLib::lib('tiki')->refresh_index($type, $object);
             }
         }
     }
     if ($prefs['feature_score'] == 'y' && $target) {
         if ($type == 'forum post') {
             require_once 'lib/comments/commentslib.php';
             $commentslib = new Comments();
             $forum_id = $commentslib->get_comment_forum_id($object);
             $forum_info = $commentslib->get_forum($forum_id);
             $thread_info = $commentslib->get_comment($object, null, $forum_info);
             $item_user = $thread_info['userName'];
         } elseif ($type == 'article') {
             require_once 'lib/articles/artlib.php';
             $artlib = new ArtLib();
             $res = $artlib->get_article($object);
             $item_user = $res['author'];
         }
         $tikilib->score_event($user, 'item_favorited', "{$type}:{$object}");
         $tikilib->score_event($item_user, 'item_is_favorited', "{$user}:{$type}:{$object}");
     }
     return array('list' => $relations);
 }
开发者ID:hurcane,项目名称:tiki-azure,代码行数:47,代码来源:Controller.php

示例2: tra

 if (isset($forum_mode) && $forum_mode == 'y' && $forum_info['is_flat'] == 'y' && $_REQUEST["comments_grandParentId"] > 0) {
     $smarty->assign('msg', tra("This forum is flat and doesn't allow replies to other replies"));
     $smarty->display("error.tpl");
     die;
 }
 if (empty($_REQUEST["comments_parentId"])) {
     $_REQUEST["comments_parentId"] = 0;
 }
 $object = explode(':', $comments_objectId);
 if ($object[0] == 'forum' && !empty($_REQUEST["comments_grandParentId"])) {
     $parent_id = $_REQUEST["comments_grandParentId"];
 } else {
     $parent_id = $_REQUEST["comments_parentId"];
 }
 if (isset($_REQUEST["comments_reply_threadId"]) && !empty($_REQUEST["comments_reply_threadId"])) {
     $reply_info = $commentslib->get_comment($_REQUEST["comments_reply_threadId"]);
     $in_reply_to = $reply_info["message_id"];
 } else {
     $in_reply_to = '';
 }
 // Remove HTML tags and empty lines at the end of the posted comment
 $_REQUEST["comments_data"] = rtrim(strip_tags($_REQUEST["comments_data"]));
 if ($tiki_p_forum_autoapp != 'y' && ($forum_info['approval_type'] == 'queue_all' || !$user && $forum_info['approval_type'] == 'queue_anon')) {
     $smarty->assign('was_queued', 'y');
     $_REQUEST['was_queued'] = 'y';
     $qId = $commentslib->replace_queue(0, $_REQUEST['forumId'], $comments_objectId, $parent_id, $user, $_REQUEST["comments_title"], $_REQUEST["comments_data"], 'n', '', '', $thread_info['title'], $in_reply_to);
     // PROCESS ATTACHMENT HERE
     if ($qId && isset($_FILES['userfile1']) && !empty($_FILES['userfile1']['name'])) {
         if (is_uploaded_file($_FILES['userfile1']['tmp_name'])) {
             check_ticket('view-forum');
             $fp = fopen($_FILES['userfile1']['tmp_name'], "rb");
开发者ID:Kraiany,项目名称:kraiany_site_docker,代码行数:31,代码来源:comments.php

示例3: tra

	) {
		$access->check_authenticity();
		$comments_show = 'y';
		$commentslib->remove_comment($_REQUEST['comments_threadId']);
		$commentslib->register_remove_post($_REQUEST['forumId'], 0);
	} else { // user can't edit this post
		$smarty->assign('msg', tra('You are not permitted to remove someone else\'s post!'));
		$smarty->assign('errortype', 'no_redirect_login');
		$smarty->display('error.tpl');
		die;
	}
	unset($_REQUEST['comments_threadId']);
}

if ($_REQUEST['comments_threadId'] > 0) {
	$comment_info = $commentslib->get_comment($_REQUEST['comments_threadId']);
	$smarty->assign('comment_title', isset($_REQUEST['comments_title']) ? $_REQUEST['comments_title'] : $comment_info['title']);
	$smarty->assign('comment_data', isset($_REQUEST['comments_data']) ? $_REQUEST['comments_data'] : $comment_info['data']);
	$smarty->assign(
					'comment_topictype', 
					isset($_REQUEST['comment_topictype']) ? $_REQUEST['comment_topictype'] : $comment_info['type']
	);
	$smarty->assign(
					'comment_topicsummary', 
					isset($_REQUEST['comment_topicsummary']) ? $_REQUEST['comment_topicsummary'] : $comment_info['summary']
	);
	$smarty->assign('comment_topicsmiley', $comment_info['smiley']);
} else {
	$smarty->assign('comment_title', isset($_REQUEST['comments_title']) ? $_REQUEST['comments_title'] : '');
	$smarty->assign('comment_data', isset($_REQUEST['comments_data']) ? $_REQUEST['comments_data'] : '');
	$smarty->assign('comment_topictype', isset($_REQUEST['comment_topictype']) ? $_REQUEST['comment_topictype'] : '');
开发者ID:railfuture,项目名称:tiki-website,代码行数:31,代码来源:tiki-view_forum.php

示例4: tr

if (!empty($_REQUEST['mass_ban_ip'])) {
	check_ticket('admin-banning');
	include_once ('lib/comments/commentslib.php');
	$commentslib = new Comments;
	$smarty->assign('mass_ban_ip', $_REQUEST['mass_ban_ip']);
	$info['mode'] = 'mass_ban_ip';
	$info['title'] = tr('Multiple IP Banning');
	$info['message'] = tr('Access from your localization was forbidden due to excessive spamming.');
	$info['date_to'] = $tikilib->now + 365 * 24 * 3600;
	$banId_list = explode('|', $_REQUEST['mass_ban_ip']);
	// Handle case when coming from tiki-list_comments with a list of IPs to ban and also delete the related comments
	if ( !empty($_REQUEST['mass_remove']) ) {
		$access->check_authenticity(tra('Delete comments then set banning rules'));
	}
	foreach ($banId_list as $id) {
		$ban_comment=$commentslib->get_comment($id);
		$ban_comments_list[$ban_comment['user_ip']][$id]['userName'] = $ban_comment['userName'];
		$ban_comments_list[$ban_comment['user_ip']][$id]['title'] = $ban_comment['title'];
		if ( !empty($_REQUEST['mass_remove']) ) {
			$commentslib->remove_comment($id);
		}
	}
	$smarty->assign_by_ref('ban_comments_list', $ban_comments_list);
}

// Handle case when coming from tiki-admin_actionlog with a list of IPs to ban
if (!empty($_REQUEST['mass_ban_ip_actionlog'])) {
	check_ticket('admin-banning');
	include_once ('lib/logs/logslib.php');
	$actionslib = new LogsLib;
	$smarty->assign('mass_ban_ip', $_REQUEST['mass_ban_ip_actionlog']);
开发者ID:railfuture,项目名称:tiki-website,代码行数:31,代码来源:tiki-admin_banning.php

示例5: unset

         $_REQUEST['topic_smiley'] = '';
     }
     if (!isset($_REQUEST['type'])) {
         $_REQUEST['type'] = '';
     }
     if (!isset($_REQUEST['topic_title'])) {
         $_REQUEST['topic_title'] = '';
     }
     if (!isset($_REQUEST['in_reply_to'])) {
         $_REQUEST['in_reply_to'] = '';
     }
     if (!isset($_REQUEST['parentId'])) {
         $_REQUEST['parentId'] = $msg_info['parentId'];
     }
     if ($_REQUEST['parentId'] > 0) {
         $p_info = $commentslib->get_comment($_REQUEST['parentId']);
         $_REQUEST['topic_title'] = $p_info['title'];
     }
     $commentslib->replace_queue($_REQUEST['qId'], $_REQUEST['forumId'], 'forum' . $_REQUEST['forumId'], $_REQUEST['parentId'], $user, $_REQUEST['title'], $_REQUEST['data'], $_REQUEST['type'], $_REQUEST['topic_smiley'], $_REQUEST['summary'], $_REQUEST['topic_title'], $_REQUEST['in_reply_to']);
     if (isset($_REQUEST['saveapp'])) {
         $commentslib->approve_queued($_REQUEST['qId']);
     }
     unset($_REQUEST['qId']);
 }
 if (isset($_REQUEST['remove'])) {
     $access->check_authenticity();
     $smarty->assign('form', 'n');
     $commentslib->remove_queued($_REQUEST['qId']);
 }
 if (isset($_REQUEST['topicize'])) {
     check_ticket('forum-queue');
开发者ID:hurcane,项目名称:tiki-azure,代码行数:31,代码来源:tiki-forum_queue.php

示例6: isset

 function create_page($info)
 {
     global $tikilib, $wikilib, $prefs, $tiki_p_wiki_attach_files, $tiki_p_edit_comments, $dbTiki, $tikidomain;
     if (($info['data'] = $this->zip->getFromName($info['zip'])) === false) {
         $this->errors[] = 'Can not unzip';
         $this->errorsArgs[] = $info['zip'];
         return false;
     }
     if ($this->page_exists($info['name'])) {
         $old = true;
         $tikilib->update_page($info['name'], $info['data'], 'Updated from import', !empty($this->config['fromUser']) ? $this->config['fromUser'] : $info['user'], !empty($this->config['fromSite']) ? $this->config['fromSite'] : $info['ip'], $info['description'], 0, isset($info['lang']) ? $info['lang'] : '', isset($info['is_html']) ? $info['is_html'] : false, null, null, isset($info['wysiwyg']) ? $info['wysiwyg'] : NULL);
     } else {
         $old = false;
         $tikilib->create_page($info['name'], $info['hits'], $info['data'], $info['lastModif'], $info['comment'], !empty($this->config['fromUser']) ? $this->config['fromUser'] : $info['user'], !empty($this->config['fromSite']) ? $this->config['fromSite'] : $info['ip'], $info['description'], isset($info['lang']) ? $info['lang'] : '', isset($info['is_html']) ? $info['is_html'] : false, null, isset($info['wysiwyg']) ? $info['wysiwyg'] : NULL, '', 0, $info['created']);
     }
     if ($prefs['feature_wiki_comments'] == 'y' && $tiki_p_edit_comments == 'y' && !empty($info['comments'])) {
         foreach ($info['comments'] as $comment) {
             global $commentslib;
             include_once 'lib/comments/commentslib.php';
             $commentslib = new Comments($dbTiki);
             $parentId = empty($comment['parentId']) ? 0 : $newThreadIds[$comment['parentId']];
             if ($parentId) {
                 $reply_info = $commentslib->get_comment($parentd);
                 $in_reply_to = $reply_info['message_id'];
             }
             $newThreadIds[$comment['threadId']] = $commentslib->post_new_comment('wiki page:' . $info['name'], $parentId, $config['fromUser'] ? $config['fromUser'] : $comment['user'], $comment['title'], $comment['data'], $message_id, $reply_to, 'n', '', '', '', '', $comment['date']);
         }
     }
     if ($prefs['feature_wiki_attachments'] == 'y' && $tiki_p_wiki_attach_files == 'y' && !empty($info['attachments'])) {
         foreach ($info['attachments'] as $attachment) {
             if (($attachment['data'] = $this->zip->getFromName($attachment['zip'])) === false) {
                 $this->errors[] = 'Can not unzip attachment';
                 $this->errorsArgs[] = $attachment['zip'];
                 return false;
             }
             if ($prefs['w_use_db'] == 'y') {
                 $fhash = '';
             } else {
                 $fhash = $this->get_attach_hash_file_name($attachment['filename']);
                 if ($fw = fopen($prefs['w_use_dir'] . $fhash, 'wb')) {
                     if (!fwrite($fw, $attachment['data'])) {
                         $this->errors[] = 'Cannot write to this file';
                         $this->errorsArgs[] = $prefs['w_use_dir'] . $fhash;
                     }
                     fclose($fw);
                     $attachment['data'] = '';
                 } else {
                     $this->errors[] = 'Cannot open this file';
                     $this->errorsArgs[] = $prefs['w_use_dir'] . $fhash;
                 }
             }
             global $wikilib;
             include_once 'lib/wiki/wikilib.php';
             $wikilib->wiki_attach_file($info['name'], $attachment['filename'], $attachment['filetype'], $attachment['filesize'], $attachment['data'], $attachment['comment'], $attachment['user'], $fhash, $attachment['created']);
             //change the page data attach is needed $res['attId']
             //$res = $wikilib->get_wiki_attach_file($info['name'], $attachment['filename'], $attachment['type'], $attachment['size']);
         }
     }
     if ($prefs['feature_wiki_pictures'] == 'y' && !empty($info['images'])) {
         foreach ($info['images'] as $image) {
             if (empty($image['zip'])) {
                 //external link to image
                 continue;
             }
             if (($image['data'] = $this->zip->getFromName($image['zip'])) === false) {
                 $this->errors[] = 'Can not unzip image';
                 $this->errorsArgs[] = $image['zip'];
                 return false;
             }
             if ($image['where'] == 'wiki') {
                 $wiki_up = 'img/wiki_up/';
                 if ($tikidomain) {
                     $wiki_up .= "{$tikidomain}/";
                 }
                 $name = str_replace('img/wiki_up/', '', $image['wiki']);
                 file_put_contents($wiki_up . $name, $image['data']);
                 chmod($wiki_up . $name, 0644);
             }
         }
     }
     if ($prefs['feature_history'] == 'y' && !empty($info['history'])) {
         $query = 'select max(`version`) from `tiki_history` where `pageName`=?';
         $maxVersion = $this->getOne($query, array($info['name']));
         if (!$maxVersion) {
             $maxVersion = 0;
         }
         $newVersion = $maxVersion;
         foreach ($info['history'] as $version) {
             if (($version['data'] = $this->zip->getFromName($version['zip'])) === false) {
                 $this->errors[] = 'Can not unzip history';
                 $this->errorsArgs[] = $version['version'];
                 return false;
             }
             $query = 'insert into `tiki_history`(`pageName`, `version`, `lastModif`, `user`, `ip`, `comment`, `data`, `description`) values(?,?,?,?,?,?,?,?)';
             $this->query($query, array($info['name'], $version['version'] + $maxVersion, $old ? $tikilib->now : $version['lastModif'], $version['user'], $version['ip'], $version['comment'], $version['data'], $version['description']));
             $newVersion = max($version['version'] + $maxVersion, $newVersion);
         }
         $query = 'update `tiki_pages` set `version`=? where `pageName`=?';
         $this->query($query, array($newVersion, $info['name']));
     }
//.........这里部分代码省略.........
开发者ID:hurcane,项目名称:tiki-azure,代码行数:101,代码来源:xmllib.php

示例7: smarty_function_rating

function smarty_function_rating($params, $smarty)
{
    global $prefs, $ratinglib;
    require_once 'lib/rating/ratinglib.php';
    if (!isset($params['type'], $params['id'])) {
        return tra('No object information provided for rating.');
    }
    $type = $params['type'];
    $id = $params['id'];
    if (isset($params['changemandated']) && $params['changemandated'] == 'y') {
        $changemandated = true;
        // needed to fix multiple submission problem in comments
    } else {
        $changemandated = false;
    }
    if (isset($_REQUEST['rating_value'][$type][$id], $_REQUEST['rating_prev'][$type][$id])) {
        $value = $_REQUEST['rating_value'][$type][$id];
        $prev = $_REQUEST['rating_prev'][$type][$id];
        if ((!$changemandated || $value != $prev) && $ratinglib->record_vote($type, $id, $value)) {
            // Handle type-specific actions
            if ($type == 'comment') {
                global $user;
                require_once 'lib/comments/commentslib.php';
                if ($user) {
                    $commentslib = new Comments();
                    $commentslib->vote_comment($id, $user, $value);
                }
            } elseif ($type == 'article') {
                global $artlib, $user;
                require_once 'lib/articles/artlib.php';
                if ($user) {
                    $artlib->vote_comment($id, $user, $value);
                }
            }
            if ($prefs['feature_score'] == 'y' && $id) {
                global $tikilib;
                if ($type == 'comment') {
                    $forum_id = $commentslib->get_comment_forum_id($id);
                    $forum_info = $commentslib->get_forum($forum_id);
                    $thread_info = $commentslib->get_comment($id, null, $forum_info);
                    $item_user = $thread_info['userName'];
                } elseif ($type == 'article') {
                    require_once 'lib/articles/artlib.php';
                    $artlib = new ArtLib();
                    $res = $artlib->get_article($id);
                    $item_user = $res['author'];
                }
                if ($value == '1') {
                    $tikilib->score_event($item_user, 'item_is_rated', "{$user}:{$type}:{$id}");
                } elseif ($value == '2') {
                    $tikilib->score_event($item_user, 'item_is_unrated', "{$user}:{$type}:{$id}");
                }
            }
        } elseif ($value != $prev) {
            return tra('An error occurred.');
        }
    }
    $vote = $ratinglib->get_vote($type, $id);
    $options = $ratinglib->get_options($type, $id);
    if ($prefs['rating_smileys'] == 'y') {
        $smiles = $ratinglib->get_options_smiles($type, $id);
        $smarty->assign('rating_smiles', $smiles);
    }
    $smarty->assign('rating_type', $type);
    $smarty->assign('rating_id', $id);
    $smarty->assign('rating_options', $options);
    $smarty->assign('current_rating', $vote);
    return $smarty->fetch('rating.tpl');
}
开发者ID:hurcane,项目名称:tiki-azure,代码行数:69,代码来源:function.rating.php

示例8: header

        }
    }
}
if ($tiki_p_forums_report == 'y' && isset($_REQUEST['report'])) {
    check_ticket('view-forum');
    $commentslib->report_post($_REQUEST['forumId'], $_REQUEST['comments_parentId'], $_REQUEST['report'], $user, '');
    $url = "tiki-view_forum_thread.php?forumId=" . $_REQUEST['forumId'] . "&comments_parentId=" . $_REQUEST['comments_parentId'] . "&post_reported=y";
    header('location: ' . $url);
    die;
}
//shows a "thanks for reporting" message
if (isset($_REQUEST["post_reported"]) && $_REQUEST["post_reported"] == 'y') {
    $smarty->assign('post_reported', 'y');
}
$smarty->assign_by_ref('forum_info', $forum_info);
$thread_info = $commentslib->get_comment($_REQUEST["comments_parentId"]);
if (empty($thread_info)) {
    $smarty->assign('msg', tra("Incorrect thread"));
    $smarty->display("error.tpl");
    die;
}
if (!empty($thread_info['parentId'])) {
    $thread_info['topic'] = $commentslib->get_comment($thread_info['parentId']);
}
if ($tiki_p_admin_forum != 'y' && $thread_info['type'] == 'l') {
    $tiki_p_forum_post = 'n';
    $smarty->assign('tiki_p_forum_post', 'n');
}
//print_r($thread_info);
$smarty->assign_by_ref('thread_info', $thread_info);
$comments_per_page = $forum_info['commentsPerPage'];
开发者ID:Kraiany,项目名称:kraiany_site_docker,代码行数:31,代码来源:tiki-view_forum_thread.php

示例9: isset

        check_ticket('view-forum');
        $comments_show = 'y';
        if (!$tikilib->user_has_voted($user, 'comment' . $_REQUEST["comments_threadId"])) {
            $commentslib->vote_comment($_REQUEST["comments_threadId"], $user, $_REQUEST["comments_vote"]);
            $tikilib->register_user_vote($user, 'comment' . $_REQUEST["comments_threadId"]);
        }
        $_REQUEST["comments_threadId"] = 0;
        $smarty->assign('comments_threadId', 0);
    }
}
if ($user) {
    $userinfo = $userlib->get_user_info($user);
    $smarty->assign_by_ref('userinfo', $userinfo);
}
if ($_REQUEST["comments_threadId"] > 0) {
    $comment_info = $commentslib->get_comment($_REQUEST["comments_threadId"]);
    $smarty->assign('comment_title', $comment_info["title"]);
    $smarty->assign('comment_data', $comment_info["data"]);
    $smarty->assign('comment_topictype', $comment_info["type"]);
    $smarty->assign('comment_topicsummary', $comment_info["summary"]);
    $smarty->assign('comment_topicsmiley', $comment_info["smiley"]);
} else {
    $smarty->assign('comment_title', isset($_REQUEST["comments_title"]) ? $_REQUEST["comments_title"] : '');
    $smarty->assign('comment_data', isset($_REQUEST["comments_data"]) ? $_REQUEST["comments_data"] : '');
    $smarty->assign('comment_topictype', isset($_REQUEST["comment_topictype"]) ? $_REQUEST["comment_topictype"] : '');
    $smarty->assign('comment_topictype', 'n');
    $smarty->assign('comment_topicsummary', '');
    $smarty->assign('comment_topicsmiley', '');
}
if (isset($_REQUEST["comments_remove"]) && isset($_REQUEST["comments_threadId"])) {
    if ($tiki_p_admin_forum == 'y' || $commentslib->user_can_edit_post($user, $_REQUEST["comments_threadId"]) && $tiki_p_forum_post_topic == 'y') {
开发者ID:noikiy,项目名称:owaspbwa,代码行数:31,代码来源:tiki-view_forum.php

示例10: trim

	function wiki_rename_page($oldName, $newName, $renameHomes = true)
	{
		global $prefs, $tikilib;
		// if page already exists, stop here
		$newName = trim($newName);
		if ($this->get_page_info($newName, false, true)) {
			// if it is a case change of same page: allow it, else stop here
			if (strcasecmp(trim($oldName), $newName) <> 0 ) throw new Exception("Page already exists", 2);
		}

		if ($this->contains_badchars($newName) && $prefs['wiki_badchar_prevent'] == 'y') {
			throw new Exception("Bad characters", 1);
		}

		$tmpName = "TmP".$newName."TmP";

		// 1st rename the page in tiki_pages, using a tmpname inbetween for
		// rename pages like ThisTestpage to ThisTestPage
		$query = 'update `tiki_pages` set `pageName`=? where `pageName`=?';
		$this->query($query, array( $tmpName, $oldName ));

		$query = 'update `tiki_pages` set `pageName`=? where `pageName`=?';
		$this->query($query, array( $newName, $tmpName ));

		// correct pageName in tiki_history, using a tmpname inbetween for
		// rename pages like ThisTestpage to ThisTestPage
		$query = 'update `tiki_history` set `pageName`=? where `pageName`=?';
		$this->query($query, array( $tmpName, $oldName ));

		$query = 'update `tiki_history` set `pageName`=? where `pageName`=?';
		$this->query($query, array( $newName, $tmpName ));

		// get pages linking to the old page
		$query = 'select `fromPage` from `tiki_links` where `toPage`=?';
		$result = $this->query($query, array( $oldName ));

		$linksToOld=array();
		while ($res = $result->fetchRow()) {
			$page = $res['fromPage'];

			$is_wiki_page = true;
			if (substr($page, 0, 11) == 'objectlink:') {
				$is_wiki_page = false;
				$objectlinkparts = explode(':', $page);
				$type = $objectlinkparts[1];
				$objectId = $objectlinkparts[2];
			}
			$linksToOld[] = $res['fromPage'];
			if ($is_wiki_page) {
				$info = $this->get_page_info($page);
				//$data=addslashes(str_replace($oldName,$newName,$info['data']));
				$data = $info['data'];
			} elseif ($type == 'forum post' || substr($type, -7) == 'comment') {
				include_once ('lib/comments/commentslib.php');
				global $dbTiki;
				$commentslib = new Comments($dbTiki);
				$comment_info = $commentslib->get_comment($objectId);
				$data = $comment_info['data'];
			}

			$quotedOldName = preg_quote($oldName, '/');
			global $semanticlib; require_once 'lib/wiki/semanticlib.php';

			foreach ( $semanticlib->getAllTokens() as $sem ) {
				$data = str_replace("($sem($oldName", "($sem($newName", $data);
			}

			if ($prefs['feature_wikiwords'] == 'y') {
				if (strstr($newName, ' '))
					$data = preg_replace("/(?<= |\n|\t|\r|\,|\;|^)$quotedOldName(?= |\n|\t|\r|\,|\;|$)/", '((' . $newName . '))', $data);
				else
					$data = preg_replace("/(?<= |\n|\t|\r|\,|\;|^)$quotedOldName(?= |\n|\t|\r|\,|\;|$)/", $newName, $data);
			}

			$data = preg_replace("/(?<=\(\()$quotedOldName(?=\)\)|\|)/i", $newName, $data);

			$quotedOldHtmlName = preg_quote(urlencode($oldName), '/');
			$htmlSearch = '/<a class="wiki" href="tiki-index\.php\?page=' . $quotedOldHtmlName . '([^"]*)"/i';
			$htmlReplace = '<a class="wiki" href="tiki-index.php?page=' . urlencode($newName) . '\\1"';
			$data = preg_replace($htmlSearch, $htmlReplace, $data);
			$htmlSearch = '/<a class="wiki" href="' . $quotedOldHtmlName . '"/i';
			$htmlReplace = '<a class="wiki" href="' . urlencode($newName) . '"';
			$data = preg_replace($htmlSearch, $htmlReplace, $data);

			$htmlWantedSearch = '/(' . $quotedOldName . ')?<a class="wiki wikinew" href="tiki-editpage\.php\?page=' . $quotedOldHtmlName . '"[^<]+<\/a>/i';
			$data = preg_replace($htmlWantedSearch, '((' . $newName . '))', $data);

			if ($is_wiki_page) {
				$query = "update `tiki_pages` set `data`=?,`page_size`=? where `pageName`=?";
				$this->query($query, array( $data,(int) strlen($data), $page));
			} elseif ($type == 'forum post' || substr($type, -7) == 'comment') {
				$query = "update `tiki_comments` set `data`=? where `threadId`=?";
				$this->query($query, array( $data, $objectId));
			}
			$this->invalidate_cache($page);
		}

		// correct toPage and fromPage in tiki_links
		// before update, manage to avoid duplicating index(es) when B is renamed to C while page(s) points to both C (not created yet) and B
		$query = 'select `fromPage` from `tiki_links` where `toPage`=?';
//.........这里部分代码省略.........
开发者ID:railfuture,项目名称:tiki-website,代码行数:101,代码来源:wikilib.php


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