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); }
function getHelp($section = '') { if (trim($section) !== '' && $section[0] !== '#') { $section = '#' . $section; } return '<a href="javascript:help_window(\'' . get_server_url() . '/plugins/pluginsadministration/documentation/' . UserManager::instance()->getCurrentUser()->getLocale() . '/' . $section . '\');">[?]</a>'; }
/** * Constructor. * * @param Integer $groupId Project Id * @param Integer $weeksNumber Statistics duration in weeks * * @return Void */ public function __construct($groupId, $weeksNumber) { $dao = new GitDao(); // TODO: Optionally include presonal forks in repo list $allRepositories = $dao->getProjectRepositoryList($groupId); $um = UserManager::instance(); $user = $um->getCurrentUser(); $repoFactory = new GitRepositoryFactory($dao, ProjectManager::instance()); foreach ($allRepositories as $repo) { $repository = $repoFactory->getRepositoryById($repo['repository_id']); if ($repository->userCanRead($user)) { $this->repoList[] = $repository; } } $this->displayChart = false; $this->weeksNumber = min($weeksNumber, self::MAX_WEEKSNUMBER); // Init some class properties according to 'weeks number' parameter $today = $_SERVER['REQUEST_TIME']; $startPeriod = strtotime("-{$this->weeksNumber} weeks"); $weekInSeconds = self::WEEKS_IN_SECONDS; for ($i = $startPeriod + $weekInSeconds; $i < $today + $weekInSeconds; $i += $weekInSeconds) { $this->dates[] = date('M d', $i); $this->weekNum[] = intval(date('W', $i)); $this->year[] = intval(date('Y', $i)); } }
public function process() { global $sys_allow_restricted_users; $parameters = $this->getParametersAsArray(); $project = null; if (!empty($parameters[0])) { $project = $this->getProject($parameters[0]); } else { $this->error('Missing argument project id'); return false; } $repositoryName = ''; if (!empty($parameters[1])) { $repositoryName = $parameters[1]; } else { $this->error('Missing argument repository name'); return false; } $userId = 0; if (!empty($parameters[2])) { $userId = $parameters[2]; } else { $this->error('Missing argument user id'); return false; } try { $repository = new GitRepository(); $repository->setBackend(Backend::instance('Git', 'GitBackend')); $repository->setDescription('-- Default description --'); //default access is private when restricted users are allowed if ($sys_allow_restricted_users == 1) { $repository->setAccess(GitRepository::PRIVATE_ACCESS); } else { $repository->setAccess(GitRepository::PUBLIC_ACCESS); } $user = null; if (!empty($userId)) { $user = UserManager::instance()->getUserById($userId); } if (!empty($user)) { $repository->setCreator($user); } $repository->setProject($project); $repository->setName($repositoryName); $repository->create(); $this->done(); } catch (GitDaoException $e) { $this->error($e->getMessage()); return false; } catch (GitDriverException $e) { $this->error($e->getMessage()); return false; } catch (GitBackendException $e) { $this->error($e->getMessage()); return false; } catch (Exception $e) { $this->error($e->getMessage()); return false; } }
public function importTemplateInProject(Project $project, PFUser $user, $template_path) { \UserManager::instance()->forceLogin($user->getUserName()); var_dump('Import Template'); $this->xml_importer->import($project->getID(), $template_path); var_dump('Template imported'); }
function register_valid(Codendi_Request $request) { global $Language; if (!$request->existAndNonEmpty('Update')) { return false; } if (!$request->existAndNonEmpty('user_id')) { $GLOBALS['Response']->addFeedback('error', $Language->getText('admin_user_changepw', 'error_userid')); return false; } if (!$request->existAndNonEmpty('form_pw')) { $GLOBALS['Response']->addFeedback('error', $Language->getText('admin_user_changepw', 'error_nopasswd')); return false; } if ($request->get('form_pw') != $request->get('form_pw2')) { $GLOBALS['Response']->addFeedback('error', $Language->getText('admin_user_changepw', 'error_passwd')); return false; } $errors = array(); if (!account_pwvalid($request->get('form_pw'), $errors)) { foreach ($errors as $e) { $GLOBALS['Response']->addFeedback('error', $e); } return false; } // if we got this far, it must be good $user_manager = UserManager::instance(); $user = $user_manager->getUserById($request->get('user_id')); $user->setPassword($request->get('form_pw')); if (!$user_manager->updateDb($user)) { $GLOBALS['Response']->addFeedback(Feedback::ERROR, $Language->getText('admin_user_changepw', 'error_update')); return false; } return true; }
/** * Build instance of SearchAdminClientFacade * * @return ElasticSearch_ClientFacade */ public function buildSearchAdminClient() { $index = fulltextsearchPlugin::SEARCH_DEFAULT; $type = ''; $client = $this->getClient($index, $type); return new ElasticSearch_SearchAdminClientFacade($client, $index, $this->project_manager, UserManager::instance(), new ElasticSearch_1_2_ResultFactory($this->project_manager, new URLVerification(), UserManager::instance())); }
function displayNotificationEmail() { $html = ''; $html .= '<h3>' . $GLOBALS['Language']->getText('plugin_docman', 'details_approval_email_title') . '</h3>'; $atsm = new Docman_ApprovalTableNotificationCycle(); $atsm->setItem($this->item); $atf =& Docman_ApprovalTableFactoriesFactory::getFromItem($this->item); $table = $atf->getTable(false); $atsm->setTable($table); $um =& UserManager::instance(); $owner =& $um->getUserById($table->getOwner()); $atsm->setOwner($owner); $atsm->sendNotifReviewer($owner); $html .= $GLOBALS['Language']->getText('plugin_docman', 'details_approval_email_subject') . ' ' . $atsm->getNotificationSubject() . "\n"; $html .= '<p class="docman_approval_email">'; if (ProjectManager::instance()->getProject($this->item->getGroupId())->getTruncatedEmailsUsage()) { $html .= $GLOBALS['Language']->getText('plugin_docman', 'truncated_email'); } else { $html .= htmlentities(quoted_printable_decode($atsm->getNotificationBodyText()), ENT_COMPAT, 'UTF-8'); } $html .= '</p>'; $backurl = $this->url . '&action=approval_create&id=' . $this->item->getId(); $html .= '<a href="' . $backurl . '">' . $GLOBALS['Language']->getText('plugin_docman', 'details_approval_email_back') . '</a>'; return $html; }
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++; } } } } }
/** * Returns an singleton instance of this class * * @param object $config * @param object $args * @return */ public static function getInstance($config, $args) { if (self::$instance == null) { self::$instance = new UserManager($config, $args); } return self::$instance; }
public function __construct(EventManager $event_manager) { $this->event_manager = $event_manager; $this->renderer = TemplateRendererFactory::build()->getRenderer(array(ForgeConfig::get('codendi_dir') . '/src/templates/search')); $this->search_types = array(Search_SearchTrackerV3::NAME => new Search_SearchTrackerV3(new ArtifactDao()), Search_SearchProject::NAME => new Search_SearchProject(new ProjectDao()), Search_SearchPeople::NAME => new Search_SearchPeople(UserManager::instance()), Search_SearchForum::NAME => new Search_SearchForum(new ForumDao()), Search_SearchSnippet::NAME => new Search_SearchSnippet(new SnippetDao()), Search_SearchWiki::NAME => new Search_SearchWiki(new WikiDao())); $this->plugin_manager = PluginManager::instance(); }
public function confirmHash() { $user_manager = UserManager::instance(); $confirm_hash = $this->request->get('confirm_hash'); $success = $user_manager->getUserByConfirmHash($confirm_hash) !== null; if ($success) { // Get user status: if already set to 'R' (restricted) don't change it! $user = $user_manager->getUserByConfirmHash($confirm_hash); if ($user->getStatus() == PFUser::STATUS_RESTRICTED || $user->getStatus() == PFUser::STATUS_VALIDATED_RESTRICTED) { $user->setStatus(PFUser::STATUS_RESTRICTED); } else { $user->setStatus(PFUser::STATUS_ACTIVE); } if ($user->getUnixUid() == 0) { $user_manager->assignNextUnixUid($user); if ($user->getStatus() == PFUser::STATUS_RESTRICTED) { // Set restricted shell for restricted users. $user->setShell($GLOBALS['codendi_bin_prefix'] . '/cvssh-restricted'); } } $user->setUnixStatus(PFUser::STATUS_ACTIVE); $user_manager->updateDb($user); $user_manager->removeConfirmHash($confirm_hash); $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('account_verify', 'account_confirm')); } else { $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('account_verify', 'err_hash')); } }
/** * Constructor * * @param Tracker_FormElement_Field_ArtifactLink $field The field of the value * @param boolean $has_changed If the changeset value has chnged from the previous one * @param array $artifact_links array of artifact_id => Tracker_ArtifactLinkInfo * @param array $reverse_artifact_links array of artifact_id => Tracker_ArtifactLinkInfo */ public function __construct($id, $field, $has_changed, $artifact_links, $reverse_artifact_links) { parent::__construct($id, $field, $has_changed); $this->artifact_links = $artifact_links; $this->reverse_artifact_links = $reverse_artifact_links; $this->user_manager = UserManager::instance(); }
function &getUser() { if ($this->user === null) { $um = UserManager::instance(); $this->user = $um->getCurrentUser(); } return $this->user; }
/** * Delete entry that match $package_id and $user_id (current user) in filemodule_monitor * * @param $package_id int * @return true if there is no error */ function delete($filemodule_id) { $um =& UserManager::instance(); $user =& $um->getCurrentUser(); $sql = sprintf("DELETE FROM filemodule_monitor WHERE filemodule_id=%d AND user_id=%d", $this->da->escapeInt($filemodule_id), $this->da->escapeInt($user->getID())); $deleted = $this->update($sql); return $deleted; }
/** @var Tracker_XML_Exporter_ArtifactXMLExporter */ public function build(Tracker_XML_ChildrenCollector $children_collector, PFUser $current_user) { $visitor = new Tracker_XML_Exporter_ChangesetValueXMLExporterVisitor(new Tracker_XML_Exporter_ChangesetValue_ChangesetValueDateXMLExporter(), new Tracker_XML_Exporter_ChangesetValue_ChangesetValueFileXMLExporter(new Tracker_XML_Exporter_LocalAbsoluteFilePathXMLExporter()), new Tracker_XML_Exporter_ChangesetValue_ChangesetValueFloatXMLExporter(), new Tracker_XML_Exporter_ChangesetValue_ChangesetValueIntegerXMLExporter(), new Tracker_XML_Exporter_ChangesetValue_ChangesetValueStringXMLExporter(), new Tracker_XML_Exporter_ChangesetValue_ChangesetValueTextXMLExporter(), new Tracker_XML_Exporter_ChangesetValue_ChangesetValuePermissionsOnArtifactXMLExporter(), new Tracker_XML_Exporter_ChangesetValue_ChangesetValueListXMLExporter(), new Tracker_XML_Exporter_ChangesetValue_ChangesetValueOpenListXMLExporter(), new Tracker_XML_Exporter_ChangesetValue_ChangesetValueArtifactLinkXMLExporter($children_collector, $current_user), new Tracker_XML_Exporter_ChangesetValue_ChangesetValueUnknownXMLExporter()); $values_exporter = new Tracker_XML_Exporter_ChangesetValuesXMLExporter($visitor); $user_xml_exporter = new UserXMLExporter(UserManager::instance()); $changeset_exporter = new Tracker_XML_Exporter_ChangesetXMLExporter($values_exporter, $user_xml_exporter); return new Tracker_XML_Exporter_ArtifactXMLExporter($changeset_exporter); }
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(); }
public function __construct($field, $value_function, $default_values, $decorators) { parent::__construct($field, $default_values, $decorators); if (!empty($value_function)) { $this->value_function = explode(',', $value_function); } $this->userManager = UserManager::instance(); }
/** * Return User groups for a given user * * @param string $user_name * * @return array Ex: array('site_active', 'gpig1_project_members') */ public function getUserGroupsForUserName($user_name) { $user = UserManager::instance()->getUserByUserName($user_name); if (!$user) { return array(); } return $this->getUserGroupsForUser($user); }
private function userHomeSanityCheck(BackendSystem $backend_system) { $dao = new UserDao(); $users = $dao->searchByStatus(array(PFUser::STATUS_ACTIVE, PFUser::STATUS_RESTRICTED))->instanciateWith(array(UserManager::instance(), 'getUserInstanceFromRow')); foreach ($users as $user) { $backend_system->userHomeSanityCheck($user); } }
public function __construct(Project $project, $archive_name, $admin_name) { $this->project = $project; $this->archive_name = basename($archive_name); $this->package_path = $archive_name; $this->data_path = $this->package_path . '/' . $this->archive_name; $this->user_manager = UserManager::instance(); $this->admin_user = $this->user_manager->getUserByUserName($admin_name); }
protected function getAvailableJobs() { if ($this->owner_type == WidgetLayoutManager::OWNER_TYPE_USER) { $owner_id = UserManager::instance()->getCurrentUser()->getId(); } else { $owner_id = $this->group_id; } return $this->getHudsonJobFactory()->getAvailableJobs($this->owner_type, $owner_id); }
function widget_instance($params) { require_once 'common/widget/WidgetLayoutManager.class.php'; $user = UserManager::instance()->getCurrentUser(); $hf = $this->getHudsonJobFactory(); // MY if ($params['widget'] == 'plugin_hudson_my_jobs') { require_once 'hudson_Widget_MyMonitoredJobs.class.php'; $params['instance'] = new hudson_Widget_MyMonitoredJobs($user->getId(), $this, $hf); } if ($params['widget'] == 'plugin_hudson_my_joblastbuilds') { require_once 'hudson_Widget_JobLastBuilds.class.php'; $params['instance'] = new hudson_Widget_JobLastBuilds(WidgetLayoutManager::OWNER_TYPE_USER, $user->getId(), $hf); } if ($params['widget'] == 'plugin_hudson_my_jobtestresults') { require_once 'hudson_Widget_JobTestResults.class.php'; $params['instance'] = new hudson_Widget_JobTestResults(WidgetLayoutManager::OWNER_TYPE_USER, $user->getId(), $hf); } if ($params['widget'] == 'plugin_hudson_my_jobtesttrend') { require_once 'hudson_Widget_JobTestTrend.class.php'; $params['instance'] = new hudson_Widget_JobTestTrend(WidgetLayoutManager::OWNER_TYPE_USER, $user->getId(), $hf); } if ($params['widget'] == 'plugin_hudson_my_jobbuildhistory') { require_once 'hudson_Widget_JobBuildHistory.class.php'; $params['instance'] = new hudson_Widget_JobBuildHistory(WidgetLayoutManager::OWNER_TYPE_USER, $user->getId(), $hf); } if ($params['widget'] == 'plugin_hudson_my_joblastartifacts') { require_once 'hudson_Widget_JobLastArtifacts.class.php'; $params['instance'] = new hudson_Widget_JobLastArtifacts(WidgetLayoutManager::OWNER_TYPE_USER, $user->getId(), $hf); } // PROJECT if ($params['widget'] == 'plugin_hudson_project_jobsoverview') { require_once 'hudson_Widget_ProjectJobsOverview.class.php'; $params['instance'] = new hudson_Widget_ProjectJobsOverview($GLOBALS['group_id'], $this, $hf); } if ($params['widget'] == 'plugin_hudson_project_joblastbuilds') { require_once 'hudson_Widget_JobLastBuilds.class.php'; $params['instance'] = new hudson_Widget_JobLastBuilds(WidgetLayoutManager::OWNER_TYPE_GROUP, $GLOBALS['group_id'], $hf); } if ($params['widget'] == 'plugin_hudson_project_jobtestresults') { require_once 'hudson_Widget_JobTestResults.class.php'; $params['instance'] = new hudson_Widget_JobTestResults(WidgetLayoutManager::OWNER_TYPE_GROUP, $GLOBALS['group_id'], $hf); } if ($params['widget'] == 'plugin_hudson_project_jobtesttrend') { require_once 'hudson_Widget_JobTestTrend.class.php'; $params['instance'] = new hudson_Widget_JobTestTrend(WidgetLayoutManager::OWNER_TYPE_GROUP, $GLOBALS['group_id'], $hf); } if ($params['widget'] == 'plugin_hudson_project_jobbuildhistory') { require_once 'hudson_Widget_JobBuildHistory.class.php'; $params['instance'] = new hudson_Widget_JobBuildHistory(WidgetLayoutManager::OWNER_TYPE_GROUP, $GLOBALS['group_id'], $hf); } if ($params['widget'] == 'plugin_hudson_project_joblastartifacts') { require_once 'hudson_Widget_JobLastArtifacts.class.php'; $params['instance'] = new hudson_Widget_JobLastArtifacts(WidgetLayoutManager::OWNER_TYPE_GROUP, $GLOBALS['group_id'], $hf); } }
public function load($id){ // run this block if user id is set if (!empty($id)) { // get location from usermanager $gim = UserManager::instance()->lookupGimNames($id); $gim = $gim[$id]['im_name']; $this->set( $id, $gim); } }
public function process(HTTPRequest $request) { $this->loadLibrary(); $user_manager = UserManager::instance(); $provider_manager = new ProviderManager(new ProviderDao()); $user_mapping_manager = new UserMappingManager(new UserMappingDao()); $login_controller = new LoginController($user_manager, $provider_manager, $user_mapping_manager); $router = new Router($login_controller); $router->route($request); }
/** * Add a user by his name to an ugroup * * @param int $groupId * @param int $ugroupId * @param String $add_user_name */ private function addUserByName($groupId, $ugroupId, $add_user_name) { $user = UserManager::instance()->findUser($add_user_name); if ($user) { ugroup_add_user_to_ugroup($groupId, $ugroupId, $user->getId()); } else { //user doesn't exist $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('include_account', 'user_not_exist')); } }
public function getContent() { $html = ''; $uh = UserHelper::instance(); $request = HTTPRequest::instance(); $hp = Codendi_HTMLPurifier::instance(); $user = UserManager::instance()->getCurrentUser(); $pm = ProjectManager::instance(); $project_ids = $user->getProjects(); foreach ($project_ids as $project_id) { $project = $pm->getProject($project_id); if ($project->usesSVN()) { list($hide_now, $count_diff, $hide_url) = my_hide_url('my_svn_group', $project_id, $request->get('hide_item_id'), count($project_ids), $request->get('hide_my_svn_group')); $html .= $hide_url; $html .= '<strong>' . $project->getPublicName() . '</strong>'; if (!$hide_now) { list($latest_revisions, $nb_revisions) = svn_get_revisions($project, 0, $this->_nb_svn_commits, '', $user->getUserName(), '', '', 0, false); if (db_numrows($latest_revisions) > 0) { $i = 0; while ($data = db_fetch_array($latest_revisions)) { $html .= '<div class="' . util_get_alt_row_color($i++) . '" style="border-bottom:1px solid #ddd">'; $html .= '<div style="font-size:0.98em;">'; $html .= '<a href="' . $this->_getLinkToCommit($project->getGroupId(), $data['revision']) . '">rev #' . $data['revision'] . '</a>'; $html .= ' ' . $GLOBALS['Language']->getText('my_index', 'my_latest_svn_commit_on') . ' '; //In the db, svn dates are stored as int whereas cvs dates are stored as timestamp $html .= format_date($GLOBALS['Language']->getText('system', 'datefmt'), is_numeric($data['date']) ? $data['date'] : strtotime($data['date'])); $html .= ' ' . $GLOBALS['Language']->getText('my_index', 'my_latest_svn_commit_by') . ' '; if (isset($data['whoid'])) { $name = $uh->getDisplayNameFromUserId($data['whoid']); } else { $name = $uh->getDisplayNameFromUserName($data['who']); } $html .= $hp->purify($name, CODENDI_PURIFIER_CONVERT_HTML); $html .= '</div>'; $html .= '<div style="padding-left:20px; padding-bottom:4px; color:#555">'; $html .= util_make_links(substr($data['description'], 0, 255), $project->getGroupId()); if (strlen($data['description']) > 255) { $html .= ' [...]'; } $html .= '</div>'; $html .= '</div>'; } $html .= '<div style="text-align:center" class="' . util_get_alt_row_color($i++) . '">'; $html .= '<a href="' . $this->_getLinkToMore($project->getGroupId(), $user->getUserName()) . '">[ More ]</a>'; $html .= '</div>'; } else { $html .= '<div></div>'; } } else { $html .= '<div></div>'; } } } return $html; }
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> '; $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%">' . ' - <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; }
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> '; $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%"> - <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; }
/** * The singleton method * * @return WorkflowFactory */ public static function instance() { if (!isset(self::$_instance)) { $formelement_factory = Tracker_FormElementFactory::instance(); $logger = new WorkflowBackendLogger(new BackendLogger()); $trigger_rules_manager = new Tracker_Workflow_Trigger_RulesManager(new Tracker_Workflow_Trigger_RulesDao(), $formelement_factory, new Tracker_Workflow_Trigger_RulesProcessor(UserManager::instance()->getUserById(Tracker_Workflow_WorkflowUser::ID), $logger), $logger); $c = __CLASS__; self::$_instance = new $c(TransitionFactory::instance(), TrackerFactory::instance(), $formelement_factory, $trigger_rules_manager, $logger); } return self::$_instance; }