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;
 }
 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;
 }
Ejemplo n.º 3
0
 private function validateJsonConditionFormat(stdClass $json)
 {
     if (!isset($json->condition)) {
         throw new Tracker_Workflow_Trigger_Exception_AddRuleJsonFormatException('condition is missing');
     }
     $valid_condition = new Valid_WhiteList('condition', array(Tracker_Workflow_Trigger_RulesBuilderData::CONDITION_ALL_OFF, Tracker_Workflow_Trigger_RulesBuilderData::CONDITION_AT_LEAST_ONE));
     $valid_condition->required();
     $valid_condition->disableFeedback();
     if (!$valid_condition->validate($json->condition)) {
         throw new Tracker_Workflow_Trigger_Exception_TriggerInvalidConditionException();
     }
 }
Ejemplo n.º 4
0
 public function route(HTTPRequest $request, Layout $response)
 {
     $valid_route = new Valid_WhiteList('func', $this->routes);
     $valid_route->required();
     if ($request->valid($valid_route)) {
         $route = $request->get('func');
         $controller = new OpenId_LoginController($this->logger, new OpenId_AccountManager(new Openid_Dao(), UserManager::instance()), $request, $response);
         $controller->{$route}();
     } else {
         $response->addFeedback(Feedback::ERROR, 'Invalid request for ' . __CLASS__);
         $response->redirect('/');
     }
 }
Ejemplo n.º 5
0
 /**
  * Compute the request
  *
  * @return void
  */
 public function request()
 {
     $request = $this->getRequest();
     if ($request->exist('action') && $this->getUser()->isLoggedIn()) {
         $vAction = new Valid_WhiteList('action', array('submit_ticket'));
         $vAction->required();
         $action = $request->getValidated('action', $vAction, false);
         switch ($action) {
             case 'submit_ticket':
                 $this->addAction('addTicket');
                 $this->addview('remedyPostSubmission');
                 break;
             default:
                 $this->addview('displayForm');
                 break;
         }
     } else {
         $this->addview('displayForm');
     }
 }
 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;
 }
 function updatePreferences($request)
 {
     $request->valid(new Valid_String('cancel'));
     $vShow = new Valid_WhiteList('show', array('A', 'S', 'AS'));
     $vShow->required();
     if (!$request->exist('cancel')) {
         if ($request->valid($vShow)) {
             switch ($request->get('show')) {
                 case 'A':
                     $this->artifact_show = 'A';
                     break;
                 case 'S':
                     $this->artifact_show = 'S';
                     break;
                 default:
                     $this->artifact_show = 'AS';
             }
             user_set_preference(self::PREF_SHOW, $this->artifact_show);
         }
     }
     return true;
 }
 protected function _showProjectAdmins()
 {
     $html = '';
     $hp = Codendi_HTMLPurifier::instance();
     $request = HTTPRequest::instance();
     $vFunc = new Valid_WhiteList('plugin_admindelegation_func', array('show_admins'));
     $vFunc->required();
     if ($request->valid($vFunc)) {
         $func = $request->get('plugin_admindelegation_func');
     } else {
         $func = '';
     }
     $vGroup = new Valid_String('plugin_admindelegation_group');
     $vGroup->required();
     if ($request->valid($vGroup)) {
         $pm = ProjectManager::instance();
         $project = $pm->getProjectFromAutocompleter($request->get('plugin_admindelegation_group'));
         if ($project && $project->isActive()) {
             $groupValue = $project->getPublicName() . ' (' . $project->getUnixName() . ')';
         } else {
             $groupValue = '';
         }
     } else {
         $project = false;
         $groupValue = '';
     }
     $html .= '<form method="post" action="?">';
     $html .= '<label>' . $GLOBALS['Language']->getText('plugin_admindelegation', 'widget_admins_label') . '</label>';
     $html .= '<input type="hidden" name="plugin_admindelegation_func" value="show_admins" />';
     $html .= '<input type="text" name="plugin_admindelegation_group" value="' . $groupValue . '" size ="40" id="plugin_admindelegation_group" />';
     $html .= '&nbsp;';
     $html .= '<input type="submit" value="' . $GLOBALS['Language']->getText('plugin_admindelegation', 'widget_btn_search') . '"/>';
     $html .= '</form>';
     $js = "new ProjectAutoCompleter('plugin_admindelegation_group', '" . util_get_dir_image_theme() . "', false);";
     $GLOBALS['HTML']->includeFooterJavascriptSnippet($js);
     if ($func == 'show_admins' && $project && $project->isActive()) {
         $allAdmins = array();
         $users = $this->getProjectAdmins($project->getId());
         if (count($users) > 0) {
             $uh = UserHelper::instance();
             $html .= '<table width="100%">';
             $html .= '<theader>';
             $html .= '<tr>';
             $html .= '<th>' . $GLOBALS['Language']->getText('plugin_admindelegation', 'widget_admins_name') . '</th>';
             $html .= '<th>' . $GLOBALS['Language']->getText('plugin_admindelegation', 'widget_admins_email') . '</th>';
             $html .= '</tr>';
             $html .= '</theader>';
             $html .= '<tbody>';
             $i = 1;
             foreach ($users as $u) {
                 $mailto = $u->getRealname() . ' &lt;' . $u->getEmail() . '&gt;';
                 $allAdmins[] = $mailto;
                 $html .= '<tr class="' . util_get_alt_row_color($i++) . '">';
                 $html .= '<td>' . $hp->purify($uh->getDisplayNameFromUser($u)) . '</td>';
                 $html .= '<td><a href="mailto:' . $mailto . '">' . $u->getEmail() . '</a></td>';
                 $html .= '</tr>';
             }
             $html .= '</tbody>';
             $html .= '</table>';
             // Mail to all admins
             $html .= '<div style="text-align:center" class="' . util_get_alt_row_color($i++) . '">';
             $html .= '<a href="mailto:' . implode(',', $allAdmins) . '?Subject=' . $GLOBALS['Language']->getText('plugin_admindelegation', 'widget_admins_mass_mail_subject', array($GLOBALS['sys_name'], $project->getPublicName())) . '">' . $GLOBALS['Language']->getText('plugin_admindelegation', 'widget_admins_mass_mail') . '</a>';
             $html .= '</div>';
         }
     }
     return $html;
 }
Ejemplo n.º 9
0
//
//
//	Originally written by Laurent Julliard 2004, Codendi Team, Xerox
//
// CAUTION!!
// Make the changes before calling svn_header_admin because
// svn_header_admin caches the project object in memory and
// the form values are therefore not updated.
//
$request->valid(new Valid_String('post_changes'));
$request->valid(new Valid_String('SUBMIT'));
if ($request->isPost() && $request->existAndNonEmpty('post_changes')) {
    $vTracked = new Valid_WhiteList('form_tracked', array('0', '1'));
    $vTracked->required();
    $vMandatoryRef = new Valid_WhiteList('form_mandatory_ref', array('0', '1'));
    $vMandatoryRef->required();
    $vPreamble = new Valid_Text('form_preamble');
    if ($request->valid($vTracked) && $request->valid($vPreamble) && $request->valid($vMandatoryRef)) {
        // group_id was validated in index.
        $form_tracked = $request->get('form_tracked');
        $form_preamble = $request->get('form_preamble');
        $form_mandatory_ref = $request->get('form_mandatory_ref');
        $ret = svn_data_update_general_settings($group_id, $form_tracked, $form_preamble, $form_mandatory_ref);
        if ($ret) {
            $GLOBALS['Response']->addFeedback('info', $Language->getText('svn_admin_general_settings', 'upd_success'));
        } else {
            $GLOBALS['Response']->addFeedback('error', $Language->getText('svn_admin_general_settings', 'upd_fail'));
        }
    } else {
        $GLOBALS['Response']->addFeedback('error', $Language->getText('svn_admin_general_settings', 'upd_fail'));
    }
Ejemplo n.º 10
0
$vGroupBy = new Valid_WhiteList('group_by', $groupByDate);
$vGroupBy->required();
if ($request->valid($vGroupBy)) {
    $selectedGroupByDate = $request->get('group_by');
} else {
    $selectedGroupByDate = 'Week';
}
$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));
Ejemplo n.º 11
0
 /**
  * This function handle file storage regarding user parameters.
  *
  * @access: private
  */
 function _storeFile($item)
 {
     $fs =& $this->_getFileStorage();
     $user =& $this->_controler->getUser();
     $request =& $this->_controler->request;
     $iFactory =& $this->_getItemFactory();
     $vFactory =& $this->_getVersionFactory();
     $uploadSucceded = false;
     $newVersion = null;
     $_label = '';
     $_changelog = '';
     $nextNb = $vFactory->getNextVersionNumber($item);
     if ($nextNb === false) {
         $number = 1;
         $_action_type = 'initversion';
         $_changelog = 'Initial version';
     } else {
         $number = $nextNb;
         $_action_type = 'newversion';
     }
     // Prepare label and changelog from user input
     $data_version = $request->get('version');
     if ($data_version) {
         if (isset($data_version['label'])) {
             $_label = $data_version['label'];
         }
         if (isset($data_version['changelog'])) {
             $_changelog = $data_version['changelog'];
         }
     }
     switch ($iFactory->getItemTypeForItem($item)) {
         case PLUGIN_DOCMAN_ITEM_TYPE_FILE:
             if ($request->exist('upload_content')) {
                 if ($request->exist('chunk_offset') && $request->exist('chunk_size')) {
                     $path = $fs->store($request->get('upload_content'), $request->get('group_id'), $item->getId(), $number, $request->get('chunk_offset'), $request->get('chunk_size'));
                 } else {
                     $path = $fs->store($request->get('upload_content'), $request->get('group_id'), $item->getId(), $number);
                 }
                 if ($path) {
                     $uploadSucceded = true;
                     if ($request->exist('file_name')) {
                         $_filename = basename($request->get('file_name'));
                     } else {
                         $_filename = basename($path);
                     }
                     if ($request->exist('file_size')) {
                         $_filesize = $request->get('file_size');
                     } else {
                         $_filesize = filesize($path);
                     }
                     if ($request->exist('mime_type')) {
                         $_filetype = $request->get('mime_type');
                     } else {
                         $_filetype = mime_content_type($path);
                         //be careful with false detection
                     }
                 }
             } else {
                 $path = $fs->upload($_FILES['file'], $item->getGroupId(), $item->getId(), $number);
                 if ($path) {
                     $uploadSucceded = true;
                     $_filename = $_FILES['file']['name'];
                     $_filesize = $_FILES['file']['size'];
                     $_filetype = $_FILES['file']['type'];
                     //TODO detect mime type server side
                 }
             }
             break;
         case PLUGIN_DOCMAN_ITEM_TYPE_EMBEDDEDFILE:
             if ($path = $fs->store($request->get('content'), $item->getGroupId(), $item->getId(), $number)) {
                 $uploadSucceded = true;
                 //TODO take mimetype once the file has been written ?
                 $_filename = basename($path);
                 $_filesize = filesize($path);
                 $_filetype = 'text/html';
             }
             break;
         default:
             break;
     }
     if ($uploadSucceded) {
         $userId = $user->getId();
         if ($request->exist('author') && $request->get('author') != $userId) {
             $versionAuthor = $request->get('author');
             $eArray = array('group_id' => $item->getGroupId(), 'item' => &$item, 'new_value' => $this->_getUserManagerInstance()->getUserById($versionAuthor)->getName(), 'user' => &$user);
             $this->event_manager->processEvent('plugin_docman_event_set_version_author', $eArray);
         } else {
             $versionAuthor = $userId;
         }
         $date = '';
         if ($request->exist('date')) {
             $date = $request->get('date');
             $eArray = array('group_id' => $item->getGroupId(), 'item' => &$item, 'old_value' => null, 'new_value' => $date, 'user' => &$user);
             $this->event_manager->processEvent('plugin_docman_event_set_version_date', $eArray);
         }
         $vArray = array('item_id' => $item->getId(), 'number' => $number, 'user_id' => $versionAuthor, 'label' => $_label, 'changelog' => $_changelog, 'filename' => $_filename, 'filesize' => $_filesize, 'filetype' => $_filetype, 'path' => $path, 'date' => $date);
         $vId = $vFactory->create($vArray);
         // Create a new version object
         $vArray['id'] = $vId;
         $vArray['date'] = $_SERVER['REQUEST_TIME'];
         $newVersion = new Docman_Version($vArray);
         $eArray = array('group_id' => $item->getGroupId(), 'item' => &$item, 'version' => $newVersion, 'user' => &$user);
         $this->event_manager->processEvent('plugin_docman_event_new_version', $eArray);
         $this->_controler->feedback->log('info', $GLOBALS['Language']->getText('plugin_docman', 'info_create_' . $_action_type));
         // Approval table
         if ($number > 0) {
             $vImport = new Valid_WhiteList('app_table_import', array('copy', 'reset', 'empty'));
             $vImport->required();
             $import = $request->getValidated('app_table_import', $vImport, false);
             if ($import) {
                 // Approval table creation needs the item currentVersion to be set.
                 $vArray['id'] = $vId;
                 $vArray['date'] = time();
                 $newVersion =& new Docman_Version($vArray);
                 $item->setCurrentVersion($newVersion);
                 $atf =& Docman_ApprovalTableFactory::getFromItem($item);
                 $atf->createTable($user->getId(), $request->get('app_table_import'));
             }
         }
     } else {
         //TODO What should we do if upload failed ?
         //Maybe cancel item ?
         $this->_controler->feedback->log('error', $GLOBALS['Language']->getText('plugin_docman', 'error_create_' . $_action_type));
     }
     return $newVersion;
 }
Ejemplo n.º 12
0
 private function getPane($request)
 {
     $vPane = new Valid_WhiteList('pane', array(Project_Admin_UGroup_View_Settings::IDENTIFIER, Project_Admin_UGroup_View_Members::IDENTIFIER, Project_Admin_UGroup_View_Permissions::IDENTIFIER, Project_Admin_UGroup_View_ShowBinding::IDENTIFIER, Project_Admin_UGroup_View_EditBinding::IDENTIFIER));
     $vPane->required();
     return $request->getValidated('pane', $vPane, Project_Admin_UGroup_View_Settings::IDENTIFIER);
 }
Ejemplo n.º 13
0
 if ($request->valid($vSrch)) {
     $_srch = $request->get('_srch');
 } else {
     $_srch = '';
 }
 $vPv = new Valid_Pv();
 $vPv->required();
 if ($request->valid($vPv)) {
     $pv = $request->get('pv');
 } else {
     $pv = 0;
 }
 // No treatment
 $request->valid(new Valid_String('SUBMIT'));
 $vSet = new Valid_WhiteList('set', array('custom', 'my', 'any'));
 $vSet->required();
 if (!$request->valid($vSet)) {
     /*
      if no set is passed in, see if a preference was set
      if no preference or not logged in, use my set
     */
     if (user_isloggedin()) {
         $custom_pref = user_get_preference('svn_commits_browcust' . $group_id);
         if ($custom_pref) {
             $pref_arr = explode('|', $custom_pref);
             if (!$_rev_id) {
                 $_rev_id = $pref_arr[0];
             }
             $_commiter = $pref_arr[1];
             $_path = $pref_arr[2];
             $_srch = $pref_arr[3];
Ejemplo n.º 14
0
                 forum_thread_delete_monitor($forum_id, $msg_id);
                 $feedback .= $Language->getText('forum_admin_index', 'msgs_del', recursive_delete($msg_id, $forum_id));
             } else {
                 $feedback .= ' ' . $Language->getText('forum_admin_index', 'msg_not_in_group') . ' ';
             }
         } else {
             $feedback .= ' ' . $Language->getText('forum_admin_index', 'msg_not_found') . ' ';
         }
     }
 } else {
     if ($request->existAndNonEmpty('add_forum')) {
         /*
         	Adding forums to this group
         */
         $vMonitored = new Valid_WhiteList('is_monitored', array(0, 1));
         $vMonitored->required();
         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
             */
Ejemplo n.º 15
0
require_once 'viewvc_utils.php';
require_once 'www/svn/svn_utils.php';
if (user_isloggedin()) {
    $vRoot = new Valid_String('root');
    $vRoot->required();
    if (!$request->valid($vRoot)) {
        exit_no_group();
    }
    $root = $request->get('root');
    $group_id = group_getid_by_name($root);
    if ($group_id === false) {
        exit_no_group();
    }
    $vRootType = new Valid_WhiteList('roottype', array('svn'));
    $vRootType->setErrorMessage($Language->getText('svn_viewvc', 'bad_roottype'));
    $vRootType->required();
    if ($request->valid($vRootType)) {
        if (!svn_utils_check_access(user_getname(), $root, viewvc_utils_getfile("/svn/viewvc.php"))) {
            exit_error($Language->getText('svn_viewvc', 'access_denied'), $Language->getText('svn_viewvc', 'acc_den_comment', session_make_url("/project/memberlist.php?group_id={$group_id}")));
        }
        viewvc_utils_track_browsing($group_id, 'svn');
        $display_header_footer = viewvc_utils_display_header();
        if ($display_header_footer) {
            $prefix_title = '';
            if ($path = viewvc_utils_getfile("/svn/viewvc.php")) {
                $prefix_title = basename($path) . ' - ';
            }
            $GLOBALS['HTML']->addStylesheet('/viewvc-static/styles.css');
            svn_header(array('title' => $prefix_title . $Language->getText('svn_utils', 'browse_tree'), 'path' => '/' . urlencode(viewvc_utils_getfile("/svn/viewvc.php"))));
        }
        viewvc_utils_passcommand();
Ejemplo n.º 16
0
}
$ugroup_id = $request->getValidated('ugroup_id', 'uint', 0);
if ($ugroup_id) {
    $res = ugroup_db_get_ugroup($ugroup_id);
    if ($res) {
        $ugroup_name = db_result($res, 0, 'name');
        $hp = Codendi_HTMLPurifier::instance();
        //define capitals
        $sql = "SELECT DISTINCT UPPER(LEFT(user.email,1)) as capital\n            FROM user\n            WHERE status in ('A', 'R')\n            UNION\n            SELECT DISTINCT UPPER(LEFT(user.realname,1)) as capital\n            FROM user\n            WHERE status in ('A', 'R')\n            UNION\n            SELECT DISTINCT UPPER(LEFT(user.user_name,1)) as capital\n            FROM user\n            WHERE status in ('A', 'R')\n            ORDER BY capital";
        $res = db_query($sql);
        $allowed_begin_values = array();
        while ($data = db_fetch_array($res)) {
            $allowed_begin_values[] = $data['capital'];
        }
        $valid_begin = new Valid_WhiteList('begin', $allowed_begin_values);
        $valid_begin->required();
        $valid_in_project = new Valid_UInt('in_project');
        $valid_in_project->required();
        $offset = $request->exist('browse') ? 0 : $request->getValidated('offset', 'uint', 0);
        $number_per_page = $request->exist('number_per_page') ? $request->getValidated('number_per_page', 'uint', 0) : 15;
        $search = $request->getValidated('search', 'string', '');
        $begin = $request->getValidated('begin', $valid_begin, '');
        $in_project = $request->getValidated('in_project', $valid_in_project, $group_id);
        $user = $request->get('user');
        if ($user && is_array($user)) {
            list($user_id, $action) = each($user);
            $user_id = (int) $user_id;
            if ($user_id) {
                switch ($action) {
                    case 'add':
                        ugroup_add_user_to_ugroup($group_id, $ugroup_id, $user_id);
Ejemplo n.º 17
0
 $vRealName->required();
 if ($request->valid($vRealName)) {
     $user->setRealName($request->get('form_realname'));
 }
 // form_unixstatus must be BEFORE form_status validation because
 // form_status can constraint form_unixstatus
 $vUnixStatus = new Valid_WhiteList('form_unixstatus', $user->getAllUnixStatus());
 $vUnixStatus->required();
 if ($request->valid($vUnixStatus)) {
     $user->setUnixStatus($request->get('form_unixstatus'));
 }
 // New status must be valid AND user account must already be validated
 // There are specific actions done in approve_pending scripts
 $accountActivationEvent = null;
 $vStatus = new Valid_WhiteList('form_status', $user->getAllWorkingStatus());
 $vStatus->required();
 if ($request->valid($vStatus) && in_array($user->getStatus(), $user->getAllWorkingStatus()) && $user->getStatus() != $request->get('form_status')) {
     switch ($request->get('form_status')) {
         case User::STATUS_ACTIVE:
             $user->setStatus($request->get('form_status'));
             $accountActivationEvent = 'project_admin_activate_user';
             break;
         case User::STATUS_RESTRICTED:
             if (isset($GLOBALS['sys_allow_restricted_users']) && $GLOBALS['sys_allow_restricted_users'] == 1) {
                 $user->setStatus($request->get('form_status'));
                 // If the user had a shell, set it to restricted shell
                 if ($user->getShell() && $user->getShell() != "/bin/false" && $user->getShell() != "/sbin/nologin") {
                     $user->setShell($GLOBALS['codendi_bin_prefix'] . '/cvssh-restricted');
                 }
                 $accountActivationEvent = 'project_admin_activate_user';
             }
Ejemplo n.º 18
0
 */
// CAUTION!!
// Make the changes before calling svn_header_admin because
// svn_header_admin caches the project object in memory and
// the form values are therefore not updated.
//
$request->valid(new Valid_String('post_changes'));
$request->valid(new Valid_String('SUBMIT'));
if ($request->isPost() && $request->existAndNonEmpty('post_changes')) {
    $vTracked = new Valid_WhiteList('form_tracked', array('0', '1'));
    $vTracked->required();
    $vMandatoryRef = new Valid_WhiteList('form_mandatory_ref', array('0', '1'));
    $vMandatoryRef->required();
    $vPreamble = new Valid_Text('form_preamble');
    $vCanChangeSVNLog = new Valid_WhiteList('form_can_change_svn_log', array('0', '1'));
    $vCanChangeSVNLog->required();
    if ($request->valid($vTracked) && $request->valid($vPreamble) && $request->valid($vMandatoryRef) && $request->valid($vCanChangeSVNLog)) {
        // group_id was validated in index.
        $form_tracked = $request->get('form_tracked');
        $form_preamble = $request->get('form_preamble');
        $form_mandatory_ref = $request->get('form_mandatory_ref');
        $form_can_change_svn_log = $request->get('form_can_change_svn_log');
        $ret = svn_data_update_general_settings($group_id, $form_tracked, $form_preamble, $form_mandatory_ref, $form_can_change_svn_log);
        if ($ret) {
            EventManager::instance()->processEvent(Event::SVN_UPDATE_HOOKS, array('group_id' => $group_id));
            $GLOBALS['Response']->addFeedback('info', $Language->getText('svn_admin_general_settings', 'upd_success'));
        } else {
            $GLOBALS['Response']->addFeedback('error', $Language->getText('svn_admin_general_settings', 'upd_fail'));
        }
    } else {
        $GLOBALS['Response']->addFeedback('error', $Language->getText('svn_admin_general_settings', 'upd_fail'));
Ejemplo n.º 19
0
if ($res && !db_error($res) && db_numrows($res) == 1) {
    $row = db_fetch_array($res);
    session_require(array('group' => $row['group_id'], 'admin_flags' => 'A'));
    if ($row['group_id'] == 100) {
        exit_error($Language->getText('global', 'error'), "Cannot modify this ugroup with LDAP plugin");
    }
} else {
    exit_error($Language->getText('global', 'error'), $Language->getText('project_admin_editugroup', 'ug_not_found', array($ugroupId, db_error())));
}
$group_id = $row['group_id'];
$ldapUserGroupManager = new LDAP_UserGroupManager($ldapPlugin->getLdap());
$ldapUserGroupManager->setId($ugroupId);
$hp = Codendi_HTMLPurifier::instance();
$btn_update = $Language->getText('plugin_ldap', 'ugroup_edit_btn_update');
$vSubmit = new Valid_WhiteList('submit', array($btn_update));
$vSubmit->required();
if ($request->isPost() && $request->valid($vSubmit)) {
    if ($request->get('submit') == $btn_update) {
        $vUserAdd = new Valid_String('user_add');
        $vUserAdd->required();
        if ($request->valid($vUserAdd)) {
            $ldapUserGroupManager->addListOfUsersToGroup($request->get('user_add'));
        }
    }
}
//
// Display
//
$ugroupRow = ugroup_db_get_ugroup($ugroupId);
$ugroupName = util_translate_name_ugroup($row['name']);
$clean_ugroupName = $hp->purify($ugroupName);
Ejemplo n.º 20
0
 private function newVersionApprovalTable(Codendi_Request $request, Docman_Item $item, PFUser $user)
 {
     $vImport = new Valid_WhiteList('app_table_import', array('copy', 'reset', 'empty'));
     $vImport->required();
     $import = $request->getValidated('app_table_import', $vImport, false);
     if ($import) {
         $atf = Docman_ApprovalTableFactoriesFactory::getFromItem($item);
         $atf->createTable($user->getId(), $request->get('app_table_import'));
     }
 }
Ejemplo n.º 21
0
 public function edit_directory()
 {
     $ldapPlugin = $this->getLdapPlugin();
     $ldapUserGroupManager = new LDAP_UserGroupManager($ldapPlugin->getLdap());
     $ldapUserGroupManager->setGroupName($this->request->get('bind_with_group'));
     $ldapUserGroupManager->setId($this->ugroup->getId());
     $btn_update = $GLOBALS['Language']->getText('plugin_ldap', 'ugroup_edit_btn_update');
     $btn_unlink = $GLOBALS['Language']->getText('plugin_ldap', 'ugroup_edit_btn_unlink');
     $vSubmit = new Valid_WhiteList('submit', array($btn_update, $btn_unlink));
     $vSubmit->required();
     if ($this->request->isPost() && $this->request->valid($vSubmit)) {
         if ($this->request->get('submit') == $btn_unlink) {
             $this->unlinkLDAPGroup($ldapUserGroupManager);
         } else {
             $this->linkLDAPGroup($ldapUserGroupManager);
         }
     } else {
         $this->edit_directory_group();
     }
 }
Ejemplo n.º 22
0
     if (!in_array($user, $members)) {
         exit_permission_denied();
     }
 }
 // Build the mail to be sent
 $vSrep = new Valid_WhiteList('send_reply', array('Submit'));
 $vSrep->required();
 if ($request->valid($vSrep)) {
     // process the mail
     $ret = plugin_forumml_process_mail($p, true);
     if ($ret) {
         $GLOBALS['Response']->addFeedback('warning', $GLOBALS['Language']->getText('plugin_forumml', 'delay_redirection', array($p->getThemePath() . "/images/ic/spinner-greenie.gif", $group_id, $list_id, $topic)), CODENDI_PURIFIER_DISABLED);
     }
 }
 $vRep = new Valid_WhiteList('reply', array('1'));
 $vRep->required();
 if ($request->valid($vRep)) {
     $GLOBALS['Response']->addFeedback('warning', $GLOBALS['Language']->getText('plugin_forumml', 'warn_post_without_confirm'));
 }
 $params['title'] = util_get_group_name_from_id($group_id) . ' - ForumML - ' . $list_name;
 if ($topicSubject) {
     $params['title'] .= ' - ' . $topicSubject;
 }
 $params['group'] = $group_id;
 $params['toptab'] = 'mail';
 $params['help'] = "CommunicationServices.html#MailingLists";
 if ($request->valid(new Valid_Pv('pv'))) {
     $params['pv'] = $request->get('pv');
 }
 mail_header($params);
 if ($request->valid($vSrep) && $request->valid($vTopic)) {
Ejemplo n.º 23
0
 /**
  * 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;
 }
Ejemplo n.º 24
0
 function _validateApprovalTable($request, $item)
 {
     $atf = Docman_ApprovalTableFactoriesFactory::getFromItem($item);
     if ($atf && $atf->tableExistsForItem()) {
         $vAppTable = new Valid_WhiteList('app_table_import', array('copy', 'reset', 'empty'));
         $vAppTable->required();
         if (!$request->valid($vAppTable)) {
             $this->feedback->log('error', $GLOBALS['Language']->getText('plugin_docman', 'error_no_option'));
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 25
0
$vGroupId = new Valid_GroupId();
$vGroupId->required();
if ($request->valid($vGroupId)) {
    $groupId = $request->get('group_id');
    $project = ProjectManager::instance()->getProject($groupId);
} else {
    header('Location: ' . get_server_url());
}
// Grant access only to project admins
$user = UserManager::instance()->getCurrentUser();
if (!$project->userIsAdmin($user)) {
    header('Location: ' . get_server_url());
}
$duMgr = new Statistics_DiskUsageManager();
$vServices = new Valid_WhiteList('services', array_keys($duMgr->getProjectServices(false)));
$vServices->required();
if ($request->validArray($vServices)) {
    $services = $request->get('services');
} else {
    $services = array_keys($duMgr->getProjectServices(false));
}
$vStartDate = new Valid('start_date');
$vStartDate->addRule(new Rule_Date());
$vStartDate->required();
if ($request->valid($vStartDate)) {
    $startDate = $request->get('start_date');
} else {
    $startDate = '';
}
$vEndDate = new Valid('end_date');
$vEndDate->addRule(new Rule_Date());
Ejemplo n.º 26
0
function plugin_forumml_show_message($p, $hp, $msg, $id_parent, $purgeCache)
{
    $body = $msg['body'];
    $request = HTTPRequest::instance();
    // Is "ready to display" body already in cache or not
    $bodyIsCached = false;
    if (!empty($msg['cached_html']) && !$purgeCache) {
        $bodyIsCached = true;
    }
    if (PEAR::isError($from_info = Mail_RFC822::parseAddressList($msg['sender'], $GLOBALS['sys_default_domain'])) || !isset($from_info[0]) || !$from_info[0]->personal) {
        $from_info = $hp->purify($msg['sender'], CODENDI_PURIFIER_CONVERT_HTML);
    } else {
        $from_info = '<abbr title="' . $hp->purify($from_info[0]->mailbox . '@' . $from_info[0]->host, CODENDI_PURIFIER_CONVERT_HTML) . '">' . $hp->purify($from_info[0]->personal, CODENDI_PURIFIER_CONVERT_HTML) . '</abbr>';
    }
    echo '<div class="plugin_forumml_message">';
    // specific thread
    echo '<div class="plugin_forumml_message_header boxitemalt" id="plugin_forumml_message_' . $msg['id_message'] . '">';
    echo '<div class="plugin_forumml_message_header_subject">' . $hp->purify($msg['subject'], CODENDI_PURIFIER_CONVERT_HTML) . '</div>';
    echo '<a href="#' . $msg['id_message'] . '" title="message #' . $msg['id_message'] . '">';
    echo '<img src="' . $p->getThemePath() . '/images/ic/comment.png" id="' . $msg['id_message'] . '" style="vertical-align:middle" alt="#' . $msg['id_message'] . '" />';
    echo '</a>';
    echo ' <span class="plugin_forumml_message_header_from">' . $from_info . '</span>';
    echo ' <span class="plugin_forumml_message_header_date">' . $GLOBALS['Language']->getText('plugin_forumml', 'show_message_date', array($msg['date'])) . '</span>';
    echo '&nbsp;<a href="#" id="plugin_forumml_toogle_msg_' . $msg['id_message'] . '" class="plugin_forumml_toggle_font">' . $GLOBALS['Language']->getText('plugin_forumml', 'toggle_font') . '</a>';
    // get CC
    $cc = trim($msg['cc']);
    if ($cc) {
        if (PEAR::isError($cc_info = Mail_RFC822::parseAddressList($cc, $GLOBALS['sys_default_domain']))) {
            $ccs = $hp->purify($cc, CODENDI_PURIFIER_CONVERT_HTML);
        } else {
            $ccs = array();
            foreach ($cc_info as $c) {
                if (!$c->personal) {
                    $ccs[] = $hp->purify($c->mailbox . '@' . $c->host, CODENDI_PURIFIER_CONVERT_HTML);
                } else {
                    $ccs[] = '<abbr title="' . $hp->purify($c->mailbox . '@' . $c->host, CODENDI_PURIFIER_CONVERT_HTML) . '">' . $hp->purify($c->personal, CODENDI_PURIFIER_CONVERT_HTML) . '</abbr>';
                }
            }
            $ccs = implode(', ', $ccs);
        }
        print '<div class="plugin_forumml_message_header_cc">' . $GLOBALS['Language']->getText('plugin_forumml', 'show_message_cc') . ' ' . $ccs . '</div>';
    }
    // Message content
    if (strpos($msg['content_type'], 'multipart/') !== false) {
        $content_type = $msg['msg_type'];
    } else {
        $content_type = $msg['content_type'];
    }
    $is_html = strpos($content_type, "text/html") !== false;
    // get attached files
    if (count($msg['attachments'])) {
        print '<div class="plugin_forumml_message_header_attachments">';
        $first = true;
        foreach ($msg['attachments'] as $attachment) {
            // Special case, this is an HTML email
            if (preg_match('/.html$/i', $attachment['file_name'])) {
                // By default, the first html attachment replaces the default body (text)
                if ($first) {
                    if (!$bodyIsCached && is_file($attachment['file_path'])) {
                        $body = file_get_contents($attachment['file_path']);
                        // Make sure that the body is utf8
                        if (!mb_detect_encoding($body, 'UTF-8', true)) {
                            $body = mb_convert_encoding($body, 'UTF-8');
                        }
                        $is_html = true;
                    }
                    continue;
                } else {
                    $flink = $attachment['file_name'];
                }
            } else {
                $flink = $attachment['file_name'];
            }
            if (!$first) {
                echo ',&nbsp;&nbsp;';
            }
            echo "<img src='" . $p->getThemePath() . "/images/ic/attach.png'/>  <a href='upload.php?group_id=" . $request->get('group_id') . "&list=" . $request->get('list') . "&id=" . $attachment['id_attachment'] . "&topic=" . $id_parent . "'>" . $flink . "</a>";
            $first = false;
        }
        echo '</div>';
    }
    echo '</div>';
    print '<div id="plugin_forumml_message_content_' . $msg['id_message'] . '" class="plugin_forumml_message_content_std">';
    $body = str_replace("\r\n", "\n", $body);
    // If there is no cached html of if user requested to regenerate the cache, do it, otherwise use cached HTML.
    if (!$bodyIsCached) {
        // Purify message body, according to the content-type
        if ($is_html) {
            // Update attachment links
            $body = plugin_forumml_replace_attachment($msg['id_message'], $request->get('group_id'), $request->get('list'), $id_parent, $body);
            // Use CODENDI_PURIFIER_FULL for html mails
            $msg['cached_html'] = $hp->purify($body, CODENDI_PURIFIER_FULL, $request->get('group_id'));
        } else {
            // CODENDI_PURIFIER_FORUMML level : no basic html markups, no forms, no javascript,
            // Allowed: url + automagic links + <blockquote>
            $purified_body = $hp->purify($body, CODENDI_PURIFIER_CONVERT_HTML, $request->get('group_id'));
            $purified_body = str_replace('&gt;', '>', $purified_body);
            $tab_body = '';
            $level = 0;
            $current_level = 0;
            $search_for_quotes = false;
            $maxi = strlen($purified_body);
            for ($i = 0; $i < $maxi; ++$i) {
                if ($search_for_quotes) {
                    if ($purified_body[$i] == ">") {
                        ++$current_level;
                        if ($level < $current_level) {
                            $tab_body .= '<blockquote class="grep">';
                            ++$level;
                        }
                    } else {
                        $search_for_quotes = false;
                        if ($level > $current_level) {
                            $tab_body .= '</blockquote>';
                            --$level;
                        }
                        if ($purified_body[$i] == "\n" && $i < $maxi - 1) {
                            $search_for_quotes = true;
                            $current_level = 0;
                        }
                        $tab_body .= $purified_body[$i];
                    }
                } else {
                    if ($purified_body[$i] == "\n" && $i < $maxi - 1) {
                        $search_for_quotes = true;
                        $current_level = 0;
                    }
                    $tab_body .= $purified_body[$i];
                }
            }
            $purified_body = str_replace('>', '&gt;', $purified_body);
            $msg['cached_html'] = nl2br($tab_body);
        }
        db_query('UPDATE plugin_forumml_message SET cached_html="' . db_es($msg['cached_html']) . '" WHERE id_message=' . $msg['id_message']);
    }
    echo $msg['cached_html'];
    echo '</div>';
    // Reply
    echo '<div class="plugin_forumml_message_footer">';
    // If you click on 'Reply', load reply form
    $vMess = new Valid_UInt('id_mess');
    $vMess->required();
    if ($request->valid($vMess) && $request->get('id_mess') == $msg['id_message']) {
        $vReply = new Valid_WhiteList('reply', array(0, 1));
        $vReply->required();
        if ($request->valid($vReply) && $request->get('reply') == 1) {
            if ($is_html) {
                $body = $hp->purify($body, CODENDI_PURIFIER_STRIP_HTML);
            } else {
                $body = $hp->purify($body, CODENDI_PURIFIER_CONVERT_HTML);
            }
            plugin_forumml_reply($hp, $msg['subject'], $msg['id_message'], $id_parent, $body, $msg['sender']);
        }
    } else {
        print "<a href='message.php?group_id=" . $request->get('group_id') . "&topic=" . $id_parent . "&id_mess=" . $msg['id_message'] . "&reply=1&list=" . $request->get('list') . "#reply-" . $msg['id_message'] . "'>\n                            <img src='" . $p->getThemePath() . "/images/ic/comment_add.png'/>\n                            " . $GLOBALS['Language']->getText('plugin_forumml', 'reply') . "\n                        </a>";
    }
    echo '</div>';
    echo '</div>';
}
Ejemplo n.º 27
0
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Tuleap. If not, see <http://www.gnu.org/licenses/
 */
require_once 'pre.php';
require_once dirname(__FILE__) . '/../include/MediawikiAdminController.class.php';
require_once dirname(__FILE__) . '/../include/MediawikiSiteAdminController.class.php';
/**
 * HACK
 */
require_once MEDIAWIKI_BASE_DIR . '/../../fusionforge_compat/include/fusionforge_compatPlugin.class.php';
$ff_plugin = new fusionforge_compatPlugin();
$ff_plugin->loaded();
$vWhiteList = new Valid_WhiteList('action', array('save', 'index', 'site_index', 'site_update_allowed_project_list'));
$vWhiteList->required();
$action = $request->getValidated('action', $vWhiteList, 'index');
switch ($action) {
    case 'index':
    case 'save':
        $service = $request->getProject()->getService('plugin_mediawiki');
        $controller = new MediawikiAdminController();
        $controller->{$action}($service, $request);
        break;
    case 'site_index':
    case 'site_update_allowed_project_list':
        $controller = new MediawikiSiteAdminController();
        $controller->{$action}($request);
        break;
}
Ejemplo n.º 28
0
$group_id = $request->get('group_id');
session_require(array('group' => $group_id, 'admin_flags' => 'A'));
//
//  get the Project
//
$pm = ProjectManager::instance();
$project = $pm->getProject($group_id);
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)) {
Ejemplo n.º 29
0
require_once 'pre.php';
$request = HTTPRequest::instance();
$vGroupId = new Valid_UInt('group_id');
$vGroupId->required();
if ($request->valid($vGroupId)) {
    $group_id = $request->get('group_id');
} else {
    exit_no_group();
}
$pm = ProjectManager::instance();
$group = $pm->getProject($group_id);
if (!$group || !is_object($group) || $group->isError()) {
    exit_no_group();
}
$vExport = new Valid_WhiteList('export', array('user_groups', 'user_groups_format'));
$vExport->required();
if ($request->valid($vExport)) {
    $export = $request->get('export');
    $col_list = array('group', 'username', 'realname');
    $lbl_list = array('group' => $GLOBALS['Language']->getText('project_export_user_groups', 'user_group'), 'username' => $GLOBALS['Language']->getText('project_export_user_groups', 'user_username', array($GLOBALS['sys_name'])), 'realname' => $GLOBALS['Language']->getText('project_export_user_groups', 'user_realname'));
    $um = UserManager::instance();
    switch ($export) {
        case 'user_groups':
            $sep = get_csv_separator();
            $eol = "\n";
            $name = 'export_user_groups_' . $project->getUnixName() . '.csv';
            header('Content-Disposition: filename=' . $name);
            header('Content-Type: text/csv');
            echo build_csv_header($col_list, $lbl_list) . $eol;
            $ugs = ugroup_db_get_existing_ugroups($group_id, array($GLOBALS['UGROUP_PROJECT_MEMBERS'], $GLOBALS['UGROUP_PROJECT_ADMIN']));
            while ($ugrp = db_fetch_array($ugs)) {
Ejemplo n.º 30
0
 function _display_artifacts($list_trackers, $print_box_begin)
 {
     $request = HTTPRequest::instance();
     $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;
     }
     $vArtifact = new Valid_WhiteList('hide_artifact', array(0, 1));
     $vArtifact->required();
     if ($request->valid($vArtifact)) {
         $hide_artifact = $request->get('hide_artifact');
     } else {
         $hide_artifact = null;
     }
     $j = $print_box_begin;
     $html_my_artifacts = "";
     $html = "";
     $html_hdr = "";
     $aid_old = 0;
     $atid_old = 0;
     $group_id_old = 0;
     $count_aids = 0;
     $group_name = "";
     $tracker_name = "";
     $artifact_types = array();
     $pm = ProjectManager::instance();
     while ($trackers_array = db_fetch_array($list_trackers)) {
         $atid = $trackers_array['group_artifact_id'];
         $group_id = $trackers_array['group_id'];
         // {{{ check permissions
         //create group
         $group = $pm->getProject($group_id);
         if (!$group || !is_object($group) || $group->isError()) {
             exit_no_group();
         }
         //Create the ArtifactType object
         if (!isset($artifact_types[$group_id])) {
             $artifact_types[$group_id] = array();
         }
         if (!isset($artifact_types[$group_id][$atid])) {
             $artifact_types[$group_id][$atid] = array();
             $artifact_types[$group_id][$atid]['at'] = new ArtifactType($group, $atid);
             $artifact_types[$group_id][$atid]['user_can_view_at'] = $artifact_types[$group_id][$atid]['at']->userCanView();
             $artifact_types[$group_id][$atid]['user_can_view_summary_or_aid'] = null;
         }
         //Check if user can view artifact
         if ($artifact_types[$group_id][$atid]['user_can_view_at'] && $artifact_types[$group_id][$atid]['user_can_view_summary_or_aid'] !== false) {
             if (is_null($artifact_types[$group_id][$atid]['user_can_view_summary_or_aid'])) {
                 $at = $artifact_types[$group_id][$atid]['at'];
                 //Create ArtifactFieldFactory object
                 if (!isset($artifact_types[$group_id][$atid]['aff'])) {
                     $artifact_types[$group_id][$atid]['aff'] = new ArtifactFieldFactory($at);
                 }
                 $aff = $artifact_types[$group_id][$atid]['aff'];
                 //Retrieve artifact_id field
                 $field = $aff->getFieldFromName('artifact_id');
                 //Check if user can read it
                 $user_can_view_aid = $field->userCanRead($group_id, $atid);
                 //Retrieve percent_complete field
                 $field = $aff->getFieldFromName('percent_complete');
                 //Check if user can read it
                 $user_can_view_percent_complete = $field && $field->userCanRead($group_id, $atid);
                 //Retriebe summary field
                 $field = $aff->getFieldFromName('summary');
                 //Check if user can read it
                 $user_can_view_summary = $field->userCanRead($group_id, $atid);
                 $artifact_types[$group_id][$atid]['user_can_view_summary_or_aid'] = $user_can_view_aid || $user_can_view_summary;
             }
             if ($artifact_types[$group_id][$atid]['user_can_view_summary_or_aid']) {
                 //work on the tracker of the last round if there was one
                 if ($atid != $atid_old && $count_aids != 0) {
                     list($hide_now, $count_diff, $hide_url) = my_hide_url('artifact', $atid_old, $hide_item_id, $count_aids, $hide_artifact);
                     $html_hdr = ($j ? '<tr class="boxitem"><td colspan="3">' : '') . $hide_url . '<A HREF="/tracker/?group_id=' . $group_id_old . '&atid=' . $atid_old . '">' . $group_name . " - " . $tracker_name . '</A>&nbsp;&nbsp;&nbsp;&nbsp;';
                     $count_new = max(0, $count_diff);
                     $html_hdr .= my_item_count($count_aids, $count_new) . '</td></tr>';
                     $html_my_artifacts .= $html_hdr . $html;
                     $count_aids = 0;
                     $html = '';
                     $j++;
                 }
                 if ($count_aids == 0) {
                     //have to call it to get at least the hide_now even if count_aids is false at this point
                     $hide_now = my_hide('artifact', $atid, $hide_item_id, $hide_artifact);
                 }
                 $group_name = $trackers_array['group_name'];
                 $tracker_name = $trackers_array['name'];
                 $aid = $trackers_array['artifact_id'];
                 $summary = $trackers_array['summary'];
                 $atid_old = $atid;
                 $group_id_old = $group_id;
                 // If user is assignee and submitter of an artifact, it will
                 // appears 2 times in the result set.
                 if ($aid != $aid_old) {
                     $count_aids++;
                 }
                 if (!$hide_now && $aid != $aid_old) {
                     // Form the 'Submitted by/Assigned to flag' for marking
                     $AS_flag = my_format_as_flag2($trackers_array['assignee'], $trackers_array['submitter']);
                     //get percent_complete if this field is used in the tracker
                     $percent_complete = '';
                     if ($user_can_view_percent_complete) {
                         $sql = "SELECT afvl.value " . "FROM artifact_field_value afv,artifact_field af, artifact_field_value_list afvl, artifact_field_usage afu " . "WHERE af.field_id = afv.field_id AND af.field_name = 'percent_complete' " . "AND afv.artifact_id = {$aid} " . "AND afvl.group_artifact_id = {$atid} AND af.group_artifact_id = {$atid} " . "AND afu.group_artifact_id = {$atid} AND afu.field_id = af.field_id AND afu.use_it = 1 " . "AND afvl.field_id = af.field_id AND afvl.value_id = afv.valueInt";
                         $res = db_query($sql);
                         if (db_numrows($res) > 0) {
                             $percent_complete = '<TD class="small">' . db_result($res, 0, 'value') . '</TD>';
                         }
                     }
                     $html .= '
                         <TR class="' . get_priority_color($trackers_array['severity']) . '"><TD class="small"><A HREF="/tracker/?func=detail&group_id=' . $group_id . '&aid=' . $aid . '&atid=' . $atid . '">' . $aid . '</A></TD>' . '<TD class="small"' . ($percent_complete ? '>' : ' colspan="2">');
                     if ($user_can_view_summary) {
                         $html .= stripslashes($summary);
                     }
                     $html .= '&nbsp;' . $AS_flag . '</TD>' . $percent_complete . '</TR>';
                 }
                 $aid_old = $aid;
             }
         }
     }
     //work on the tracker of the last round if there was one
     if ($atid_old != 0 && $count_aids != 0) {
         list($hide_now, $count_diff, $hide_url) = my_hide_url('artifact', $atid_old, $hide_item_id, $count_aids, $hide_artifact);
         $html_hdr = ($j ? '<tr class="boxitem"><td colspan="3">' : '') . $hide_url . '<A HREF="/tracker/?group_id=' . $group_id_old . '&atid=' . $atid_old . '">' . $group_name . " - " . $tracker_name . '</A>&nbsp;&nbsp;&nbsp;&nbsp;';
         $count_new = max(0, $count_diff);
         $html_hdr .= my_item_count($count_aids, $count_new) . '</td></tr>';
         $html_my_artifacts .= $html_hdr . $html;
     }
     return $html_my_artifacts;
 }