当前位置: 首页>>代码示例>>PHP>>正文


PHP fRequest类代码示例

本文整理汇总了PHP中fRequest的典型用法代码示例。如果您正苦于以下问题:PHP fRequest类的具体用法?PHP fRequest怎么用?PHP fRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了fRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例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: generateHiddens

 private function generateHiddens(WpTesting_Model_Step $step)
 {
     $hiddens = array();
     $hiddens['passer_action'] = $step->isLast() ? WpTesting_Doer_TestPasser::ACTION_PROCESS_FORM : WpTesting_Doer_TestPasser::ACTION_FILL_FORM;
     if (!fRequest::isPost()) {
         return $hiddens;
     }
     unset($_POST['passer_action']);
     foreach ($_POST as $key => $value) {
         if (!is_array($value)) {
             $hiddens[$key] = $value;
             continue;
         }
         foreach ($value as $index => $subValue) {
             $hiddens["{$key}[{$index}]"] = $subValue;
         }
     }
     return $hiddens;
 }
开发者ID:pmanterys,项目名称:wp-mw-newsletter,代码行数:19,代码来源:FillForm.php

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: getopt

<?php

include_once 'inc/init.php';
$debug = false;
if (isset($_SERVER['argc'])) {
    $args = getopt('d::h::', array('debug', 'help'));
    if (isset($args['debug']) || isset($args['d'])) {
        $debug = true;
    } elseif (isset($args['help']) || isset($args['h'])) {
        print "Tattle Check Processor: \n" . "\n" . "--help, -h : Displays this help \n" . "\n" . "--debug, -d : Enables debuging (?debug=true can be used via a web request) \n";
    }
} elseif ($debug = fRequest::get('debug', 'boolean')) {
    $debug = true;
}
if ($debug) {
    print "debug enabled";
    fCore::enableDebugging(TRUE);
}
$checks = Check::findActive();
foreach ($checks as $check) {
    $data = Check::getData($check);
    if (count($data) > 0) {
        $title = $check->prepareName();
        fCore::debug('Processing :' . $title . ":\n", FALSE);
        $check_value = Check::getResultValue($data, $check);
        fCore::debug("Result :" . $check_value . ":\n", FALSE);
        $result = Check::setResultsLevel($check_value, $check);
        fCore::debug("Check Value:" . $result . ":\n", FALSE);
        if (is_null($check->getLastCheckTime())) {
            $next_check = new fTimestamp();
            fCore::debug("is null?\n", FALSE);
开发者ID:rberger,项目名称:Graphite-Tattle,代码行数:31,代码来源:processor.php

示例14: getSortDirection

 /**
  * Gets the current sort direction
  *
  * @param  string $default_direction  The default direction, `'asc'` or `'desc'`
  * @return string  The direction, `'asc'` or `'desc'`
  */
 public static function getSortDirection($default_direction)
 {
     // Reset value if requested
     if (self::wasResetRequested()) {
         self::setPreviousSortDirection(NULL);
         return;
     }
     if (self::getPreviousSortDirection() && !fRequest::check('dir')) {
         self::$sort_direction = self::getPreviousSortDirection();
         self::$loaded_values['dir'] = self::$sort_direction;
     } else {
         self::$sort_direction = fRequest::getValid('dir', array($default_direction, $default_direction == 'asc' ? 'desc' : 'asc'));
         self::setPreviousSortDirection(self::$sort_direction);
     }
     return self::$sort_direction;
 }
开发者ID:gopalgrover23,项目名称:flourish-classes,代码行数:22,代码来源:fCRUD.php

示例15: populate

 /**
  * Sets the values for this record by getting values from the request through the fRequest class
  * 
  * @return fActiveRecord  The record object, to allow for method chaining
  */
 public function populate()
 {
     $class = get_class($this);
     if (fORM::getActiveRecordMethod($class, 'populate')) {
         return $this->__call('populate', array());
     }
     fORM::callHookCallbacks($this, 'pre::populate()', $this->values, $this->old_values, $this->related_records, $this->cache);
     $schema = fORMSchema::retrieve($class);
     $table = fORM::tablize($class);
     $column_info = $schema->getColumnInfo($table);
     foreach ($column_info as $column => $info) {
         if (fRequest::check($column)) {
             $method = 'set' . fGrammar::camelize($column, TRUE);
             $cast_to = $info['type'] == 'blob' ? 'binary' : NULL;
             $this->{$method}(fRequest::get($column, $cast_to));
         }
     }
     fORM::callHookCallbacks($this, 'post::populate()', $this->values, $this->old_values, $this->related_records, $this->cache);
     return $this;
 }
开发者ID:mrjwc,项目名称:printmaster,代码行数:25,代码来源:fActiveRecord.php


注:本文中的fRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。