Example #1
0
 public static function _goto($a_target, $a_thread = 0, $a_posting = 0)
 {
     /**
      * @var $ilAccess ilAccessHandler
      * @var $ilErr ilErrorHandling
      * @var $lng ilLanguage
      */
     global $ilAccess, $ilErr, $lng;
     if ($ilAccess->checkAccess('read', '', $a_target)) {
         if ($a_thread != 0) {
             $objTopic = new ilForumTopic($a_thread);
             if ($objTopic->getFrmObjId() && $objTopic->getFrmObjId() != ilObject::_lookupObjectId($a_target)) {
                 $ref_ids = ilObject::_getAllReferences($objTopic->getFrmObjId());
                 foreach ($ref_ids as $ref_id) {
                     if ($ilAccess->checkAccess('read', '', $ref_id)) {
                         $new_ref_id = $ref_id;
                         break;
                     }
                 }
                 if (isset($new_ref_id) && $new_ref_id != $a_target) {
                     ilUtil::redirect(ILIAS_HTTP_PATH . "/goto.php?target=frm_" . $new_ref_id . "_" . $a_thread . "_" . $a_posting);
                 }
             }
             $_GET['ref_id'] = $a_target;
             $_GET['pos_pk'] = $a_posting;
             $_GET['thr_pk'] = $a_thread;
             $_GET['anchor'] = $a_posting;
             $_GET['cmdClass'] = 'ilObjForumGUI';
             $_GET['cmd'] = 'viewThread';
             $_GET['baseClass'] = 'ilRepositoryGUI';
             include_once 'ilias.php';
             exit;
         } else {
             $_GET['ref_id'] = $a_target;
             $_GET['baseClass'] = 'ilRepositoryGUI';
             include_once 'ilias.php';
             exit;
         }
     } else {
         if ($ilAccess->checkAccess('read', '', ROOT_FOLDER_ID)) {
             $_GET['target'] = '';
             $_GET['ref_id'] = ROOT_FOLDER_ID;
             ilUtil::sendInfo(sprintf($lng->txt('msg_no_perm_read_item'), ilObject::_lookupTitle(ilObject::_lookupObjId($a_target))), true);
             $_GET['baseClass'] = 'ilRepositoryGUI';
             include 'ilias.php';
             exit;
         }
     }
     $ilErr->raiseError($lng->txt('msg_no_perm_read'), $ilErr->FATAL);
 }