コード例 #1
0
ファイル: status.php プロジェクト: ConnorChristie/GrabViews
 /**
  * Perm Check: Can approve a status
  *
  * @param	array	[Array of author data, uses getAuthor if none]
  * @param	array	[Array of status information OR status ID OR uses $this->_internalData['StatusData'] if none]
  * @return	bool
  */
 public function canApproveStatus($author = null, $status = null)
 {
     $author = $author === null ? $this->getAuthor() : $author;
     $status = $status === null ? $this->_internalData['StatusData'] : (is_array($status) ? $status : $this->_loadStatus($status));
     if (!$author['member_id'] or !$status['status_id']) {
         return FALSE;
     }
     if (!$this->isEnabled()) {
         return FALSE;
     }
     if (!$author['g_is_supmod']) {
         if ($author['member_id'] == $status['status_member_id'] && !IPSMember::isOnModQueue($author['member_id'])) {
             return TRUE;
         }
         return FALSE;
     } else {
         return true;
     }
     /* is left by someone else */
     if ($status['status_member_id'] != $status['status_author_id'] && $status['status_member_id'] != $author['member_id']) {
         return false;
     }
     return TRUE;
 }
コード例 #2
0
ファイル: bootstrap.php プロジェクト: mover5/imobackup
 /**
  * Add a comment
  *
  * @param	Int		Parent ID
  * @param	string	Post content
  * @param	array	Member ID of author (current member assumed if empty)
  * @return	exception or comment ID
  *
  * EXCEPTION CODES
  * NO_PERMISSION		Do not have permission to add comment
  */
 public function add($parentId, $post, $memberId = null)
 {
     /* Load member */
     $memberData = IPSMember::load($memberId === null ? $this->memberData['member_id'] : $memberId, 'all');
     if (!$memberData['member_id']) {
         if (!$this->request['comment_name']) {
             throw new Exception('NO_NAME');
         }
         $memberData['members_display_name'] = $this->request['comment_name'];
     }
     /* Permission test */
     $can = $this->can('add', array('comment_parent_id' => $parentId));
     if ($can !== true) {
         throw new Exception($can);
     }
     /* Mod queue? */
     $modQ = IPSMember::isOnModQueue($memberData);
     if ($modQ === NULL) {
         throw new Exception('NO_PERMISSION');
     }
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite');
     $editor = new $classToLoad();
     $editor->setBbcodeSection($this->bbcodeSection());
     $editor->setLegacyMode(false);
     $comment = $editor->process($post);
     if (!trim($comment)) {
         throw new Exception('NO_COMMENT');
     }
     /* Build insert data */
     $array = array('comment_author_id' => intval($memberData['member_id']), 'comment_author_name' => $memberData['members_display_name'], 'comment_ip_address' => $this->member->ip_address, 'comment_date' => time(), 'comment_text' => $comment, 'comment_approved' => $modQ ? 0 : 1, 'comment_parent_id' => $parentId);
     /* Pre save */
     $insert = $this->preSave('add', $array, 0, $parentId);
     /* Insert and fetch DB */
     $save = $this->remapToLocal($insert);
     if (count($save)) {
         $this->DB->insert($this->table(), $save);
         $insert['comment_id'] = $this->DB->getInsertId();
     }
     /* Post save */
     $insert = $this->postSave('add', $insert, $insert['comment_id'], $parentId);
     /* remove saved content */
     if ($this->memberData['member_id']) {
         $editor->removeAutoSavedContent(array('member_id' => $this->memberData['member_id'], 'autoSaveKey' => 'comment-' . $this->table() . '-' . $parentId));
     }
     /* Send notifications */
     $this->sendNotifications($this->remapFromLocal($insert), $comment);
     return $insert;
 }
コード例 #3
0
 /**
  * Used when isPublished is set to auto
  * @param string $type
  * @return boolean
  */
 protected function _checkPostModeration($type)
 {
     $memberData = $this->getAuthor();
     /* Does this member have mod_posts enabled? */
     if (IPSMember::isOnModQueue($memberData)) {
         return FALSE;
     }
     /* Group can bypass mod queue */
     if ($memberData['g_avoid_q']) {
         return TRUE;
     }
     /* Check to see if this forum has moderation enabled */
     switch (intval($this->getForumData('preview_posts'))) {
         default:
         case 0:
             return TRUE;
             break;
         case 1:
             return FALSE;
             break;
         case 2:
             return $type == 'new' ? FALSE : TRUE;
             break;
         case 3:
             return $type == 'reply' ? FALSE : TRUE;
             break;
     }
     /* Our post can be seen! */
     return TRUE;
 }
コード例 #4
0
ファイル: topics.php プロジェクト: Advanture/Online-RolePlay
 /**
  * Shows the edit box
  *
  * @return	@e void
  */
 public function editBoxShow()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $pid = intval($this->request['p']);
     $fid = intval($this->request['f']);
     $tid = intval($this->request['t']);
     $show_reason = 0;
     //-----------------------------------------
     // Check P|T|FID
     //-----------------------------------------
     if (!$pid or !$tid or !$fid) {
         $this->returnString('error');
     }
     if ($this->memberData['member_id']) {
         if (IPSMember::isOnModQueue($this->memberData) === NULL) {
             $this->returnJsonError($this->lang->words['ajax_reply_noperm']);
         }
     }
     //-----------------------------------------
     // Get classes
     //-----------------------------------------
     if (!is_object($this->postClass)) {
         $this->registry->getClass('class_localization')->loadLanguageFile(array('public_editors'), 'core');
         require_once IPSLib::getAppDir('forums') . "/sources/classes/post/classPost.php";
         /*noLibHook*/
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . '/sources/classes/post/classPostForms.php', 'classPostForms', 'forums');
         $this->postClass = new $classToLoad($this->registry);
     }
     /* Set post class data */
     $this->postClass->setForumData($this->registry->getClass('class_forums')->getForumById($fid));
     $this->postClass->setTopicID($tid);
     $this->postClass->setForumID($fid);
     $this->postClass->setPostID($pid);
     /* Topic Data */
     $this->postClass->setTopicData($this->registry->getClass('topics')->getTopicById($tid));
     # Set Author
     $this->postClass->setAuthor($this->member->fetchMemberData());
     # Get Edit form
     try {
         $html = $this->postClass->displayAjaxEditForm();
         $html = $this->registry->output->replaceMacros($html);
         $this->returnHtml($html);
     } catch (Exception $error) {
         $this->returnString($error->getMessage());
     }
 }