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


PHP WebRequest::getPostKeys方法代码示例

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


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

示例1: runPage

 protected function runPage()
 {
     try {
         self::checkAccess('edit-access-levels');
         $this->mSmarty->assign("readonly", '');
     } catch (AccessDeniedException $ex) {
         // caution: if you're copying this, this is a hack to make sure
         //			users know they don't have the access to do this, not
         // 			to actually stop them from doing it, though it will have
         // 			that effect to the non-tech-savvy.
         $this->mSmarty->assign("readonly", 'disabled="disabled"');
     }
     if (WebRequest::wasPosted()) {
         // make SURE we have the right access level for this operation
         self::checkAccess('edit-access-levels');
         foreach (WebRequest::getPostKeys() as $k) {
             $entry = StaffAccess::getById($k);
             if ($entry == null) {
                 continue;
             }
             if ($entry->getLevel() != WebRequest::postInt($k)) {
                 $entry->setLevel(WebRequest::postInt($k));
                 $entry->save();
             }
         }
         global $cWebPath;
         $this->mHeaders[] = "HTTP/1.1 303 See Other";
         $this->mHeaders[] = "Location: " . $cWebPath . "/management.php/Access";
         return;
     }
     $this->mBasePage = "mgmt/access.tpl";
     $accesslist = array();
     $accessKeys = StaffAccess::getKnownActions();
     foreach ($accessKeys as $k) {
         $accessEntry = StaffAccess::getByAction($k);
         global $gLogger;
         $gLogger->log("Access entry {$accessEntry->getAction()}({$accessEntry->getLevel()}) found!");
         $accesslist[] = array(id => $accessEntry->getId(), name => $accessEntry->getAction(), value => $accessEntry->getLevel());
     }
     $this->mSmarty->assign("accesslist", $accesslist);
 }
开发者ID:vulnerabilityCode,项目名称:hotel-system,代码行数:41,代码来源:MPageAccess.php

示例2: save

 private function save()
 {
     $keys = WebRequest::getPostKeys();
     foreach ($keys as $k) {
         // extract id from POST request
         $id = str_replace("lang", "", $k);
         $id = str_replace("msg", "", $id);
         if (!is_numeric($id)) {
             throw new ArgumentException("{$k}: [{$id}] is not an integer", 0);
         }
         // retrieve message object
         $message = Message::getById($id);
         if ($message == null) {
             throw new ArgumentException("Message ID {$id} could not be found");
         }
         $value = WebRequest::post($k);
         if ($message->getContent != $value) {
             // write content
             $message->setContent($value);
             // save object
             $message->save();
         }
     }
 }
开发者ID:vulnerabilityCode,项目名称:hotel-system,代码行数:24,代码来源:MPageLanguages.php


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