function displayRss() { global $Language; $request =& HTTPRequest::instance(); $group_id = $request->get('group_id'); include 'www/export/rss_sfnews.php'; }
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; }
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; } } }
function Docman_HTTPController(&$plugin, $pluginPath, $themePath, $request = null) { if (!$request) { $request = HTTPRequest::instance(); } $this->Docman_Controller($plugin, $pluginPath, $themePath, $request); }
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; }
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; }
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'; } }
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>'; }
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; }
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); }
/** * 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()); } }
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>'; }
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'], '', '*****@*****.**', '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++; } } } } }
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(); }
/** * 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); }
public function getContent() { $request =& HTTPRequest::instance(); $group_id = $request->get('group_id'); if ($GLOBALS['sys_use_trove'] != 0) { trove_getcatlisting($group_id, 0, 1); } }
function request() { $request =& HTTPRequest::instance(); if ($request->get('action') == 'generate') { $this->action = 'generate'; } $this->view = 'index'; }
/** * Show the content of the widget * * @return void * * @see Widget::getContent() */ public function getContent() { $request =& HTTPRequest::instance(); $group_id = $request->get('group_id'); $duMgr = new Statistics_DiskUsageManager(); $duHtml = new Statistics_DiskUsageHtml($duMgr); return $duHtml->getTotalProjectSize($group_id); }
function actions() { $request =& HTTPRequest::instance(); if ($request->isPost() && $request->get("delete") == "Delete") { $dao = new MaillogDao(CodendiDataAccess::instance()); $dao->deleteAllMessages(); $GLOBALS['Response']->redirect($this->getPluginPath() . '/'); } }
/** * Widget content * * @see src/common/widget/Widget#getContent() * @return String */ function getContent() { $request = HTTPRequest::instance(); $groupId = $request->get('group_id'); $html = ''; $html .= "\n<!-- PROJECT LINKS START -->\n"; $html .= $this->getAllLinks($groupId); $html .= "\n<!-- PROJECT LINKS END -->\n"; return $html; }
function Widget_ProjectLatestFileReleases() { $this->Widget('projectlatestfilereleases'); $request =& HTTPRequest::instance(); $pm = ProjectManager::instance(); $project = $pm->getProject($request->get('group_id')); if ($project && $this->canBeUsedByProject($project)) { $this->content = $project->getService(Service::FILE)->getSummaryPageContent(); } }
function register_valid($user_id, CSRFSynchronizerToken $csrf, EventManager $event_manager) { $request = HTTPRequest::instance(); if (!$request->isPost() || !$request->exist('Update')) { return 0; } $csrf->check(); // check against old pw $user_manager = UserManager::instance(); $user = $user_manager->getUserById($user_id); if ($user === null) { $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('account_change_pw', 'user_not_found')); return 0; } $password_expiration_checker = new User_PasswordExpirationChecker(); $password_handler = PasswordHandlerFactory::getPasswordHandler(); $login_manager = new User_LoginManager($event_manager, $user_manager, $password_expiration_checker, $password_handler); if (!$login_manager->verifyPassword($user, $request->get('form_oldpw'))) { $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('account_change_pw', 'incorrect_old_password')); return 0; } try { $status_manager = new User_UserStatusManager(); $status_manager->checkStatus($user); } catch (User_StatusInvalidException $exception) { $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('account_change_pw', 'account_inactive')); return 0; } if (!$request->exist('form_pw')) { $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('account_change_pw', 'password_needed')); return 0; } if ($request->get('form_pw') != $request->get('form_pw2')) { $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('account_change_pw', 'password_not_match')); return 0; } if ($request->get('form_pw') === $request->get('form_oldpw')) { $GLOBALS['Response']->addFeedback('warning', $GLOBALS['Language']->getText('account_change_pw', 'identical_password')); return 0; } if (!account_pwvalid($request->get('form_pw'), $errors)) { foreach ($errors as $e) { $GLOBALS['Response']->addFeedback('error', $e); } return 0; } // if we got this far, it must be good $user->setPassword($request->get('form_pw')); if (!$user_manager->updateDb($user)) { $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('account_change_pw', 'internal_error_update')); return 0; } return 1; }
/** * Constructor * * @param String $owner_type The owner type * @param Int $owner_id The owner id * @param HudsonJobFactory $factory The HudsonJob factory * * @return void */ function __construct($owner_type, $owner_id, HudsonJobFactory $factory) { $request =& HTTPRequest::instance(); if ($owner_type == WidgetLayoutManager::OWNER_TYPE_USER) { $this->widget_id = 'plugin_hudson_my_joblastartifacts'; $this->group_id = $owner_id; } else { $this->widget_id = 'plugin_hudson_project_joblastartifacts'; $this->group_id = $request->get('group_id'); } parent::__construct($this->widget_id, $factory); $this->setOwner($owner_id, $owner_type); }
/** * Compute the content of the widget * * @return string html */ public function getContent() { $request = HTTPRequest::instance(); $groupId = $request->get('group_id'); $plugin = PluginManager::instance()->getPluginByName('git'); $weeksNumber = $request->get('weeks_number'); if (empty($weeksNumber)) { $weeksNumber = $plugin->getPluginInfo()->getPropVal('weeks_number'); } $content = '<div style="text-align:center"><p> <img src="' . $this->pluginPath . '/index.php?group_id=' . $groupId . '&weeks_number=' . $weeksNumber . '&action=view_last_git_pushes" title="' . $GLOBALS['Language']->getText('plugin_git', 'widget_project_pushes_title') . '" /> </div>'; return $content; }
public function process() { $hp = Codendi_HTMLPurifier::instance(); $all_path = array('/src/common', '/src/www', '/plugins'); $request = HTTPRequest::instance(); if ($request->isAjax()) { echo '<ul>'; foreach ($all_path as $p) { if ($request->get('path') && preg_match('`' . preg_quote($request->get('path')) . '`', $p)) { echo '<li>' . $hp->purify($p, CODENDI_PURIFIER_CONVERT_HTML) . '</li>'; } } echo '</ul>'; exit; } $GLOBALS['HTML']->includeJavascriptFile('/scripts/scriptaculous/scriptaculous.js'); $GLOBALS['HTML']->header(array('title' => $GLOBALS['Language']->getText('plugin_devtodolist', 'descriptor_name'), 'toptab' => 'admin')); $default_path = $request->get('path'); if ($default_path) { $path = array($default_path); } else { $default_path = '/src/common/tracker/'; $path = $all_path; } echo '<form action="" method="GET" id="form_path"> <label for="path">Path: </label><input type="text" name="path" value="' . $default_path . '" id="path" /> <div id="autocomp"></div> <input type="submit" value="' . $GLOBALS['Language']->getText('global', 'btn_submit') . '" /> </form> <script type="text/javascript"> new Ajax.Autocompleter("path", "autocomp", "?", {frequency:0.2}); </script> <hr size="1" /> '; foreach ($path as $p) { echo '<h2>' . $hp->purify($p, CODENDI_PURIFIER_CONVERT_HTML) . '</h2>'; flush(); echo '<pre>'; $cmd = 'cd ' . $GLOBALS['codendi_dir'] . $p . ' ; grep -rinE "TODO" * | grep -v ".svn" | grep -v ".php~" | grep -v ".class~" | grep -v ".html~" | grep -v ".zargo" | grep -v ".tab~"'; passthru($cmd); echo '</pre>'; } $GLOBALS['HTML']->footer(array()); }
public function __construct(PFUser $user, Git_HTTP_Command $command) { parent::__construct(); $gitolite_user_info = posix_getpwnam('gitolite'); $this->gitolite_home = $gitolite_user_info['dir']; $this->env['SHELL'] = '/bin/sh'; $this->env['REMOTE_USER'] = $user->getUnixName(); $this->env['GIT_HTTP_BACKEND'] = $command->getCommand(); $this->env['HOME'] = $this->gitolite_home; $this->env['REMOTE_ADDR'] = HTTPRequest::instance()->getIPAddress(); $this->appendToEnv('REQUEST_URI'); $this->appendToEnv('REMOTE_PORT'); $this->appendToEnv('SERVER_ADDR'); $this->appendToEnv('SERVER_PORT'); }
function deleteJob() { $request =& HTTPRequest::instance(); $group_id = $request->get('group_id'); $job_id = $request->get('job_id'); $job_dao = new PluginHudsonJobDao(CodendiDataAccess::instance()); if (!$job_dao->deleteHudsonJob($job_id)) { $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_hudson', 'delete_job_error')); } else { $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_hudson', 'job_deleted')); $em = EventManager::instance(); $params = array('job_id' => $job_id); $em->processEvent('delete_ci_triggers', $params); } }
/** * Constructor * * @param Int $group_id The owner id * @param hudsonPlugin $plugin The plugin * @param HudsonJobFactory $factory The HudsonJob factory * * @return void */ function __construct($group_id, hudsonPlugin $plugin, HudsonJobFactory $factory) { parent::__construct('plugin_hudson_project_jobsoverview', $factory); $this->setOwner($group_id, WidgetLayoutManager::OWNER_TYPE_GROUP); $this->plugin = $plugin; $request =& HTTPRequest::instance(); $this->group_id = $request->get('group_id'); $this->_use_global_status = user_get_preference('plugin_hudson_use_global_status' . $this->group_id); if ($this->_use_global_status === false) { $this->_use_global_status = "false"; user_set_preference('plugin_hudson_use_global_status' . $this->group_id, $this->_use_global_status); } if ($this->_use_global_status == "true") { $this->_all_status = array('grey' => 0, 'blue' => 0, 'yellow' => 0, 'red' => 0); } }
function register_valid() { global $Language; $request =& HTTPRequest::instance(); if (!$request->isPost() || !$request->exist('Update')) { return 0; } if (!$request->existAndNonEmpty('form_realname')) { $GLOBALS['Response']->addFeedback('error', $Language->getText('account_change_realname', 'error')); return 0; } // if we got this far, it must be good $sql = "UPDATE user SET realname='" . db_es($request->get('form_realname')) . "' WHERE user_id=" . user_getid(); db_query($sql); return 1; }
function getContent() { $request =& HTTPRequest::instance(); $group_id = $request->get('group_id'); $pm = ProjectManager::instance(); $project = $pm->getProject($group_id); $token = new CSRFSynchronizerToken(''); $presenter = new MassmailFormPresenter($token, $GLOBALS['Language']->getText('contact_admins', 'title', array($project->getPublicName())), '/include/massmail_to_project_admins.php'); $template_factory = TemplateRendererFactory::build(); $renderer = $template_factory->getRenderer($presenter->getTemplateDir()); echo '<a href="#massmail-project-members" data-project-id="' . $group_id . '" class="massmail-project-member-link project_home_contact_admins" data-toggle="modal"> <i class="icon-envelope-alt"></i> ' . $GLOBALS['Language']->getText('include_project_home', 'contact_admins') . '</a>'; echo $renderer->renderToString('massmail', $presenter); }