• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Valid_UInt类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getContent

 function getContent()
 {
     $frsrf = new FRSReleaseFactory();
     $html_my_monitored_fp = '';
     $sql = "SELECT groups.group_name,groups.group_id " . "FROM groups,filemodule_monitor,frs_package " . "WHERE groups.group_id=frs_package.group_id " . "AND frs_package.status_id !=" . $frsrf->STATUS_DELETED . " " . "AND frs_package.package_id=filemodule_monitor.filemodule_id " . "AND filemodule_monitor.user_id='" . user_getid() . "' ";
     $um =& UserManager::instance();
     $current_user =& $um->getCurrentUser();
     if ($current_user->isRestricted()) {
         $projects = $current_user->getProjects();
         $sql .= "AND groups.group_id IN (" . implode(',', $projects) . ") ";
     }
     $sql .= "GROUP BY group_id ORDER BY group_id ASC LIMIT 100";
     $result = db_query($sql);
     $rows = db_numrows($result);
     if (!$result || $rows < 1) {
         $html_my_monitored_fp .= $GLOBALS['Language']->getText('my_index', 'my_files_msg');
     } else {
         $html_my_monitored_fp .= '<table style="width:100%">';
         $request =& HTTPRequest::instance();
         for ($j = 0; $j < $rows; $j++) {
             $group_id = db_result($result, $j, 'group_id');
             $sql2 = "SELECT frs_package.name,filemodule_monitor.filemodule_id " . "FROM groups,filemodule_monitor,frs_package " . "WHERE groups.group_id=frs_package.group_id " . "AND groups.group_id={$group_id} " . "AND frs_package.status_id !=" . $frsrf->STATUS_DELETED . " " . "AND frs_package.package_id=filemodule_monitor.filemodule_id " . "AND filemodule_monitor.user_id='" . user_getid() . "'  LIMIT 100";
             $result2 = db_query($sql2);
             $rows2 = db_numrows($result2);
             $vItemId = new Valid_UInt('hide_item_id');
             $vItemId->required();
             if ($request->valid($vItemId)) {
                 $hide_item_id = $request->get('hide_item_id');
             } else {
                 $hide_item_id = null;
             }
             $vFrs = new Valid_WhiteList('hide_frs', array(0, 1));
             $vFrs->required();
             if ($request->valid($vFrs)) {
                 $hide_frs = $request->get('hide_frs');
             } else {
                 $hide_frs = null;
             }
             list($hide_now, $count_diff, $hide_url) = my_hide_url('frs', $group_id, $hide_item_id, $rows2, $hide_frs);
             $html_hdr = ($j ? '<tr class="boxitem"><td colspan="2">' : '') . $hide_url . '<A HREF="/project/?group_id=' . $group_id . '">' . db_result($result, $j, 'group_name') . '</A>&nbsp;&nbsp;&nbsp;&nbsp;';
             $html = '';
             $count_new = max(0, $count_diff);
             for ($i = 0; $i < $rows2; $i++) {
                 if (!$hide_now) {
                     $html .= '
                     <TR class="' . util_get_alt_row_color($i) . '">' . '<TD WIDTH="99%">&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;<A HREF="/file/showfiles.php?group_id=' . $group_id . '">' . db_result($result2, $i, 'name') . '</A></TD>' . '<TD><A HREF="/file/filemodule_monitor.php?filemodule_id=' . db_result($result2, $i, 'filemodule_id') . '&group_id=' . $group_id . '" onClick="return confirm(\'' . $GLOBALS['Language']->getText('my_index', 'stop_file') . '\')">' . '<IMG SRC="' . util_get_image_theme("ic/trash.png") . '" HEIGHT="16" WIDTH="16" ' . 'BORDER=0" ALT="' . $GLOBALS['Language']->getText('my_index', 'stop_monitor') . '"></A></TD></TR>';
                 }
             }
             $html_hdr .= my_item_count($rows2, $count_new) . '</td></tr>';
             $html_my_monitored_fp .= $html_hdr . $html;
         }
         $html_my_monitored_fp .= '</table>';
     }
     return $html_my_monitored_fp;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:55,代码来源:Widget_MyMonitoredFp.class.php


示例2: getContent

 function getContent()
 {
     $html_my_monitored_forums = '';
     $sql = "SELECT groups.group_id, groups.group_name " . "FROM groups,forum_group_list,forum_monitored_forums " . "WHERE groups.group_id=forum_group_list.group_id " . "AND groups.status = 'A' " . "AND forum_group_list.is_public <> 9 " . "AND forum_group_list.group_forum_id=forum_monitored_forums.forum_id " . "AND forum_monitored_forums.user_id='" . user_getid() . "' ";
     $um =& UserManager::instance();
     $current_user =& $um->getCurrentUser();
     if ($current_user->isRestricted()) {
         $projects = $current_user->getProjects();
         $sql .= "AND groups.group_id IN (" . implode(',', $projects) . ") ";
     }
     $sql .= "GROUP BY group_id ORDER BY group_id ASC LIMIT 100";
     $result = db_query($sql);
     $rows = db_numrows($result);
     if (!$result || $rows < 1) {
         $html_my_monitored_forums .= $GLOBALS['Language']->getText('my_index', 'my_forums_msg');
     } else {
         $request =& HTTPRequest::instance();
         $html_my_monitored_forums .= '<table style="width:100%">';
         for ($j = 0; $j < $rows; $j++) {
             $group_id = db_result($result, $j, 'group_id');
             $sql2 = "SELECT forum_group_list.group_forum_id,forum_group_list.forum_name " . "FROM groups,forum_group_list,forum_monitored_forums " . "WHERE groups.group_id=forum_group_list.group_id " . "AND groups.group_id={$group_id} " . "AND forum_group_list.is_public <> 9 " . "AND forum_group_list.group_forum_id=forum_monitored_forums.forum_id " . "AND forum_monitored_forums.user_id='" . user_getid() . "' LIMIT 100";
             $result2 = db_query($sql2);
             $rows2 = db_numrows($result2);
             $vItemId = new Valid_UInt('hide_item_id');
             $vItemId->required();
             if ($request->valid($vItemId)) {
                 $hide_item_id = $request->get('hide_item_id');
             } else {
                 $hide_item_id = null;
             }
             $vForum = new Valid_WhiteList('hide_forum', array(0, 1));
             $vForum->required();
             if ($request->valid($vForum)) {
                 $hide_forum = $request->get('hide_forum');
             } else {
                 $hide_forum = null;
             }
             list($hide_now, $count_diff, $hide_url) = my_hide_url('forum', $group_id, $hide_item_id, $rows2, $hide_forum);
             $html_hdr = ($j ? '<tr class="boxitem"><td colspan="2">' : '') . $hide_url . '<A HREF="/forum/?group_id=' . $group_id . '">' . db_result($result, $j, 'group_name') . '</A>&nbsp;&nbsp;&nbsp;&nbsp;';
             $html = '';
             $count_new = max(0, $count_diff);
             for ($i = 0; $i < $rows2; $i++) {
                 if (!$hide_now) {
                     $group_forum_id = db_result($result2, $i, 'group_forum_id');
                     $html .= '
                 <TR class="' . util_get_alt_row_color($i) . '"><TD WIDTH="99%">' . '&nbsp;&nbsp;&nbsp;-&nbsp;<A HREF="/forum/forum.php?forum_id=' . $group_forum_id . '">' . stripslashes(db_result($result2, $i, 'forum_name')) . '</A></TD>' . '<TD ALIGN="center"><A HREF="/my/stop_monitor.php?forum_id=' . $group_forum_id . '" onClick="return confirm(\'' . $GLOBALS['Language']->getText('my_index', 'stop_forum') . '\')">' . '<IMG SRC="' . util_get_image_theme("ic/trash.png") . '" HEIGHT="16" WIDTH="16" ' . 'BORDER=0 ALT="' . $GLOBALS['Language']->getText('my_index', 'stop_monitor') . '"></A></TD></TR>';
                 }
             }
             $html_hdr .= my_item_count($rows2, $count_new) . '</td></tr>';
             $html_my_monitored_forums .= $html_hdr . $html;
         }
         $html_my_monitored_forums .= '</table>';
     }
     return $html_my_monitored_forums;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:55,代码来源:Widget_MyMonitoredForums.class.php


示例3: getUGroupIdInRequest

 private function getUGroupIdInRequest($request)
 {
     $vUgroupId = new Valid_UInt('ugroup_id');
     $vUgroupId->required();
     if ($request->valid($vUgroupId)) {
         $ugroupId = $request->get('ugroup_id');
     } else {
         $ugroupId = null;
     }
     return $ugroupId;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:11,代码来源:Binding.class.php


示例4: initDisplay

 function initDisplay()
 {
     $request =& HTTPRequest::instance();
     //
     // User may request a specific table id
     $vVersion = new Valid_UInt('version');
     $vVersion->required();
     if ($request->valid($vVersion)) {
         $this->version = $request->get('version');
     }
     $this->atf =& Docman_ApprovalTableFactoriesFactory::getFromItem($this->item, $this->version);
     $this->table =& $this->atf->getTable();
 }
开发者ID:rinodung,项目名称:tuleap,代码行数:13,代码来源:Docman_View_ItemDetailsSectionApproval.class.php


示例5: update

 public function update()
 {
     $vChildren = new Valid_UInt('children');
     $vChildren->required();
     if ($this->request->validArray($vChildren)) {
         $this->dao->updateChildren($this->tracker->getId(), $this->request->get('children'));
     } else {
         if ($this->request->exist('children')) {
             $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_hierarchy', 'controller_bad_request'));
         } else {
             $this->dao->deleteAllChildren($this->tracker->getId());
         }
     }
     $this->redirect(array('tracker' => $this->tracker->getId(), 'func' => 'admin-hierarchy'));
 }
开发者ID:uniteddiversity,项目名称:tuleap,代码行数:15,代码来源:Controller.class.php


示例6: 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'));
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:14,代码来源:ValidHelpersTest.php


示例7: getContent

 function getContent()
 {
     $folder_or_document = is_a($this->item, 'Docman_Folder') ? 'folder' : (is_a($this->item, 'Docman_File') ? 'file' : 'document');
     $item_type = $this->_controller->_getItemFactory()->getItemTypeForItem($this->item);
     $vVersion = new Valid_UInt('version');
     $vVersion->required();
     if ($this->_controller->request->valid($vVersion)) {
         $version = $this->_controller->request->get('version');
         $label = $this->_controller->request->get('label');
     } else {
         $version = false;
     }
     $content = '';
     $content .= '<dl><dt>' . $GLOBALS['Language']->getText('plugin_docman', 'details_actions_delete') . '</dt><dd>';
     $content .= '<form action="' . $this->url . '" method="POST">';
     $content .= '<div class="docman_confirm_delete">';
     if ($version !== false) {
         $content .= $GLOBALS['Language']->getText('plugin_docman', 'details_delete_warning_version', array($this->hp->purify($this->item->getTitle(), CODENDI_PURIFIER_CONVERT_HTML), $version));
     } else {
         $content .= $GLOBALS['Language']->getText('plugin_docman', 'details_delete_warning_' . $folder_or_document, $this->hp->purify($this->item->getTitle(), CODENDI_PURIFIER_CONVERT_HTML));
     }
     if ($item_type == PLUGIN_DOCMAN_ITEM_TYPE_WIKI) {
         $content .= $this->getWikiDeleteInfo();
     }
     $content .= '<div class="docman_confirm_delete_buttons">';
     if ($this->token) {
         $content .= '<input type="hidden" name="token" value="' . $this->token . '" />';
     }
     $content .= '     <input type="hidden" name="section" value="actions" />';
     if ($version !== false) {
         $content .= '     <input type="hidden" name="action" value="deleteVersion" />';
         $content .= '     <input type="hidden" name="version" value="' . $version . '" />';
     } else {
         $content .= '     <input type="hidden" name="action" value="delete" />';
     }
     $content .= '     <input type="hidden" name="id" value="' . $this->item->getId() . '" />';
     $content .= '     <input type="submit" tabindex="2" name="confirm" value="' . $GLOBALS['Language']->getText('plugin_docman', 'details_delete_confirm') . '" />';
     $content .= '     <input type="submit" tabindex="1" name="cancel" value="' . $GLOBALS['Language']->getText('plugin_docman', 'details_delete_cancel') . '" />';
     $content .= '</div>';
     $content .= '</div>';
     $content .= '</form>';
     $content .= '</dd></dl>';
     return $content;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:44,代码来源:Docman_View_ItemDetailsSectionDelete.class.php


示例8: getContent

 function getContent()
 {
     $html = '';
     $request = HTTPRequest::instance();
     $um = UserManager::instance();
     $user = $um->getCurrentUser();
     $vFunc = new Valid_WhiteList('docman_func', array('show_docman'));
     $vFunc->required();
     if ($request->valid($vFunc)) {
         $func = $request->get('docman_func');
     } else {
         $func = '';
     }
     $vDocmanId = new Valid_UInt('docman_id');
     $vDocmanId->required();
     if ($request->valid($vDocmanId)) {
         $docman_id = $request->get('docman_id');
     } else {
         $docman_id = '';
     }
     $html .= '<form method="post" action="?">';
     $html .= '<label>' . $GLOBALS['Language']->getText('plugin_docman', 'widget_my_docman_search_label') . '</label>';
     $html .= '<input type="hidden" name="docman_func" value="show_docman" />';
     $html .= '<input type="text" name="docman_id" value="' . $docman_id . '" id="docman_id" />';
     $html .= '&nbsp;';
     $html .= '<input type="submit" value="' . $GLOBALS['Language']->getText('plugin_docman', 'widget_my_docman_search_btn') . '"/>';
     $html .= '</form>';
     if ($func == 'show_docman' && $docman_id) {
         $res = $this->returnAllowedGroupId($docman_id, $user);
         if ($res) {
             $dPm = Docman_PermissionsManager::instance($res['group_id']);
             $itemPerm = $dPm->userCanAccess($user, $docman_id);
             if ($itemPerm) {
                 $html .= '<p><a href="/plugins/docman/?group_id=' . $res['group_id'] . '&action=details&id=' . $docman_id . '&section=properties">Show &quot;' . $res['title'] . '&quot; Properties</a></p>';
                 return $html;
             }
         }
         $html .= '<p>' . $GLOBALS['Language']->getText('plugin_docman', 'perm_denied') . '</p>';
     }
     return $html;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:41,代码来源:Docman_Widget_MyDocmanSearch.class.php


示例9: validateRequest

 /**
  * Validate the HTTP request for the user members pane
  *
  * @param Integer     $groupId Id of the project
  * @param HTTPRequest $request HTTP request
  *
  * @return Array
  */
 public function validateRequest($groupId, $request)
 {
     $userDao = new UserDao();
     $res = $userDao->firstUsernamesLetters();
     $allowedBeginValues = array();
     foreach ($res as $data) {
         $allowedBeginValues[] = $data['capital'];
     }
     $result['allowed_begin_values'] = $allowedBeginValues;
     $validBegin = new Valid_WhiteList('begin', $allowedBeginValues);
     $validBegin->required();
     $validInProject = new Valid_UInt('in_project');
     $validInProject->required();
     $result['offset'] = $request->exist('browse') ? 0 : $request->getValidated('offset', 'uint', 0);
     $result['number_per_page'] = $request->exist('number_per_page') ? $request->getValidated('number_per_page', 'uint', 0) : 15;
     $result['search'] = $request->getValidated('search', 'string', '');
     $result['begin'] = $request->getValidated('begin', $validBegin, '');
     $result['in_project'] = $request->getValidated('in_project', $validInProject, $groupId);
     $result['user'] = $request->get('user');
     $result['add_user_name'] = $request->get('add_user_name');
     return $result;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:30,代码来源:Members.class.php


示例10: forum_create_forum

     if ($request->valid($vForumName) && $request->valid($vDescription) && $request->valid($vIsPublic) && $request->valid($vMonitored)) {
         $forum_name = $request->get('forum_name');
         $is_public = $request->get('is_public');
         $description = $request->get('description');
         $is_monitored = $request->get('is_monitored');
         $fid = forum_create_forum($group_id, $forum_name, $is_public, 1, $description);
         if ($is_monitored) {
             forum_add_monitor($fid, user_getid());
         }
     }
 } else {
     if ($request->existAndNonEmpty('change_status')) {
         /*
         	Change a forum to public/private
         */
         $vGrpForum = new Valid_UInt('group_forum_id');
         $vGrpForum->required();
         if ($request->valid($vForumName) && $request->valid($vDescription) && $request->valid($vIsPublic) && $request->valid($vGrpForum)) {
             $forum_name = $request->get('forum_name');
             $is_public = $request->get('is_public');
             $description = $request->get('description');
             $group_forum_id = $request->get('group_forum_id');
             $sql = "UPDATE forum_group_list SET is_public=" . db_ei($is_public) . ",forum_name='" . db_es(htmlspecialchars($forum_name)) . "'," . "description='" . db_es(htmlspecialchars($description)) . "' " . "WHERE group_forum_id=" . db_ei($group_forum_id) . " AND group_id=" . db_ei($group_id);
             $result = db_query($sql);
             if (!$result || db_affected_rows($result) < 1) {
                 $feedback .= ' ' . $Language->getText('forum_admin_index', 'upd_err') . ' ';
             } else {
                 $feedback .= ' ' . $Language->getText('forum_admin_index', 'upd_success') . ' ';
             }
         }
     }
开发者ID:pombredanne,项目名称:tuleap,代码行数:31,代码来源:index.php


示例11: 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;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:12,代码来源:MilestoneController.class.php


示例12: updatePreferences

 function updatePreferences(&$request)
 {
     $request->valid(new Valid_String('cancel'));
     $nbShow = new Valid_UInt('nb_svn_commits');
     $nbShow->required();
     if (!$request->exist('cancel')) {
         if ($request->valid($nbShow)) {
             $this->_nb_svn_commits = $request->get('nb_svn_commits');
         } else {
             $this->_nb_svn_commits = self::NB_COMMITS_TO_DISPLAY;
         }
         user_set_preference('my_latests_svn_commits_nb_display', $this->_nb_svn_commits);
     }
     return true;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:15,代码来源:Widget_MyLatestSvnCommits.class.php


示例13: 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'));
         }
     }
 }
开发者ID:nterray,项目名称:tuleap,代码行数:35,代码来源:WikiServiceAdminActions.class.php


示例14: Valid_WhiteList

}
$vRelative = new Valid_WhiteList('relative', array('true'));
$vRelative->required();
if ($request->valid($vRelative)) {
    $relative = true;
} else {
    $relative = false;
}
$vOrder = new Valid_WhiteList('order', array('start_size', 'end_size', 'evolution', 'evolution_rate'));
$vOrder->required();
if ($request->valid($vOrder)) {
    $order = $request->get('order');
} else {
    $order = 'end_size';
}
$vOffset = new Valid_UInt('offset');
$vOffset->required();
if ($request->valid($vOffset)) {
    $offset = $request->get('offset');
} else {
    $offset = 0;
}
$title = 'Disk usage';
$GLOBALS['HTML']->includeCalendarScripts();
$GLOBALS['HTML']->header(array('title' => $title));
echo '<h1>' . $title . '</h1>';
echo '
<table>
  <tr>
    <th align="center">Service/Projects</th>
    <th align="center">Users</th>
开发者ID:pombredanne,项目名称:tuleap,代码行数:31,代码来源:disk_usage.php


示例15: Valid_UInt

<?php

//
// SourceForge: Breaking Down the Barriers to Open Source Development
// Copyright (c) Enalean, 2015. All rights reserved
// Copyright 1999-2000 (c) The SourceForge Crew
// http://sourceforge.net
//
require_once 'pre.php';
require_once 'bookmarks.php';
require_once 'my_utils.php';
$request = HTTPRequest::instance();
$vId = new Valid_UInt('bookmark_id');
$vId->setErrorMessage('bookmark_id is required');
$vId->required();
if (!$request->valid($vId)) {
    $GLOBALS['Response']->redirect('/my');
} else {
    $bookmark_id = (int) $request->get('bookmark_id');
}
$vUrl = new Valid_String('bookmark_url');
$vUrl->setErrorMessage('Url is required');
$vUrl->required();
$vTitle = new Valid_String('bookmark_title');
$vTitle->setErrorMessage('Title is required');
$vTitle->required();
$bookmark_url_id = '/my/bookmark_edit.php?bookmark_id=' . $bookmark_id;
$csrf_token = new CSRFSynchronizerToken($bookmark_url_id);
if ($request->isPost() && $request->valid($vUrl) && $request->valid($vTitle)) {
    $csrf_token->check();
    $bookmark_url = $request->get('bookmark_url');
开发者ID:pombredanne,项目名称:tuleap,代码行数:31,代码来源:bookmark_edit.php


示例16: validateRequest

 /**
  * Validate request values
  *
  * @param HTTPRequest $request request containing form values
  *
  * @return Array
  */
 function validateRequest($request)
 {
     $status = true;
     $invalid = array();
     $valid = new Valid_String('request_summary');
     $valid->required();
     $summary = trim($request->get('request_summary'));
     if ($request->valid($valid) && strlen($summary) < self::MAX_SUMMARY_LENGTH && $summary != '') {
         $params['summary'] = $summary;
     } else {
         $status = false;
         $invalid[] = $GLOBALS['Language']->getText('plugin_requesthelp', 'summary');
     }
     $valid = new Valid_Text('request_description');
     $valid->required();
     $description = trim($request->get('request_description'));
     $defaultDescription = $GLOBALS['Language']->getText('plugin_requesthelp', 'requesthelp_default_description');
     if ($request->valid($valid) && strlen($description) < self::MAX_DESCRIPTION_LENGTH && $description != '' && $description != $defaultDescription) {
         $params['description'] = $description;
     } else {
         $status = false;
         $invalid[] = 'Description';
     }
     $valid = new Valid_UInt('type');
     $valid->required();
     if ($request->valid($valid)) {
         $requestType = $request->get('type');
         $params['type'] = $requestType;
         switch ($requestType) {
             case RequestHelp::TYPE_SUPPORT:
                 $params['text_type'] = $this->_getPluginProperty('support_request');
                 break;
             case RequestHelp::TYPE_ENHANCEMENT:
                 $params['text_type'] = $this->_getPluginProperty('enhancement_request');
                 break;
             default:
                 $status = false;
                 $invalid[] = 'Type';
                 break;
         }
     } else {
         $status = false;
         $invalid[] = 'Type';
     }
     $valid = new Valid_UInt('severity');
     $valid->required();
     if ($request->valid($valid)) {
         $severity = $request->get('severity');
         $params['severity'] = $severity;
         switch ($severity) {
             case RequestHelp::SEVERITY_MINOR:
                 $params['text_severity'] = 'Minor';
                 break;
             case RequestHelp::SEVERITY_SERIOUS:
                 $params['text_severity'] = 'Serious';
                 break;
             case RequestHelp::SEVERITY_CRITICAL:
                 $params['text_severity'] = 'Critical';
                 break;
             default:
                 $status = false;
                 $invalid[] = $GLOBALS['Language']->getText('plugin_requesthelp', 'severity');
                 break;
         }
     } else {
         $status = false;
         $invalid[] = $GLOBALS['Language']->getText('plugin_requesthelp', 'severity');
     }
     $cc = array();
     $mails = array_map('trim', preg_split('/[,;]/', $request->get('cc')));
     $rule = new Rule_Email();
     $um = $this->_getUserManager();
     $invalidCc = array();
     foreach ($mails as $mail) {
         if ($rule->isValid($mail)) {
             $cc[] = $mail;
         } else {
             if (trim($mail) != '') {
                 $user = $um->findUser($mail);
                 if ($user) {
                     $mail = $user->getUserName();
                     if ($mail) {
                         $cc[] = $mail;
                     } else {
                         $invalidCc[] = $mail;
                     }
                 } else {
                     $invalidCc[] = $mail;
                 }
             }
         }
     }
     if (!empty($invalidCc)) {
//.........这里部分代码省略.........
开发者ID:rinodung,项目名称:tuleap,代码行数:101,代码来源:RequestHelpActions.class.php


示例17: Valid_UInt

//
// SourceForge: Breaking Down the Barriers to Open Source Development
// Copyright 1999-2000 (c) The SourceForge Crew
// http://sourceforge.net
//
//
require_once 'pre.php';
require '../forum/forum_utils.php';
$request =& HTTPRequest::instance();
if (user_isloggedin()) {
    /*
    	User obviously has to be logged in to monitor
    	a thread
    */
    $vForumId = new Valid_UInt('forum_id');
    $vForumId->required();
    if ($request->valid($vForumId)) {
        $forum_id = $request->get('forum_id');
        // Check permissions
        if (!forum_utils_access_allowed($forum_id)) {
            exit_error($Language->getText('global', 'error'), $Language->getText('forum_forum', 'forum_restricted'));
        }
        //If the forum is associated to a private news, non-allowed users shouldn't be able to monitor this forum
        // but they should be able to disable monitoring news that have been set from public to private
        $qry = "SELECT * FROM news_bytes WHERE forum_id=" . db_ei($forum_id);
        $res = db_query($qry);
        if (db_numrows($res) > 0) {
            if (!forum_utils_news_access($forum_id) && !user_monitor_forum($forum_id, user_getid())) {
                exit_error($Language->getText('global', 'error'), $Language->getText('news_admin_index', 'permission_denied'));
            }
开发者ID:pombredanne,项目名称:tuleap,代码行数:30,代码来源:monitor.php


示例18: 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>&nbsp;<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>&nbsp;<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>&nbsp;<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>&nbsp;<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);
     }
 }
开发者ID:nterray,项目名称:tuleap,代码行数:89,代码来源:RequestHelpViews.class.php


示例19: exit_no_group

if (!$project || !is_object($project) || $project->isError()) {
    exit_no_group();
}
//if the project isn't active, require you to be a member of the super-admin group
if ($project->getStatus() != 'A') {
    session_require(array('group' => 1));
}
$vFunc = new Valid_WhiteList('func', array('member_req_notif_group', 'member_req_notif_message'));
$vFunc->required();
if ($request->isPost() && $request->valid($vFunc)) {
    /*
      updating the database
    */
    switch ($request->get('func')) {
        case 'member_req_notif_group':
            $vUGroups = new Valid_UInt('ugroups');
            $vUGroups->required();
            if ($request->validArray($vUGroups)) {
                $ugroups = $request->get('ugroups');
                // Remove ugroups that are empty or contain no project admins
                $result = ugroup_filter_ugroups_by_project_admin($group_id, $ugroups);
                $nonAdmins = $result['non_admins'];
                $validUgroups = $result['ugroups'];
                if (empty($validUgroups)) {
                    // If no valid ugroups the default one is project admins ugroup
                    $validUgroups = array($GLOBALS['UGROUP_PROJECT_ADMIN']);
                    $GLOBALS['Response']->addFeedback('error', $Language->getText('project_admin_index', 'member_request_delegation_ugroups_all_invalid'));
                } else {
                    // If some selected ugroups are not valid display them to the user.
                    $diff = array_diff($ugroups, $validUgroups);
                    if (!empty($diff)) {
开发者ID:pombredanne,项目名称:tuleap,代码行数:31,代码来源:permission_request.php


示例20: Valid_String

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Validate类代码示例发布时间:2022-05-23
下一篇:
PHP Valid类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap