Example #1
0
        $pluginName = "Plugin\\" . str_replace(" ", "_", ucwords(str_replace("_", " ", $pluginName))) . "\\Base";
        $plugin = $pluginName::instance();
        $slug = \Web::instance()->slug($plugin->_package());
        $plugins[$slug] = $plugin;
        if (!$plugin->_installed()) {
            try {
                $plugin->_install();
            } catch (Exception $e) {
                $f3->set("error", "Failed to install plugin " . $plugin->_package() . ": " . $e->getMessage());
            }
        }
        try {
            $plugin->_load();
        } catch (Exception $e) {
            $f3->set("error", "Failed to initialize plugin " . $plugin->_package() . ": " . $e->getMessage());
        }
    }
}
$f3->set("plugins", $plugins);
// register filter
\Helper\View::instance()->filter('parseText', '$this->parseText');
\Helper\View::instance()->filter('formatFilesize', '$this->formatFilesize');
// Set up user session
$user = new Model\User();
$user->loadCurrent();
// Load issue types
$types = new \Model\Issue\Type();
$f3->set("issue_types", $types->find(null, null, $f3->get("cache_expire.db")));
// Run the application
$f3->set("menuitem", false);
$f3->run();
Example #2
0
 public function single($f3, $params)
 {
     $this->_requireLogin();
     $user = new \Model\User();
     $user->load(array("username = ? AND deleted_date IS NULL", $params["username"]));
     if ($user->id) {
         $f3->set("title", $user->name);
         $f3->set("this_user", $user);
         // Extra arrays required for bulk update
         $status = new \Model\Issue\Status();
         $f3->set("statuses", $status->find(null, null, $f3->get("cache_expire.db")));
         $f3->set("users", $user->getAll());
         $f3->set("groups", $user->getAllGroups());
         $priority = new \Model\Issue\Priority();
         $f3->set("priorities", $priority->find(null, array("order" => "value DESC"), $f3->get("cache_expire.db")));
         $type = new \Model\Issue\Type();
         $f3->set("types", $type->find(null, null, $f3->get("cache_expire.db")));
         $issue = new \Model\Issue\Detail();
         $f3->set("created_issues", $issue->paginate(0, 200, array("status_closed = '0' AND deleted_date IS NULL AND author_id = ?", $user->id), array("order" => "priority DESC, due_date DESC")));
         $f3->set("assigned_issues", $issue->paginate(0, 200, array("status_closed = '0' AND deleted_date IS NULL AND owner_id = ?", $user->id), array("order" => "priority DESC, due_date DESC")));
         $f3->set("overdue_issues", $issue->paginate(0, 200, array("status_closed = '0' AND deleted_date IS NULL AND owner_id = ? AND due_date IS NOT NULL AND due_date < ?", $user->id, date("Y-m-d", \Helper\View::instance()->utc2local())), array("order" => "due_date ASC")));
         $this->_render("user/single.html");
     } else {
         $f3->error(404);
     }
 }
Example #3
0
 /**
  * @param \Base $f3
  */
 public function add_selecttype($f3)
 {
     $type = new \Model\Issue\Type();
     $f3->set("types", $type->find(null, null, $f3->get("cache_expire.db")));
     $f3->set("title", $f3->get("dict.new_n", $f3->get("dict.issues")));
     $f3->set("menuitem", "new");
     $this->_render("issues/new.html");
 }
Example #4
0
$f3->config($homedir . "app/dict/en.ini");
$test = new Test();
// No output for routes
$f3->set("QUIET", true);
$f3->set("HALT", false);
$f3->mock("GET /login");
$test->expect(!$f3->get("ERROR"), "GET /login");
$f3->mock("POST /login", array("username" => "admin", "password" => "admin"));
$test->expect(!$f3->get("ERROR"), "POST /login");
$f3->mock("GET /ping");
$test->expect(!$f3->get("ERROR"), "GET /ping (no session)");
// Build a fake session
$user = new Model\User();
$user->load(1);
$types = new \Model\Issue\Type();
$f3->mset(array("user" => $user->cast(), "user_obj" => $user, "plugins" => array(), "issue_types" => $types->find()));
$test->expect($user->id == 1, "Force user authentication");
$f3->mock("GET /ping");
$test->expect(!$f3->get("ERROR"), "GET /ping (active session)");
$f3->mock("GET /");
$test->expect(!$f3->get("ERROR"), "GET /");
$f3->mock("GET /issues/1");
$test->expect($f3->get("PARAMS.id") == 1 && !$f3->get("ERROR"), "GET /issues/1");
$f3->mock("GET /issues/1/history");
$test->expect($f3->get("PARAMS.id") == 1 && !$f3->get("ERROR"), "GET /issues/1/history");
$f3->mock("GET /issues/1/watchers");
$test->expect($f3->get("PARAMS.id") == 1 && !$f3->get("ERROR"), "GET /issues/1/watchers");
$f3->mock("GET /issues/1/related");
$test->expect($f3->get("PARAMS.id") == 1 && !$f3->get("ERROR"), "GET /issues/1/related");
$f3->mock("GET /backlog");
$test->expect(!$f3->get("ERROR"), "GET /backlog");