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


PHP Action::handle方法代码示例

本文整理汇总了PHP中Action::handle方法的典型用法代码示例。如果您正苦于以下问题:PHP Action::handle方法的具体用法?PHP Action::handle怎么用?PHP Action::handle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Action的用法示例。


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

示例1: handle

 /**
  * Handle request
  *
  * This is the main method for handling a request. Note that
  * most preparation should be done in the prepare() method;
  * by the time handle() is called the action should be
  * more or less ready to go.
  *
  * @param array $args $_REQUEST args; handled in prepare()
  *
  * @return void
  */
 function handle($args)
 {
     parent::handle($args);
     if (!common_logged_in()) {
         $this->clientError(_('Not logged in.'));
         return;
     }
     if (!$this->user->hasRole('grader')) {
         $this->clientError(_('Usted no tiene privilegios para visitar esta página.'));
         return;
     }
     $groupid = $this->trimmed('groupid');
     $delimiter = $this->trimmed('grade-export-delimiter');
     $separator = $this->trimmed('grade-export-separator');
     $arrayReport = Grades::getGradedNoticesAndUsersWithinGroup($groupid);
     $nicksMembers = Grades::getMembersNicksExcludeGradersAndAdmin($groupid);
     foreach ($nicksMembers as $nick) {
         if (!array_key_exists($nick, $arrayReport)) {
             $arrayReport[$nick] = 0;
         }
     }
     $arrayFinal = array();
     foreach ($arrayReport as $alumno => $puntuacion) {
         $arrayFinal[] = array($alumno, number_format($puntuacion, 2));
     }
     $this->generarInformeCSV($arrayFinal, 'report_group_' . $groupid . '.csv', $separator, $delimiter);
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:39,代码来源:GradeexportcsvAction.php

示例2: handle

 function handle($args)
 {
     parent::handle($args);
     if (common_is_real_login()) {
         $this->clientError(_('Already logged in.'));
     } else {
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $openid_url = $this->trimmed('openid_url');
             # CSRF protection
             $token = $this->trimmed('token');
             if (!$token || $token != common_session_token()) {
                 $this->showForm(_('There was a problem with your session token. Try again, please.'), $openid_url);
                 return;
             }
             $rememberme = $this->boolean('rememberme');
             common_ensure_session();
             $_SESSION['openid_rememberme'] = $rememberme;
             $result = oid_authenticate($openid_url, 'finishopenidlogin');
             if (is_string($result)) {
                 # error message
                 unset($_SESSION['openid_rememberme']);
                 $this->showForm($result, $openid_url);
             }
         } else {
             $openid_url = oid_get_last();
             $this->showForm(null, $openid_url);
         }
     }
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:29,代码来源:openidlogin.php

示例3: handle

 function handle($args)
 {
     parent::handle($args);
     if (common_is_real_login()) {
         // TRANS: Client error message trying to log on with OpenID while already logged on.
         $this->clientError(_m('Already logged in.'));
     } else {
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $provider = common_config('openid', 'trusted_provider');
             if ($provider) {
                 $openid_url = $provider;
                 if (common_config('openid', 'append_username')) {
                     $openid_url .= $this->trimmed('openid_username');
                 }
             } else {
                 $openid_url = $this->trimmed('openid_url');
             }
             oid_assert_allowed($openid_url);
             $rememberme = $this->boolean('rememberme');
             common_ensure_session();
             $_SESSION['openid_rememberme'] = $rememberme;
             $result = oid_authenticate($openid_url, 'finishopenidlogin');
             if (is_string($result)) {
                 # error message
                 unset($_SESSION['openid_rememberme']);
                 $this->showForm($result, $openid_url);
             }
         } else {
             $openid_url = oid_get_last();
             $this->showForm(null, $openid_url);
         }
     }
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:33,代码来源:openidlogin.php

示例4: handle

 /**
  * Handle the request
  *
  * @param array $args $_REQUEST data (unused)
  *
  * @return void
  */
 function handle($args)
 {
     parent::handle($args);
     if (empty($this->url)) {
         // TRANS: Form validation error displayed when a URL parameter is missing.
         $this->showError(_m('A URL parameter is required.'));
         return;
     }
     if (!empty($this->challenge)) {
         // must be a GET
         if ($_SERVER['REQUEST_METHOD'] != 'GET') {
             // TRANS: Form validation error displayed when HTTP GET is not used.
             $this->showError(_m('This resource requires an HTTP GET.'));
             return;
         }
         header('Content-Type: text/xml');
         echo $this->challenge;
     } else {
         // must be a POST
         if ($_SERVER['REQUEST_METHOD'] != 'POST') {
             // TRANS: Form validation error displayed when HTTP POST is not used.
             $this->showError(_m('This resource requires an HTTP POST.'));
             return;
         }
         header('Content-Type: text/xml');
         echo "<notifyResult success='true' msg='Thanks for the update.' />\n";
     }
     $this->ip = $_SERVER['REMOTE_ADDR'];
     common_log(LOG_INFO, 'RSSCloud Logging Aggregator - ' . $this->ip . ' claims the feed at ' . $this->url . ' has been updated.');
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:37,代码来源:loggingaggregator.php

示例5: handle

 /**
  * Class handler.
  *
  * @param array $args query arguments
  *
  * @return boolean false if user doesn't exist
  */
 function handle($args)
 {
     parent::handle($args);
     $type = $this->trimmed('type');
     $short_name = '';
     if ($type == 'people') {
         $type = 'peoplesearch';
         // TRANS: ShortName in the OpenSearch interface when trying to find users.
         $short_name = _('People Search');
     } else {
         $type = 'noticesearch';
         // TRANS: ShortName in the OpenSearch interface when trying to find notices.
         $short_name = _('Notice Search');
     }
     header('Content-Type: application/opensearchdescription+xml');
     $this->startXML();
     $this->elementStart('OpenSearchDescription', array('xmlns' => 'http://a9.com/-/spec/opensearch/1.1/'));
     $short_name = common_config('site', 'name') . ' ' . $short_name;
     $this->element('ShortName', null, $short_name);
     $this->element('Contact', null, common_config('site', 'email'));
     $this->element('Url', array('type' => 'text/html', 'method' => 'get', 'template' => str_replace('---', '{searchTerms}', common_local_url($type, array('q' => '---')))));
     $this->element('Image', array('height' => 16, 'width' => 16, 'type' => 'image/vnd.microsoft.icon'), common_path('favicon.ico'));
     $this->element('Image', array('height' => 50, 'width' => 50, 'type' => 'image/png'), Theme::path('logo.png'));
     $this->element('AdultContent', null, 'false');
     $this->element('Language', null, common_language());
     $this->element('OutputEncoding', null, 'UTF-8');
     $this->element('InputEncoding', null, 'UTF-8');
     $this->elementEnd('OpenSearchDescription');
     $this->endXML();
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:37,代码来源:opensearch.php

示例6: handle

 function handle($args)
 {
     parent::handle($args);
     if (common_logged_in()) {
         // TRANS: Client error displayed trying to recover password while already logged in.
         $this->clientError(_('You are already logged in!'));
         return;
     } else {
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             if ($this->arg('recover')) {
                 $this->recoverPassword();
             } else {
                 if ($this->arg('reset')) {
                     $this->resetPassword();
                 } else {
                     // TRANS: Client error displayed when unexpected data is posted in the password recovery form.
                     $this->clientError(_('Unexpected form submission.'));
                 }
             }
         } else {
             if ($this->trimmed('code')) {
                 $this->checkCode();
             } else {
                 $this->showForm();
             }
         }
     }
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:28,代码来源:recoverpassword.php

示例7: handle

 /**
  * Class handler.
  *
  * @param array $args query arguments
  *
  * @return void
  */
 function handle($args)
 {
     parent::handle($args);
     if (!common_logged_in()) {
         $this->clientError(_('Not logged in.'));
         return;
     }
     $user = common_current_user();
     if ($_SERVER['REQUEST_METHOD'] != 'POST') {
         common_redirect(common_local_url('all', array('nickname' => $user->nickname)));
         return;
     }
     $idGroup = $this->trimmed('idGroup');
     $token = $this->trimmed('token-' . $idGroup);
     if (!$token || $token != common_session_token()) {
         $this->clientError(_('There was a problem with your session token. Try again, please.'));
         return;
     }
     if ($this->trimmed('submit-auto') != null) {
         $groupids = NotesPDF::getNoticeIDsInAGroupModeAuto($idGroup);
         $notices = Notice::multiGet('id', $groupids)->fetchAll();
         GenerarPDF::content($idGroup, $notices, 'Automáticos');
     } else {
         if ($this->trimmed('submit-custom') != null) {
             $tag = $this->trimmed('combo-tag') == 'Todos' ? '%' : $this->trimmed('combo-tag');
             $nick = $this->trimmed('combo-user') == 'Todos' ? '%' : $this->trimmed('combo-user');
             $grade = $this->trimmed('combo-grade') == 'Todos' ? '%' : $this->trimmed('combo-grade');
             $noticeIds = NotesPDF::getNoticesInModeCustom(array('idGroup' => $idGroup, 'tag' => $tag, 'nick' => $nick, 'grade' => $grade));
             $notices = Notice::multiGet('id', $noticeIds)->fetchAll();
             GenerarPDF::content($idGroup, $notices, 'Personalizados');
         } else {
             $this->showForm('Error al generar los apuntes. Inténtelo de nuevo en unos minutos.');
         }
     }
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:42,代码来源:NotesgenerateAction.php

示例8: handle

 /**
  * Class handler.
  *
  * @param array $args query arguments
  *
  * @return void
  */
 function handle($args)
 {
     parent::handle($args);
     $xrdsOutputter = new XRDSOutputter();
     $xrdsOutputter->startXRDS();
     Event::handle('StartUserXRDS', array($this, &$xrdsOutputter));
     //oauth
     $xrdsOutputter->elementStart('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)', 'xml:id' => 'oauth', 'xmlns:simple' => 'http://xrds-simple.net/core/1.0', 'version' => '2.0'));
     $xrdsOutputter->element('Type', null, 'xri://$xrds*simple');
     $xrdsOutputter->showXrdsService(OAUTH_ENDPOINT_REQUEST, common_local_url('requesttoken'), array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY, OAUTH_HMAC_SHA1), null, $this->user->uri);
     $xrdsOutputter->showXrdsService(OAUTH_ENDPOINT_AUTHORIZE, common_local_url('userauthorization'), array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY, OAUTH_HMAC_SHA1));
     $xrdsOutputter->showXrdsService(OAUTH_ENDPOINT_ACCESS, common_local_url('accesstoken'), array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY, OAUTH_HMAC_SHA1));
     $xrdsOutputter->showXrdsService(OAUTH_ENDPOINT_RESOURCE, null, array(OAUTH_AUTH_HEADER, OAUTH_POST_BODY, OAUTH_HMAC_SHA1));
     $xrdsOutputter->elementEnd('XRD');
     //omb
     $xrdsOutputter->elementStart('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)', 'xml:id' => 'omb', 'xmlns:simple' => 'http://xrds-simple.net/core/1.0', 'version' => '2.0'));
     $xrdsOutputter->element('Type', null, 'xri://$xrds*simple');
     $xrdsOutputter->showXrdsService(OMB_ENDPOINT_POSTNOTICE, common_local_url('postnotice'));
     $xrdsOutputter->showXrdsService(OMB_ENDPOINT_UPDATEPROFILE, common_local_url('updateprofile'));
     $xrdsOutputter->elementEnd('XRD');
     Event::handle('EndUserXRDS', array($this, &$xrdsOutputter));
     //misc
     $xrdsOutputter->elementStart('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)', 'version' => '2.0'));
     $xrdsOutputter->showXrdsService(OAUTH_DISCOVERY, '#oauth');
     $xrdsOutputter->showXrdsService(OMB_VERSION, '#omb');
     $xrdsOutputter->elementEnd('XRD');
     $xrdsOutputter->endXRDS();
 }
开发者ID:himmelex,项目名称:NTW,代码行数:35,代码来源:xrds.php

示例9: handle

 /**
  * Handle input and output a page
  *
  * @param array $args $_REQUEST arguments
  *
  * @return void
  */
 function handle($args)
 {
     parent::handle($args);
     if (!common_logged_in()) {
         // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
         $this->clientError(_('Not logged in.'));
     } else {
         if (!common_is_real_login()) {
             // Cookie theft means that automatic logins can't
             // change important settings or see private info, and
             // _all_ our settings are important
             common_set_returnto($this->selfUrl());
             $user = common_current_user();
             if (Event::handle('RedirectToLogin', array($this, $user))) {
                 common_redirect(common_local_url('login'), 303);
             }
         } else {
             if ($_SERVER['REQUEST_METHOD'] == 'POST') {
                 $this->handlePost();
             } else {
                 $this->showForm();
             }
         }
     }
 }
开发者ID:phpsource,项目名称:gnu-social,代码行数:32,代码来源:settingsaction.php

示例10: handle

 function handle($args)
 {
     parent::handle($args);
     if (common_is_real_login()) {
         // TRANS: Client error message trying to log on with OpenID while already logged on.
         $this->clientError(_m('Already logged in.'));
     } else {
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $token = $this->trimmed('token');
             if (!$token || $token != common_session_token()) {
                 // TRANS: Message given when there is a problem with the user's session token.
                 $this->showForm(_m('There was a problem with your session token. Try again, please.'));
                 return;
             }
             if ($this->arg('create')) {
                 if (!$this->boolean('license')) {
                     // TRANS: Message given if user does not agree with the site's license.
                     $this->showForm(_m('You can\'t register if you don\'t agree to the license.'), $this->trimmed('newname'));
                     return;
                 }
                 $this->createNewUser();
             } else {
                 if ($this->arg('connect')) {
                     $this->connectUser();
                 } else {
                     // TRANS: Messag given on an unknown error.
                     $this->showForm(_m('An unknown error has occured.'), $this->trimmed('newname'));
                 }
             }
         } else {
             $this->tryLogin();
         }
     }
 }
开发者ID:Br3nda,项目名称:StatusNet,代码行数:34,代码来源:finishopenidlogin.php

示例11: handle

 /**
  * Handle input, produce output
  *
  * Switches based on GET or POST method. On GET, shows a form
  * for posting a notice. On POST, saves the results of that form.
  *
  * Results may be a full page, or just a single notice list item,
  * depending on whether AJAX was requested.
  *
  * @param array $args $_REQUEST contents
  *
  * @return void
  */
 function handle($args)
 {
     if (!common_logged_in()) {
         // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
         $this->clientError(_('Not logged in.'));
     } else {
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             // check for this before token since all POST and FILES data
             // is losts when size is exceeded
             if (empty($_POST) && $_SERVER['CONTENT_LENGTH']) {
                 // TRANS: Client error displayed when the number of bytes in a POST request exceeds a limit.
                 // TRANS: %s is the number of bytes of the CONTENT_LENGTH.
                 $msg = _m('The server was unable to handle that much POST data (%s byte) due to its current configuration.', 'The server was unable to handle that much POST data (%s bytes) due to its current configuration.', intval($_SERVER['CONTENT_LENGTH']));
                 $this->clientError(sprintf($msg, $_SERVER['CONTENT_LENGTH']));
             }
             parent::handle($args);
             $user = common_current_user();
             $group = User_group::staticGet('id', $this->trimmed('groupid'));
             $taskid = $this->trimmed('taskid');
             try {
                 $this->saveNewNotice();
                 Task::completeTask($user->id, $taskid);
             } catch (Exception $e) {
                 $this->ajaxErrorMsg($e->getMessage(), $taskid, $group);
                 return;
             }
         }
     }
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:42,代码来源:NewnoticetaskAction.php

示例12: handle

 /**
  * Handle input and output a page
  *
  * @param array $args $_REQUEST arguments
  *
  * @return void
  */
 function handle($args)
 {
     parent::handle($args);
     if (!common_logged_in()) {
         $this->clientError(_('Not logged in.'));
         return;
     } else {
         if (!common_is_real_login()) {
             // Cookie theft means that automatic logins can't
             // change important settings or see private info, and
             // _all_ our settings are important
             common_set_returnto($this->selfUrl());
             $user = common_current_user();
             if ($user->hasOpenID()) {
                 common_redirect(common_local_url('openidlogin'));
             } else {
                 common_redirect(common_local_url('login'));
             }
         } else {
             if ($_SERVER['REQUEST_METHOD'] == 'POST') {
                 $this->handlePost();
             } else {
                 $this->showForm();
             }
         }
     }
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:34,代码来源:settingsaction.php

示例13: handle

 function handle($args)
 {
     parent::handle($args);
     if (common_is_real_login()) {
         $this->clientError(_('Already logged in.'));
     } else {
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $token = $this->trimmed('token');
             if (!$token || $token != common_session_token()) {
                 $this->showForm(_('There was a problem with your session token. Try again, please.'));
                 return;
             }
             if ($this->arg('create')) {
                 if (!$this->boolean('license')) {
                     $this->showForm(_('You can\'t register if you don\'t agree to the license.'), $this->trimmed('newname'));
                     return;
                 }
                 $this->createNewUser();
             } else {
                 if ($this->arg('connect')) {
                     $this->connectUser();
                 } else {
                     common_debug(print_r($this->args, true), __FILE__);
                     $this->showForm(_('Something weird happened.'), $this->trimmed('newname'));
                 }
             }
         } else {
             $this->tryLogin();
         }
     }
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:31,代码来源:finishopenidlogin.php

示例14: handle

 /**
  * Class handler.
  *
  * @param array $args query arguments
  *
  * @return boolean false if nickname or user isn't found
  */
 protected function handle()
 {
     parent::handle();
     $nickname = $this->trimmed('nickname');
     if (!$nickname) {
         // TRANS: Client error displayed trying to get an avatar without providing a nickname.
         $this->clientError(_('No nickname.'));
     }
     $size = $this->trimmed('size') ?: 'original';
     $user = User::getKV('nickname', $nickname);
     if (!$user) {
         // TRANS: Client error displayed trying to get an avatar for a non-existing user.
         $this->clientError(_('No such user.'));
     }
     $profile = $user->getProfile();
     if (!$profile) {
         // TRANS: Error message displayed when referring to a user without a profile.
         $this->clientError(_('User has no profile.'));
     }
     if ($size === 'original') {
         try {
             $avatar = Avatar::getUploaded($profile);
             $url = $avatar->displayUrl();
         } catch (NoAvatarException $e) {
             $url = Avatar::defaultImage(AVATAR_PROFILE_SIZE);
         }
     } else {
         $url = $profile->avatarUrl($size);
     }
     common_redirect($url, 302);
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:38,代码来源:avatarbynickname.php

示例15: handle

 /**
  * Handle the request
  *
  * @param array $args $_REQUEST data (unused)
  *
  * @return void
  */
 function handle($args)
 {
     parent::handle($args);
     if (empty($this->url)) {
         $this->showError('Hey, you have to provide a url parameter.');
         return;
     }
     if (!empty($this->challenge)) {
         // must be a GET
         if ($_SERVER['REQUEST_METHOD'] != 'GET') {
             $this->showError('This resource requires an HTTP GET.');
             return;
         }
         header('Content-Type: text/xml');
         echo $this->challenge;
     } else {
         // must be a POST
         if ($_SERVER['REQUEST_METHOD'] != 'POST') {
             $this->showError('This resource requires an HTTP POST.');
             return;
         }
         header('Content-Type: text/xml');
         echo "<notifyResult success='true' msg='Thanks for the update.' />\n";
     }
     $this->ip = $_SERVER['REMOTE_ADDR'];
     common_log(LOG_INFO, 'RSSCloud Logging Aggregator - ' . $this->ip . ' claims the feed at ' . $this->url . ' has been updated.');
 }
开发者ID:himmelex,项目名称:NTW,代码行数:34,代码来源:LoggingAggregator.php


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