addBreadCrumb(['link' => FORUM.'index.php', 'title' => self::$locale['forum_0000']]); } /** * @throws \ReflectionException */ public function do_postify() { if ($postify = $this->load_postify($_GET['post'])) { if (method_exists($postify, 'execute')) { $postify->execute(); } else { if (iMOD) { addNotice('danger', 'No action taken'); redirect(self::$default_redirect_link); } } } else { if (iMOD) { addNotice('danger', 'No action taken'); redirect(self::$default_redirect_link); } } } /** * @param $class_actions * * @return object * @throws \ReflectionException */ private function load_postify($class_actions) { /* * Overrides */ $implements = [ 'on' => 'track', 'off' => 'track', 'voteup' => 'vote', 'votedown' => 'vote' ]; // Override the class action with the implemented method. $class_actions = (isset($implements[$class_actions]) ? $implements[$class_actions] : $class_actions); if (file_exists(FORUM_CLASS.'postify/'.$class_actions.'.php')) { require_once(FORUM_CLASS.'postify/'.$class_actions.'.php'); $namespace_ = '\\PHPFusion\\Forums\\Postify\\'; $prefix_ = 'Postify_'; $obj = new \ReflectionClass($namespace_.$prefix_.$class_actions); $this->postify_action[$class_actions] = $obj->newInstance(); } // Need to execute the implement_method if (is_object($this->postify_action[$class_actions])) { return (object)$this->postify_action[$class_actions]; } else { throw new \Exception('Invalid Action'); } } /** * @return mixed|string */ protected function get_postify_error_message() { $_GET['error'] = (!empty($_GET['error']) && isnum($_GET['error']) && $_GET['error'] <= 6 ? $_GET['error'] : 0); if (!empty($_GET['error'])) { switch ($_GET['error']) { case 1: // Attachment file type is not allowed return self::$locale['forum_0540']; break; case 2: // Invalid attachment of filesize return self::$locale['forum_0541']; break; case 3: // Error: You did not specify a Subject and/or Message return self::$locale['forum_0542']; break; case 4: // Error: Your cookie session has expired, please login and repost return self::$locale['forum_0551']; case 5: // This post is locked. Contact the moderator for further information. return self::$locale['forum_0555']; break; case 6: // You may only edit a post for %d minute(s) after initial submission. return sprintf(self::$locale['forum_0556'], self::$forum_settings['forum_edit_timelimit']); break; } } return NULL; } /** * Generate default postify uri * * @return array */ protected function get_postify_uri() { if ($_GET['error'] < 3) { if (!isset($_GET['thread_id']) || !isnum($_GET['thread_id'])) { addNotice('danger', 'URL Error'); redirect(self::$default_redirect_link); } $link[] = ['url' => fusion_get_settings('siteurl').'infusions/forum/viewthread.php?thread_id='.$_GET['thread_id'], 'title' => self::$locale['forum_0548']]; redirect(fusion_get_settings('siteurl').'infusions/forum/viewthread.php?thread_id='.$_GET['thread_id'], 3); } $link[] = ['url' => fusion_get_settings('siteurl')."infusions/forum/index.php?viewforum&forum_id=".$_GET['forum_id'], 'title' => self::$locale['forum_0549']]; $link[] = ['url' => fusion_get_settings('siteurl')."infusions/forum/index.php", 'title' => self::$locale['forum_0550']]; return (array)$link; } }