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


PHP DiscussHelper::getTable方法代码示例

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


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

示例1: remove

 function remove()
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     $mails = JRequest::getVar('cid', '', 'POST');
     $message = '';
     $type = 'success';
     if (empty($mails)) {
         $message = JText::_('COM_EASYDISCUSS_NO_MAIL_ID_PROVIDED');
         $type = 'error';
     } else {
         $table = DiscussHelper::getTable('MailQueue');
         foreach ($mails as $id) {
             $table->load($id);
             if (!$table->delete()) {
                 DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_SPOOLS_DELETE_ERROR'), DISCUSS_QUEUE_ERROR);
                 $this->setRedirect('index.php?option=com_easydiscuss&view=spools');
                 return;
             }
         }
         $message = JText::_('COM_EASYDISCUSS_SPOOLS_EMAILS_DELETED');
     }
     DiscussHelper::setMessageQueue($message, $type);
     $this->setRedirect('index.php?option=com_easydiscuss&view=spools');
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:25,代码来源:spools.php

示例2: delete

 public function delete($id)
 {
     $ajax = new Disjax();
     $user = JFactory::getUser();
     // @rule: Do not allow empty id or guests to delete files.
     if (empty($id) || empty($user->id)) {
         return false;
     }
     $attachment = DiscussHelper::getTable('Attachments');
     $attachment->load($id);
     // Ensure that only post owner or admin can delete it.
     if (!$attachment->deleteable()) {
         return false;
     }
     // Ensure that only post owner or admin can delete it.
     if (!$attachment->delete()) {
         return false;
     }
     $theme = new DiscussThemes();
     $content = JText::_('COM_EASYDISCUSS_ATTACHMENT_DELETED_SUCCESSFULLY');
     $options = new stdClass();
     $options->content = $content;
     $options->title = JText::_('COM_EASYDISCUSS_ATTACHMENT_DELETE_CONFIRMATION_TITLE');
     $buttons = array();
     $button = new stdClass();
     $button->title = JText::_('COM_EASYDISCUSS_BUTTON_CLOSE');
     $button->action = 'disjax.closedlg();';
     $buttons[] = $button;
     $options->buttons = $buttons;
     $ajax->script('EasyDiscuss.$("#attachment-' . $attachment->id . '" ).trigger("itemRemoved").remove();');
     $ajax->dialog($options);
     $ajax->send();
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:33,代码来源:view.ajax.php

示例3: getUserTooltip

        function getUserTooltip($id, $name)
        {
            $profile = DiscussHelper::getTable('Profile');
            $profile->load($id);
            ob_start();
            ?>
			<div>
				<strong><u><?php 
            echo $name;
            ?>
</u></strong>
				<img src='<?php 
            echo $profile->getAvatar();
            ?>
' width='32' />
			</div>
			<p>
				<?php 
            echo JText::sprintf('COM_EASYDISCUSS_TOOLTIPS_USER_INFO', $name, $profile->getDateJoined(), $profile->numPostCreated, $profile->numPostAnswered);
            ?>
			</p>
			<?php 
            $content = ob_get_contents();
            ob_end_clean();
            return $content;
        }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:26,代码来源:themes.php

示例4: store

 public function store($updateNulls = false)
 {
     if (empty($this->email) && $this->userid) {
         $user = JFactory::getUser($this->userid);
         $this->fullname = $user->email();
     }
     if (empty($this->fullname) && $this->userid) {
         $profile = DiscussHelper::getTable('Profile');
         $profile->load($this->userid);
         $this->fullname = $profile->getName();
     }
     if (empty($this->member)) {
         $this->member = $this->userid ? 1 : 0;
     }
     if (empty($this->interval)) {
         $this->interval = 'instant';
     }
     if (empty($this->created)) {
         $this->created = DiscussHelper::getDate()->toMySQL();
     }
     if (empty($this->sent_out)) {
         $this->sent_out = DiscussHelper::getDate()->toMySQL();
     }
     return parent::store($updateNulls);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:25,代码来源:subscribe.php

示例5: removeLocation

 /**
  * Remove a location from a post.
  *
  * @since	3.0
  * @access	public
  */
 public function removeLocation($id)
 {
     $ajax = new Disjax();
     $post = DiscussHelper::getTable('Post');
     $state = $post->load($id);
     $my = JFactory::getUser();
     if (!$id || !$state) {
         echo JText::_('COM_EASYDISCUSS_INVALID_ID');
         return $ajax->send();
     }
     if ($post->user_id != $my->id && !DiscussHelper::isModerator($post->category_id)) {
         echo JText::_('COM_EASYDISCUSS_NOT_ALLOWED_TO_REMOVE_LOCATION_FOR_POST');
         return $ajax->send();
     }
     // Update the address, latitude and longitude of the post.
     $post->address = '';
     $post->latitude = '';
     $post->longitude = '';
     $post->store();
     $content = JText::_('COM_EASYDISCUSS_LOCATION_IS_REMOVED');
     $options = new stdClass();
     $options->content = $content;
     $options->title = JText::_('COM_EASYDISCUSS_DELETE_LOCATION_TITLE');
     $buttons = array();
     $button = new stdClass();
     $button->title = JText::_('COM_EASYDISCUSS_BUTTON_CLOSE');
     $button->action = 'disjax.closedlg();';
     $buttons[] = $button;
     $options->buttons = $buttons;
     $ajax->script('discuss.location.removeHTML("' . $id . '");');
     $ajax->dialog($options);
     return $ajax->send();
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:39,代码来源:view.ajax.php

示例6: add

 public static function add($userObj, $entityObj, $interval = null, $data)
 {
     if (!$userObj instanceof JUser) {
         return false;
     }
     if ($entityObj instanceof DiscussPost) {
         $type = 'post';
     } elseif ($entityObj instanceof DiscussCategory) {
         $type = 'category';
     } else {
         // $type = 'site'
         return false;
     }
     $email = isset($data['poster_email']) ? $data['poster_email'] : '';
     $name = isset($data['poster_name']) ? $data['poster_name'] : '';
     $subscribe = DiscussHelper::getTable('Subscribe');
     if (empty($userObj->id)) {
         $subscribe->userid = 0;
         $subscribe->member = 0;
         $subscribe->email = $email;
         $subscribe->fullname = $name;
     } else {
         $subscribe->userid = $userObj->id;
         $subscribe->member = 1;
         $subscribe->email = $userObj->email;
         $subscribe->fullname = $userObj->name;
     }
     $subscribe->type = $type;
     $subscribe->cid = $entityObj->id;
     $subscribe->interval = $interval;
     return $subscribe->store();
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:32,代码来源:subscriber.php

示例7: display

 /**
  * Generates a random captcha image
  *
  **/
 function display($cachable = false, $urlparams = false)
 {
     // @TODO: Run some cleaning query here to clear the database.
     JTable::addIncludePath(DISCUSS_TABLES);
     $id = JRequest::getInt('captcha-id', '');
     $captcha = DiscussHelper::getTable('Captcha');
     // clearing the oudated keys.
     $captcha->clear();
     // load the captcha records.
     $captcha->load($id);
     if (!$captcha->id) {
         return false;
     }
     // @task: Generate a very random integer and take only 5 chars max.
     $hash = JString::substr(md5(rand(0, 9999)), 0, 5);
     $captcha->response = $hash;
     $captcha->store();
     // Captcha width and height
     $width = 100;
     $height = 20;
     $image = ImageCreate($width, $height);
     $white = ImageColorAllocate($image, 255, 255, 255);
     $black = ImageColorAllocate($image, 0, 0, 0);
     $gray = ImageColorAllocate($image, 204, 204, 204);
     ImageFill($image, 0, 0, $white);
     ImageString($image, 5, 30, 3, $hash, $black);
     ImageRectangle($image, 0, 0, $width - 1, $height - 1, $gray);
     imageline($image, 0, $height / 2, $width, $height / 2, $gray);
     imageline($image, $width / 2, 0, $width / 2, $height, $gray);
     header('Content-type: image/jpeg');
     ImageJpeg($image);
     ImageDestroy($image);
     exit;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:38,代码来源:captcha.php

示例8: ajaxSubscribe

 function ajaxSubscribe($id)
 {
     $disjax = new disjax();
     $mainframe = JFactory::getApplication();
     $my = JFactory::getUser();
     $tag = DiscussHelper::getTable('Tags');
     $tag->load($id);
     $tpl = new DiscussThemes();
     $tpl->set('tag', $tag);
     $tpl->set('my', $my);
     $html = $tpl->fetch('ajax.subscribe.tag.php');
     $options = new stdClass();
     $options->title = JText::sprintf('COM_EASYDISCUSS_SUBSCRIBE_TO_TAG', $tag->title);
     $options->content = $html;
     $buttons = array();
     $button = new stdClass();
     $button->title = JText::_('COM_EASYDISCUSS_BUTTON_CANCEL');
     $button->action = 'disjax.closedlg();';
     $buttons[] = $button;
     $button = new stdClass();
     $button->title = JText::_('COM_EASYDISCUSS_BUTTON_SUBSCRIBE');
     $button->action = 'discuss.subscribe.tag(' . $tag->id . ')';
     $button->className = 'btn-primary';
     $buttons[] = $button;
     $options->buttons = $buttons;
     $disjax->dialog($options);
     $disjax->send();
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:28,代码来源:view.ajax.php

示例9: display

 public function display($tpl = null)
 {
     $id = JRequest::getInt('id', 0);
     $badge = DiscussHelper::getTable('Badges');
     $badge->load($id);
     if (!$badge->created) {
         $date = DiscussHelper::getHelper('Date')->dateWithOffset(DiscussHelper::getDate()->toMySQL());
         $badge->created = $date->toMySQL();
     }
     // There could be some errors here.
     if (JRequest::getMethod() == 'POST') {
         $badge->bind(JRequest::get('post'));
         // Description might contain html codes
         $description = JRequest::getVar('description', '', 'post', 'string', JREQUEST_ALLOWRAW);
         $badge->description = $description;
     }
     $jConfig = DiscussHelper::getJConfig();
     $editor = JFactory::getEditor($jConfig->get('editor'));
     $model = $this->getModel('Badges');
     $rules = $model->getRules();
     $badges = $this->getBadges();
     $this->assign('editor', $editor);
     $this->assign('badges', $badges);
     $this->assign('rules', $rules);
     $this->assign('badge', $badge);
     parent::display($tpl);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:27,代码来源:view.html.php

示例10: getAuthorHTML

 /**
  * Get the author html output
  */
 private function getAuthorHTML($authors)
 {
     // @TODO: Make this option configurable
     // This option sets the limit on the number of authors to be displayed in the notification
     $limit = 3;
     $html = '';
     for ($i = 0; $i < count($authors); $i++) {
         $profile = DiscussHelper::getTable('Profile');
         $profile->load($authors[$i]);
         $html .= ' <b>' . $profile->getName() . '</b>';
         if ($i + 1 == $limit) {
             // Calculate the balance
             $balance = count($authors) - ($i + 1);
             $html .= ' ' . DiscussHelper::getHelper('String')->getNoun('COM_EASYDISCUSS_AND_OTHERS', $balance, true);
             break;
         }
         if (isset($authors[$i + 2])) {
             $html .= JText::_(',');
         } else {
             if (isset($authors[$i + 1])) {
                 $html .= ' ' . JText::_('COM_EASYDISCUSS_AND');
             }
         }
     }
     return $html;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:29,代码来源:notifications.php

示例11: process

 function process()
 {
     $view = new EasyDiscussView();
     $date = DiscussHelper::getDate();
     $now = $date->toMySQL();
     $modelSubscribe = $view->getModel('Subscribe');
     $subscribers = $modelSubscribe->getSiteSubscribers($this->interval, $now);
     $total = count($subscribers);
     if (empty($total)) {
         return false;
     }
     foreach ($subscribers as $subscriber) {
         $notify = DiscussHelper::getNotification();
         $data = array();
         $rows = $modelSubscribe->getCreatedPostByInterval($subscriber->sent_out, $now);
         $posts = array();
         if ($rows) {
             foreach ($rows as $row) {
                 $row['categorylink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=categorie&layout=listings&category_id=' . $row['category_id'], false, true);
                 $row['link'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $row['id'], false, true);
                 $row['userlink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=profile&id=' . $row['user_id'], false, true);
                 $category = DiscussHelper::getTable('Category');
                 $creator = DiscussHelper::getTable('Profile');
                 $category->load($row['category_id']);
                 $creator->load($row['user_id']);
                 $row['category'] = $category->getTitle();
                 $row['avatar'] = $creator->getAvatar();
                 $row['name'] = $creator->getName();
                 $row['date'] = DiscussDateHelper::toFormat($row['created'], '%b %e, %Y');
                 $row['message'] = DiscussHelper::parseContent($row['content']);
                 $posts[] = $row;
             }
         }
         $data['post'] = $posts;
         $data['total'] = count($data['post']);
         $data['unsubscribeLink'] = DiscussHelper::getUnsubscribeLink($subscriber, true, true);
         $subject = $date->toMySQL();
         switch (strtoupper($this->interval)) {
             case 'DAILY':
                 $subject = $date->toFormat('%F');
                 $data['interval'] = JText::_('today');
                 break;
             case 'WEEKLY':
                 $subject = $date->toFormat('%V');
                 $data['interval'] = JText::_('this week');
                 break;
             case 'MONTHLY':
                 $subject = $date->toFormat('%B');
                 $data['interval'] = JText::_('this month');
                 break;
         }
         if (!empty($data['post'])) {
             $notify->addQueue($subscriber->email, JText::sprintf('COM_EASYDISCUSS_YOUR_' . $this->interval . '_SUBSCRIPTION', $subject), '', 'email.subscription.site.interval.php', $data);
         }
         $subscribe = DiscussHelper::getTable('Subscribe');
         $subscribe->load($subscriber->id);
         $subscribe->sent_out = $now;
         $subscribe->store();
     }
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:60,代码来源:subscription.php

示例12: save

 public function save()
 {
     JRequest::checkToken('request') or jexit('Invalid Token');
     $mainframe = JFactory::getApplication();
     $post = JRequest::get('post');
     $ids = isset($post['id']) ? $post['id'] : '';
     $starts = isset($post['start']) ? $post['start'] : '';
     $ends = isset($post['end']) ? $post['end'] : '';
     $titles = isset($post['title']) ? $post['title'] : '';
     $removal = isset($post['itemRemove']) ? $post['itemRemove'] : '';
     $model = DiscussHelper::getModel('Ranks', true);
     if (!empty($removal)) {
         $rids = explode(',', $removal);
         $model->removeRanks($rids);
     }
     if (!empty($ids)) {
         if (count($ids) > 0) {
             for ($i = 0; $i < count($ids); $i++) {
                 $data = array();
                 $data['id'] = $ids[$i];
                 $data['start'] = $starts[$i];
                 $data['end'] = $ends[$i];
                 $data['title'] = $titles[$i];
                 $ranks = DiscussHelper::getTable('Ranks');
                 $ranks->bind($data);
                 $ranks->store();
             }
         }
         //end if
     }
     //end if
     $message = JText::_('COM_EASYDISCUSS_RANKING_SUCCESSFULLY_UPDATED');
     DiscussHelper::setMessageQueue($message, DISCUSS_QUEUE_SUCCESS);
     $mainframe->redirect('index.php?option=com_easydiscuss&view=ranks');
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:35,代码来源:ranks.php

示例13: display

 public function display($tmpl = null)
 {
     $config = DiscussHelper::getConfig();
     $jConfig = DiscussHelper::getJConfig();
     if (!$config->get('main_rss')) {
         return;
     }
     $filteractive = JRequest::getString('filter', 'allposts');
     $sort = JRequest::getString('sort', 'latest');
     if ($filteractive == 'unanswered' && ($sort == 'active' || $sort == 'popular')) {
         //reset the active to latest.
         $sort = 'latest';
     }
     $doc = JFactory::getDocument();
     $doc->link = JRoute::_('index.php?option=com_easydiscuss&view=index');
     // Load up the tag
     $tag = JRequest::getInt('id', 0);
     $table = DiscussHelper::getTable('Tags');
     $table->load($tag);
     // Set the title of the document
     $doc->setTitle($table->title);
     $doc->setDescription(JText::sprintf('COM_EASYDISCUSS_DISCUSSIONS_TAGGED_IN', $table->title));
     $postModel = $this->getModel('Posts');
     $posts = $postModel->getTaggedPost($tag, $sort, $filteractive);
     $pagination = $postModel->getPagination('0', $sort, $filteractive);
     $jConfig = DiscussHelper::getJConfig();
     $posts = DiscussHelper::formatPost($posts);
     foreach ($posts as $row) {
         // Assign to feed item
         $title = $this->escape($row->title);
         $title = html_entity_decode($title);
         // load individual item creator class
         $item = new JFeedItem();
         $item->title = $title;
         $item->link = JRoute::_('index.php?option=com_easydiscuss&view=post&id=' . $row->id);
         $item->description = $row->content;
         $item->date = DiscussHelper::getDate($row->created)->toMySQL();
         if (!empty($row->tags)) {
             $tagData = array();
             foreach ($row->tags as $tag) {
                 $tagData[] = '<a href="' . JRoute::_('index.php?option=com_easydiscuss&view=tags&id=' . $tag->id) . '">' . $tag->title . '</a>';
             }
             $row->tags = implode(', ', $tagData);
         } else {
             $row->tags = '';
         }
         $item->category = $row->tags;
         $item->author = $row->user->getName();
         if ($jConfig->get('feed_email') != 'none') {
             if ($jConfig->get('feed_email') == 'author') {
                 $item->authorEmail = $row->user->email;
             } else {
                 $item->authorEmail = $jConfig->get('mailfrom');
             }
         }
         $doc->addItem($item);
     }
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:58,代码来源:view.feed.php

示例14: removeLog

 public function removeLog($command, $userId, $content_id)
 {
     $db = DiscussHelper::getDBO();
     $table = DiscussHelper::getTable('History');
     $query = 'SELECT id' . ' FROM ' . $db->nameQuote('#__discuss_users_history') . ' WHERE ' . $db->nameQuote('command') . '=' . $db->Quote($command) . ' AND ' . $db->nameQuote('user_id') . '=' . $db->Quote($userId) . ' AND ' . $db->nameQuote('content_id') . '=' . $db->Quote($content_id);
     $db->setQuery($query);
     $result = $db->loadResult();
     $table->delete($result);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:9,代码来源:history.php

示例15: convert

 /**
  * Converts a comment into a discussion reply
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return	
  */
 public function convert()
 {
     JRequest::checkToken('request') or jexit('Invalid Token');
     // Get the Joomla app
     $app = JFactory::getApplication();
     // Get the comment id from the request.
     $id = JRequest::getInt('id');
     // Load the comment
     $comment = DiscussHelper::getTable('Comment');
     $comment->load($id);
     if (!$id || !$comment->id) {
         // Throw error here.
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_COMMENTS_INVALID_COMMENT_ID_PROVIDED'), DISCUSS_QUEUE_ERROR);
         $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false));
         $app->close();
     }
     // Get the post id from the request.
     $postId = JRequest::getInt('postId');
     $post = DiscussHelper::getTable('Post');
     $post->load($postId);
     if (!$postId || !$post->id) {
         // Throw error here.
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_COMMENTS_INVALID_POST_ID_PROVIDED'), DISCUSS_QUEUE_ERROR);
         $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false));
         $app->close();
     }
     if (!$comment->canConvert()) {
         // Throw error here.
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_COMMENTS_NOT_ALLOWED_TO_CONVERT'), DISCUSS_QUEUE_ERROR);
         $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $post->id, false));
         $app->close();
     }
     // Create a new reply.
     $reply = DiscussHelper::getTable('Post');
     $reply->title = $post->title;
     $reply->content = $comment->comment;
     $reply->published = 1;
     $reply->created = $comment->created;
     $reply->parent_id = $post->id;
     $reply->user_id = $comment->user_id;
     $reply->user_type = 'member';
     $reply->category_id = $post->category_id;
     $state = $reply->store();
     if (!$state) {
         // Throw error here.
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_COMMENTS_ERROR_SAVING_REPLY'), DISCUSS_QUEUE_ERROR);
         $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $post->id, false));
         $app->close();
     }
     // Once the reply is stored, delete the comment
     $comment->delete();
     DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_COMMENTS_SUCCESS_CONVERTED_COMMENT_TO_REPLY'), DISCUSS_QUEUE_SUCCESS);
     $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $post->id, false));
     $app->close();
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:63,代码来源:comments.php


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