本文整理汇总了PHP中Valid_UInt::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP Valid_UInt::validate方法的具体用法?PHP Valid_UInt::validate怎么用?PHP Valid_UInt::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Valid_UInt
的用法示例。
在下文中一共展示了Valid_UInt::validate方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUInt
function testUInt()
{
$v = new Valid_UInt();
$v->disableFeedback();
$this->assertTrue($v->validate('0'));
$this->assertTrue($v->validate('1'));
$this->assertTrue($v->validate('2147483647'));
$this->assertFalse($v->validate('-1'));
// With a value lower than -2^31 it may imply a int overflow that may
// generate a positive int (in this case: 2^31-1).
$this->assertFalse($v->validate('-2147483649'));
$this->assertFalse($v->validate('0.5'));
$this->assertFalse($v->validate('toto'));
}
示例2: deleteAttachments
/**
* Perform wiki attachment removal.
*/
function deleteAttachments()
{
$request = HTTPRequest::instance();
if ($request->isPost() && $request->exist('attachments_to_delete')) {
$args = $request->get('attachments_to_delete');
$deleteStatus = true;
$um = UserManager::instance();
$user = $um->getCurrentUser();
foreach ($args as $id) {
$valid = new Valid_UInt('repo_id');
$valid->required();
if ($valid->validate($id)) {
$wa = new WikiAttachment();
$wa->initWithId($id);
if ($wa->validate() && $wa->gid == $_REQUEST['group_id'] && $wa->isAutorized($user->getId())) {
if (!$wa->deleteAttachment()) {
$deleteStatus = false;
}
} else {
$deleteStatus = false;
}
} else {
$deleteStatus = false;
}
}
if ($deleteStatus) {
$GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('wiki_actions_wikiserviceadmin', 'delete_attachment_success'));
} else {
$GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('wiki_actions_wikiserviceadmin', 'delete_attachment_failure'));
}
}
}
示例3: frs_process_release_form
function frs_process_release_form($is_update, $request, $group_id, $title, $url)
{
global $frspf, $frsrf, $frsff;
$pm = ProjectManager::instance();
//get and filter all inputs from $request
$release = array();
$res = $request->get('release');
$vName = new Valid_String();
$vPackage_id = new Valid_UInt();
$vStatus_id = new Valid_UInt();
if ($vName->validate($res['name']) && $vPackage_id->validate($res['package_id']) && $vStatus_id->validate($res['status_id'])) {
$release['status_id'] = $res['status_id'];
$release['name'] = $res['name'];
$release['package_id'] = $res['package_id'];
} else {
$GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('file_admin_editreleases', 'rel_update_failed'));
$GLOBALS['Response']->redirect('/file/showfiles.php?group_id=' . $group_id);
}
$um = UserManager::instance();
$user = $um->getCurrentUser();
$vDate = new Valid_String();
if ($vDate->validate($res['date'])) {
$release['date'] = $res['date'];
} else {
$release['date'] = "";
}
$vRelease_notes = new Valid_Text();
if ($vRelease_notes->validate($res['release_notes'])) {
$release['release_notes'] = $res['release_notes'];
} else {
$release['release_notes'] = "";
}
$vChange_log = new Valid_Text();
if ($vChange_log->validate($res['change_log'])) {
$release['change_log'] = $res['change_log'];
} else {
$release['change_log'] = "";
}
if ($request->valid(new Valid_String('js'))) {
$js = $request->get('js');
} else {
$js = "";
}
if ($request->validArray(new Valid_String('ftp_file'))) {
$ftp_file = $request->get('ftp_file');
} else {
$ftp_file = array();
}
if ($request->validArray(new Valid_UInt('file_processor'))) {
$file_processor = $request->get('file_processor');
} else {
$file_processor = array();
}
if ($request->validArray(new Valid_UInt('file_type'))) {
$file_type = $request->get('file_type');
} else {
$file_type = array();
}
if ($request->validArray(new Valid_String('reference_md5'))) {
$reference_md5 = $request->get('reference_md5');
} else {
$reference_md5 = array();
}
if ($request->validArray(new Valid_String('comment'))) {
$comment = $request->get('comment');
} else {
$comment = array();
}
if ($request->validArray(new Valid_UInt('ftp_file_processor'))) {
$ftp_file_processor = $request->get('ftp_file_processor');
} else {
$ftp_file_processor = array();
}
if ($request->validArray(new Valid_UInt('ftp_file_type'))) {
$ftp_file_type = $request->get('ftp_file_type');
} else {
$ftp_file_type = array();
}
if ($request->validArray(new Valid_String('ftp_reference_md5'))) {
$ftp_reference_md5 = $request->get('ftp_reference_md5');
} else {
$ftp_reference_md5 = array();
}
if ($request->valid(new Valid_String('release_news_subject'))) {
$release_news_subject = $request->get('release_news_subject');
} else {
$release_news_subject = "";
}
if ($request->valid(new Valid_Text('release_news_details'))) {
$release_news_details = $request->get('release_news_details');
} else {
$release_news_details = "";
}
if ($request->valid(new Valid_WhiteList('private_news', array(0, 1)))) {
$private_news = $request->get('private_news');
} else {
$private_news = 0;
}
if ($request->validArray(new Valid_UInt('ugroups'))) {
$ugroups = $request->get('ugroups');
//.........这里部分代码省略.........
示例4: inconsistentArtifactsIdsAreValid
private function inconsistentArtifactsIdsAreValid(array $artifact_ids)
{
$validator = new Valid_UInt();
$validator->required();
$artifact_factory = Tracker_ArtifactFactory::instance();
foreach ($artifact_ids as $artifact_id) {
if (!($validator->validate($artifact_id) && $artifact_factory->getArtifactById($artifact_id))) {
return false;
}
}
return true;
}
示例5: displayForm
/**
* Display form to fill a request
*
* @param Array $params params of the hook
*
* @return Void
*/
function displayForm($params = null)
{
$um = UserManager::instance();
$user = $um->getCurrentUser();
$ignoreLabs = $this->getController()->getPlugin()->getProperty('ignore_labs');
if ($user->isLoggedIn() && ($ignoreLabs || $user->useLabFeatures())) {
$type = RequestHelp::TYPE_SUPPORT;
$severity = RequestHelp::SEVERITY_MINOR;
$summary = '';
$description = $GLOBALS['Language']->getText('plugin_requesthelp', 'requesthelp_default_description');
$cc = '';
if (is_array($params)) {
$valid = new Valid_UInt();
if (isset($params['type']) && $valid->validate($params['type'])) {
$type = $params['type'];
}
if (isset($params['severity']) && $valid->validate($params['severity'])) {
$severity = $params['severity'];
}
$valid = new Valid_String();
if (isset($params['summary']) && $valid->validate($params['summary'])) {
$summary = $params['summary'];
}
$valid = new Valid_Text();
if (isset($params['description']) && $valid->validate($params['description'])) {
$description = $params['description'];
}
$valid = new Valid_String();
if (isset($params['cc']) && $valid->validate($params['cc'])) {
$cc = $params['cc'];
}
}
$p = PluginManager::instance()->getPluginByName('requesthelp');
echo '<fieldset class="requesthelp_fieldset">
<legend><b>' . $GLOBALS['Language']->getText('plugin_requesthelp', 'requesthelp_explain_label') . '</b></legend>
<form name="request" class="requesthelp_cssform" action="' . $p->getPluginPath() . '/" method="post" enctype="multipart/form-data">
<table>
<tr>';
echo '<td><b><a class="tooltip" href="#" title="' . $GLOBALS['Language']->getText('plugin_requesthelp', 'tooltip_type') . '">Type:</a></b> <span class="highlight"><big>*</big></b></span></td><td><select name="type"><option value="' . RequestHelp::TYPE_SUPPORT . '" ';
if ($type == RequestHelp::TYPE_SUPPORT) {
echo 'selected';
}
echo '>' . $GLOBALS['Language']->getText('plugin_requesthelp', 'Support_request') . '</option>
<option value="' . RequestHelp::TYPE_ENHANCEMENT . '" ';
if ($type == RequestHelp::TYPE_ENHANCEMENT) {
echo 'selected';
}
echo '>' . $GLOBALS['Language']->getText('plugin_requesthelp', 'Enhancement_request') . '</option>
</select>';
echo '</td><td align="right"><b><a class="tooltip" href="#" title="' . $GLOBALS['Language']->getText('plugin_requesthelp', 'tooltip_severity') . '">' . $GLOBALS['Language']->getText('plugin_requesthelp', 'severity') . ':</a></b> <span class="highlight"><big>*</big></b></span>
<select name="severity">
<option value="' . RequestHelp::SEVERITY_MINOR . '" ';
if ($severity == RequestHelp::SEVERITY_MINOR) {
echo 'selected';
}
echo '>' . $GLOBALS['Language']->getText('plugin_requesthelp', 'Minor') . '</option>
<option value="' . RequestHelp::SEVERITY_SERIOUS . '" ';
if ($severity == RequestHelp::SEVERITY_SERIOUS) {
echo 'selected';
}
echo '>' . $GLOBALS['Language']->getText('plugin_requesthelp', 'Serious') . '</option>
<option value="' . RequestHelp::SEVERITY_CRITICAL . '" ';
if ($severity == RequestHelp::SEVERITY_CRITICAL) {
echo 'selected';
}
echo '>' . $GLOBALS['Language']->getText('plugin_requesthelp', 'Critical') . '</option>
</select>
</td>
</tr>';
echo '<tr><td><b><a class="tooltip" href="#" title="' . $GLOBALS['Language']->getText('plugin_requesthelp', 'tooltip_summary') . '">' . $GLOBALS['Language']->getText('plugin_requesthelp', 'summary') . ':</a></b> <span class="highlight"><big>*</big></span></td>
<td colspan="3"><input type="text" name="request_summary" value="' . $summary . '" /></td></tr>';
echo '<tr><td><b><a class="tooltip" href="#" title="' . $GLOBALS['Language']->getText('plugin_requesthelp', 'tooltip_description') . '"><span class="requesthelp_totop">Description:</span></a></b> <span class="highlight"><span class="requesthelp_totop"><big>*</big></b></span></span></td><td colspan="3"><textarea id="request_description" name="request_description">' . $description . '</textarea></td></tr>
<tr><td></td><td colspan="3"><i><b><u>Note</u>: </b>' . $GLOBALS['Language']->getText('plugin_requesthelp', 'requesthelp_cc_note') . '</i></td></tr>
<tr><td><label>CC :</label></td><td colspan="3"><input id="requesthelp_cc" type="text" name="cc" value="' . $cc . '" /></td></tr>
<tr><td><input name="action" type="hidden" value="submit_ticket" /></td><td><input name="submit" type="submit" value="Submit" /></td></tr>
</table>
</form>
</fieldset>';
$js = "\$('request_description').defaultValueActsAsHint();\n options = new Array();\n options['defaultValueActsAsHint'] = false;\n new UserAutoCompleter('requesthelp_cc', '" . util_get_dir_image_theme() . "', true, options);";
$GLOBALS['Response']->includeFooterJavascriptSnippet($js);
}
}
示例6: explode
// Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved
// http://www.codendi.com
//
//
require_once 'pre.php';
require_once 'www/project/admin/permissions.php';
require_once 'common/frs/FRSFileFactory.class.php';
require_once 'www/file/file_utils.php';
list(, $group_id, $file_id) = explode('/', $_SERVER['PATH_INFO']);
// Must have a group_id and file_id otherwise
// we cannot do much
$vGroupId = new Valid_groupId();
$vGroupId->required();
$vFileId = new Valid_UInt();
$vFileId->required();
if (!$vFileId->validate($file_id) || !$vGroupId->validate($group_id)) {
exit_missing_param();
}
// Now make an innerjoin on the 4 tables to be sure
// that the file_id we have belongs to the given group_id
$frsff = new FRSFileFactory();
$file =& $frsff->getFRSFileFromDb($file_id, $group_id);
if (!$file || $file->isError()) {
exit_error($Language->getText('file_download', 'incorrect_release_id'), $Language->getText('file_download', 'report_error', $GLOBALS['sys_name']));
}
// Check permissions for downloading the file, and check that the file has the active status
if (!$file->userCanDownload() || !$file->isActive()) {
exit_error($Language->getText('file_download', 'access_denied'), $Language->getText('file_download', 'access_not_authorized', session_make_url("/project/memberlist.php?group_id={$group_id}")));
}
if (!$file->fileExists()) {
exit_error($Language->getText('global', 'error'), $Language->getText('file_download', 'file_not_available'));
示例7:
<?php
//
// SourceForge: Breaking Down the Barriers to Open Source Development
// Copyright 1999-2000 (c) The SourceForge Crew
// http://sourceforge.net
//
//
require_once 'pre.php';
require '../survey/survey_utils.php';
$request = HTTPRequest::instance();
$group_id = $request->get('group_id');
$valid = new Valid_UInt();
if (!$valid->validate($group_id)) {
$group_id = null;
}
$survey_id = $request->get('survey_id');
if (!$valid->validate($survey_id)) {
$survey_id = null;
}
survey_header(array('title' => $Language->getText('survey_s', 's'), 'help' => 'survey.html#publishing-a-survey'));
if (!$survey_id || !$group_id) {
echo "<H1>" . $Language->getText('survey_index', 'g_id_err') . "</H1>";
} else {
// select this survey from the database
$sql = "select * from surveys where group_id = '" . db_ei($group_id) . "' AND survey_id='" . db_ei($survey_id) . "'";
$result = db_query($sql);
if (!user_isloggedin() && !db_result($result, 0, "is_anonymous")) {
/*
Tell them they need to be logged in
*/