本文整理汇总了PHP中HTTPRequest::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP HTTPRequest::instance方法的具体用法?PHP HTTPRequest::instance怎么用?PHP HTTPRequest::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTTPRequest
的用法示例。
在下文中一共展示了HTTPRequest::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayRss
function displayRss()
{
global $Language;
$request =& HTTPRequest::instance();
$group_id = $request->get('group_id');
include 'www/export/rss_sfnews.php';
}
示例2: urlIsWebDav
private function urlIsWebDav(array $server)
{
$webdav_host = $this->getPluginInfo()->getPropertyValueForName('webdav_host');
$webdav_base_uri = $this->getPluginInfo()->getPropertyValueForName('webdav_base_uri');
$http_host = HTTPRequest::instance()->getFromServer('HTTP_HOST');
return strpos($http_host . $server['REQUEST_URI'], $webdav_host . $webdav_base_uri) !== false;
}
示例3: request
function request()
{
$request =& HTTPRequest::instance();
session_require(array('group' => $request->get('group_id'), 'admin_flags' => 'A'));
if ($request->exist('view')) {
switch ($request->get('view')) {
case 'creation':
$this->view = 'creation';
break;
case 'edit':
$this->view = 'edit';
break;
default:
$this->view = 'browse';
break;
}
} else {
$this->view = 'browse';
}
if ($request->exist('action')) {
switch ($request->get('action')) {
case 'do_edit':
$this->action = 'do_edit';
break;
case 'do_create':
$this->action = 'do_create';
break;
case 'do_delete':
$this->action = 'do_delete';
break;
default:
break;
}
}
}
示例4: Docman_HTTPController
function Docman_HTTPController(&$plugin, $pluginPath, $themePath, $request = null)
{
if (!$request) {
$request = HTTPRequest::instance();
}
$this->Docman_Controller($plugin, $pluginPath, $themePath, $request);
}
示例5: getContent
function getContent()
{
$request = HTTPRequest::instance();
$user = UserManager::instance()->getCurrentUser();
//group id of the user is member
$projects_id_user = $user->getProjects();
$html = '';
$pm = ProjectManager::instance();
foreach ($projects_id_user as $project_id) {
$project = $pm->getProject($project_id);
$project_unix_name = $project->getUnixName();
$project_public_name = $project->getPublicName();
$members_id_array = $project->getMembersUserNames();
if (sizeof($members_id_array) > 1) {
list($hide_now, $count_diff, $hide_url) = my_hide_url('im_group', $project_id, $request->get('hide_item_id'), count($members_id_array), $request->get('hide_im_group'));
$html .= $hide_url;
$html .= '<b>' . $project_public_name . '</b><br>';
if (!$hide_now) {
$html .= '<div style="padding-left:20px;">';
foreach ($members_id_array as $member) {
$html .= $this->plugin->getDisplayPresence($member['user_id'], $member['user_name'], $member['realname']);
$html .= '<br>';
}
$html .= '</div>';
}
}
}
return $html;
}
示例6: getBodyHeaderActions
function getBodyHeaderActions($params)
{
$html = '';
$html .= '<ul>';
if (user_isloggedin()) {
$html .= '<li class="header_actions_nolink">' . $GLOBALS['Language']->getText('include_menu', 'logged_in') . ': ' . user_getname() . '</li>';
$html .= '<li><a href="/account/logout.php">' . $GLOBALS['Language']->getText('include_menu', 'logout') . '</a></li>';
if (isset($GLOBALS['sys_use_project_registration']) && $GLOBALS['sys_use_project_registration'] == 1 || !isset($GLOBALS['sys_use_project_registration'])) {
$html .= '<li><a href="/project/register.php">' . $GLOBALS['Language']->getText('include_menu', 'register_new_proj') . '</a></li>';
}
if (!HTTPRequest::instance()->isPost()) {
$add_bookmark_url = http_build_query(array('bookmark_url' => $_SERVER['REQUEST_URI'], 'bookmark_title' => str_replace($GLOBALS['sys_name'] . ': ', '', $params['title'])));
$html .= '<li class="bookmarkpage"><a href="/my/bookmark_add.php?' . $add_bookmark_url . '">' . $GLOBALS['Language']->getText('include_menu', 'bookmark_this_page') . '</a></li>';
}
} else {
$html .= '<li class="header_actions_nolink highlight">' . $GLOBALS['Language']->getText('include_menu', 'not_logged_in') . '</li>';
$login_url = '/account/login.php';
if ($_SERVER['REQUEST_URI'] != $login_url) {
$login_url .= '?return_to=' . urlencode($_SERVER['REQUEST_URI']);
}
$html .= '<li><a href="' . $this->purifier->purify($login_url) . '">' . $GLOBALS['Language']->getText('include_menu', 'login') . '</a></li>';
$em =& EventManager::instance();
$display_new_user = true;
$em->processEvent('display_newaccount', array('allow' => &$display_new_user));
if ($display_new_user) {
$html .= '<li><a href="/account/register.php">' . $GLOBALS['Language']->getText('include_menu', 'new_user') . '</a></li>';
}
}
$html .= '</ul>';
return $html;
}
示例7: request
function request()
{
$request =& HTTPRequest::instance();
$views = array('introduction', 'descriptor', 'webspace', 'hooks', 'database', 'finish');
if (!isset($_SESSION['PluginCreationWizard_view']) || $request->exist('cancel')) {
$_SESSION['PluginCreationWizard_view'] = 0;
$_SESSION['PluginCreationWizard_params'] = array();
}
if ($request->exist('next')) {
$this->action = $views[$_SESSION['PluginCreationWizard_view']];
$_SESSION['PluginCreationWizard_view']++;
}
if ($request->exist('back')) {
$_SESSION['PluginCreationWizard_view']--;
}
if ($_SESSION['PluginCreationWizard_view'] < 0) {
$_SESSION['PluginCreationWizard_view'] = 0;
}
if ($_SESSION['PluginCreationWizard_view'] >= count($views)) {
$_SESSION['PluginCreationWizard_view'] = count($views) - 1;
}
$this->view = $views[$_SESSION['PluginCreationWizard_view']];
if ($request->exist('goto') && ($key = array_search($request->get('goto'), $views)) !== false) {
$this->view = $request->get('goto');
$_SESSION['PluginCreationWizard_view'] = $key;
}
if ($request->exist('finish')) {
unset($_SESSION['PluginCreationWizard_view']);
$this->action = 'create';
$this->view = 'end';
}
}
示例8: getContent
function getContent()
{
$request = HTTPRequest::instance();
return '<div style="text-align:center">
<img src="/widgets/widget.php?owner=' . WidgetLayoutManager::OWNER_TYPE_GROUP . $request->get('group_id') . '&action=process&name[' . $this->id . ']=' . $this->getInstanceId() . '" />
</div>';
}
示例9: Widget_ProjectLatestCommits
function Widget_ProjectLatestCommits($id, $get_commits_callback)
{
$this->Widget($id);
$request =& HTTPRequest::instance();
$this->group_id = $request->get('group_id');
$this->commits_callback = $get_commits_callback;
}
示例10: verify_login_valid
function verify_login_valid()
{
global $Language;
$request =& HTTPRequest::instance();
if (!$request->existAndNonEmpty('form_loginname')) {
$GLOBALS['Response']->addFeedback('error', $Language->getText('include_session', 'missing_pwd'));
return 0;
}
// first check just confirmation hash
$res = db_query('SELECT confirm_hash,status FROM user WHERE ' . 'user_name=\'' . db_es($request->get('form_loginname')) . '\'');
if (db_numrows($res) < 1) {
$GLOBALS['Response']->addFeedback('error', $Language->getText('account_verify', 'err_user'));
return 0;
}
$usr = db_fetch_array($res);
//if sys_user_approval=1 then check if the admin aldready validates the account
if ($GLOBALS['sys_user_approval'] == 0 || $usr['status'] == 'V' || $usr['status'] == 'W') {
if (strcmp($request->get('confirm_hash'), $usr['confirm_hash'])) {
$GLOBALS['Response']->addFeedback('error', $Language->getText('account_verify', 'err_hash'));
return 0;
}
} else {
$GLOBALS['Response']->addFeedback('error', $Language->getText('account_verify', 'err_status'));
return 0;
}
// then check valid login
return UserManager::instance()->login($request->get('form_loginname'), $request->get('form_pw'), true);
}
示例11: synchronize_muc_and_grp
/**
* synchronize_muc_and_grp_together
*/
function synchronize_muc_and_grp()
{
$request =& HTTPRequest::instance();
$unix_group_name = $request->get('unix_group_name');
$group_id = $request->get('group_id');
$group_Owner_name = $request->get('group_Owner_name');
$group_name = $request->get('group_name');
if (!(isset($group_name) && $group_name != null)) {
$group_name = $unix_group_name;
}
$group_description = $request->get('group_description');
if (!(isset($group_description) && $group_description != null)) {
$group_description = 'No description';
}
$dao = new IMDao(IMDataAccess::instance($this->getControler()));
try {
$dao->synchronize_muc_only($unix_group_name, $group_name, $group_description, $group_Owner_name, $group_id);
$GLOBALS['Response']->addFeedback('info', $group_name . ' ' . $GLOBALS['Language']->getText('plugin_im_admin', 'synchronise_muc_msg'));
} catch (Exception $e) {
$GLOBALS['Response']->addFeedback('error', $group_name . ' ' . $GLOBALS['Language']->getText('plugin_im_admin', 'synchronise_muc_error') . $e->getMessage());
}
try {
$dao->synchronize_grp_only($unix_group_name, $group_name);
$GLOBALS['Response']->addFeedback('info', $group_name . ' ' . $GLOBALS['Language']->getText('plugin_im_admin', 'synchronise_grp_msg'));
} catch (Exception $e) {
$GLOBALS['Response']->addFeedback('error', $group_name . ' ' . $GLOBALS['Language']->getText('plugin_im_admin', 'synchronise_grp_error') . $e->getMessage());
}
}
示例12: getContent
public function getContent()
{
$request =& HTTPRequest::instance();
$group_id = $request->get('group_id');
$pm = ProjectManager::instance();
$project = $pm->getProject($group_id);
$res_admin = db_query("SELECT user.user_id AS user_id,user.user_name AS user_name, user.realname as realname " . "FROM user,user_group " . "WHERE user_group.user_id=user.user_id AND user_group.group_id=" . db_ei($group_id) . " AND " . "user_group.admin_flags = 'A'");
if (db_numrows($res_admin) > 0) {
$user_helper = UserHelper::instance();
$hp = Codendi_HTMLPurifier::instance();
$em = EventManager::instance();
echo '<span class="develtitle">' . $GLOBALS['Language']->getText('include_project_home', 'proj_admins') . ':</span><br />';
while ($row_admin = db_fetch_array($res_admin)) {
$display_name = '';
$em->processEvent('get_user_display_name', array('user_id' => $row_admin['user_id'], 'user_name' => $row_admin['user_name'], 'realname' => $row_admin['realname'], 'user_display_name' => &$display_name));
if (!$display_name) {
$display_name = $hp->purify($user_helper->getDisplayNameFromUserId($row_admin['user_id']));
}
echo '<a href="/users/' . $row_admin['user_name'] . '/">' . $display_name . '</a><br />';
}
}
echo '<span class="develtitle">' . $GLOBALS['Language']->getText('include_project_home', 'proj_members') . ':</span><br />';
// count of developers on this project
$res_count = db_query("SELECT user_id FROM user_group WHERE group_id=" . db_ei($group_id));
echo db_numrows($res_count);
echo ' <a href="/project/memberlist.php?group_id=' . $group_id . '">[' . $GLOBALS['Language']->getText('include_project_home', 'view_members') . ']</a>';
}
示例13: generate
function generate()
{
global $Language;
$request =& HTTPRequest::instance();
if ($data = $request->get('data')) {
if (isset($data['users']['generate']) && $data['users']['generate']) {
$um = UserManager::instance();
$nb_wanted = isset($data['users']['nb']) ? (int) $data['users']['nb'] : 1;
$users = $this->_getUsersData();
reset($users);
$nb_done = 0;
while ((list(, $user) = each($users)) && $nb_wanted > $nb_done) {
if (!$um->getUserByUserName($user['name'])) {
require_once 'account.php';
account_create($user['name'], 'codendi', '', $user['realname'], '', '379fbec92fb84a72d6026a422@mailinator.com', 'A', '', 0, 0, 'Europe/Paris', 'en_US', 'A');
$nb_done++;
}
}
}
if (isset($data['projects']['generate']) && $data['projects']['generate']) {
$nb_wanted = isset($data['projects']['nb']) ? (int) $data['projects']['nb'] : 1;
$projects = $this->_getProjectsData();
reset($projects);
$nb_done = 0;
while ((list(, $project) = each($projects)) && $nb_wanted > $nb_done) {
if (!group_get_object_by_name($project['name'])) {
$projectCreator = new ProjectCreator(ProjectManager::instance(), ReferenceManager::instance());
$projectCreator->create(array('project' => array('form_unix_name' => $project['name'], 'form_full_name' => $project['name'], 'form_short_description' => $project['description'], 'form_purpose' => $project['description'], 'form_required_sw' => '', 'form_patents' => '', 'form_comments' => '', 'built_from_template' => 100, 'is_test' => false, 'is_public' => true, 'trove' => array())));
$nb_done++;
}
}
}
}
}
示例14: __construct
public function __construct()
{
$this->views = array('header' => array(), 'footer' => array());
$this->actions = array();
$this->actionResultData = array('dummy' => 'dummy');
$this->user = UserManager::instance()->getCurrentUser();
$this->request = HTTPRequest::instance();
}
示例15: isException
/**
* Always permit requests for localhost, or for api or soap scripts and for system tracker templates
*
* @param Array $server
*
* @return Boolean
*/
function isException($server)
{
$userRequestsDefaultTemplates = $server['REQUEST_URI'] == TRACKER_BASE_URL . '/index.php?group_id=100' && HTTPRequest::instance()->isAjax();
$userRequestsDefaultTemplates |= $server['REQUEST_URI'] == TRACKER_BASE_URL . '/invert_comments_order.php';
$userRequestsDefaultTemplates |= $server['REQUEST_URI'] == TRACKER_BASE_URL . '/invert_display_changes.php';
$userRequestsDefaultTemplates |= $server['REQUEST_URI'] == TRACKER_BASE_URL . '/unsubscribe_notifications.php';
return $userRequestsDefaultTemplates || parent::isException($server);
}