當前位置: 首頁>>代碼示例>>PHP>>正文


PHP fRequest::get方法代碼示例

本文整理匯總了PHP中fRequest::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP fRequest::get方法的具體用法?PHP fRequest::get怎麽用?PHP fRequest::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在fRequest的用法示例。


在下文中一共展示了fRequest::get方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: submit

 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}");
     }
 }
開發者ID:daerduoCarey,項目名稱:oj,代碼行數:35,代碼來源:SubmitController.php

示例2: show

 public function show()
 {
     $this->editable = UserHelper::isEditor();
     $cons = array();
     $field = trim(fRequest::get('field'));
     $start_year = trim(fRequest::get('start_year'));
     $major = trim(fRequest::get('major'));
     $location = trim(fRequest::get('location'));
     $words = trim(fRequest::get('words'));
     $cons['login_name|display_name~'] = $words;
     if (!empty($field)) {
         $cons['field='] = $field;
     }
     if (!empty($start_year)) {
         $cons['start_year='] = $start_year;
     }
     if (!empty($major)) {
         $cons['major='] = $major;
     }
     if (!empty($location)) {
         $cons['location~'] = $location;
     }
     $this->users = fRecordSet::build('Profile', $cons, array('id' => 'asc'));
     $this->field = $field;
     $this->start_year = $start_year;
     $this->major = $major;
     $this->location = $location;
     $this->words = $words;
     $this->render('search/index');
 }
開發者ID:daerduoCarey,項目名稱:xiaoyou,代碼行數:30,代碼來源:SearchController.php

示例3: update

 /**
  * Crop image file and set coordinates
  */
 public function update()
 {
     $x = fRequest::get('x', 'integer');
     $y = fRequest::get('y', 'integer');
     $w = fRequest::get('w', 'integer');
     $h = fRequest::get('h', 'integer');
     $img_w = fRequest::get('img_w', 'integer');
     $img_h = fRequest::get('img_h', 'integer');
     try {
         // throw new Exception(sprintf('x=%d,y=%d,w=%d,h=%d,img_w=%d,img_h=%d', $x, $y, $w, $h, $img_w, $img_h));
         $img_r = imagecreatefromjpeg($this->uploadfile);
         $x = $x * imagesx($img_r) / $img_w;
         $y = $y * imagesy($img_r) / $img_h;
         $w = $w * imagesx($img_r) / $img_w;
         $h = $h * imagesy($img_r) / $img_h;
         $dst_r = imageCreateTrueColor($this->target_width, $this->target_height);
         imagecopyresampled($dst_r, $img_r, 0, 0, $x, $y, $this->target_width, $this->target_height, $w, $h);
         imagejpeg($dst_r, $this->avatarfile, $this->jpeg_quality);
         $dst_r = imageCreateTrueColor($this->mini_width, $this->mini_height);
         imagecopyresampled($dst_r, $img_r, 0, 0, $x, $y, $this->mini_width, $this->mini_height, $w, $h);
         imagejpeg($dst_r, $this->minifile, $this->jpeg_quality);
         Activity::fireUpdateAvatar();
         $this->ajaxReturn(array('result' => 'success'));
     } catch (Exception $e) {
         $this->ajaxReturn(array('result' => 'failure', 'message' => $e->getMessage()));
     }
 }
開發者ID:daerduoCarey,項目名稱:xiaoyou,代碼行數:30,代碼來源:AvatarController.php

示例4: updateJudgeStatus

 public function updateJudgeStatus()
 {
     try {
         $op = strtolower(trim(fRequest::get('status', 'string')));
         $judge_message = base64_decode(fRequest::get('judgeMessage', 'string'));
         $verdict = fRequest::get('verdict', 'integer');
         $id = fRequest::get('id', 'integer');
         $r = new Record($id);
         if ($op == 'running') {
             $r->setJudgeStatus(JudgeStatus::RUNNING);
             $r->setJudgeMessage($r->getJudgeMessage() . "\n{$judge_message}");
             $r->store();
         } else {
             if ($op == 'done') {
                 $r->setJudgeStatus(JudgeStatus::DONE);
                 if (!empty($judge_message)) {
                     $r->setJudgeMessage($judge_message);
                 }
                 $r->setVerdict($verdict);
                 $r->store();
             }
         }
         echo "{$op}\n";
         echo "{$judge_message}\n";
         echo "{$verdict}\n";
         echo "{$id}\n";
     } catch (fException $e) {
         echo -1;
     }
 }
開發者ID:daerduoCarey,項目名稱:oj,代碼行數:30,代碼來源:PollingController.php

示例5: create

 public function create()
 {
     try {
         $profileId = UserHelper::getProfileId();
         $msg = new Msg();
         $msg->setSender($profileId);
         $msg->setContent(trim(fRequest::get('msg-content')));
         $re = trim(fRequest::get('dest', 'integer'));
         $x = new Profile($re);
         $msg->setReceiver($re);
         if (strlen($msg->getContent()) < 1) {
             throw new fValidationException('信息長度不能少於1個字符');
         }
         if (strlen($msg->getContent()) > 140) {
             throw new fValidationException('信息長度不能超過140個字符');
         }
         $msg->store();
         //Activity::fireNewTweet();
         fMessaging::create('success', 'create msg', '留言成功!');
     } catch (fNotFoundException $e) {
         fMessaging::create('failure', 'create msg', '該用戶名不存在!');
     } catch (fException $e) {
         fMessaging::create('failure', 'create msg', $e->getMessage());
     }
     fURL::redirect(SITE_BASE . '/profile/' . $re . '/msgs');
 }
開發者ID:daerduoCarey,項目名稱:xiaoyou,代碼行數:26,代碼來源:MsgController.php

示例6: loadPassingsPage

 /**
  * Process action on page load
  */
 public function loadPassingsPage()
 {
     $table = $this->createPassingTableOnce();
     if (!fRequest::check('passing_id')) {
         return;
     }
     $this->processAction($table->current_action(), fRequest::get('passing_id', 'array'));
 }
開發者ID:pmanterys,項目名稱:wp-mw-newsletter,代碼行數:11,代碼來源:PassingBrowser.php

示例7: update

 public function update($id)
 {
     try {
         $users = new Name($id);
         if (!UserHelper::isEditor()) {
             throw new fValidationException('not allowed');
         }
         $users->setStudentNumber(fRequest::get('stuid'));
         $users->setRealname(fRequest::get('realname'));
         $users->store();
         $this->ajaxReturn(array('result' => 'success', 'user_id' => $users->getId()));
     } catch (fException $e) {
         $this->ajaxReturn(array('result' => 'failure', 'message' => $e->getMessage()));
     }
 }
開發者ID:daerduoCarey,項目名稱:xiaoyou,代碼行數:15,代碼來源:NameController.php

示例8: reply

 public function reply($id)
 {
     try {
         $tweet = new Tweet($id);
         $comment = new TweetComment();
         $comment->setTweetId($tweet->getId());
         $comment->setProfileId(UserHelper::getProfileId());
         $comment->setContent(trim(fRequest::get('tweet-comment')));
         if (strlen($comment->getContent()) < 1) {
             throw new fValidationException('回複長度不能少於1個字符');
         }
         if (strlen($comment->getContent()) > 140) {
             throw new fValidationException('回複長度不能超過140個字符');
         }
         $comment->store();
     } catch (fException $e) {
         // TODO
     }
     fURL::redirect(SITE_BASE . '/profile/' . $tweet->getProfileId() . '#tweet/' . $tweet->getId());
 }
開發者ID:daerduoCarey,項目名稱:xiaoyou,代碼行數:20,代碼來源:TweetController.php

示例9: index

 public function index()
 {
     if (fAuthorization::checkLoggedIn()) {
         $this->cache_control('private', 2);
     } else {
         $this->cache_control('private', 5);
     }
     $top = fRequest::get('top', 'integer');
     $this->owner = trim(fRequest::get('owner'));
     $this->problem_id = trim(fRequest::get('problem'));
     $this->language = trim(fRequest::get('language'));
     $this->verdict = trim(fRequest::get('verdict'));
     $this->page = fRequest::get('page', 'integer', 1);
     $this->records = Record::find($top, $this->owner, $this->problem_id, $this->language, $this->verdict, $this->page);
     $this->page_records = $this->records;
     $common_url = SITE_BASE . "/status?owner={$this->owner}&problem={$this->problem_id}&language={$this->language}&verdict={$this->verdict}";
     $this->top_url = "{$common_url}&top=";
     $this->page_url = "{$common_url}&page=";
     $this->nav_class = 'status';
     $this->render('record/index');
 }
開發者ID:daerduoCarey,項目名稱:oj,代碼行數:21,代碼來源:RecordController.php

示例10: create

 public function create()
 {
     try {
         $profileId = UserHelper::getProfileId();
         $mail = new Mail();
         $mail->setSender($profileId);
         $mail->setContent(trim(fRequest::get('mail-content')));
         $re = trim(fRequest::get('dest'));
         if (empty($re)) {
             $re = trim(fRequest::get('destre', 'integer'));
             $pa = trim(fRequest::get('parent', 'integer', -1));
             $x = new Profile($re);
             $mail->setReceiver($re);
             $mail->setParent($pa);
         } else {
             //$receiver=fRecordSet::build('Profile',array('login_name=' => $re ),array())->getRecord(0);
             $receiver = fRecordSet::build('Profile', array('login_name=' => $re), array());
             if ($receiver->count()) {
                 $receiver = $receiver->getRecord(0);
             } else {
                 throw new fNotFoundException('user doesn\'t exist');
             }
             $mail->setReceiver($receiver->getId());
         }
         if (strlen($mail->getContent()) < 1) {
             throw new fValidationException('信息長度不能少於1個字符');
         }
         if (strlen($mail->getContent()) > 140) {
             throw new fValidationException('信息長度不能超過140個字符');
         }
         $mail->store();
         //Activity::fireNewTweet();
         fMessaging::create('success', 'create mail', '信息發送成功!');
     } catch (fNotFoundException $e) {
         fMessaging::create('failure', 'create mail', '該用戶名不存在,或該用戶沒有創建個人資料!');
     } catch (fException $e) {
         fMessaging::create('failure', 'create mail', $e->getMessage());
     }
     fURL::redirect(SITE_BASE . '/inbox');
 }
開發者ID:daerduoCarey,項目名稱:xiaoyou,代碼行數:40,代碼來源:MailController.php

示例11: index

 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');
 }
開發者ID:daerduoCarey,項目名稱:oj,代碼行數:23,代碼來源:ProblemController.php

示例12: array

    // Get manufacturers also for drop-down box
    #$manufacturers = fRecordSet::build('Manufacturer', NULL, array('name' => 'asc'));
    // Get list of models
    $models = Model::getSimple($db);
    // Get types
    if (feature('consumable_types')) {
        $types = Tag::get_by_type('consumable_type');
    }
    include 'views/consumables/addedit.php';
}
/**
 * Delete a consumable
 */
if ($action == 'delete') {
    // Get ID
    $id = fRequest::get('id', 'integer');
    try {
        $c = new Consumable($id);
        if (fRequest::isPost()) {
            $c->delete();
            fMessaging::create('success', fURL::get(), 'The consumable ' . $c->getName() . ' was successfully deleted.');
            fURL::redirect(fURL::get());
        }
    } catch (fNotFoundException $e) {
        fMessaging::create('error', fURL::get(), 'The consumable requested, ID ' . $id . ', could not be found.');
        fURL::redirect($manage_url);
    } catch (fExpectedException $e) {
        fMessaging::create('error', fURL::get(), $e->getMessage());
    } catch (fSQLException $e) {
        fMessaging::create('error', fURL::get(), 'Database error: ' . $e->getMessage());
    }
開發者ID:mrjwc,項目名稱:printmaster,代碼行數:31,代碼來源:consumables.php

示例13:

$tmpl->set('title', 'Log In');
$tmpl->set('no-nav', true);
$tmpl->place('header');
?>
   <form action="<?php 
echo fURL::get() . '?action=log_in';
?>
" method="post">
     <div class="main" id="main">
       <fieldset>
         <div class="clearfix">
           <label for="username">Username</label>
           <div class="input">
             <input id="username" type="text" name="username" value="<?php 
echo fRequest::get('username');
?>
" />
           </div>
         </div><!-- /clearfix -->
         <div class="clearfix">
           <label for="password">Password</label>
           <div class="input">
             <input id="password" type="password" name="password" value="" />
           </div>
         </div><!-- /clearfix -->
         <div class="actions">       
           <input class="btn" type="submit" value="Log In" />
           <a class="btn" href="<?php 
echo User::makeUrl('add');
?>
開發者ID:rberger,項目名稱:Graphite-Tattle,代碼行數:30,代碼來源:log_in.php

示例14: fValidation

        fRequest::validateCSRFToken($_POST['token']);
        $validator = new fValidation();
        $validator->addRequiredFields('password', 'email');
        $validator->addEmailFields('email');
        $validator->validate();
        $users = fRecordSet::build('User', array('email=' => strtolower($_POST['email'])));
        if ($users->count() == 0) {
            throw new fValidationException('Invalid username or password.');
        }
        $rec = $users->getRecords();
        $user = $rec[0];
        if (!fCryptography::checkPasswordHash($_POST['password'], $user->getPassword())) {
            throw new fValidationException('Invalid username or password.');
        }
        fSession::set('user', $user->getId());
        if (fRequest::get('persistent_login', 'boolean')) {
            fSession::enablePersistence();
        }
        if (isset($_POST['forward'])) {
            fURL::redirect('http://' . $_SERVER['SERVER_NAME'] . $_POST['forward']);
        } else {
            fURL::redirect('/members');
        }
        exit;
    } catch (fValidationException $e) {
        echo "<p>" . $e->printMessage() . "</p>";
    } catch (fSQLException $e) {
        echo "<p>An unexpected error occurred, please try again later</p>";
        trigger_error($e);
    }
}
開發者ID:russss,項目名稱:hackspace-foundation-sites,代碼行數:31,代碼來源:login.php

示例15: elseif

    include VIEW_PATH . '/add_edit_user.php';
} elseif ('settings' == $action) {
    $user = new User($user_id);
    if (fRequest::isPost()) {
        try {
            $user->populate();
        } catch (fExpectedException $e) {
            fMessaging::create('error', fURL::get(), $e - getMessage());
        }
    }
    include VIEW_PATH . '/add_edit_user_settings.php';
} elseif ('delete' == $action) {
    try {
        $user = new User($user_id);
        if (fRequest::isPost()) {
            fRequest::validateCSRFToken(fRequest::get('token'));
            $user->delete();
            fMessaging::create('success', User::makeUrl('edit', $user), 'The user ' . $user->getName() . ' was successfully deleted');
            fURL::redirect(User::makeUrl('edit', $user));
        }
    } catch (fNotFoundException $e) {
        fMessaging::create('error', User::makeUrl('edit', $user), 'The line requested could not be found');
        fURL::redirect(User::makeUrl('edit', $user));
    } catch (fExpectedException $e) {
        fMessaging::create('error', fURL::get(), $e->getMessage());
    }
    include VIEW_PATH . '/delete.php';
} else {
    if (!fAuthorization::checkAuthLevel('admin')) {
        fURL::redirect(User::makeURL('edit', fSession::get('user_id')));
    } else {
開發者ID:nleskiw,項目名稱:Graphite-Tattle,代碼行數:31,代碼來源:user.php


注:本文中的fRequest::get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。