本文整理汇总了PHP中CKunenaLink::GetViewLink方法的典型用法代码示例。如果您正苦于以下问题:PHP CKunenaLink::GetViewLink方法的具体用法?PHP CKunenaLink::GetViewLink怎么用?PHP CKunenaLink::GetViewLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CKunenaLink
的用法示例。
在下文中一共展示了CKunenaLink::GetViewLink方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUserLink
/**
* adds the link for the connect param
* @since 1.7.3
* @param $user pass-by-reference
* @return void
*/
private function getUserLink(&$user)
{
$username = KunenaFactory::getUser($user['userid'])->getName();
if ($user['leapcorrection'] == $this->timeo->format('z', true) + 1) {
$subject = getSubject($username);
$db = JFactory::getDBO();
$query = "SELECT id,catid,subject,time as year FROM #__kunena_messages WHERE subject='{$subject}'";
$db->setQuery($query, 0, 1);
$post = $db->loadAssoc();
if ($db->getErrorMsg()) {
KunenaError::checkDatabaseError();
}
$catid = $this->params->get('bcatid');
$postyear = new JDate($post['year'], $this->soffset);
if (empty($post) && !empty($catid) || !empty($post) && !empty($catid) && $postyear->format('Y', true) < $this->timeo->format('Y', true)) {
$botname = $this->params->get('swkbbotname', JText::_('SW_KBIRTHDAY_FORUMPOST_BOTNAME_DEF'));
$botid = $this->params->get('swkbotid');
$time = CKunenaTimeformat::internalTime();
//Insert the birthday thread into DB
$query = "INSERT INTO #__kunena_messages (catid,name,userid,email,subject,time, ip)\n\t\t \t\tVALUES({$catid},'{$botname}',{$botid}, '','{$subject}', {$time}, '')";
$db->setQuery($query);
$db->query();
if ($db->getErrorMsg()) {
KunenaError::checkDatabaseError();
}
//What ID get our thread?
$messid = (int) $db->insertID();
//Insert the thread message into DB
$message = getMessage($username);
$query = "INSERT INTO #__kunena_messages_text (mesid,message)\n VALUES({$messid},'{$message}')";
$db->setQuery($query);
$db->query();
if ($db->getErrorMsg()) {
KunenaError::checkDatabaseError();
}
//We know the thread ID so we can update the parent thread id with it's own ID because we know it's
//the first post
$query = "UPDATE #__kunena_messages SET thread={$messid} WHERE id={$messid}";
$db->setQuery($query);
$db->query();
if ($db->getErrorMsg()) {
KunenaError::checkDatabaseError();
}
// now increase the #s in categories
CKunenaTools::modifyCategoryStats($messid, 0, $time, $catid);
$user['link'] = CKunenaLink::GetViewLink('view', $messid, $catid, '', $username);
$uri = JFactory::getURI();
if ($uri->getVar('option') == 'com_kunena') {
$app =& JFactory::getApplication();
$app->redirect($uri->toString());
}
} elseif (!empty($post)) {
$user['link'] = CKunenaLink::GetViewLink('view', $post['id'], $post['catid'], '', $username);
}
} else {
$user['link'] = CKunenaLink::GetProfileLink($user['userid']);
}
}