function createPage($smarty)
{
    if (!Users::isAdmin()) {
        Redirect::error(403);
    }
    $smarty->assign('edit_headers', Queries::itemListHeaders(Input::get('table', 'get')));
    $smarty->assign('edit_table', Queries::itemList(Input::get('table', 'get')));
    return $smarty;
}
function createPage($smarty)
{
    $item = Queries::examWithId(Input::get('id', 'get'));
    if (empty($item->id)) {
        Redirect::error(404);
    }
    $smarty->assign('item', $item);
    $smarty->assign('table_parentT', 'exams');
    $smarty->assign('table_parentI', $item->id);
    $smarty->assign('planning', Tables::planning(true, 'exams', $item->id));
    return $smarty;
}
Beispiel #3
0
 public function get_index($category, $title, $id, $idparent = null)
 {
     $id = !is_null($idparent) ? $idparent : $id;
     $article = Article::find($id);
     // || strcmp($title,$article->title)!=0
     if (is_null($article)) {
         return Redirect::error(404);
     }
     $article->categoryName = $article->Category()->first()->getCategoryFullName();
     $article->categoryUrl = $article->Category()->first()->getCategoryUrl();
     return View::make('visitor.article_content', array('article' => $article));
 }
Beispiel #4
0
function createPage($smarty)
{
    $subject = DB::instance()->get("subjects", array("", "abbreviation", "=", Input::get('subject', 'get')))->first();
    if (empty($subject->id)) {
        Redirect::error(404);
    }
    $smarty->assign('subject', $subject);
    $smarty->assign('links', json_decode($subject->links));
    $smarty->assign('events', Tables::events(true, $subject->abbreviation));
    $smarty->assign('table_parentT', 'subjects');
    $smarty->assign('table_parentI', $subject->id);
    $smarty->assign('planning', Tables::planning(true, 'subjects', $subject->id));
    return $smarty;
}
function createPage($smarty)
{
    if (!Users::isAdmin()) {
        Redirect::error(403);
    }
    if (Input::exists() && Input::get('action') === 'admin_item_insert') {
        Update::adminInsertItem();
    }
    if (Input::exists() && Input::get('action') === 'admin_item_update') {
        Update::adminUpdateItem();
    }
    if (Input::exists() && Input::get('action') === 'admin_item_delete') {
        Update::adminDeleteItem();
    }
    $smarty->assign('columns', Queries::editableEntry(Input::get('table', 'get'), Input::get('id', 'get')));
    return $smarty;
}
Beispiel #6
0
 public function get_edit($id)
 {
     $data['title'] = "Edit Palette";
     $data['lead'] = "Edit your palette's details";
     $data['tabs'][] = array('All', URL::to('litmus/palettes'));
     $data['tabs'][] = array('View', URL::to('litmus/palettes/' . $id));
     $data['tabs'][] = array('Edit', URL::to('litmus/palettes/' . $id . '/edit'), 'active');
     $data['object'] = Palette::find($id);
     if (!$data['object']) {
         return Redirect::error(404);
     }
     $data['url'] = URL::to('litmus/palettes/' . $id);
     $data['verb'] = 'PUT';
     $data['fields'] = Config::get('litmus::config.form.palette');
     $data['content'] = View::make('litmus::partials.form', $data)->render();
     return $this->layout($data);
 }
Beispiel #7
0
<?php

Route::get('documents', function () {
    $path = URL::current();
    return array('GET ' . $path . '/:id' => 'Retrieve data about a specific document', 'POST ' . $path => 'Create a new document', 'POST ' . $path . '/:id' => 'Update a document', 'DELETE ' . $path . '/:id' => 'Delete a document');
});
Route::get('documents/(:num)', function ($id) {
    if ($doc = Document::get($id)) {
        return $doc;
    }
    return Redirect::error('404');
});
Beispiel #8
0
 public static function itemListHeaders($table)
 {
     $info = DB::tableFormInfo($table);
     if (empty($info)) {
         Redirect::error(404);
     }
     return extractFields($info, 'COLUMN_NAME');
 }
Beispiel #9
0
 /**
  * 如果用户没有通行权,则进行什么操作
  *
  * @return viod
  */
 public function error($msg, $url)
 {
     \Redirect::error($msg, $url);
 }
Beispiel #10
0
 public static function adminDeleteItem()
 {
     if (Users::isAdmin()) {
         $validation = new Validate();
         $validation->check($_POST, array('action' => array('name' => 'Action', 'required' => true, 'wildcard' => 'admin_item_delete'), 'table' => array('name' => 'Table Name', 'required' => true), 'id' => array('name' => 'Entry ID', 'required' => true)));
         if ($validation->passed()) {
             DB::instance()->delete(Input::get('table'), array("", "id", "=", Input::get('id')));
             if (Input::get('table') === Users::safeSid() . '_assignments') {
                 Calendar::deleteAssignment(Input::get('id'));
             }
             Notifications::addSuccess('Entry deleted!');
             Redirect::to('?page=home');
         } else {
             Notifications::addValidationFail($validation->getErrors());
         }
     } else {
         Redirect::error(403);
     }
 }
Beispiel #11
0
<?php

require_once 'app/core/init.php';
require_once 'main.php';
if (isset($_GET['page']) && !empty($_GET['page'])) {
    $smarty = new Smarty();
    $smarty->debugging = Config::get('debug/smartyDebug');
    $smarty->caching = Config::get('smarty/caching');
    $smarty->cache_lifetime = Config::get('smarty/cache_lifetime');
    $cache_id = md5(json_encode($_GET) . json_encode($_POST) . Notifications::getAsJson());
    $pageFile = 'app/pages/' . $_GET['page'] . '.php';
    $templateFile = 'templates/pages/' . $_GET['page'] . '.tpl';
    if (file_exists($pageFile) && file_exists($templateFile)) {
        require $pageFile;
        if (!$allowCaching) {
            $cache_id = md5($cache_id . Hash::hashUnique());
        }
        if (!$smarty->isCached($templateFile, $cache_id)) {
            $smarty = createPage($smarty);
            $smarty = pageAddMain($smarty);
        }
        $smarty = pageAddMessages($smarty);
        $smarty->loadFilter("output", "trimwhitespace");
        $smarty->display($templateFile, $cache_id);
    } else {
        Redirect::error(404);
    }
} else {
    Redirect::to('?page=home');
}