本文整理汇总了PHP中KunenaError类的典型用法代码示例。如果您正苦于以下问题:PHP KunenaError类的具体用法?PHP KunenaError怎么用?PHP KunenaError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KunenaError类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: sync
function sync() {
// FIXME: remove option:
$usercache = JRequest::getBool ( 'usercache', 0 );
$useradd = JRequest::getBool ( 'useradd', 0 );
$userdel = JRequest::getBool ( 'userdel', 0 );
$userrename = JRequest::getBool ( 'userrename', 0 );
$app = JFactory::getApplication ();
$db = JFactory::getDBO ();
if (!JRequest::checkToken()) {
$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_ERROR_TOKEN' ), 'error' );
$this->setRedirect(KunenaRoute::_($this->baseurl, false));
return;
}
if ($useradd) {
$db->setQuery ( "INSERT INTO #__kunena_users (userid) SELECT a.id FROM #__users AS a LEFT JOIN #__kunena_users AS b ON b.userid=a.id WHERE b.userid IS NULL" );
$db->query ();
if (KunenaError::checkDatabaseError()) return;
$app->enqueueMessage ( JText::_('COM_KUNENA_SYNC_USERS_DO_ADD') . ' ' . $db->getAffectedRows () );
}
if ($userdel) {
$db->setQuery ( "DELETE a FROM #__kunena_users AS a LEFT JOIN #__users AS b ON a.userid=b.id WHERE b.username IS NULL" );
$db->query ();
if (KunenaError::checkDatabaseError()) return;
$app->enqueueMessage ( JText::_('COM_KUNENA_SYNC_USERS_DO_DEL') . ' ' . $db->getAffectedRows () );
}
if ($userrename) {
$model = $this->getModel('Syncusers');
$cnt = $model->KupdateNameInfo ();
$app->enqueueMessage ( JText::_('COM_KUNENA_SYNC_USERS_DO_RENAME') . " $cnt" );
}
$this->setRedirect(KunenaRoute::_($this->baseurl, false));
}
开发者ID:GoremanX,项目名称:Kunena-2.0,代码行数:35,代码来源:syncusers.php
示例2: displayAnnouncement
function displayAnnouncement($tpl = null) {
if (KunenaFactory::getConfig()->showannouncement > 0) {
$moderator = intval($this->me->isModerator('global'));
$cache = JFactory::getCache('com_kunena', 'output');
if ($cache->start("{$this->template->name}.common.announcement.{$moderator}", 'com_kunena.template')) return;
// User needs to be global moderator to edit announcements
if ($moderator) {
$this->canEdit = true;
} else {
$this->canEdit = false;
}
// FIXME: move into model
$db = JFactory::getDBO();
$query = "SELECT * FROM #__kunena_announcement WHERE published='1' ORDER BY created DESC";
$db->setQuery ( $query, 0, 1 );
$this->announcement = $db->loadObject ();
if (KunenaError::checkDatabaseError()) return;
if ($this->announcement) {
$this->annTitle = KunenaHtmlParser::parseText($this->announcement->title);
$this->annDescription = $this->announcement->sdescription ? KunenaHtmlParser::parseBBCode($this->announcement->sdescription) : KunenaHtmlParser::parseBBCode($this->announcement->description, 300);
$this->annDate = KunenaDate::getInstance($this->announcement->created);
$this->annListURL = KunenaRoute::_("index.php?option=com_kunena&view=announcement&layout=list");
$this->annMoreURL = !empty($this->announcement->description) ? KunenaRoute::_("index.php?option=com_kunena&view=announcement&id={$this->announcement->id}") : null;
$result = $this->loadTemplate($tpl);
if (JError::isError($result)) {
return $result;
}
echo $result;
} else {
echo ' ';
}
$cache->end();
} else echo ' ';
}
开发者ID:rich20,项目名称:Kunena,代码行数:35,代码来源:view.html.php
示例3: _getDefaultMenuItem
protected function _getDefaultMenuItem($menu, $active, $visited = array())
{
if (empty($active->query['defaultmenu']) || $active->id == $active->query['defaultmenu']) {
// There is no highlighted menu item
return null;
}
$item = $menu->getItem($active->query['defaultmenu']);
if (!$item) {
// Menu item points to nowhere, abort
KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_NOT_EXISTS'), 'menu');
return null;
} elseif (isset($visited[$item->id])) {
// Menu loop detected, abort
KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_LOOP'), 'menu');
return null;
} elseif (empty($item->component) || $item->component != 'com_kunena' || !isset($item->query['view'])) {
// Menu item doesn't point to Kunena, abort
KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_NOT_KUNENA'), 'menu');
return null;
} elseif ($item->query['view'] == 'home') {
// Menu item is pointing to another Home Page, try to find default menu item from there
$visited[$item->id] = 1;
$item = $this->_getDefaultMenuItem($menu, $item->query['defaultmenu'], $visited);
}
return $item;
}
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:26,代码来源:home.php
示例4: setUpBeforeClass
/**
* Sets up the fixture.
*/
public static function setUpBeforeClass()
{
$queries[] = "TRUNCATE TABLE #__kunena_categories";
$queries[] = "TRUNCATE TABLE #__kunena_topics";
$queries[] = "TRUNCATE TABLE #__kunena_messages";
$queries[] = "TRUNCATE TABLE #__kunena_messages_text";
$queries[] = "TRUNCATE TABLE #__kunena_users";
$queries[] = "TRUNCATE TABLE #__kunena_users_banned";
$queries[] = "TRUNCATE TABLE #__kunena_user_categories";
$queries[] = "TRUNCATE TABLE #__kunena_user_read";
$queries[] = "TRUNCATE TABLE #__kunena_user_topics";
$queries[] = "TRUNCATE TABLE #__kunena_thankyou";
$queries[] = "TRUNCATE TABLE #__kunena_keywords";
$queries[] = "TRUNCATE TABLE #__kunena_keywords_map";
$queries[] = "TRUNCATE TABLE #__kunena_polls_users";
$queries[] = "TRUNCATE TABLE #__kunena_polls_options";
$queries[] = "TRUNCATE TABLE #__kunena_polls";
$queries[] = "TRUNCATE TABLE #__kunena_sessions";
$db = JFactory::getDBO();
foreach ($queries as $query) {
$db->setQuery($query);
$db->query();
KunenaError::checkDatabaseError();
}
KunenaFactory::loadLanguage();
KunenaFactory::getUser(42)->save();
}
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:30,代码来源:PostingTest.php
示例5: displayListEmoji
/**
* Return JSON results of smilies available
*
* @param string $tpl
*
* @since K4.0
*
* @return void
*/
public function displayListEmoji($tpl = null)
{
$response = array();
if ($this->me->exists())
{
$search = $this->app->input->get('search');
$db = JFactory::getDBO();
$kquery = new KunenaDatabaseQuery;
$kquery->select('*')->from("{$db->qn('#__kunena_smileys')}")->where("code LIKE '%{$db->escape($search)}%' AND emoticonbar=1");
$db->setQuery($kquery);
$smileys = $db->loadObjectList();
KunenaError::checkDatabaseError();
foreach ($smileys as $smiley)
{
$emojis['key'] = $smiley->code;
$emojis['name'] = $smiley->code;
$emojis['url'] = JUri::root() . 'media/kunena/emoticons/' . $smiley->location;
$response['emojis'][] = $emojis;
}
}
// Set the MIME type and header for JSON output.
$this->document->setMimeEncoding('application/json');
JResponse::setHeader('Content-Disposition', 'attachment; filename="' . $this->getName() . '.' . $this->getLayout() . '.json"');
echo json_encode($response);
}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:40,代码来源:view.raw.php
示例6: getEmoticons
public static function getEmoticons($grayscale = false, $emoticonbar = false)
{
$db = JFactory::getDBO ();
$grayscale == true ? $column = "greylocation" : $column = "location";
$sql = "SELECT code, {$db->quoteName($column)} AS file FROM #__kunena_smileys";
if ($emoticonbar == true)
{
$sql .= " WHERE emoticonbar='1'";
}
$db->setQuery ( $sql );
$smilies = $db->loadObjectList ();
KunenaError::checkDatabaseError();
$smileyArray = array ();
$template = KunenaFactory::getTemplate();
foreach ( $smilies as $smiley )
{
// We load all smileys in array, so we can sort them
$smileyArray [$smiley->code] = JUri::root(true) .'/'. $template->getSmileyPath($smiley->file);
}
if ($emoticonbar == 0)
{
// don't sort when it's only for use in the emoticonbar
array_multisort ( array_keys ( $smileyArray ), SORT_DESC, $smileyArray );
reset ( $smileyArray );
}
return $smileyArray;
}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:32,代码来源:parser.php
示例7: getCatsDetails
public function getCatsDetails($catids)
{
$query = "SELECT * FROM #__kunena_categories WHERE id={$this->_db->Quote($catids)} AND published='1'";
$this->_db->setQuery($query);
$results = $this->_db->loadObject();
KunenaError::checkDatabaseError();
return $results;
}
开发者ID:vuchannguyen,项目名称:hoctap,代码行数:8,代码来源:kunena.pathway.class.php
示例8: _getTopHits
public function _getTopHits($limit=0) {
$db = JFactory::getDBO ();
$query = "SELECT userid AS id, profileviews AS count FROM #__alpha_userpoints WHERE a.profileviews>0 ORDER BY profileviews DESC";
$db->setQuery ( $query, 0, $limit );
$top = $db->loadObjectList ();
KunenaError::checkDatabaseError ();
return $top;
}
开发者ID:rich20,项目名称:Kunena,代码行数:8,代码来源:profile.php
示例9: 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']);
}
}
开发者ID:rich20,项目名称:mod_sw_kbirthday_J16,代码行数:64,代码来源:forum.php
示例10: loadModerators
protected function loadModerators()
{
$db = JFactory::getDBO();
$query = "SELECT u.id AS userid, m.catid\n\t\t\t\tFROM #__users AS u\n\t\t\t\tINNER JOIN #__kunena_users AS ku ON u.id=ku.userid\n\t\t\t\tLEFT JOIN #__kunena_moderation AS m ON u.id=m.userid\n\t\t\t\tLEFT JOIN #__kunena_categories AS c ON m.catid=c.id\n\t\t\t\tWHERE u.block='0' AND ku.moderator='1' AND (m.catid IS NULL OR c.moderated='1')";
$db->setQuery($query);
$list = (array) $db->loadObjectList();
KunenaError::checkDatabaseError();
return parent::loadModerators($list);
}
开发者ID:rich20,项目名称:Kunena-1.6,代码行数:9,代码来源:access.php
示例11: _getTopHits
public function _getTopHits($limit = 0)
{
$db = JFactory::getDBO();
$query = "SELECT u.id, ku.uhits AS count\n\t\t\tFROM #__kunena_users AS ku\n\t\t\tINNER JOIN #__users AS u ON u.id=ku.userid\n\t\t\tWHERE ku.uhits>0\n\t\t\tORDER BY ku.uhits DESC";
$db->setQuery($query, 0, $limit);
$top = (array) $db->loadObjectList();
KunenaError::checkDatabaseError();
return $top;
}
开发者ID:juanferden,项目名称:adoperp,代码行数:9,代码来源:profile.php
示例12: getAnnouncement
public function getAnnouncement() {
$db = JFactory::getDBO();
$query = "SELECT * FROM #__kunena_announcement WHERE published='1' ORDER BY created DESC";
$db->setQuery ( $query, 0, 1 );
$announcement = $db->loadObject ();
if (KunenaError::checkDatabaseError()) return;
return $announcement;
}
开发者ID:GoremanX,项目名称:Kunena-2.0,代码行数:9,代码来源:common.php
示例13: loadModerators
public function loadModerators() {
$db = JFactory::getDBO ();
$query = "SELECT uc.user_id AS userid, category_id AS catid
FROM #__kunena_user_categories AS uc
INNER JOIN #__users AS u ON u.id=uc.user_id AND u.block=0
WHERE uc.role=1";
$db->setQuery ( $query );
$list = (array) $db->loadObjectList ();
KunenaError::checkDatabaseError ();
return $this->storeModerators($list);
}
开发者ID:GoremanX,项目名称:Kunena-2.0,代码行数:11,代码来源:access.php
示例14: getRank
public function getRank() {
$db = JFactory::getDBO ();
if ( $this->getState('item.id') ) {
$db->setQuery ( "SELECT * FROM #__kunena_ranks WHERE rank_id = '{$this->getState('item.id')}'" );
$rankselected = $db->loadObject ();
if (KunenaError::checkDatabaseError()) return;
return $rankselected;
}
return;
}
开发者ID:rich20,项目名称:Kunena,代码行数:12,代码来源:ranks.php
示例15: _getTopHits
public function _getTopHits($limit=0) {
$db = JFactory::getDBO ();
$query = "SELECT cu.userid AS id, cu.view AS count
FROM #__community_users AS cu
INNER JOIN #__users AS u ON u.id=cu.userid
WHERE cu.view>0
ORDER BY cu.view DESC";
$db->setQuery ( $query, 0, $limit );
$top = (array) $db->loadObjectList ();
KunenaError::checkDatabaseError();
return $top;
}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:12,代码来源:profile.php
示例16: loadAllowedCategories
protected function loadAllowedCategories($userid)
{
$allowed = $this->joomlaAccess->getAllowedCategories($userid);
$db = JFactory::getDBO();
$query = "SELECT c.id FROM #__kunena_categories AS c\n\t\t\tINNER JOIN #__community_groups_members AS g ON c.accesstype='jomsocial' AND c.access=g.groupid\n\t\t\tWHERE c.published=1 AND g.approved=1 AND g.memberid={$db->quote($userid)}";
$db->setQuery($query);
$list = (array) $db->loadResultArray();
KunenaError::checkDatabaseError();
foreach ($list as $catid) {
$allowed[$catid] = $catid;
}
return $allowed;
}
开发者ID:vuchannguyen,项目名称:hoctap,代码行数:13,代码来源:access.php
示例17: getSmiley
public function getSmiley()
{
$db = JFactory::getDBO();
if ($this->getState('item.id')) {
$db->setQuery("SELECT * FROM #__kunena_smileys WHERE id = '{$this->getState('item.id')}'");
$selected = $db->loadObject();
if (KunenaError::checkDatabaseError()) {
return;
}
return $selected;
}
return null;
}
开发者ID:laiello,项目名称:senluonirvana,代码行数:13,代码来源:smilies.php
示例18: getRank
public function getRank()
{
$db = JFactory::getDBO();
$id = $this->getState($this->getName() . '.id');
if ($id) {
$db->setQuery("SELECT * FROM #__kunena_ranks WHERE rank_id={$db->quote($id)}");
$selected = $db->loadObject();
if (KunenaError::checkDatabaseError()) {
return null;
}
return $selected;
}
return null;
}
开发者ID:madcsaba,项目名称:li-de,代码行数:14,代码来源:rank.php
示例19: getProfileView
public function getProfileView($PopUserCount = 0)
{
$_db =& JFactory::getDBO();
$_config = KunenaFactory::getConfig();
$queryName = $_config->username ? "username" : "name";
if (!$PopUserCount) {
$PopUserCount = $_config->popusercount;
}
$query = "SELECT u.uhits AS hits, u.userid AS user_id, j.id, j.{$queryName} AS user FROM #__kunena_users AS u\n\t\t\t\t\tINNER JOIN #__users AS j ON j.id = u.userid\n\t\t\t\t\tWHERE u.uhits>'0' AND j.block=0 ORDER BY u.uhits DESC";
$_db->setQuery($query, 0, $PopUserCount);
$topKunenaProfileView = $_db->loadObjectList();
KunenaError::checkDatabaseError();
return $topKunenaProfileView;
}
开发者ID:vuchannguyen,项目名称:hoctap,代码行数:14,代码来源:profile.php
示例20: kUpdateNameInfo
function kUpdateNameInfo() {
$db = JFactory::getDBO();
$config = KunenaFactory::getConfig ();
$queryName = $config->username ? "username" : "name";
$query = "UPDATE #__kunena_messages AS m, #__users AS u
SET m.name = u.$queryName
WHERE m.userid = u.id";
$db->setQuery($query);
$db->query();
KunenaError::checkDatabaseError();
return $db->getAffectedRows();
}
开发者ID:rich20,项目名称:Kunena,代码行数:14,代码来源:syncusers.php
注:本文中的KunenaError类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论