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


PHP DiscussHelper::getRegistry方法代码示例

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


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

示例1: authorizeAccess

 function authorizeAccess()
 {
     $mainframe = JFactory::getApplication();
     $session = JFactory::getSession();
     $config = DiscussHelper::getConfig();
     $consumerKey = $config->get('integration_twitter_consumer_key');
     $consumerSecretKey = $config->get('integration_twitter_consumer_secret_key');
     if ($session->has('twitter_oauth_request_token', 'discuss')) {
         //$request_token		= $session->get('twitter_oauth_token', 'discuss');
         $session_request = JString::str_ireplace(',', "\r\n", $session->get('twitter_oauth_request_token', '', 'discuss'));
         $request_token = DiscussHelper::getRegistry($session_request);
         /* Create TwitteroAuth object with app key/secret and token key/secret from default phase */
         $connection = new DiscussTwitterOAuth($consumerKey, $consumerSecretKey, $request_token->get('oauth_token', ''), $request_token->get('oauth_token_secret', ''));
         /* Request access tokens from twitter */
         $access_token = $connection->getAccessToken($_REQUEST['oauth_verifier']);
         if (!empty($access_token['oauth_token']) && !empty($access_token['oauth_token_secret'])) {
             if ($session->has('twitter_oauth_access_token', 'discuss')) {
                 $session->clear('twitter_oauth_access_token', 'discuss');
             }
             $session->set('twitter_oauth_access_token', "user_id=" . $access_token["user_id"] . ",screen_name=" . $access_token["screen_name"] . ",oauth_token=" . $access_token['oauth_token'] . ",oauth_token_secret=" . $access_token['oauth_token_secret'], 'discuss');
             $status = true;
             $msg = JText::_('COM_EASYDISCUSS_TWITTER_OAUTH_SUCCESS');
         } else {
             $status = false;
             $msg = JText::_('COM_EASYDISCUSS_TWITTER_OAUTH_FAILED');
         }
     } else {
         $status = false;
         $msg = JText::_('COM_EASYDISCUSS_TWITTER_USER_NOT_FOUND');
     }
     echo "<script language=javascript>window.opener.discuss.login.twitter.signin(" . $status . ", '" . $msg . "'); self.close();</script>";
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:32,代码来源:twitter.php

示例2: getConfig

 function getConfig()
 {
     static $config = null;
     if (is_null($config)) {
         $params = $this->_getParams('config');
         $config = DiscussHelper::getRegistry($params);
     }
     return $config;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:9,代码来源:settings.php

示例3: display

 public function display($tpl = null)
 {
     // Initialise variables
     $config = DiscussHelper::getConfig();
     $id = JRequest::getInt('id');
     $profile = JTable::getInstance('Profile', 'Discuss');
     $profile->load($id);
     $userparams = DiscussHelper::getRegistry($profile->get('params'));
     $siteDetails = DiscussHelper::getRegistry($profile->get('site'));
     $avatarIntegration = $config->get('layout_avatarIntegration', 'default');
     $user = JFactory::getUser($id);
     $isNew = $user->id == 0 ? true : false;
     $badges = $profile->getBadges();
     $model = $this->getModel('Badges');
     $history = $model->getBadgesHistory($profile->id);
     $params = $user->getParameters(true);
     // Badge id's that are assigned to the user.
     $badgeIds = '';
     for ($i = 0; $i < count($badges); $i++) {
         $badgeIds .= $badges[$i]->id;
         if (next($badges) !== false) {
             $badgeIds .= ',';
         }
         $badgeUser = DiscussHelper::getTable('BadgesUsers');
         $badgeUser->loadByUser($id, $badges[$i]->id);
         $badges[$i]->reference_id = $badgeUser->id;
         $badges[$i]->custom = $badgeUser->custom;
     }
     $this->assign('badgeIds', $badgeIds);
     $this->assignRef('badges', $badges);
     $this->assignRef('history', $history);
     $this->assignRef('config', $config);
     $this->assignRef('profile', $profile);
     $this->assignRef('user', $user);
     $this->assignRef('isNew', $isNew);
     $this->assignRef('params', $params);
     $this->assignRef('avatarIntegration', $avatarIntegration);
     $this->assignRef('userparams', $userparams);
     $this->assignRef('siteDetails', $siteDetails);
     parent::display($tpl);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:41,代码来源:view.html.php

示例4: display

 public function display($tpl = null)
 {
     // Initialise variables
     $doc = JFactory::getDocument();
     $my = JFactory::getUser();
     $config = DiscussHelper::getConfig();
     $app = JFactory::getApplication();
     $registry = DiscussHelper::getRegistry();
     $categoryId = JRequest::getInt('category_id', 0);
     // Perform redirection if there is a category_id in the index view.
     if (!empty($categoryId)) {
         $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=categories&layout=listings&category_id=' . $categoryId, false));
         $app->close();
     }
     // Try to detect if there's any category id being set in the menu parameter.
     $activeMenu = $app->getMenu()->getActive();
     if ($activeMenu && !$categoryId) {
         // Load menu params to the registry.
         $registry->loadString($activeMenu->params);
         if ($registry->get('category_id')) {
             $categoryId = $registry->get('category_id');
         }
     }
     // Get the current logged in user's access.
     $acl = DiscussHelper::getHelper('ACL');
     // Todo: Perhaps we should fix the confused naming of filter and sort to type and sort
     $filter = JRequest::getString('filter', $registry->get('filter'));
     $sort = JRequest::getString('sort', $registry->get('sort'));
     // Get the pagination limit
     $limit = $registry->get('limit');
     $limit = $limit == '-2' ? DiscussHelper::getListLimit() : $limit;
     $limit = $limit == '-1' ? DiscussHelper::getJConfig()->get('list_limit') : $limit;
     // Add view to this page.
     $this->logView();
     // set page title.
     DiscussHelper::setPageTitle();
     // Set the meta of the page.
     DiscussHelper::setMeta();
     // Add rss feed into headers
     DiscussHelper::getHelper('Feeds')->addHeaders('index.php?option=com_easydiscuss&view=index');
     // Get list of categories on the site.
     $catModel = $this->getModel('Categories');
     // Pagination is by default disabled.
     $pagination = false;
     // Get the model.
     $postModel = DiscussHelper::getModel('Posts');
     // Get a list of accessible categories
     $cats = $this->getAccessibleCategories($categoryId);
     // Get featured posts from this particular category.
     $featured = array();
     if ($config->get('layout_featuredpost_frontpage')) {
         $options = array('pagination' => false, 'category' => $cats, 'sort' => $sort, 'filter' => $filter, 'limit' => $config->get('layout_featuredpost_limit', $limit), 'featured' => true);
         $featured = $postModel->getDiscussions($options);
         if (is_null($featured)) {
             $featured = array();
         }
     }
     // Get normal discussion posts.
     $options = array('sort' => $sort, 'category' => $cats, 'filter' => $filter, 'limit' => $limit, 'featured' => false);
     $posts = $postModel->getDiscussions($options);
     if (is_null($posts)) {
         $posts = array();
     }
     $authorIds = array();
     $topicIds = array();
     $tmpPostsArr = array_merge($featured, $posts);
     if (count($tmpPostsArr) > 0) {
         foreach ($tmpPostsArr as $tmpArr) {
             $authorIds[] = $tmpArr->user_id;
             $topicIds[] = $tmpArr->id;
         }
     }
     $pagination = $postModel->getPagination(0, 'latest', '', $cats, false);
     $postLoader = EDC::getTable('Posts');
     $postLoader->loadBatch($topicIds);
     $postTagsModel = EDC::getModel('PostsTags');
     $postTagsModel->setPostTagsBatch($topicIds);
     $model = EDC::getModel('Posts');
     $lastReplyUser = $model->setLastReplyBatch($topicIds);
     // Reduce SQL queries by pre-loading all author object.
     $authorIds = array_merge($lastReplyUser, $authorIds);
     $authorIds = array_unique($authorIds);
     // Initialize the list of user's so we run lesser sql queries.
     $profile = EDC::getTable('Profile');
     $profile->init($authorIds);
     // Format featured entries.
     $featured = EDC::formatPost($featured, false, true);
     // Format normal entries
     $posts = EDC::formatPost($posts, false, true);
     // Get unread count
     $unreadCount = $model->getUnreadCount($cats, false);
     // Get unresolved count
     // Change the "all" to TRUE or FALSE to include/exclude featured post count
     $unresolvedCount = $model->getUnresolvedCount('', $cats, '', 'all');
     // Get resolved count
     $resolvedCount = $model->getTotalResolved();
     // Get unanswered count
     $unansweredCount = EDC::getUnansweredCount($cats, true);
     // Get assigned post count that isn't answered yet.
     $assignedCount = 0;
//.........这里部分代码省略.........
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:101,代码来源:view.html.php

示例5: apply


//.........这里部分代码省略.........
     if (DiscussHelper::getJoomlaVersion() <= '1.5') {
         // If updating self, load the new user object into the session
         if ($user->get('id') == $my->get('id')) {
             // Get an ACL object
             $acl = JFactory::getACL();
             // Get the user group from the ACL
             $grp = $acl->getAroGroup($user->get('id'));
             // Mark the user as logged in
             $user->set('guest', 0);
             $user->set('aid', 1);
             // Fudge Authors, Editors, Publishers and Super Administrators into the special access group
             if ($acl->is_group_child_of($grp->name, 'Registered') || $acl->is_group_child_of($grp->name, 'Public Backend')) {
                 $user->set('aid', 2);
             }
             // Set the usertype based on the ACL group name
             $user->set('usertype', $grp->name);
             $session = JFactory::getSession();
             $session->set('user', $user);
         }
     }
     $post = JRequest::get('post');
     if ($isNew) {
         // if this is a new account, we unset the id so
         // that profile jtable will add new record properly.
         unset($post['id']);
     }
     $profile = DiscussHelper::getTable('Profile');
     $profile->load($user->id);
     $profile->bind($post);
     $file = JRequest::getVar('Filedata', '', 'Files', 'array');
     if (!empty($file['name'])) {
         $newAvatar = DiscussHelper::uploadAvatar($profile, true);
         $profile->avatar = $newAvatar;
     }
     //save params
     $userparams = DiscussHelper::getRegistry('');
     if (isset($post['facebook'])) {
         $userparams->set('facebook', $post['facebook']);
     }
     if (isset($post['show_facebook'])) {
         $userparams->set('show_facebook', $post['show_facebook']);
     }
     if (isset($post['twitter'])) {
         $userparams->set('twitter', $post['twitter']);
     }
     if (isset($post['show_twitter'])) {
         $userparams->set('show_twitter', $post['show_twitter']);
     }
     if (isset($post['linkedin'])) {
         $userparams->set('linkedin', $post['linkedin']);
     }
     if (isset($post['show_linkedin'])) {
         $userparams->set('show_linkedin', $post['show_linkedin']);
     }
     if (isset($post['skype'])) {
         $userparams->set('skype', $post['skype']);
     }
     if (isset($post['show_skype'])) {
         $userparams->set('show_skype', $post['show_skype']);
     }
     if (isset($post['website'])) {
         $userparams->set('website', $post['website']);
     }
     if (isset($post['show_website'])) {
         $userparams->set('show_website', $post['show_website']);
     }
     $profile->params = $userparams->toString();
     // Save site details
     $siteDetails = DiscussHelper::getRegistry('');
     if (isset($post['siteUrl'])) {
         $siteDetails->set('siteUrl', $post['siteUrl']);
     }
     if (isset($post['siteUsername'])) {
         $siteDetails->set('siteUsername', $post['siteUsername']);
     }
     if (isset($post['sitePassword'])) {
         $siteDetails->set('sitePassword', $post['sitePassword']);
     }
     if (isset($post['ftpUrl'])) {
         $siteDetails->set('ftpUrl', $post['ftpUrl']);
     }
     if (isset($post['ftpUsername'])) {
         $siteDetails->set('ftpUsername', $post['ftpUsername']);
     }
     if (isset($post['ftpPassword'])) {
         $siteDetails->set('ftpPassword', $post['ftpPassword']);
     }
     if (isset($post['optional'])) {
         $siteDetails->set('optional', $post['optional']);
     }
     $profile->site = $siteDetails->toString();
     $profile->store();
     // Update points
     DiscussHelper::getHelper('ranks')->assignRank($profile->id, 'points');
     $app = JFactory::getApplication();
     $task = $this->getTask();
     $url = $task == 'apply' ? 'index.php?option=com_easydiscuss&view=user&id=' . $profile->id : 'index.php?option=com_easydiscuss&view=users';
     DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_USER_INFORMATION_SAVED'), DISCUSS_QUEUE_SUCCESS);
     $app->redirect($url);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:101,代码来源:user.php

示例6: defined

/**
 * @package		EasyDiscuss
 * @copyright	Copyright (C) 2010 Stack Ideas Private Limited. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
 *
 * EasyDiscuss is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * See COPYRIGHT.php for copyright notices and details.
 */
defined('_JEXEC') or die('Restricted access');
$profile = JTable::getInstance('Profile', 'Discuss');
$profile->load($post->user_id);
$siteDetails = DiscussHelper::getRegistry($profile->get('site'));
$siteUrl = $siteDetails->get('siteUrl');
$siteusername = $siteDetails->get('siteUsername');
$password = $siteDetails->get('sitePassword');
$ftpurl = $siteDetails->get('ftpUrl');
$ftpusername = $siteDetails->get('ftpUsername');
$ftppassword = $siteDetails->get('ftpPassword');
$siteinfo = $siteDetails->get('optional');
$showProfileDetails = true;
if (empty($siteUrl) && empty($siteusername) && empty($password) && empty($ftpurl) && empty($ftpusername) && empty($ftppassword)) {
    $showProfileDetails = false;
}
$access = trim($system->config->get('tab_site_access'));
// Nobody can view this if access is not set yet.
if (!$access) {
    return;
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:30,代码来源:field.output.site.php

示例7: listings

 /**
  * Displays a list of recent discussions from a particular category.
  *
  * @since	3.0
  * @access	public
  */
 public function listings()
 {
     // Initialise variables
     $doc = JFactory::getDocument();
     $my = JFactory::getUser();
     $config = DiscussHelper::getConfig();
     $app = JFactory::getApplication();
     $registry = DiscussHelper::getRegistry();
     $categoryId = JRequest::getInt('category_id', 0);
     // Try to detect if there's any category id being set in the menu parameter.
     $activeMenu = $app->getMenu()->getActive();
     if ($activeMenu) {
         // Load menu params to the registry.
         $registry->loadString($activeMenu->params);
         // Set the active category id if exists.
         $categoryId = $registry->get('category_id') ? $registry->get('category_id') : $categoryId;
     }
     // Get the current logged in user's access.
     $acl = DiscussHelper::getHelper('ACL');
     // Todo: Perhaps we should fix the confused naming of filter and sort to type and sort
     $activeFilter = JRequest::getString('filter', $registry->get('filter'));
     $sort = JRequest::getString('sort', $registry->get('sort'));
     // Get the pagination limit
     $limit = $registry->get('limit');
     $limit = $limit == '-2' ? DiscussHelper::getListLimit() : $limit;
     $limit = $limit == '-1' ? DiscussHelper::getJConfig()->get('list_limit') : $limit;
     // Get the active category id if there is any
     $activeCategory = DiscussHelper::getTable('Category');
     $activeCategory->load($categoryId);
     DiscussHelper::setPageTitle($activeCategory->title);
     // Add breadcrumbs for active category.
     if ($activeCategory->id != 0) {
         // Test if user is really allowed to access this category.
         if (!$activeCategory->canAccess()) {
             $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=index', false), JText::_('COM_EASYDISCUSS_SYSTEM_INSUFFICIENT_PERMISSIONS'));
             $app->close();
             return;
         }
         // Add pathway for category here.
         DiscussHelper::getHelper('Pathway')->setCategoryPathway($activeCategory);
     }
     // Add view to this page.
     $this->logView();
     // Set the meta of the page.
     DiscussHelper::setMeta();
     $doc = JFactory::getDocument();
     $doc->setMetadata('description', strip_tags($activeCategory->getDescription()));
     // Add rss feed into headers
     DiscussHelper::getHelper('Feeds')->addHeaders('index.php?option=com_easydiscuss&view=index');
     // Get list of categories on the site.
     $catModel = $this->getModel('Categories');
     // Pagination is by default disabled.
     $pagination = false;
     if ($categoryId) {
         $category = DiscussHelper::getTable('Category');
         $category->load($categoryId);
         $categories[] = $category;
     } else {
         $categories = $catModel->getCategories($categoryId);
         if (count($categories) > 1) {
             $ids = array();
             foreach ($categories as $row) {
                 $ids[] = $row->id;
             }
             // iniCounts should only called in index page.
             $category = DiscussHelper::getTable('Category');
             $category->initCounts($ids, true);
         }
     }
     // Get the model.
     $postModel = DiscussHelper::getModel('Posts');
     $authorIds = array();
     $topicIds = array();
     for ($i = 0; $i < count($categories); $i++) {
         $category =& $categories[$i];
         // building category childs lickage.
         $category->childs = null;
         $nestedLinks = '';
         // In category page
         if ($config->get('layout_show_all_subcategories', '1')) {
             // By default show all the subcategories of the selected category
             DiscussHelper::buildNestedCategories($category->id, $category, false, true);
         } else {
             // Show one level of subcategories of the selected category only
             $category->childs = $catModel->getChildCategories($category->id);
         }
         DiscussHelper::accessNestedCategories($category, $nestedLinks, '0', '', 'listlink', ', ');
         $category->nestedLink = $nestedLinks;
         // Get featured posts from this particular category.
         $featured = $postModel->getDiscussions(array('pagination' => false, 'sort' => $sort, 'filter' => $activeFilter, 'category' => $category->id, 'limit' => $config->get('layout_featuredpost_limit', $limit), 'featured' => true));
         // Get normal discussion posts.
         $posts = $postModel->getDiscussions(array('sort' => $sort, 'filter' => $activeFilter, 'category' => $category->id, 'limit' => $limit, 'featured' => false));
         $tmpPostsArr = array_merge($featured, $posts);
         if (count($tmpPostsArr) > 0) {
//.........这里部分代码省略.........
开发者ID:pguilford,项目名称:vcomcc,代码行数:101,代码来源:view.html.php

示例8: saveProfile

 function saveProfile()
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     $mainframe = JFactory::getApplication();
     $config = DiscussHelper::getConfig();
     $post = JRequest::get('post');
     array_walk($post, array($this, '_trim'));
     if (!$this->_validateProfileFields($post)) {
         $this->setRedirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=profile&layout=edit', false));
         return;
     }
     $my = JFactory::getUser();
     $my->name = $post['fullname'];
     // We check for password2 instead off password because apparently it is still autofill the form although is autocomplete="off"
     if (!empty($post['password2'])) {
         $my->password = $post['password'];
         $my->bind($post);
     }
     // Cheap fix: Do not allow user to override `edited` field.
     // Ideally, this should just be passed as ignore into the table.
     if (isset($post['edited'])) {
         unset($post['edited']);
     }
     // column mapping.
     $post['location'] = $post['address'];
     $profile = DiscussHelper::getTable('Profile');
     $profile->load($my->id);
     $profile->bind($post);
     //save avatar
     $file = JRequest::getVar('Filedata', '', 'files', 'array');
     if (!empty($file['name'])) {
         $newAvatar = $this->_upload($profile);
         // @rule: If this is the first time the user is changing their profile picture, give a different point
         if ($profile->avatar == 'default.png') {
             // @rule: Process AUP integrations
             DiscussHelper::getHelper('Aup')->assign(DISCUSS_POINTS_NEW_AVATAR, $my->id, $newAvatar);
         } else {
             // @rule: Process AUP integrations
             DiscussHelper::getHelper('Aup')->assign(DISCUSS_POINTS_UPDATE_AVATAR, $my->id, $newAvatar);
         }
         // @rule: Badges when they change their profile picture
         DiscussHelper::getHelper('History')->log('easydiscuss.new.avatar', $my->id, JText::_('COM_EASYDISCUSS_BADGES_HISTORY_UPDATED_AVATAR'));
         DiscussHelper::getHelper('Badges')->assign('easydiscuss.new.avatar', $my->id);
         DiscussHelper::getHelper('Points')->assign('easydiscuss.new.avatar', $my->id);
         // Reset the points
         $profile->updatePoints();
         $profile->avatar = $newAvatar;
     }
     //save params
     $userparams = DiscussHelper::getRegistry('');
     if (isset($post['facebook'])) {
         $userparams->set('facebook', $post['facebook']);
     }
     if (isset($post['show_facebook'])) {
         $userparams->set('show_facebook', $post['show_facebook']);
     }
     if (isset($post['twitter'])) {
         $userparams->set('twitter', $post['twitter']);
     }
     if (isset($post['show_twitter'])) {
         $userparams->set('show_twitter', $post['show_twitter']);
     }
     if (isset($post['linkedin'])) {
         $userparams->set('linkedin', $post['linkedin']);
     }
     if (isset($post['show_linkedin'])) {
         $userparams->set('show_linkedin', $post['show_linkedin']);
     }
     if (isset($post['skype'])) {
         $userparams->set('skype', $post['skype']);
     }
     if (isset($post['show_skype'])) {
         $userparams->set('show_skype', $post['show_skype']);
     }
     if (isset($post['website'])) {
         $userparams->set('website', $post['website']);
     }
     if (isset($post['show_website'])) {
         $userparams->set('show_website', $post['show_website']);
     }
     $profile->params = $userparams->toString();
     // Save site details
     $siteDetails = DiscussHelper::getRegistry('');
     if (isset($post['siteUrl'])) {
         $siteDetails->set('siteUrl', $post['siteUrl']);
     }
     if (isset($post['siteUsername'])) {
         $siteDetails->set('siteUsername', $post['siteUsername']);
     }
     if (isset($post['sitePassword'])) {
         $siteDetails->set('sitePassword', $post['sitePassword']);
     }
     if (isset($post['ftpUrl'])) {
         $siteDetails->set('ftpUrl', $post['ftpUrl']);
     }
     if (isset($post['ftpUsername'])) {
         $siteDetails->set('ftpUsername', $post['ftpUsername']);
     }
     if (isset($post['ftpPassword'])) {
//.........这里部分代码省略.........
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:101,代码来源:profile.php

示例9: save

 public function save()
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     $mainframe = JFactory::getApplication();
     $task = $this->getTask();
     $message = '';
     $type = 'success';
     if (JRequest::getMethod() == 'POST') {
         $post = JRequest::get('post');
         if (empty($post['title'])) {
             DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_CATEGORIES_INVALID_CATEGORY'), DISCUSS_QUEUE_ERROR);
             $url = 'index.php?option=com_easydiscuss&view=categories';
             $mainframe->redirect(JRoute::_($url, false));
             return;
         }
         $category = JTable::getInstance('Category', 'Discuss');
         $user = JFactory::getUser();
         $post['created_by'] = $user->id;
         $catId = JRequest::getVar('catid', '');
         $isNew = empty($catId) ? true : false;
         $alterOrdering = true;
         if (!empty($catId)) {
             $category->load($catId);
             $newParentId = $post['parent_id'];
             if ($category->parent_id != $newParentId) {
                 $alterOrdering = true;
             } else {
                 $alterOrdering = false;
             }
             $post['id'] = $catId;
         }
         $category->bind($post);
         // Description might contain html codes
         $description = JRequest::getVar('description', '', 'post', 'string', JREQUEST_ALLOWRAW);
         $category->description = $description;
         // Bind params
         $params = DiscussHelper::getRegistry('');
         $params->set('show_description', $post['show_description']);
         $params->set('maxlength', $post['maxlength']);
         $params->set('maxlength_size', $post['maxlength_size']);
         $params->set('cat_notify_custom', $post['cat_notify_custom']);
         $params->set('cat_email_parser', $post['cat_email_parser']);
         $params->set('cat_email_parser_password', $post['cat_email_parser_password']);
         $params->set('cat_email_parser_switch', $post['cat_email_parser_switch']);
         $category->params = $params->toString();
         if (!$category->store($alterOrdering)) {
             JError::raiseError(500, $category->getError());
             exit;
         }
         //save the category acl
         $category->deleteACL();
         $category->saveACL($post);
         $file = JRequest::getVar('Filedata', '', 'files', 'array');
         if (!empty($file['name'])) {
             $newAvatar = DiscussHelper::uploadCategoryAvatar($category, true);
             $category->avatar = $newAvatar;
             $category->store();
             //now update the avatar.
         }
         // now we need to rerun the category ordering incase admin assign the correct category tree as a child of another category.
         $category->rebuildOrdering();
         $message = JText::_('COM_EASYDISCUSS_CATEGORIES_SAVED_SUCCESS');
     } else {
         $message = JText::_('COM_EASYDISCUSS_INVALID_REQUEST');
         $type = 'error';
     }
     DiscussHelper::setMessageQueue($message, $type);
     if ($task == 'savePublishNew') {
         $mainframe->redirect('index.php?option=com_easydiscuss&view=category');
         $mainframe->close();
     }
     if ($task == 'apply') {
         $mainframe->redirect('index.php?option=com_easydiscuss&view=category&catid=' . $category->id);
         $mainframe->close();
     }
     $mainframe->redirect('index.php?option=com_easydiscuss&view=categories');
     $mainframe->close();
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:79,代码来源:category.php

示例10: onContentPrepare

 public static function onContentPrepare($context = 'post', &$data = '', &$params = array(), $limitstart = 0)
 {
     $dispatcher = JDispatcher::getInstance();
     $context = 'com_easydiscuss.' . $context;
     if (empty($params)) {
         $params = DiscussHelper::getRegistry('');
     }
     self::beforeTrigger($data);
     if (DiscussHelper::getJoomlaVersion() >= '1.6') {
         $result = $dispatcher->trigger('onContentPrepare', array($context, &$data, &$params, $limitstart));
     } else {
         $result = $dispatcher->trigger('onPrepareContent', array(&$data, &$params, $limitstart));
     }
     self::afterTrigger($data);
     return $result;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:16,代码来源:events.php

示例11: loadParams

 public function loadParams()
 {
     $this->_params = DiscussHelper::getRegistry($this->params);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:4,代码来源:category.php

示例12: setAccess

 public function setAccess($access)
 {
     $access = DiscussHelper::getRegistry($access);
     $this->_access_token = $access->get('token');
     return true;
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:6,代码来源:helper.php

示例13: getAuthentication

    public static function getAuthentication()
    {
        $config = DiscussHelper::getConfig();
        $consumerKey = $config->get('integration_twitter_consumer_key');
        $consumerSecretKey = $config->get('integration_twitter_consumer_secret_key');
        ob_start();
        if (!empty($consumerKey) && !empty($consumerSecretKey)) {
            $session = JFactory::getSession();
            $twitterUserId = '';
            $twitterScreenName = '';
            $twitterOauthToken = '';
            $twitterOauthTokenSecret = '';
            if ($session->has('twitter_oauth_access_token', 'discuss')) {
                $session_request = JString::str_ireplace(',', "\r\n", $session->get('twitter_oauth_access_token', '', 'discuss'));
                $access_token = DiscussHelper::getRegistry($session_request);
                $twitterUserId = $access_token->get('user_id', '');
                $twitterScreenName = $access_token->get('screen_name', '');
                $twitterOauthToken = $access_token->get('oauth_token', '');
                $twitterOauthTokenSecret = $access_token->get('oauth_token_secret', '');
            }
            //check if this is frontend or backend
            // 			$app = JFactory::getApplication();
            // 			if ( $app->getClientId() === 1 ) {
            // 				$controller = 'c';
            // 			}else{
            // 				$controller = 'controller';
            // 			}
            if (empty($twitterUserId) || empty($twitterOauthToken) || empty($twitterOauthTokenSecret)) {
                ?>
<p class="small"><?php 
                echo JText::_('COM_EASYDISCUSS_TWITTER_SIGN_IN_DESC');
                ?>
</p><?php 
                ?>
<p class="small"><a href="javascript:void(0)" onclick="Popup=window.open('<?php 
                echo trim(JURI::base(), "/") . DiscussRouter::_('/index.php?option=com_easydiscuss&controller=twitter&task=requestAccess', false);
                ?>
','Popup','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no, width=800,height=450,top=100'); return false;"><img src="<?php 
                echo DISCUSS_JURIROOT;
                ?>
/media/com_easydiscuss/images/twitter_signon.png" border="0" alt="here" /></a></p><?php 
            } else {
                $screen_name = $twitterScreenName ? $twitterScreenName : $twitterUserId;
                ?>
<p class="small"><?php 
                echo JText::sprintf('COM_EASYDISCUSS_TWITTER_SIGNED_IN_AS', $screen_name);
                ?>
</p><?php 
                ?>
<p class="small"><a href="javascript:void(0);" onclick="discuss.login.twitter.signout();"><?php 
                echo JText::sprintf('COM_EASYDISCUSS_TWITTER_SIGN_OUT', $screen_name);
                ?>
</a></p><?php 
            }
        } else {
            ?>
<div><?php 
            echo JText::_('COM_EASYDISCUSS_TWITTER_OAUTH_INTEGRATION_INCOMPLETE');
            ?>
</div><?php 
        }
        $html = ob_get_contents();
        @ob_end_clean();
        return $html;
    }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:65,代码来源:twitter.php

示例14: setAccess

 public function setAccess($access)
 {
     $access = DiscussHelper::getRegistry($access);
     $this->token = new OAuthConsumer($access->get('token'), $access->get('secret'));
     return $this->token;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:6,代码来源:helper.php

示例15: unsubscribe

 function unsubscribe()
 {
     $my = JFactory::getUser();
     $redirectLInk = 'index.php?option=com_easydiscuss&view=profile#Subscriptions';
     if ($my->id == 0) {
         $redirectLInk = 'index.php?option=com_easydiscuss&view=index';
     }
     //type=site - subscription type
     //sid=1 - subscription id
     //uid=42 - user id
     //token=0fd690b25dd9e4d2dc47a252d025dff4 - md5 subid.subdate
     $data = base64_decode(JRequest::getVar('data', ''));
     $param = DiscussHelper::getRegistry($data);
     $param->type = $param->get('type', '');
     $param->sid = $param->get('sid', '');
     $param->uid = $param->get('uid', '');
     $param->token = $param->get('token', '');
     $subtable = DiscussHelper::getTable('Subscribe');
     $subtable->load($param->sid);
     $token = md5($subtable->id . $subtable->created);
     $paramToken = md5($param->sid . $subtable->created);
     if (empty($subtable->id)) {
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_SUBSCRIPTION_NOT_FOUND'), 'error');
         $this->setRedirect(DiscussRouter::_($redirectLInk, false));
         return false;
     }
     if ($token != $paramToken) {
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_SUBSCRIPTION_UNSUBSCRIBE_FAILED'), 'error');
         $this->setRedirect(DiscussRouter::_($redirectLInk, false));
         return false;
     }
     if (!$subtable->delete($param->sid)) {
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_SUBSCRIPTION_UNSUBSCRIBE_FAILED_ERROR_DELETING_RECORDS'), 'error');
         $this->setRedirect(DiscussRouter::_($redirectLInk, false));
         return false;
     }
     DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_SUBSCRIPTION_UNSUBSCRIBE_SUCCESS'));
     $this->setRedirect(DiscussRouter::_($redirectLInk, false));
     return true;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:40,代码来源:subscription.php


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