예제 #1
0
 public function submit($problem_id)
 {
     try {
         $problem = new Problem($problem_id);
         $language = fRequest::get('language', 'integer');
         if (!array_key_exists($language, static::$languages)) {
             throw new fValidationException('Invalid language.');
         }
         fSession::set('last_language', $language);
         $code = trim(fRequest::get('code', 'string'));
         if (strlen($code) == 0) {
             throw new fValidationException('Code cannot be empty.');
         }
         if ($problem->isSecretNow()) {
             if (!User::can('view-any-problem')) {
                 throw new fAuthorizationException('Problem is secret now. You are not allowed to submit this problem.');
             }
         }
         $record = new Record();
         $record->setOwner(fAuthorization::getUserToken());
         $record->setProblemId($problem->getId());
         $record->setSubmitCode($code);
         $record->setCodeLanguage($language);
         $record->setSubmitDatetime(Util::currentTime());
         $record->setJudgeStatus(JudgeStatus::PENDING);
         $record->setJudgeMessage('Judging... PROB=' . $problem->getId() . ' LANG=' . static::$languages[$language]);
         $record->setVerdict(Verdict::UNKNOWN);
         $record->store();
         Util::redirect('/status');
     } catch (fException $e) {
         fMessaging::create('error', $e->getMessage());
         fMessaging::create('code', '/submit', fRequest::get('code', 'string'));
         Util::redirect("/submit?problem={$problem_id}");
     }
 }
예제 #2
0
 public function update()
 {
     $id = (int) $this->registry->params['id'];
     //var_dump($id); die();
     if (!empty($_POST)) {
         $result = $this->offices_model->update_office($id);
         if ($result) {
             Util::redirect('offices');
         }
         /*
         else {
             Util::redirect('offices/update/' . $id);
         }
         */
     }
     // adatok bevitele a view objektumba
     $this->view->title = 'Admin irodák oldal';
     $this->view->description = 'Admin irodák oldal description';
     //form validator
     $this->view->js_link[] = $this->make_link('js', ADMIN_ASSETS, 'plugins/jquery-validation-new/jquery.validate.min.js');
     $this->view->js_link[] = $this->make_link('js', ADMIN_ASSETS, 'plugins/jquery-validation-new/additional-methods.min.js');
     $this->view->js_link[] = $this->make_link('js', ADMIN_ASSETS, 'plugins/jquery-validation-new/localization/messages_hu.js');
     $this->view->js_link[] = $this->make_link('js', ADMIN_JS, 'pages/offices_insert_update.js');
     // egy iroda adatainak lekérdezése
     $this->view->office = $this->offices_model->offices_data_query($id);
     $this->view->render('offices/tpl_update_office');
 }
예제 #3
0
 /**
  *	(AJAX) Felhasználó regisztráció
  */
 public function ajax_register()
 {
     if (Util::is_ajax()) {
         $respond = $this->regisztracio_model->register_user();
         echo $respond;
         exit;
     } else {
         Util::redirect('error');
     }
 }
예제 #4
0
 public function form_handler()
 {
     $validator = new Validator($_POST);
     $validator->setRules('name', 'Name', 'minLength[4]|maxLength[8]');
     $validator->setRules('date', 'Date', 'dateRange[ 12/27/10, 12/28/10 ]');
     if ($validator->validate()) {
         $validator->storeSuccessMessage('Success!');
     }
     Util::redirect('admin', true);
 }
예제 #5
0
파일: index.php 프로젝트: jlsa/justitia
 function __construct()
 {
     // find active entity
     parent::__construct();
     // submit?
     $uploaded = handle_uploaded_submission($this->entity);
     if ($uploaded) {
         $self_url = 'index.php' . $this->entity->path() . '?made_submission=' . $uploaded->submissionid;
         Util::redirect($self_url);
     }
 }
예제 #6
0
 /**
  *	A site_users tábla listáját adja vissza és kezeli a csoportos művelteket is
  */
 public function ajax_get_items()
 {
     if (Util::is_ajax()) {
         $request_data = $_REQUEST;
         $json_data = $this->register_subscribe_model->get_items($request_data);
         // adatok visszaküldése a javascriptnek
         echo json_encode($json_data);
     } else {
         Util::redirect('error');
     }
 }
예제 #7
0
파일: User.php 프로젝트: daerduoCarey/oj
 public static function requireEmailVerified()
 {
     if (!fAuthorization::checkLoggedIn()) {
         return;
     }
     if (User::hasEmailVerified()) {
         return;
     }
     fMessaging::create('warning', 'You are required to verify your email address before doing this action.');
     Util::redirect('/email/verify');
 }
예제 #8
0
 static function find_page($url = '')
 {
     // clean up path
     $url = trim($url);
     if ($url[0] == '/') {
         $url = substr($url, 1);
     }
     if (preg_match('@//|[.][.]|/[.][^/]*@', $url)) {
         return Page::error_page_file_not_found($url);
     }
     // trim trailing slash
     if (preg_match('@([/]+)$@', $url)) {
         $url = preg_replace('@([/]+)$@', '', $url);
         // don't redirect, because apache adds these, and we would loop
     }
     // trim extension
     if (preg_match('@([/]*[.].*|[/]+)$@', $url)) {
         $url = preg_replace('@([/]*[.].*|[/]+)$@', '', $url);
         //die($url);
         Util::redirect($url);
     }
     $url = trim($url);
     if ($url == '') {
         $url = 'index';
     }
     // options:
     /*
     1. a .php file -> include it
     2. a .txt file -> autoformat it
     3. a .lhs file -> autoformat it
     */
     if (file_exists("{$url}.txt")) {
         return new TextFilePage($url, "./{$url}.txt");
     } else {
         if (file_exists("{$url}.lhs")) {
             return new TextFilePage($url, "./{$url}.lhs");
         } else {
             if (file_exists("{$url}/index.txt")) {
                 return new TextFilePage($url, "./{$url}/index.txt");
             } else {
                 if (file_exists("{$url}/index.php")) {
                     include "{$url}/index.php";
                     return $page;
                     //		} else if (file_exists("$url.php")) {
                     //			return "x";
                 } else {
                     return Page::error_page_file_not_found($url);
                 }
             }
         }
     }
 }
예제 #9
0
 public function index()
 {
     if (isset($this->registry->params['user_id']) && isset($this->registry->params['newsletter_unsubscribe_code'])) {
         $this->leiratkozas_model->leiratkozas($this->registry->params['user_id'], $this->registry->params['newsletter_unsubscribe_code']);
         // adatok bevitele a view objektumba
         $this->view->title = 'Leiratkozás hírlevélről';
         $this->view->description = 'Leiratkozás hírlevélről';
         $this->view->keywords = 'Leiratkozás hírlevélről';
         $this->view->render('leiratkozas/tpl_leiratkozas');
     } else {
         Util::redirect('error');
     }
 }
예제 #10
0
 public function postUserCategories()
 {
     if (!User::can('manage-site')) {
         fMessaging::create('error', 'You are not allowed to manage user categories.');
         fURL::redirect(Util::getReferer());
     }
     $class_name = fRequest::get('class_name');
     $username = fRequest::get('username');
     $profile = new Profile($username);
     $profile->setClassName($class_name);
     $profile->store();
     Util::redirect('/admin/user/categories#' . $username);
 }
예제 #11
0
 public function index()
 {
     Auth::handleLogin();
     // lekérdezzük, hogy kitöltötte-e már az előregisztrációt a bejelentkezett user (return bool)
     $result_prereg = $this->eloregisztracio_model->check_preregister();
     if ($result_prereg === false && isset($_POST['pre_register_submit'])) {
         $result = $this->eloregisztracio_model->pre_register('insert');
         if ($result) {
             Util::redirect('munkak');
         } else {
             Util::redirect('eloregisztracio');
         }
     }
     if ($result_prereg === true && isset($_POST['pre_register_update'])) {
         $result = $this->eloregisztracio_model->pre_register('update');
         if ($result) {
             Util::redirect('munkak');
         } else {
             Util::redirect('eloregisztracio');
         }
     }
     //validátor
     /*
      $this->view->js_link[] = $this->make_link('js', SITE_ASSETS, 'plugins/jquery-validation/jquery.validate.min.js');
      $this->view->js_link[] = $this->make_link('js', SITE_ASSETS, 'plugins/jquery-validation/additional-methods.min.js');
      $this->view->js_link[] = $this->make_link('js', SITE_ASSETS, 'plugins/jquery-validation/localization/messages_hu.js');
      $this->view->js_link[] = $this->make_link('js', SITE_ASSETS, 'plugins/jquery-validation/localization/methods_hu.js');
     
      $this->view->js_link[] = $this->make_link('js', SITE_ASSETS, 'plugins/jquery.blockui.min.js');
      $this->view->js_link[] = $this->make_link('js', SITE_ASSETS, 'pages/modal_handler.js');
     */
     //$this->view->js_link[] = $this->make_link('js', SITE_ASSETS, 'pages/sidebar_search.js');
     $this->view->js_link[] = $this->make_link('js', SITE_ASSETS, 'pages/eloregisztracio.js');
     // alapbeállítások lekérdezése
     $this->view->settings = $this->eloregisztracio_model->get_settings();
     // 3 legfrissebb munka
     $this->view->latest_jobs = $this->eloregisztracio_model->jobs_query(3);
     // oldal tartalmának lekérdezése (paraméter a pages tábla page_id)
     $this->view->content = $this->eloregisztracio_model->get_page_data(15);
     $this->view->title = $this->view->content['page_metatitle'];
     $this->view->description = $this->view->content['page_metadescription'];
     $this->view->keywords = $this->view->content['page_metakeywords'];
     if ($result_prereg) {
         $this->view->prereg_data = $this->eloregisztracio_model->get_prereg_data();
         //$this->view->debug(true);
         $this->view->render('eloregisztracio/tpl_eloregisztracio_update');
     } else {
         //$this->view->debug(true);
         $this->view->render('eloregisztracio/tpl_eloregisztracio');
     }
 }
예제 #12
0
 function __construct()
 {
     // find active entity
     $user = Authentication::require_user();
     $this->entity = Entity::get(@$_SERVER['PATH_INFO'], !$user->is_admin);
     // Redjudge all
     if (isset($_REQUEST['rejudge_all']) and Authentication::is_admin()) {
         Log::info("Requested redjudgement for all submissions in this entity", $this->entity->path());
         foreach ($this->entity->all_submissions() as $subm) {
             $subm->rejudge();
         }
         Util::redirect(str_replace('rejudge_all=1', '', $_SERVER['REQUEST_URI']));
     }
 }
예제 #13
0
 public function __construct()
 {
     $id = Util::getRequest('id');
     if ($id == null || intval($id) != $id) {
         Util::redirect('?missing_id');
     }
     // Hash auslesen
     $results = RoItem::getObjects(array('i.id' => $id), array('to' => 1), "i.online ASC, i.item_id ASC, i.price_one ASC");
     if ($results == null || is_array($results) == false || count($results) == 0) {
         Util::redirect('?hash_not_found');
     }
     $this->item = current($results);
     $this->item->loadHits();
     parent::__construct();
 }
예제 #14
0
 /**
  *	Tartalmi elemk módosítása
  *
  */
 public function edit()
 {
     $id = $this->registry->params;
     if (isset($_POST['submit_update_content'])) {
         $result = $this->content_model->update_content($id);
         Util::redirect('content');
     }
     // adatok bevitele a view objektumba
     $this->view->title = 'Tartalom szerkesztése';
     $this->view->description = 'Tartalom szerkesztése description';
     $this->view->js_link[] = $this->make_link('js', ADMIN_ASSETS, 'plugins/bootbox/bootbox.min.js');
     $this->view->js_link[] = $this->make_link('js', ADMIN_ASSETS, 'plugins/ckeditor/ckeditor.js');
     $this->view->js_link[] = $this->make_link('js', ADMIN_JS, 'pages/edit_content.js');
     // visszadja a szerkesztendő oldal adatait egy tömbben (page_id, page_title ... stb.)
     $this->view->data_arr = $this->content_model->content_data_query($id);
     $this->view->render('content/tpl_edit_content');
 }
예제 #15
0
 protected static function Report($errorMessage, $backTrace, $file, $line)
 {
     $htmlError = self::BuildBackTrace($errorMessage, $backTrace, $file, $line, true);
     $textError = self::BuildBackTrace($errorMessage, $backTrace, $file, $line, false);
     header('Status: 503 Service Temporarily Unavailable');
     if (HTTPContext::Enabled()) {
         echo $htmlError;
         die;
     } else {
         echo $textError;
     }
     $userReported = true;
     if (!$userReported) {
         /**
          * Redirect frontend user to generic error 
          */
         Util::redirect('/error/500/');
     }
 }
예제 #16
0
 public static function parseURL()
 {
     $rules = Configuration::Query('/configuration/rewrite/frontend/rule');
     if ($rules) {
         $controller = 'FrontEnd';
         if (isset($rules->length)) {
             foreach ($rules as $rule) {
                 self::MatchRule($rule, $controller);
             }
         }
     }
     $subject = $_SERVER['REQUEST_URI'];
     $domain = Configuration::Query('/configuration/domain')->item(0)->nodeValue;
     $subdir = Configuration::Query('/configuration/domain/@subdir');
     if ($subdir) {
         $domain = $domain . $subdir->item(0)->nodeValue;
         $subject = str_replace('/' . $subdir->item(0)->nodeValue, '', $subject);
     }
     Util::redirect(rtrim($domain, '/') . '/not-found/404/?' . $subject);
 }
예제 #17
0
 public function index()
 {
     /*		Auth::handleLogin();
     
     		if (!Acl::create()->userHasAccess('home_menu')) {
     		exit('nincs hozzáférése');
     		}
     		
     		*/
     if (isset($_POST['submit_settings'])) {
         $result = $this->settings_model->update_settings();
         Util::redirect('settings');
     }
     $this->view->settings = $this->settings_model->get_settings();
     // adatok bevitele a view objektumba
     $this->view->title = 'Beállítások oldal';
     $this->view->description = 'Beállítások oldal description';
     $this->view->js_link[] = $this->make_link('js', ADMIN_JS, 'pages/settings.js');
     $this->view->render('settings/tpl_settings');
 }
예제 #18
0
 /**
  *	Oldal adatainak módosítása
  */
 public function edit()
 {
     $id = (int) $this->registry->params['id'];
     if (isset($_POST['submit_update_page'])) {
         $result = $this->pages_model->update_page($id);
         if ($result) {
             Util::redirect('pages');
         } else {
             Util::redirect('pages/edit/' . $id);
         }
     }
     // adatok bevitele a view objektumba
     $this->view->title = 'Oldal szerkesztése';
     $this->view->description = 'Oldal szerkesztése description';
     $this->view->js_link[] = $this->make_link('js', ADMIN_ASSETS, 'plugins/bootbox/bootbox.min.js');
     $this->view->js_link[] = $this->make_link('js', ADMIN_ASSETS, 'plugins/ckeditor/ckeditor.js');
     $this->view->js_link[] = $this->make_link('js', ADMIN_JS, 'pages/edit_page.js');
     // visszadja a szerkesztendő oldal adatait egy tömbben (page_id, page_title ... stb.)
     $this->view->data_arr = $this->pages_model->page_data_query($id);
     $this->view->render('pages/tpl_edit_page');
 }
예제 #19
0
 function __construct()
 {
     Authentication::require_admin();
     $this->is_admin_page = true;
     // find submission
     if (!isset($_REQUEST['submissionid'])) {
         throw new NotFoundException("Missing parameter: submissionid");
     }
     $this->subm = Submission::by_id(intval($_REQUEST['submissionid']));
     $this->entity = $this->subm->entity();
     // rejudge?
     if (isset($_REQUEST['rejudge'])) {
         $this->subm->rejudge();
         // redirect to this page, so a refresh doesn't rejudge again
         Util::redirect('admin_view_submission.php?submissionid=' . $_REQUEST['submissionid']);
     }
     // delete?
     if (isset($_REQUEST['delete'], $_POST['confirm']) && $_POST['confirm'] == sha1('confirmed' . $this->subm->submissionid)) {
         $this->subm->delete();
         Util::redirect('index.php' . $this->entity->path());
     }
 }
예제 #20
0
 public function index()
 {
     $this->cache_control('private', 5);
     if ($pid = fRequest::get('id', 'integer')) {
         Util::redirect('/problem/' . $pid);
     }
     $view_any = User::can('view-any-problem');
     $this->page = fRequest::get('page', 'integer', 1);
     $this->title = trim(fRequest::get('title', 'string'));
     $this->author = trim(fRequest::get('author', 'string'));
     $this->problems = Problem::find($view_any, $this->page, $this->title, $this->author);
     $this->page_url = SITE_BASE . '/problems?';
     if (!empty($this->title)) {
         $this->page_url .= 'title=' . fHTML::encode($this->title) . '&';
     }
     if (!empty($this->author)) {
         $this->page_url .= 'author=' . fHTML::encode($this->author) . '&';
     }
     $this->page_url .= 'page=';
     $this->page_records = $this->problems;
     $this->nav_class = 'problems';
     $this->render('problem/index');
 }
예제 #21
0
 public static function FrontSetLang()
 {
     $lang = Util::getvalue('lang');
     Application::SetLang($lang);
     Util::redirect('/');
 }
예제 #22
0
// Require the user to NOT be logged in before they can see this page.
Auth::getInstance()->requireGuest();
// Get checked status of the "remember me" checkbox
$remember_me = isset($_POST['remember_me']);
// Process the submitted form
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $email = $_POST['email'];
    if (Auth::getInstance()->login($email, $_POST['password'], $remember_me)) {
        // Redirect to home page or intended page, if set
        if (isset($_SESSION['return_to'])) {
            $url = $_SESSION['return_to'];
            unset($_SESSION['return_to']);
        } else {
            $url = '/sandbox/ecommerce/index.php';
        }
        Util::redirect($url);
    }
}
// Set the title, show the page header, then the rest of the HTML
$page_title = 'Login';
include 'includes/header.php';
?>


       <div class="login" style="height:400px">
          <div class="wrap">
        <div class="col_1_of_login span_1_of_login">
          <h4 class="title">New Customers</h4>
          <h5 class="sub_title">Register Account</h5>
          <p>Classicware gives consumers the top traditional items from local cities or country. We aim to connect the world. Every country has their heritage and culture, every country has traditional products and people from other coutry want to buy them and we provide solution for this.</p>
          <div class="button1">
 /**
  * Redirect to the home page if a user is logged in.
  *
  * @return void
  */
 public function requireGuest()
 {
     if ($this->isLoggedIn()) {
         Util::redirect('/index.php');
     }
 }
/**
 * Reset password form
 */
// Initialisation
require_once 'includes/init.php';
// Require the user to NOT be logged in before they can see this page.
Auth::getInstance()->requireGuest();
// Process the submitted form
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $user = User::findForPasswordReset($_POST['token']);
    if ($user !== null) {
        $user->password = $_POST['password'];
        $user->password_confirmation = $_POST['password_confirmation'];
        if ($user->resetPassword()) {
            // Redirect to success page
            Util::redirect('/reset_password_success.php');
        }
    }
} else {
    // GET
    // Find the user based on the token
    if (isset($_GET['token'])) {
        $user = User::findForPasswordReset($_GET['token']);
    }
}
// Set the title, show the page header, then the rest of the HTML
$page_title = 'Reset password';
include 'includes/header.php';
?>

<h1>Reset password</h1>
예제 #25
0
 /**
  *	Slide törlése
  *
  */
 public function delete()
 {
     if (!isset($this->registry->params['id'])) {
         throw new Exception('Nincs "id" nevű eleme a $params tombnek! (a lekerdezes nem hajthato vegre)');
         return false;
     }
     $id = (int) $this->registry->params['id'];
     $this->slider_model->delete_slide($id);
     Util::redirect('slider');
 }
예제 #26
0
<?php

/**
 * Homepage
 */
// Initialisation
require_once 'includes/init.php';
// Set the title, show the page header, then the rest of the HTML
$page_title = 'Home';
include 'includes/header.php';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $contact = Contact::sendFeedback($_POST);
    if (empty($contact->errors)) {
        // Redirect to home page
        Util::redirect('index.php');
    }
}
?>

<section id="contact">
	<div class= "container">
		<div class="row">
			<div class="col-md-6">

				<h1>Contact Form</h1>
				<p>Send a message via the form below.</p>

				<form method="POST" role="form">
					<div class="form-group">
						<input type="text" name="name" id="name" class="form-control" placeholder="Your Name">
					</div>
예제 #27
0
 public static function redirect($controller, $action = null, array $args = array(), array $params = array(), $hard = false)
 {
     if (stristr($controller, 'http://') || stristr($controller, 'https://')) {
         //if page is a URL, then set $url as page
         $url = $controller;
     } else {
         //if page is NOT a URL, then set  generate a $url from page
         $url = URL::create($controller, $action, $args, $params);
     }
     Util::redirect($url, $hard);
     exit;
 }
<?php

/**
 * Sign up a new user
 */
// Initialisation
require_once 'includes/init.php';
// Require the user to NOT be logged in before they can see this page.
Auth::getInstance()->requireGuest();
// Process the submitted form
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $user = User::signup($_POST);
    if (empty($user->errors)) {
        // Redirect to signup success page
        Util::redirect('/signup_success.php');
    }
}
// Set the title, show the page header, then the rest of the HTML
$page_title = 'Sign Up';
include 'includes/header.php';
?>

<h1>Sign Up</h1>

<?php 
if (isset($user)) {
    ?>
  <ul>
    <?php 
    foreach ($user->errors as $error) {
        ?>
예제 #29
0
<?php

require_once 'bootstrap.php';
User::logout();
Util::redirect('/beginning-php/vanity/');
예제 #30
0
    public function kilepes()
    {
        // alapbeállítások lekérdezése
        $this->view->settings = $this->feltetelek_model->get_settings();
        if (Util::is_ajax() == false) {
            // kilépési adatok küldése e-mailban
            if (!empty($_POST)) {
                // adatok szűrése strip_tags függvénnyel
                $data = array();
                foreach ($_POST as $key => $value) {
                    $data[$key] = strip_tags($value);
                }
                $from_name = $data['name'];
                $from_email = $this->view->settings['email_kilepes'];
                $to_email = $this->view->settings['email_kilepes'];
                $to_name = $from_name;
                $subject = 'Kilépési szándék';
                $message = <<<_msg

            <html>    
            <body>
                <h2>Kilépő diák adatai</h2>
                    <p>A következő diák jelezte kilépési szándékát:
                <div>
                    <table>
                        <tbody>
                            <tr>
                                <td><strong>Név:</strong></td><td>{$data['name']} </td>
                            </tr>
                            <tr>
                                <td><strong>Anyja neve:</strong></td><td>{$data['mother_name']} </td>
                            </tr>
                            <tr>
                                <td><strong>Születési idő:</strong></td><td>{$data['birth_time']} </td>
                            </tr>
                            <tr>    
                                <td><strong>Adószám:</strong></td><td>{$data['tax_id']} </td>
                            </tr>
                            <tr>
                                <td><strong>Bankszámlaszám:</strong></td><td>{$data['bank_account_number']} </td>
                            </tr>
                    </tbody>
                    </table>
                </div> 
            </body>
            </html>    
_msg;
                //e-mail küldése
                $result = $this->feltetelek_model->send_email($from_email, $from_name, $subject, $message, $to_email, $to_name);
                if ($result) {
                    Message::set('success', 'Kilépési adatok elküldve!');
                } else {
                    Message::set('error', 'Üzenet küldési hiba!');
                }
                Util::redirect('feltetelek/kilepes');
            }
        }
        // JS, CSS
        $this->view->js_link[] = $this->make_link('js', SITE_ASSETS, 'pages/sidebar_search.js');
        $this->view->js_link[] = $this->make_link('js', SITE_ASSETS, 'pages/common.js');
        $this->view->js_link[] = $this->make_link('js', SITE_ASSETS, 'pages/kilepesi_feltetelek.js');
        // 3 legfrissebb munka
        $this->view->latest_jobs = $this->feltetelek_model->jobs_query(3);
        // oldal tartalmának lekérdezése (paraméter a pages tábla page_id)
        $this->view->content = $this->feltetelek_model->get_page_data(3);
        $this->view->title = $this->view->content['page_metatitle'];
        $this->view->description = $this->view->content['page_metadescription'];
        $this->view->keywords = $this->view->content['page_metakeywords'];
        //$this->view->debug(true);
        $this->view->render('feltetelek/tpl_feltetelek_kilepes');
    }