/** * Get Dynamic ugroups members * * @param Integer $ugroupId Id of the uGroup * @param Integer $groupId Id of the project * * @return DataAccessResult */ public function getDynamicUGroupsMembers($ugroupId, $groupId) { if ($ugroupId <= 100) { $dao = new UGroupUserDao(CodendiDataAccess::instance()); return $dao->searchUserByDynamicUGroupId($ugroupId, $groupId); } }
function getDao() { if (!isset($this->_dao)) { $this->_dao = new ForumML_MessageDao(CodendiDataAccess::instance()); } return $this->_dao; }
/** * * Returns an instance of UserDao * * @return UserDao */ function getUserDao() { if (!$this->userDao) { $this->userDao = new UserDao(CodendiDataAccess::instance()); } return $this->userDao; }
function CodendiUpgrade() { $this->_upgradeError = null; $this->setEnvironment(); $da =& CodendiDataAccess::instance(); parent::DataAccessObject($da); }
function &_getDao() { if (!$this->dao) { $this->dao = new NotificationsDao(CodendiDataAccess::instance()); } return $this->dao; }
function listMessages() { include_once 'MaillogDao.class.php'; $dao = new MaillogDao(CodendiDataAccess::instance()); $dar = $dao->getAllMessages(); $nb = $dao->getNbMessages(); echo "<h1>List of emails sent by " . $GLOBALS['sys_name'] . "</h1>\n"; echo "<div style=\"text-align: center;\">Nb messages: " . $nb . "</div>\n"; echo "<form name=\"maillog\" method=\"post\" action=\"?\">\n"; echo "<p>\n"; echo "<input type=\"submit\" name=\"delete\" value=\"Delete\" />\n"; echo "</p>\n"; $hp = Codendi_HTMLPurifier::instance(); while ($dar->valid()) { $row = $dar->current(); $dar2 = $dao->getAllHeaders($row['id_message']); echo '<table class="table table-bordered table-striped"><tbody>'; while ($dar2->valid()) { $row2 = $dar2->current(); echo "<tr><th>" . $hp->purify($row2['name']) . ":</th><td>" . $hp->purify($row2['value']) . "</td></tr>"; $dar2->next(); } $input = preg_replace("/=\r?\n/", '', $row['html_body']); $input = preg_replace('/=([a-f0-9]{2})/ie', "chr(hexdec('\\1'))", $input); echo '<tr><th></th><td>'; var_dump(substr($input, 0, 400)); echo '</td></tr>'; echo "</table>\n"; $dar->next(); } echo "</form>"; }
/** * The manager is a singleton * * @return PermissionsManager */ public static function instance() { if (!self::$_permissionmanager_instance) { self::$_permissionmanager_instance = new PermissionsManager(new PermissionsDAO(CodendiDataAccess::instance())); } return self::$_permissionmanager_instance; }
public function __construct() { parent::__construct(); $this->initDb(); $this->disk_usage_dao = new Statistics_DiskUsageDao(CodendiDataAccess::instance()); $this->disk_data_purger = new Statistics_DiskUsagePurger($this->disk_usage_dao); }
/** * Obtain an instance of SvnNotificationDao * * @return SvnNotificationDao */ public function _getDao() { if (!isset($this->_dao)) { $this->_dao = new SvnNotificationDao(CodendiDataAccess::instance()); } return $this->_dao; }
protected function _getMailingListDao() { if (!$this->_mailinglistdao) { $this->_mailinglistdao = new MailingListDao(CodendiDataAccess::instance()); } return $this->_ugroupdao; }
private function &_getWatermarkMetadataValueDao() { if (!$this->dao) { $this->dao = new DocmanWatermark_MetadataValueDao(CodendiDataAccess::instance()); } return $this->dao; }
function &_getVersionDao() { if (!$this->dao) { $this->dao =& new Docman_VersionDao(CodendiDataAccess::instance()); } return $this->dao; }
function _getPriorityPluginHookDao() { if (!is_a($this->priorityPluginHookDao, 'PriorityPluginHookDao')) { $this->priorityPluginHookDao = new PriorityPluginHookDao(CodendiDataAccess::instance()); } return $this->priorityPluginHookDao; }
function _getDao() { if (!$this->dao) { $this->dao = new Docman_LogDao(CodendiDataAccess::instance()); } return $this->dao; }
function _getDao() { if (!$this->dao) { $this->dao = new SystemEventDao(CodendiDataAccess::instance()); } return $this->dao; }
function &getDao() { if ($this->dao === null) { $this->dao = new Docman_SettingsDao(CodendiDataAccess::instance()); } return $this->dao; }
function listMessages() { $dao = new MaillogDao(CodendiDataAccess::instance()); $dar = $dao->getAllMessages(); $nb = $dao->getNbMessages(); echo "<h1>List of emails sent by " . $GLOBALS['sys_name'] . "</h1>\n"; echo "<div style=\"text-align: center;\">Nb messages: " . $nb . "</div>\n"; echo "<form name=\"maillog\" method=\"post\" action=\"?\">\n"; echo "<p>\n"; echo "<input type=\"submit\" name=\"delete\" value=\"Delete\" />\n"; echo "</p>\n"; $hp =& Codendi_HTMLPurifier::instance(); while ($dar->valid()) { $row = $dar->current(); $dar2 = $dao->getAllHeaders($row['id_message']); echo "<div style=\"background-color: lightgrey;\">\n"; while ($dar2->valid()) { $row2 = $dar2->current(); echo "<strong>" . $hp->purify($row2['name']) . ":</strong> " . $hp->purify($row2['value']) . "<br>\n"; $dar2->next(); } echo "</div>\n"; echo '<div style="width: 80em; font-family: monospace; margin-bottom: 0.5em;">' . "\n"; echo $hp->purify($row['body'], CODENDI_PURIFIER_BASIC); echo "</div>\n"; $dar->next(); } echo "</form>"; }
function &getDao() { static $_codendi_wikiattachmentrevisiondao_instance; if (!$_codendi_wikiattachmentrevisiondao_instance) { $_codendi_wikiattachmentrevisiondao_instance = new PHPWikiAttachmentRevisionDao(CodendiDataAccess::instance()); } return $_codendi_wikiattachmentrevisiondao_instance; }
/** * Return Docman_MetadataListOfValuesElementDao object. */ function &getDao() { static $_plugin_docman_metadata_love_dao_instance; if (!$_plugin_docman_metadata_love_dao_instance) { $_plugin_docman_metadata_love_dao_instance =& new Docman_MetadataListOfValuesElementDao(CodendiDataAccess::instance()); } return $_plugin_docman_metadata_love_dao_instance; }
/** * Return Docman_MetadataValueDao reference. */ function &getDao() { static $_plugin_docman_metadata_value_dao_instance; if (!$_plugin_docman_metadata_value_dao_instance) { $_plugin_docman_metadata_value_dao_instance =& new Docman_MetadataValueDao(CodendiDataAccess::instance()); } return $_plugin_docman_metadata_value_dao_instance; }
/** * ArtifactRuleFactory is a singleton */ function &instance() { static $_artifactrulefactory_instance; if (!$_artifactrulefactory_instance) { $rules_dao = new ArtifactRuleDao(CodendiDataAccess::instance()); $_artifactrulefactory_instance = new ArtifactRuleFactory($rules_dao); } return $_artifactrulefactory_instance; }
function instance() { static $_pluginfactory_instance; if (!$_pluginfactory_instance) { $dao = new PluginDao(CodendiDataAccess::instance()); $_pluginfactory_instance = new PluginFactory($dao); } return $_pluginfactory_instance; }
/** * @return PluginFactory */ public static function instance() { if (!self::$instance) { $plugin_dao = new PluginDao(CodendiDataAccess::instance()); $restricted_plugin_dao = new RestrictedPluginDao(); $restrictor = new PluginResourceRestrictor($restricted_plugin_dao); self::$instance = new PluginFactory($plugin_dao, $restrictor); } return self::$instance; }
/** * Export user list in csv format * * @param String $user_name_search * @param String $current_sort_header * @param String $sort_order * */ public function exportUserList($user_name_search, $current_sort_header, $sort_order, $status_values) { global $Language; header('Content-Type: text/csv'); header('Content-Disposition:attachment; filename=users_list.csv'); $eol = "\n"; $documents_title = array('user_id' => $Language->getText('admin_userlist', 'id_user'), 'login_name' => $Language->getText('include_user_home', 'login_name'), 'real_name' => $Language->getText('include_user_home', 'real_name'), 'member_of' => $Language->getText('admin_userlist', 'member_of'), 'admin_of' => $Language->getText('admin_userlist', 'admin_of'), 'status' => $Language->getText('admin_userlist', 'status')); echo build_csv_header($this->col_list, $documents_title) . $eol; $dao = new UserDao(CodendiDataAccess::instance()); $result = $dao->listAllUsers($user_name_search, 0, 0, $current_sort_header, $sort_order, $status_values); $users = $result['users']; echo $this->buildCsvBody($users); }
function updateGlobalNotification($global_notification_id, $data) { $dao = new ArtifactGlobalNotificationDao(CodendiDataAccess::instance()); $feedback = ''; $arr_email_address = split('[,;]', $data['addresses']); if (!util_validateCCList($arr_email_address, $feedback, false)) { $GLOBALS['Response']->addFeedback('error', $feedback); } else { $data['addresses'] = util_cleanup_emails(implode(', ', $arr_email_address)); return $dao->modify($global_notification_id, $data); } return false; }
/** * Copy the reports from the tracker $from_id to the tracker $to_id * The copied reports must have scope == 'P' */ public function copyReports($from_id, $to_id) { $user_id = UserManager::instance()->getCurrentUser()->getId(); $dao = new GraphOnTrackers_ReportDao(CodendiDataAccess::instance()); foreach ($dao->searchByTrackerIdAndScope($from_id, 'P') as $row) { //retrieve the report $report = new GraphOnTrackers_Report($row['report_graphic_id']); //Create a new one $copied_report = GraphOnTrackers_Report::create($to_id, $user_id, $report->getName(), $report->getDescription(), $report->getScope()); //Copy the charts $this->copyCharts($report, $copied_report); } }
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); } }
/** * Public Method to create the watermark metadata map in the target project (customized for the import purpose) * @param Docman_Metadata object dm: the metadata object to be checked * @return array ('md' => int matched metadataId, 'love' => related loves) */ public function getWatermarkMetadataMap($md) { // get the metadata iterator from target project $dmd = new Docman_MetadataDao(CodendiDataAccess::instance()); $dar = $dmd->searchByName($this->targetProjectId, $md->getName()); // if the name doesn't match then return md = 0 $dar->rewind(); if (!$dar->valid()) { return array('md' => 0, 'love' => array()); } else { // check metadata properties type, useIt, AllowMultipleValue if it doesn't much then return md = 0 while ($dar->valid()) { $row = $dar->current(); if ($row['use_it'] == $md->isUsed() && $row['data_type'] == $md->getType() && $row['mul_val_ok'] == $md->isMultipleValuesAllowed()) { // it seams that the metadata is ok // check now if source Metadata values already exist $dmlovef = new Docman_MetadataListOfValuesElementFactory($md->getId()); $loveIter = $dmlovef->getIteratorByFieldId($md->getId(), $md->getLabel(), true); $dmloveft = new Docman_MetadataListOfValuesElementFactory($row['field_id']); $loveIter->rewind(); $i = 0; $loves = array(); while ($loveIter->valid()) { $love = $loveIter->current(); $lovetIter = $dmloveft->getByName($love->getName(), $row['field_id'], true); $lovetIter->rewind(); if (!$lovetIter->valid()) { return array('md' => 0, 'love' => array()); } $lovet = $lovetIter->current(); $dwmdvf = new DocmanWatermark_MetadataValueFactory(); $loves[$i]['value_id'] = $lovet->getId(); $loves[$i]['watermark'] = $dwmdvf->isWatermarkedOnValue($love->getId()); $i++; $loveIter->next(); } return array('md' => $row['field_id'], 'love' => $loves); } $dar->next(); } return array('md' => 0, 'love' => array()); } }
function _fetchServices(&$server) { $html = ''; $service_dao = new ServiceDao(CodendiDataAccess::instance()); $dar =& $service_dao->searchByServerId($server->getId()); if ($dar) { $matches = array(); $projects = array(); while ($dar->valid()) { $row = $dar->current(); $label = $row['label']; if ($label == "service_" . $row['short_name'] . "_lbl_key") { $label = $GLOBALS['Language']->getText('project_admin_editservice', $label); } else { if (preg_match('/(.*):(.*)/', $label, $matches)) { $label = $GLOBALS['Language']->getText($matches[1], $matches[2]); } } $projects[$row['group_id']][] = array('label' => $label, 'id' => $row['service_id']); $dar->next(); } if (count($projects)) { $html .= '<p>' . $GLOBALS['Language']->getText('admin_servers', 'delete_using') . '</p>'; $html .= '<dl>'; $pm = ProjectManager::instance(); foreach ($projects as $project_id => $services) { if ($p = $pm->getProject($project_id)) { $html .= '<dt><a title="Project admin" href="/project/admin/?group_id=' . $project_id . '">' . $p->getPublicName() . '</a></dt>'; $html .= '<dd><ul>'; foreach ($services as $service) { $html .= '<li><a href ="/project/admin/editservice.php?group_id=' . $project_id . '&service_id=' . $service['id'] . '">' . $service['label'] . '</a></li>'; } $html .= '</ul></dd>'; } } $html .= '</dl>'; } } return $html; }
function _getReferenceDao() { if (!is_a($this->referenceDao, 'ReferenceDao')) { $this->referenceDao = new ReferenceDao(CodendiDataAccess::instance()); } return $this->referenceDao; }