示例#1
0
 /**
  * Send user to specific unauthorized page
  * @return void
  */
 public function sendUnauthorizedPage()
 {
     $loginPage = $this->modx->getOption('discuss.login_resource_id', null, 0);
     if (!empty($loginPage) && $this->ssoMode) {
         $url = $this->modx->makeUrl($loginPage, '', array('discuss' => 1, 'discussPlace' => $this->controller->getSessionPlace()), 'full');
         $this->modx->sendRedirect($url);
     } else {
         $this->modx->sendUnauthorizedPage();
     }
 }
示例#2
0
文件: Topic.php 项目: vito/chyrp-site
 /**
  * Function: delete_link
  * Outputs a delete link for the topic, if the <User.can> delete_topic.
  *
  * Parameters:
  *     $text - The text to show for the link.
  *     $before - If the link can be shown, show this before it.
  *     $after - If the link can be shown, show this after it.
  */
 public function delete_link($text = null, $before = null, $after = null, $classes = "")
 {
     if (!$this->deletable()) {
         return false;
     }
     fallback($text, __("Delete"));
     echo $before . '<a href="' . url("delete_topic/" . $this->id, DiscussController::current()) . '" title="Delete" class="topic_delete_link delete_link" id="' . ($classes ? $classes . " " : '') . 'topic_delete_' . $this->id . '">' . $text . '</a>' . $after;
 }
示例#3
0
文件: Forum.php 项目: vito/chyrp-site
 /**
  * Function: url
  * Returns a forum's URL.
  */
 public function url()
 {
     if ($this->no_results) {
         return false;
     }
     return url("forum/" . $this->url, DiscussController::current());
 }
 /**
  * @param string $key
  * @param mixed $value
  * @dataProvider providerSetPlaceholder
  */
 public function testSetPlaceholder($key, $value)
 {
     $this->controller->setPlaceholder($key, $value);
     $this->assertEquals($value, $this->controller->placeholders[$key]);
 }
示例#5
0
文件: index.php 项目: vito/chyrp-site
<?php

if (version_compare(PHP_VERSION, "5.1.3", "<")) {
    exit("Chyrp requires PHP 5.1.3 or greater.");
}
require_once "../includes/common.php";
# Prepare the controller.
$discuss = DiscussController::current();
# Parse the route.
$route = Route::current($discuss);
if (module_enabled("cacher") and !empty(Modules::$instances["cacher"]->cacher->path)) {
    $cacher =& Modules::$instances["cacher"]->cacher;
    $cacher->caches = INCLUDES_DIR . "/caches/discuss";
    $cacher->path = str_replace(INCLUDES_DIR . "/caches", INCLUDES_DIR . "/caches/discuss", $cacher->path);
    $cacher->file = $cacher->path . "/" . md5($cacher->url) . ".html";
    $cacher->remove_expired();
}
# Execute the appropriate Controller responder.
$route->init();
# If the route failed or nothing was displayed, check for:
#     1. Module-provided pages.
#     2. Feather-provided pages.
#     3. Theme-provided pages.
if (!$route->success) {
    $displayed = false;
    if (!$displayed and $theme->file_exists("pages/" . $route->action)) {
        $discuss->display("pages/discuss/" . $route->action);
    } elseif (!$displayed) {
        show_404();
    }
}