Example #1
0
 public function before()
 {
     parent::before();
     if (!\Auth::check()) {
         \Output::redirect('myauth');
     }
     \Asset::remove_path('assets/');
     \Asset::add_path('assets/uploadify/');
     $this->template->css = \Asset::css(array('style.css'), array(), 'layout', false);
     $this->template->js = \Asset::js(array('jquery-1.3.2.min.js', 'swfobject.js', 'jquery.uploadify.v2.1.0.min.js', 'jquery.application.js'), array(), 'layout', false);
 }
Example #2
0
 public function before()
 {
     parent::before();
     try {
         if (!$this->user) {
             \Session::set_flash('error', "Please login to access this page.");
             //non logged in users must login first
             $destination = Uri::create(Input::uri());
             Response::redirect(Uri::create('user/login', array(), array('destination' => $destination)));
             //require login first
         }
     } catch (Exception $e) {
         \Session::set_flash('error', $e->getMessage());
         \Response::redirect('/welcome/404');
     }
 }
Example #3
0
 public static function get_admin_dashboard_stats()
 {
     $data = Controller_User::get_dashboard_stats(0);
     $data['admin'] = true;
     return $data;
 }
Example #4
0
 /**
  * Action: photographer profile
  */
 public function action_profile()
 {
     $user = Model_User::find_user(urldecode((string) $this->request->param('username')));
     if (!$user) {
         $this->request->redirect(Route::url('galleries'));
         return;
     }
     // Build page
     $this->view = Controller_User::_set_page($user);
     $this->view->tab = 'galleries';
     // Galleries
     $galleries = Model_Gallery::factory()->find_by_user($user->id);
     $this->view->add(View_Page::COLUMN_CENTER, $this->section_galleries_thumbs($galleries, true, false));
     // Top images
     foreach (array(Model_Image::TOP_RATED, Model_Image::TOP_COMMENTED, Model_Image::TOP_VIEWED) as $type) {
         $section = $this->section_top($type, 6, $user->id, false);
         $section->aside = true;
         $this->view->add(View_Page::COLUMN_RIGHT, $section);
     }
 }
Example #5
0
File: blog.php Project: anqh/anqh
 /**
  * Action: user's blog
  */
 public function action_user()
 {
     $user = Model_User::find_user(urldecode((string) $this->request->param('username')));
     if (!$user) {
         $this->request->redirect(Route::url('blogs'));
         return;
     }
     $blogs = Model_Blog_Entry::factory()->find_by_user($user);
     if ($months = $this->_build_months($blogs)) {
         // Default to last month
         $year = (int) $this->request->param('year');
         $month = (int) $this->request->param('month');
         if (!$year) {
             $year = max(array_keys($months));
             $month = max(array_keys($months[$year]));
         } else {
             if (!$month) {
                 $month = isset($months[$year]) ? min(array_keys($months[$year])) : 1;
             }
         }
         $year = min($year, date('Y'));
         $month = min(12, max(1, $month));
         // Build page
         $this->view = Controller_User::_set_page($user);
         $this->view->tab = 'blog';
         $this->view->add(View_Page::COLUMN_CENTER, '<h2>' . HTML::chars(date('F Y', mktime(null, null, null, $month, 1, $year))) . '</h2>');
         // Pagination
         $params = array('username' => urlencode($user->username));
         $this->view->add(View_Page::COLUMN_CENTER, $this->section_month_pagination($months, 'blog_user', $params, $year, $month));
         // Entries
         if (isset($months[$year]) && isset($months[$year][$month])) {
             foreach ($months[$year][$month] as $entry) {
                 $this->view->add(View_Page::COLUMN_CENTER, $this->section_entry($entry, true));
             }
         }
         // Month browser
         $this->view->add(View_Page::COLUMN_RIGHT, $this->section_month_browser($months, 'blog_user', $params, $year, $month));
     } else {
         // No entires found
         $this->view->add(View_Page::COLUMN_CENTER, new View_Alert(__('Alas, the quill seems to be dry, no blog entries found.'), null, View_Alert::INFO));
     }
 }
Example #6
0
 public function before()
 {
     parent::before();
 }
Example #7
0
        $user->historiaAdmin($data);
    } else {
        $data = $model->history($_SESSION['login']);
        $user->historia($data);
    }
});
Flight::route('POST /user/zaloz', function () {
    $auth = new Controller_Authorization();
    if (!$auth->isLogged($_SESSION['login'], $_SESSION['check']) && !$auth->isAdmin($_SESSION['login'])) {
        Flight::redirect('/');
    }
    $user = new Controller_User();
    $model = new Model_Dao();
    if ($model->create($_POST['imie'], $_POST['nazwisko'], $_POST['login'], $_POST['haslo'], $_POST['stan'])) {
        $message = "Dodano konto!";
    } else {
        $message = "Blad, sprawdz czy login juz nie istnieje";
    }
    $user->zaloz($message);
});
Flight::route('/user/zaloz', function () {
    $auth = new Controller_Authorization();
    if (!$auth->isLogged($_SESSION['login'], $_SESSION['check']) && !$auth->isAdmin($_SESSION['login'])) {
        Flight::redirect('/');
    }
    $user = new Controller_User();
    $user->zaloz();
});
//Flight::route('/@name/@id', function($name, $id){
//    echo Flight::request()->GET;
//});
 public function action_index($timestamp = null)
 {
     parent::action_index();
     \Fuel\Core\Response::redirect('user/timesheets/advanced/logtimes/' . (is_null($timestamp) ? \Fuel\Core\Date::forge()->get_timestamp() : $timestamp));
 }
Example #9
0
File: music.php Project: anqh/anqh
 /**
  * Action: Artist profile
  */
 public function action_profile()
 {
     $user = Model_User::find_user(urldecode((string) $this->request->param('username')));
     if (!$user) {
         $this->request->redirect(Route::url('charts'));
         return;
     }
     // Build page
     $this->view = Controller_User::_set_page($user);
     $this->view->tab = 'music';
     // Browse
     $tracks = Model_Music_Track::factory()->find_by_user($user->id, Model_Music_Track::TYPE_MIX, 0);
     if ($count = count($tracks)) {
         $this->view->add(View_Page::COLUMN_LEFT, $this->section_browse($tracks, __('Mixtapes') . ' <small>(' . $count . ')</small>'));
     }
     $tracks = Model_Music_Track::factory()->find_by_user($user->id, Model_Music_Track::TYPE_TRACK, 0);
     if ($count = count($tracks)) {
         $this->view->add(View_Page::COLUMN_RIGHT, $this->section_browse($tracks, __('Tracks') . ' <small>(' . $count . ')</small>'));
     }
 }