private function check_authorizations()
 {
     if (!$this->downloadfile->is_authorized_to_delete()) {
         $error_controller = PHPBoostErrors::user_not_authorized();
         DispatchManager::redirect($error_controller);
     }
     if (AppContext::get_current_user()->is_readonly()) {
         $error_controller = PHPBoostErrors::user_in_read_only();
         DispatchManager::redirect($error_controller);
     }
 }
 private function check_authorizations()
 {
     if (!BugtrackerAuthorizationsService::check_authorizations()->moderation() && $this->current_user->get_id() != $this->bug->get_assigned_to_id()) {
         $error_controller = PHPBoostErrors::user_not_authorized();
         DispatchManager::redirect($error_controller);
     }
     if (AppContext::get_current_user()->is_readonly()) {
         $controller = PHPBoostErrors::user_in_read_only();
         DispatchManager::redirect($controller);
     }
 }
 private function check_authorizations(ShoutboxMessage $message)
 {
     if (!$message->is_authorized_to_delete()) {
         $error_controller = PHPBoostErrors::user_not_authorized();
         DispatchManager::redirect($error_controller);
     }
     if (AppContext::get_current_user()->is_readonly()) {
         $controller = PHPBoostErrors::user_in_read_only();
         DispatchManager::redirect($controller);
     }
 }
 private function check_authorizations()
 {
     if (!$this->event->get_content()->is_registration_authorized()) {
         $error_controller = PHPBoostErrors::user_not_authorized();
         DispatchManager::redirect($error_controller);
     }
     if (time() > $this->event->get_start_date()->get_timestamp()) {
         $error_controller = new UserErrorController(LangLoader::get_message('error', 'status-messages-common'), LangLoader::get_message('calendar.notice.unsuscribe.event_date_expired', 'common', 'calendar'));
         DispatchManager::redirect($error_controller);
     }
     if (AppContext::get_current_user()->is_readonly()) {
         $error_controller = PHPBoostErrors::user_in_read_only();
         DispatchManager::redirect($error_controller);
     }
 }
 public function execute(HTTPRequestCustom $request)
 {
     AppContext::get_session()->csrf_get_protect();
     $news = $this->get_news($request);
     if (!$news->is_authorized_to_delete()) {
         $error_controller = PHPBoostErrors::user_not_authorized();
         DispatchManager::redirect($error_controller);
     }
     if (AppContext::get_current_user()->is_readonly()) {
         $controller = PHPBoostErrors::user_in_read_only();
         DispatchManager::redirect($controller);
     }
     NewsService::delete('WHERE id=:id', array('id' => $news->get_id()));
     NewsService::get_keywords_manager()->delete_relations($news->get_id());
     PersistenceContext::get_querier()->delete(DB_TABLE_EVENTS, 'WHERE module=:module AND id_in_module=:id', array('module' => 'news', 'id' => $news->get_id()));
     CommentsService::delete_comments_topic_module('news', $news->get_id());
     Feed::clear_cache('news');
     AppContext::get_response()->redirect($request->get_url_referrer() ? $request->get_url_referrer() : NewsUrlBuilder::home(), StringVars::replace_vars(LangLoader::get_message('news.message.success.delete', 'common', 'news'), array('name' => $news->get_name())));
 }
 private function check_authorizations()
 {
     $downloadfile = $this->get_downloadfile();
     if ($downloadfile->get_id() === null) {
         if (!$downloadfile->is_authorized_to_add()) {
             $error_controller = PHPBoostErrors::user_not_authorized();
             DispatchManager::redirect($error_controller);
         }
     } else {
         if (!$downloadfile->is_authorized_to_edit()) {
             $error_controller = PHPBoostErrors::user_not_authorized();
             DispatchManager::redirect($error_controller);
         }
     }
     if (AppContext::get_current_user()->is_readonly()) {
         $controller = PHPBoostErrors::user_in_read_only();
         DispatchManager::redirect($controller);
     }
 }
Ejemplo n.º 7
0
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 ###################################################*/
require_once '../kernel/begin.php';
include_once '../wiki/wiki_functions.php';
load_module_lang('wiki');
$config = WikiConfig::load();
if (AppContext::get_current_user()->is_readonly()) {
    $controller = PHPBoostErrors::user_in_read_only();
    DispatchManager::redirect($controller);
}
define('TITLE', $LANG['wiki_contribuate']);
$bread_crumb_key = 'wiki_post';
require_once '../wiki/wiki_bread_crumb.php';
$is_cat = (int) retrieve(POST, 'is_cat', false);
$is_cat_get = (int) (retrieve(GET, 'type', '') == 'cat');
$is_cat = $is_cat > 0 ? $is_cat : $is_cat_get;
$id_edit = retrieve(POST, 'id_edit', 0);
$title = retrieve(POST, 'title', '');
$encoded_title = retrieve(GET, 'title', '');
$contents = wiki_parse(retrieve(POST, 'contents', '', TSTRING_AS_RECEIVED));
$contents_preview = retrieve(POST, 'contents', '', TSTRING_UNCHANGE);
$id_cat = retrieve(GET, 'id_parent', 0);
$new_id_cat = retrieve(POST, 'id_cat', 0);
 private function check_authorizations()
 {
     $message = $this->get_message();
     if ($message->get_id() === null) {
         if (!GuestbookAuthorizationsService::check_authorizations()->write()) {
             $error_controller = PHPBoostErrors::user_not_authorized();
             DispatchManager::redirect($error_controller);
         }
     } else {
         if (!$message->is_authorized_edit()) {
             $error_controller = PHPBoostErrors::user_not_authorized();
             DispatchManager::redirect($error_controller);
         }
     }
     if (AppContext::get_current_user()->is_readonly()) {
         $controller = PHPBoostErrors::user_in_read_only();
         DispatchManager::redirect($controller);
     }
 }
 private function check_authorizations()
 {
     $bug = $this->get_bug();
     if ($bug->get_id() === null) {
         if (!$bug->is_authorized_to_add()) {
             $error_controller = PHPBoostErrors::user_not_authorized();
             DispatchManager::redirect($error_controller);
         }
     } else {
         if (!($bug->is_authorized_to_edit() || $bug->get_assigned_to_id() && $this->current_user->get_id() == $bug->get_assigned_to_id())) {
             $error_controller = PHPBoostErrors::user_not_authorized();
             DispatchManager::redirect($error_controller);
         }
     }
     if (AppContext::get_current_user()->is_readonly()) {
         $error_controller = PHPBoostErrors::user_in_read_only();
         DispatchManager::redirect($error_controller);
     }
 }