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


PHP Kit::ValidateParam方法代码示例

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


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

示例1: __construct

 /**
  * Layout Page Logic
  * @return 
  * @param $db Object
  */
 function __construct(database $db, user $user)
 {
     $this->db =& $db;
     $this->user =& $user;
     $this->sub_page = Kit::GetParam('sp', _GET, _WORD, 'view');
     $this->layoutid = Kit::GetParam('layoutid', _REQUEST, _INT);
     // If we have modify selected then we need to get some info
     if ($this->layoutid != '') {
         // get the permissions
         Debug::LogEntry('audit', 'Loading permissions for layoutid ' . $this->layoutid);
         $this->auth = $user->LayoutAuth($this->layoutid, true);
         if (!$this->auth->edit) {
             trigger_error(__("You do not have permissions to edit this layout"), E_USER_ERROR);
         }
         $this->sub_page = "edit";
         $sql = " SELECT layout, description, userid, retired, xml FROM layout ";
         $sql .= sprintf(" WHERE layoutID = %d ", $this->layoutid);
         if (!($results = $db->query($sql))) {
             trigger_error($db->error());
             trigger_error(__("Cannot retrieve the Information relating to this layout. The layout may be corrupt."), E_USER_ERROR);
         }
         if ($db->num_rows($results) == 0) {
             $this->has_permissions = false;
         }
         while ($aRow = $db->get_row($results)) {
             $this->layout = Kit::ValidateParam($aRow[0], _STRING);
             $this->description = Kit::ValidateParam($aRow[1], _STRING);
             $this->retired = Kit::ValidateParam($aRow[3], _INT);
             $this->xml = $aRow[4];
         }
     }
 }
开发者ID:rovak73,项目名称:xibo-cms,代码行数:37,代码来源:layout.class.php

示例2: Add

 public function Add($dataSetId, $heading, $dataTypeId, $listContent, $columnOrder = 0, $dataSetColumnTypeId = 1, $formula = '')
 {
     Debug::LogEntry('audit', sprintf('IN - DataSetID = %d', $dataSetId), 'DataSetColumn', 'Add');
     try {
         $dbh = PDOConnect::init();
         // Is the column order provided?
         if ($columnOrder == 0) {
             $SQL = "";
             $SQL .= "SELECT IFNULL(MAX(ColumnOrder), 1) AS ColumnOrder ";
             $SQL .= "  FROM datasetcolumn ";
             $SQL .= "WHERE datasetID = :datasetid ";
             $sth = $dbh->prepare($SQL);
             $sth->execute(array('datasetid' => $dataSetId));
             if (!($row = $sth->fetch())) {
                 return $this->SetError(25005, __('Could not determine the Column Order'));
             }
             $columnOrder = Kit::ValidateParam($row['ColumnOrder'], _INT);
         }
         // Insert the data set column
         $SQL = "INSERT INTO datasetcolumn (DataSetID, Heading, DataTypeID, ListContent, ColumnOrder, DataSetColumnTypeID, Formula) ";
         $SQL .= "    VALUES (:datasetid, :heading, :datatypeid, :listcontent, :columnorder, :datasetcolumntypeid, :formula) ";
         $sth = $dbh->prepare($SQL);
         $sth->execute(array('datasetid' => $dataSetId, 'heading' => $heading, 'datatypeid' => $dataTypeId, 'listcontent' => $listContent, 'columnorder' => $columnOrder, 'datasetcolumntypeid' => $dataSetColumnTypeId, 'formula' => $formula));
         $id = $dbh->lastInsertId();
         Debug::LogEntry('audit', 'Complete', 'DataSetColumn', 'Add');
         return $id;
     } catch (Exception $e) {
         Debug::LogEntry('error', $e->getMessage());
         return $this->SetError(25005, __('Could not add DataSet Column'));
     }
 }
开发者ID:abbeet,项目名称:server39,代码行数:31,代码来源:datasetcolumn.data.class.php

示例3: Version

 /**
  * Defines the Version and returns it
  * @return 
  * @param $object String [optional]
  */
 static function Version($object = '')
 {
     try {
         $dbh = PDOConnect::init();
         $sth = $dbh->prepare('SELECT app_ver, XlfVersion, XmdsVersion, DBVersion FROM version');
         $sth->execute();
         if (!($row = $sth->fetch())) {
             throw new Exception('No results returned');
         }
         $appVer = Kit::ValidateParam($row['app_ver'], _STRING);
         $xlfVer = Kit::ValidateParam($row['XlfVersion'], _INT);
         $xmdsVer = Kit::ValidateParam($row['XmdsVersion'], _INT);
         $dbVer = Kit::ValidateParam($row['DBVersion'], _INT);
         if (!defined('VERSION')) {
             define('VERSION', $appVer);
         }
         if (!defined('DBVERSION')) {
             define('DBVERSION', $dbVer);
         }
         if ($object != '') {
             return Kit::GetParam($object, $row, _STRING);
         }
         return $row;
     } catch (Exception $e) {
         trigger_error($e->getMessage());
         trigger_error(__('No Version information - please contact technical support'), E_USER_WARNING);
     }
 }
开发者ID:abbeet,项目名称:server39,代码行数:33,代码来源:config.class.php

示例4: ValidateQuestion

 public function ValidateQuestion($questionNumber, $response)
 {
     switch ($questionNumber) {
         case 0:
             if (Kit::ValidateParam($response, _BOOL)) {
                 $this->a[0] = "Protected";
             } else {
                 $this->a[0] = "Off";
             }
             return true;
         case 1:
             $this->a[1] = Kit::ValidateParam($response, _INT, 30);
             return true;
         case 2:
             $this->a[2] = Kit::ValidateParam($response, _INT, 30);
             return true;
         case 3:
             $this->a[3] = Kit::ValidateParam($response, _BOOL);
             return true;
         case 4:
             // TODO: Teach Kit how to validate email addresses?
             $this->a[4] = Kit::ValidateParam($response, _PASSWORD);
             return true;
         case 5:
             // TODO: Teach Kit how to validate email addresses?
             $this->a[5] = Kit::ValidateParam($response, _PASSWORD);
             return true;
         case 6:
             $this->a[6] = Kit::ValidateParam($response, _INT, 12);
             return true;
     }
     return false;
 }
开发者ID:taphier,项目名称:xibo-cms,代码行数:33,代码来源:23.php

示例5: ValidateQuestion

 public function ValidateQuestion($questionNumber, $response)
 {
     switch ($questionNumber) {
         case 0:
             $this->a[0] = Kit::ValidateParam($response, _BOOL);
             return true;
     }
     return false;
 }
开发者ID:fignew,项目名称:xibo-cms,代码行数:9,代码来源:48.php

示例6: UnlinkAllFromMedia

 /**
  * Unlink all media from the provided media item
  * @param int $mediaid The media item to unlink from
  */
 public function UnlinkAllFromMedia($mediaid)
 {
     Debug::LogEntry('audit', 'IN', get_class(), __FUNCTION__);
     try {
         $dbh = PDOConnect::init();
         $mediaid = Kit::ValidateParam($mediaid, _INT, false);
         $sth = $dbh->prepare('DELETE FROM `lkmediadisplaygroup` WHERE mediaid = :mediaid');
         $sth->execute(array('mediaid' => $mediaid));
         return true;
     } catch (Exception $e) {
         Debug::LogEntry('error', $e->getMessage(), get_class(), __FUNCTION__);
         if (!$this->IsError()) {
             $this->SetError(1, __('Unknown Error'));
         }
         return false;
     }
 }
开发者ID:fignew,项目名称:xibo-cms,代码行数:21,代码来源:lkmediadisplaygroup.data.class.php

示例7: LinkEveryone

 /**
  * Links everyone to the layout specified
  * @param <type> $layoutId
  * @param <type> $view
  * @param <type> $edit
  * @param <type> $del
  * @return <type>
  */
 public function LinkEveryone($dataSetId, $view, $edit, $del)
 {
     Debug::LogEntry('audit', 'IN', 'DataSetGroupSecurity', 'LinkEveryone');
     try {
         $dbh = PDOConnect::init();
         // Get the Group ID for Everyone
         $sth = $dbh->prepare('SELECT GroupID FROM `group` WHERE IsEveryone = 1');
         $sth->execute();
         if (!($row = $sth->fetch())) {
             throw new Exception('Missing Everyone group');
         }
         // Link
         return $this->Link($dataSetId, Kit::ValidateParam($row['GroupID'], _INT), $view, $edit, $del);
     } catch (Exception $e) {
         Debug::LogEntry('error', $e->getMessage());
         return $this->SetError(25024, __('Could not Link DataSet to Group'));
     }
 }
开发者ID:abbeet,项目名称:server39,代码行数:26,代码来源:datasetgroupsecurity.data.class.php

示例8: ChangePassword

 /**
  * Change a users password
  * @param <type> $userId
  * @param <type> $oldPassword
  * @param <type> $newPassword
  * @param <type> $retypedNewPassword
  * @return <type> 
  */
 public function ChangePassword($userId, $oldPassword, $newPassword, $retypedNewPassword, $forceChange = false)
 {
     try {
         $dbh = PDOConnect::init();
         // Validate
         if ($userId == 0) {
             $this->ThrowError(26001, __('User not selected'));
         }
         // We can force the users password to change without having to provide the old one.
         // Is this a potential security hole - we must have validated that we are an admin to get to this point
         if (!$forceChange) {
             // Get the stored hash
             $sth = $dbh->prepare('SELECT UserPassword FROM `user` WHERE UserID = :userid');
             $sth->execute(array('userid' => $userId));
             if (!($row = $sth->fetch())) {
                 $this->ThrowError(26000, __('Incorrect Password Provided'));
             }
             $good_hash = Kit::ValidateParam($row['UserPassword'], _STRING);
             // Check the Old Password is correct
             if ($this->validate_password($oldPassword, $good_hash) === false) {
                 $this->ThrowError(26000, __('Incorrect Password Provided'));
             }
         }
         // Check the New Password and Retyped Password match
         if ($newPassword != $retypedNewPassword) {
             $this->ThrowError(26001, __('New Passwords do not match'));
         }
         // Check password complexity
         if (!$this->TestPasswordAgainstPolicy($newPassword)) {
             throw new Exception("Error Processing Request", 1);
         }
         // Generate a new SALT and Password
         $hash = $this->create_hash($newPassword);
         $sth = $dbh->prepare('UPDATE `user` SET UserPassword = :hash, CSPRNG = 1 WHERE UserID = :userid');
         $sth->execute(array('hash' => $hash, 'userid' => $userId));
         return true;
     } catch (Exception $e) {
         Debug::LogEntry('error', $e->getMessage());
         if (!$this->IsError()) {
             $this->SetError(25000, __('Could not edit Password'));
         }
         return false;
     }
 }
开发者ID:abbeet,项目名称:server39,代码行数:52,代码来源:userdata.data.class.php

示例9: add

 public function add($tag)
 {
     try {
         $dbh = PDOConnect::init();
         // See if it exists
         $sth = $dbh->prepare('SELECT * FROM `tag` WHERE tag = :tag');
         $sth->execute(array('tag' => $tag));
         if ($row = $sth->fetch()) {
             return Kit::ValidateParam($row['tagId'], _INT);
         }
         // Insert if not
         $sth = $dbh->prepare('INSERT INTO `tag` (tag) VALUES (:tag)');
         $sth->execute(array('tag' => $tag));
         return $dbh->lastInsertId();
     } catch (Exception $e) {
         Debug::LogEntry('error', $e->getMessage(), get_class(), __FUNCTION__);
         if (!$this->IsError()) {
             $this->SetError(1, __('Unknown Error'));
         }
         return false;
     }
 }
开发者ID:fignew,项目名称:xibo-cms,代码行数:22,代码来源:tag.data.class.php

示例10: LinkEveryone

 /**
  * Links everyone to the layout specified
  * @param <type> $layoutId
  * @param <type> $view
  * @param <type> $edit
  * @param <type> $del
  * @return <type>
  */
 public function LinkEveryone($layoutId, $regionId, $mediaId, $view, $edit, $del)
 {
     try {
         $dbh = PDOConnect::init();
         $sth = $dbh->prepare('SELECT GroupID FROM `group` WHERE IsEveryone = 1');
         $sth->execute();
         if (!($row = $sth->fetch())) {
             throw new Exception("Error Processing Request", 1);
         }
         $groupId = Kit::ValidateParam($row['GroupID'], _INT);
         if (!$this->Link($layoutId, $regionId, $mediaId, $groupId, $view, $edit, $del)) {
             throw new Exception("Error Processing Request", 1);
         }
         return true;
     } catch (Exception $e) {
         Debug::LogEntry('error', $e->getMessage());
         if (!$this->IsError()) {
             $this->SetError(1, __('Unknown Error'));
         }
         return false;
     }
 }
开发者ID:abbeet,项目名称:server39,代码行数:30,代码来源:layoutmediagroupsecurity.data.class.php

示例11: TransitionAuth

 /**
  * Get a list of transitions
  * @param string in/out
  * @param string transition code
  * @return boolean
  */
 public function TransitionAuth($type = '', $code = '')
 {
     // Return a list of in/out transitions (or both)
     $SQL = 'SELECT TransitionID, ';
     $SQL .= '   Transition, ';
     $SQL .= '   Code, ';
     $SQL .= '   HasDuration, ';
     $SQL .= '   HasDirection, ';
     $SQL .= '   AvailableAsIn, ';
     $SQL .= '   AvailableAsOut ';
     $SQL .= '  FROM `transition` ';
     $SQL .= ' WHERE 1 = 1 ';
     if ($type != '') {
         // Filter on type
         if ($type == 'in') {
             $SQL .= '  AND AvailableAsIn = 1 ';
         }
         if ($type == 'out') {
             $SQL .= '  AND AvailableAsOut = 1 ';
         }
     }
     if ($code != '') {
         // Filter on code
         $SQL .= sprintf("AND Code = '%s' ", $this->db->escape_string($code));
     }
     $SQL .= ' ORDER BY Transition ';
     $rows = $this->db->GetArray($SQL);
     if (!is_array($rows)) {
         trigger_error($this->db->error());
         return false;
     }
     $transitions = array();
     foreach ($rows as $transition) {
         $transitionItem = array();
         $transitionItem['transitionid'] = Kit::ValidateParam($transition['TransitionID'], _INT);
         $transitionItem['transition'] = Kit::ValidateParam($transition['Transition'], _STRING);
         $transitionItem['code'] = Kit::ValidateParam($transition['Code'], _WORD);
         $transitionItem['hasduration'] = Kit::ValidateParam($transition['HasDuration'], _INT);
         $transitionItem['hasdirection'] = Kit::ValidateParam($transition['HasDirection'], _INT);
         $transitionItem['enabledforin'] = Kit::ValidateParam($transition['AvailableAsIn'], _INT);
         $transitionItem['enabledforout'] = Kit::ValidateParam($transition['AvailableAsOut'], _INT);
         $transitionItem['class'] = ($transitionItem['hasduration'] == 1 ? 'hasDuration' : '') . ' ' . ($transitionItem['hasdirection'] == 1 ? 'hasDirection' : '');
         $transitions[] = $transitionItem;
     }
     return $transitions;
 }
开发者ID:abbeet,项目名称:server39,代码行数:52,代码来源:module_user_general.php

示例12: Grid

 function Grid()
 {
     $db =& $this->db;
     $response = new ResponseManager();
     $type = Kit::GetParam('filter_type', _POST, _WORD);
     $fromDt = Kit::GetParam('filter_fromdt', _POST, _STRING);
     setSession('sessions', 'Filter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
     setSession('sessions', 'filter_type', $type);
     setSession('sessions', 'filter_fromdt', $fromDt);
     $SQL = "SELECT session.userID, user.UserName,  IsExpired, LastPage,  session.LastAccessed,  RemoteAddr,  UserAgent ";
     $SQL .= "FROM `session` LEFT OUTER JOIN user ON user.userID = session.userID ";
     $SQL .= "WHERE 1 = 1 ";
     if ($fromDt != '') {
         // From Date is the Calendar Formatted DateTime in ISO format
         $SQL .= sprintf(" AND session.LastAccessed < '%s' ", DateManager::getMidnightSystemDate(DateManager::getTimestampFromString($fromDt)));
     }
     if ($type == "active") {
         $SQL .= " AND IsExpired = 0 ";
     }
     if ($type == "expired") {
         $SQL .= " AND IsExpired = 1 ";
     }
     if ($type == "guest") {
         $SQL .= " AND session.userID IS NULL ";
     }
     // Load results into an array
     $log = $db->GetArray($SQL);
     Debug::LogEntry('audit', $SQL);
     if (!is_array($log)) {
         trigger_error($db->error());
         trigger_error(__('Error getting the log'), E_USER_ERROR);
     }
     $cols = array(array('name' => 'lastaccessed', 'title' => __('Last Accessed')), array('name' => 'isexpired', 'title' => __('Active'), 'icons' => true), array('name' => 'username', 'title' => __('User Name')), array('name' => 'lastpage', 'title' => __('Last Page')), array('name' => 'ip', 'title' => __('IP Address')), array('name' => 'browser', 'title' => __('Browser')));
     Theme::Set('table_cols', $cols);
     $rows = array();
     foreach ($log as $row) {
         $row['userid'] = Kit::ValidateParam($row['userID'], _INT);
         $row['username'] = Kit::ValidateParam($row['UserName'], _STRING);
         $row['isexpired'] = Kit::ValidateParam($row['IsExpired'], _INT) == 1 ? 0 : 1;
         $row['lastpage'] = Kit::ValidateParam($row['LastPage'], _STRING);
         $row['lastaccessed'] = DateManager::getLocalDate(strtotime(Kit::ValidateParam($row['LastAccessed'], _STRING)));
         $row['ip'] = Kit::ValidateParam($row['RemoteAddr'], _STRING);
         $row['browser'] = Kit::ValidateParam($row['UserAgent'], _STRING);
         // Edit
         $row['buttons'][] = array('id' => 'sessions_button_logout', 'url' => 'index.php?p=sessions&q=ConfirmLogout&userid=' . $row['userid'], 'text' => __('Logout'));
         $rows[] = $row;
     }
     Theme::Set('table_rows', $rows);
     $response->SetGridResponse(Theme::RenderReturn('table_render'));
     $response->Respond();
 }
开发者ID:fignew,项目名称:xibo-cms,代码行数:51,代码来源:sessions.class.php

示例13: GetColumns

 public function GetColumns($dataSetId)
 {
     if ($dataSetId == 0 || $dataSetId == '') {
         return $this->SetError(25001, __('Missing dataSetId'));
     }
     try {
         $dbh = PDOConnect::init();
         $sth = $dbh->prepare('SELECT DataSetColumnID, Heading, datatype.DataType, datasetcolumntype.DataSetColumnType, ListContent, ColumnOrder 
               FROM datasetcolumn 
                INNER JOIN `datatype` 
                ON datatype.DataTypeID = datasetcolumn.DataTypeID 
                INNER JOIN `datasetcolumntype` 
                ON datasetcolumntype.DataSetColumnTypeID = datasetcolumn.DataSetColumnTypeID 
              WHERE DataSetID = :datasetid
             ORDER BY ColumnOrder ');
         $sth->execute(array('datasetid' => $dataSetId));
         $results = $sth->fetchAll();
         // Check there are some columns returned
         if (count($results) <= 0) {
             $this->ThrowError(__('No columns'));
         }
         $rows = array();
         foreach ($results as $row) {
             $col['datasetcolumnid'] = Kit::ValidateParam($row['DataSetColumnID'], _INT);
             $col['heading'] = Kit::ValidateParam($row['Heading'], _STRING);
             $col['listcontent'] = Kit::ValidateParam($row['ListContent'], _STRING);
             $col['columnorder'] = Kit::ValidateParam($row['ColumnOrder'], _INT);
             $col['datatype'] = Kit::ValidateParam($row['DataType'], _STRING);
             $col['datasetcolumntype'] = Kit::ValidateParam($row['DataSetColumnType'], _STRING);
             $rows[] = $col;
         }
         Debug::LogEntry('audit', sprintf('Returning %d columns.', count($rows)), 'DataSetColumn', 'GetColumns');
         return $rows;
     } catch (Exception $e) {
         Debug::LogEntry('error', $e->getMessage());
         if (!$this->IsError()) {
             $this->SetError(1, __('Unknown Error'));
         }
         return false;
     }
 }
开发者ID:fignew,项目名称:xibo-cms,代码行数:41,代码来源:datasetcolumn.data.class.php

示例14: EditForm

 /**
  * Edit Form
  */
 public function EditForm()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $helpManager = new HelpManager($db, $user);
     // Can we edit?
     if (Config::GetSetting('MODULE_CONFIG_LOCKED_CHECKB') == 'Checked') {
         trigger_error(__('Module Config Locked'), E_USER_ERROR);
     }
     $moduleId = Kit::GetParam('ModuleID', _GET, _INT);
     // Pull the currently known info from the DB
     $SQL = '';
     $SQL .= 'SELECT ModuleID, ';
     $SQL .= '   Name, ';
     $SQL .= '   Enabled, ';
     $SQL .= '   Description, ';
     $SQL .= '   RegionSpecific, ';
     $SQL .= '   ValidExtensions, ';
     $SQL .= '   ImageUri, ';
     $SQL .= '   PreviewEnabled ';
     $SQL .= '  FROM `module` ';
     $SQL .= ' WHERE ModuleID = %d ';
     $SQL = sprintf($SQL, $moduleId);
     if (!($row = $db->GetSingleRow($SQL))) {
         trigger_error($db->error());
         trigger_error(__('Error getting Module'));
     }
     Theme::Set('validextensions', Kit::ValidateParam($row['ValidExtensions'], _STRING));
     Theme::Set('imageuri', Kit::ValidateParam($row['ImageUri'], _STRING));
     Theme::Set('isregionspecific', Kit::ValidateParam($row['RegionSpecific'], _INT));
     Theme::Set('enabled_checked', Kit::ValidateParam($row['Enabled'], _INT) ? 'checked' : '');
     Theme::Set('preview_enabled_checked', Kit::ValidateParam($row['PreviewEnabled'], _INT) ? 'checked' : '');
     // Set some information about the form
     Theme::Set('form_id', 'ModuleEditForm');
     Theme::Set('form_action', 'index.php?p=module&q=Edit');
     Theme::Set('form_meta', '<input type="hidden" name="ModuleID" value="' . $moduleId . '" />');
     $form = Theme::RenderReturn('module_form_edit');
     $response->SetFormRequestResponse($form, __('Edit Module'), '350px', '325px');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . $helpManager->Link('Module', 'Edit') . '")');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Save'), '$("#ModuleEditForm").submit()');
     $response->Respond();
 }
开发者ID:abbeet,项目名称:server39,代码行数:47,代码来源:module.class.php

示例15: GetSingleValue

 /**
  * Gets a single value from the provided SQL
  * @param <string> $SQL
  * @param <string> $columnName
  * @param <int> $dataType
  * @return <type>
  */
 public function GetSingleValue($SQL, $columnName, $dataType)
 {
     if (!($row = $this->GetSingleRow($SQL))) {
         return false;
     }
     if (!isset($row[$columnName])) {
         $this->error_text = 'No such column or column is null';
         return false;
     }
     return Kit::ValidateParam($row[$columnName], $dataType);
 }
开发者ID:fignew,项目名称:xibo-cms,代码行数:18,代码来源:module_db_mysql.php


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