Ejemplo n.º 1
0
function register_valid()
{
    if (!$GLOBALS["Update"]) {
        return 0;
    }
    if (!$GLOBALS['form_name']) {
        $GLOBALS['register_error'] = "You must supply a new name.";
        return 0;
    }
    group_add_history('Changed Project Name', '', $group_id);
    // if we got this far, it must be good
    db_query("UPDATE groups SET group_name='{$GLOBALS['form_name']}' WHERE group_id=" . $GLOBALS['group_id']);
    return 1;
}
Ejemplo n.º 2
0
 function activate_group($group_id)
 {
     global $feedback;
     //echo("activate_group($group_id)<br>");
     if (sf_ldap_create_group($group_id, 0)) {
         db_query("UPDATE groups " . "SET status='A' " . "WHERE group_id={$group_id}");
         /*
         	Make founding admin be an active member of the project
         */
         $admin_res = db_query("SELECT * " . "FROM users,user_group " . "WHERE user_group.group_id={$group_id} " . "AND user_group.admin_flags='A' " . "AND users.user_id=user_group.user_id ");
         if (db_numrows($admin_res) > 0) {
             $group =& group_get_object($group_id);
             //
             //	user_get_object should really have a valid user_id passed in
             //	or you are defeating the purpose of the object pooling
             //
             $admin =& user_get_object(db_result($admin_res, 0, 'user_id'), $admin_res);
             if ($group->addUser($admin->getUnixName())) {
                 /*
                 	Now send the project approval emails
                 */
                 group_add_history('approved', 'x', $group_id);
                 send_new_project_email($group_id);
                 usleep(250000);
                 // TODO: This is dirty. If sendmail required pause, let send_new... handle it
             } else {
                 $feedback = $group->getErrorMessage();
             }
         } else {
             echo db_error();
         }
     } else {
         /* There was error creating LDAP entry */
         group_add_history('ldap:', sf_ldap_get_error_msg(), $group_id);
     }
 }
Ejemplo n.º 3
0
 public function setTruncatedEmailsUsage(Project $project, $usage)
 {
     $project_id = $project->getID();
     $this->_getDao()->setTruncatedEmailsUsage($project_id, $usage);
     group_add_history('truncated_emails', $usage, $project_id);
 }
 /**
  * Import artifacts that the user has accepted from the parse report and update DB.
  *
  *
  */
 function displayImport($parsed_labels, $artifacts_data, $aid_column, $count_artifacts)
 {
     global $Language;
     $notify = false;
     if (user_get_preference('tracker_import_notify_' . $this->ath->getID()) == '1') {
         $notify = true;
     }
     $errors = "";
     $ok = $this->updateDB($parsed_labels, $artifacts_data, $aid_column, $errors, $notify);
     if ($ok) {
         $GLOBALS['Response']->addFeedback('info', $Language->getText('tracker_import', 'success_import', $count_artifacts));
     } else {
         $GLOBALS['Response']->addFeedback('error', $errors);
     }
     //update group history
     group_add_history('import', $this->ath->getName(), $this->group->group_id);
 }
Ejemplo n.º 5
0
     $valid_parent = false;
 } catch (Project_HierarchyManagerAlreadyAncestorException $e) {
     $GLOBALS['Response']->addFeedback('error', $Language->getText('project_admin_editgroupinfo', 'ancestor_exception', db_error() ? db_error() : ' '));
     $valid_parent = false;
 }
 // in the database, these all default to '1',
 // so we have to explicity set 0
 $sql = 'UPDATE groups SET ' . "group_name='" . db_es(htmlspecialchars($form_group_name)) . "'," . "short_description='" . db_es($form_shortdesc) . "'";
 $sql .= " WHERE group_id='" . db_ei($group_id) . "'";
 //echo $sql;
 $result = db_query($sql);
 $update_success = true;
 if ((!$result || db_affected_rows($result) < 1) && $updatedesc == 0 && !$set_parent) {
     $update_success = false;
 } else {
     group_add_history('changed_public_info', '', $group_id);
     // Raise an event
     $em =& EventManager::instance();
     $em->processEvent('project_admin_edition', array('group_id' => $group_id));
 }
 //update visibility
 if ($user_can_choose_visibility) {
     if ($currentproject->getAccess() != $request->get('project_visibility')) {
         $project_manager->setAccess($currentproject, $request->get('project_visibility'));
         $update_success = true;
     }
 }
 //update truncated emails
 if ($user_can_choose_truncated_emails) {
     $usage = (int) $request->exist('truncated_emails');
     if ($currentproject->getTruncatedEmailsUsage() != $usage) {
Ejemplo n.º 6
0
                 }
             } else {
                 $oldUgroups = array(ugroup_get_name_from_id($GLOBALS['UGROUP_PROJECT_ADMIN']));
             }
             foreach ($validUgroups as $ugroupId) {
                 $ugroupName = ugroup_get_name_from_id($ugroupId);
                 $newUgroups = array($ugroupName);
                 $addedUgroups = array();
                 if ($ugroupId == $GLOBALS['UGROUP_PROJECT_ADMIN']) {
                     $addedUgroups[] = util_translate_name_ugroup('project_admin');
                 } else {
                     $addedUgroups[] = $ugroupName;
                 }
             }
             //update group history
             group_add_history('membership_request_updated', implode(',', $oldUgroups) . ' :: ' . implode(',', $newUgroups), $group_id);
             $GLOBALS['Response']->addFeedback('info', $Language->getText('project_admin_index', 'member_request_delegation_ugroups_msg', implode(', ', $addedUgroups)));
         }
     } else {
         $GLOBALS['Response']->addFeedback('error', $Language->getText('project_admin_index', 'member_request_delegation_ugroups_error'));
     }
     break;
 case 'member_req_notif_message':
     $updatedMessage = true;
     // Validate the text
     $vMessage = new Valid_Text('text');
     $vMessage->required();
     $message = trim($request->get('text'));
     $dar = $pm->getMessageToRequesterForAccessProject($group_id);
     if ($dar && !$dar->isError() && $dar->rowCount() == 1) {
         $row = $dar->current();
Ejemplo n.º 7
0
             //was a member
             $feedback .= " Project was already a featured member ";
         }
     } else {
         //user doesn't exist
         $feedback .= "That project does not exist on " . $GLOBALS['sys_default_name'];
     }
     $foundry->refreshFoundryData();
 } else {
     if ($func == 'setfoundrydata') {
         $res = db_query("UPDATE foundry_data SET guide_image_id='{$guide_image_id}',logo_image_id='{$logo_image_id}',trove_categories='{$trove_categories}' WHERE foundry_id='{$group_id}'");
         if (db_affected_rows($res) < 1) {
             echo db_error();
             $feedback .= " Update failed ";
         } else {
             group_add_history('data updated', '', $group_id);
             $feedback .= " Data Updated ";
         }
         $foundry->refreshFoundryData();
     } else {
         if ($func == 'adduser') {
             /*
             	Add a user to this project
             	They don't need unix access
             */
             if (!$foundry->addUser($form_unix_name)) {
                 $feedback .= $foundry->getErrorMessage();
             } else {
                 $feedback = ' User Added Successfully ';
             }
         }
Ejemplo n.º 8
0
<?php

//
// SourceForge: Breaking Down the Barriers to Open Source Development
// Copyright 1999-2000 (c) The SourceForge Crew
// http://sourceforge.net
//
// $Id: editgroupinfo.php,v 1.4 2004/04/02 11:28:01 helix Exp $
require 'pre.php';
require 'vars.php';
require $DOCUMENT_ROOT . '/project/admin/project_admin_utils.php';
session_require(array('group' => $group_id, 'admin_flags' => 'A'));
// If this was a submission, make updates
if ($Update) {
    group_add_history('Changed Public Info', '', $group_id);
    // in the database, these all default to '1',
    // so we have to explicity set 0
    if (!$use_bugs) {
        $use_bugs = 0;
    }
    if (!$use_bug_depend) {
        $use_bug_depend = 0;
    }
    if (!$use_mail) {
        $use_mail = 0;
    }
    if (!$use_survey) {
        $use_survey = 0;
    }
    if (!$use_patch) {
        $use_patch = 0;
Ejemplo n.º 9
0
 * You should have received a copy of the GNU General Public License
 * along with GForge; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
require_once '../../env.inc.php';
require_once $gfwww . 'include/pre.php';
require_once $gfwww . 'include/trove.php';
require_once $gfwww . 'project/admin/project_admin_utils.php';
$group_id = getIntFromRequest('group_id');
session_require(array('group' => $group_id, 'admin_flags' => 'A'));
// Check for submission. If so, make changes and redirect
if (getStringFromRequest('submit') && getStringFromRequest('root1')) {
    if (!form_key_is_valid(getStringFromRequest('form_key'))) {
        exit_form_double_submit();
    }
    group_add_history('Changed Trove', $group_id, $group_id);
    // there is at least a $root1[xxx]
    $allroots = array();
    $allroots = getStringFromRequest('root1');
    //$eachroot = ;//must make this bypass because it wouldn't compile otherwise
    while (list($rootnode, $value) = each($allroots)) {
        // check for array, then clear each root node for group
        db_query("\n\t\t\tDELETE FROM trove_group_link\n\t\t\tWHERE group_id='{$group_id}'\n\t\t\tAND trove_cat_root='{$rootnode}'\n\t\t");
        for ($i = 1; $i <= $TROVE_MAXPERROOT; $i++) {
            $varname = 'root' . $i;
            // check to see if exists first, then insert into DB
            //@TODO change this to use the escaping utils
            $var_aux = getStringFromRequest($varname);
            $category = $var_aux[$rootnode];
            if ($category) {
                trove_setnode($group_id, $category, $rootnode);
Ejemplo n.º 10
0
 * 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 'trove.php';
require_once 'www/project/admin/project_admin_utils.php';
require_once 'common/include/HTTPRequest.class.php';
$request = HTTPRequest::instance();
$group_id = $request->getValidated('group_id', 'uint', 0);
session_require(array('group' => $group_id, 'admin_flags' => 'A'));
// Check for submission. If so, make changes and redirect
$roots = $request->get('root1');
if ($request->exist('Submit') && is_array($roots)) {
    group_add_history('changed_trove', "", $group_id);
    foreach ($roots as $root_id => $nop) {
        // check for array, then clear each root node for group
        db_query('DELETE FROM trove_group_link WHERE group_id=' . db_ei($group_id) . ' AND trove_cat_root=' . db_ei($root_id));
        for ($i = 1; $i <= $GLOBALS['TROVE_MAXPERROOT']; $i++) {
            $submitted_category = $request->get('root' . $i);
            if (isset($submitted_category[$root_id]) && $submitted_category[$root_id]) {
                $category_id = $submitted_category[$root_id];
                trove_setnode($group_id, $category_id, $root_id);
            }
        }
    }
    session_redirect('/project/admin/?group_id=' . $group_id);
}
project_admin_header(array('title' => $Language->getText('project_admin_grouptrove', 'g_trove_info'), 'group' => $group_id));
// LJ New message added to explain that if a Topic category is not there
 /**
  * Wrapper for group_add_history
  * 
  * @param String  $field_name Event name
  * @param String  $old_value  Event value
  * @param Integer $group_id   Project id of the vent
  * 
  * @return Boolean
  */
 protected function addProjectHistory($field_name, $old_value, $group_id)
 {
     return group_add_history($field_name, $old_value, $group_id);
 }
Ejemplo n.º 12
0
        $feedback .= sf_ldap_get_error_msg();
        group_add_history('ldap:', sf_ldap_get_error_msg(), $group_id);
    } else {
        db_query("UPDATE groups SET is_public={$form_public},status='{$form_status}'," . "license='{$form_license}',type='{$group_type}'," . "unix_box='{$form_box}',http_domain='{$form_domain}' WHERE group_id={$group_id}");
        if ($form_status == "D") {
            db_query("UPDATE prweb_vhost SET state=2 WHERE group_id={$group_id}");
        }
        $feedback .= 'Updated Project Info<br>';
    }
    /*
    	If this is a foundry, see if they have a preferences row, if not, create one
    */
    if ($group_type == '2') {
        $res = db_query("SELECT * FROM foundry_data WHERE foundry_id='{$group_id}'");
        if (db_numrows($res) < 1) {
            group_add_history('added foundry_data row', '', $group_id);
            $feedback .= ' CREATING NEW FOUNDRY_DATA ROW ';
            $r = db_query("INSERT INTO foundry_data (foundry_id) VALUES ('{$group_id}')");
            if (!$r || db_affected_rows($r) < 1) {
                echo 'COULD NOT INSERT NEW FOUNDRY_DATA ROW: ' . db_error();
            }
        }
    }
}
// get current information
$res_grp = db_query("SELECT * FROM groups WHERE group_id={$group_id}");
if (db_numrows($res_grp) < 1) {
    exit_error("Invalid Group", "Invalid group was passed in.");
}
$row_grp = db_fetch_array($res_grp);
site_admin_header(array('title' => "Editing Group"));
Ejemplo n.º 13
0
$atf = new ArtifactTypeFactory($group);
if (!$group || !is_object($group) || $group->isError()) {
    exit_error($Language->getText('global', 'error'), $Language->getText('project_admin_index', 'not_get_atf'));
}
// Get the artfact type list
$at_arr = $atf->getArtifactTypes();
session_require(array('group' => $group_id, 'admin_flags' => 'A'));
$project = $pm->getProject($group_id);
if ($project->isError()) {
    //wasn't found or some other problem
    echo $Language->getText('project_admin_userperms', 'unable_load_p') . "<br>";
    return;
}
// ########################### form submission, make updates
if ($request->exist('submit')) {
    group_add_history('changed_member_perm', '', $group_id);
    $nb_errors = 0;
    $res_dev = db_query("SELECT * FROM user_group WHERE group_id={$group_id}");
    while ($row_dev = db_fetch_array($res_dev)) {
        if ($request->exist("admin_user_{$row_dev['user_id']}")) {
            $forum_flags = "forums_user_{$row_dev['user_id']}";
            $doc_flags = "doc_user_{$row_dev['user_id']}";
            $file_flags = "file_user_{$row_dev['user_id']}";
            $wiki_flags = "wiki_user_{$row_dev['user_id']}";
            $svn_flags = "svn_user_{$row_dev['user_id']}";
            $news_flags = "news_user_{$row_dev['user_id']}";
            $flags = array('forum_flags', 'doc_flags', 'file_flags', 'wiki_flags', 'news_flags', 'svn_flags');
            $admin_flags = "admin_user_{$row_dev['user_id']}";
            ${$admin_flags} = $request->get($admin_flags);
            //
            // cannot turn off their own admin flag if no other admin in project -- set it back to 'A'
Ejemplo n.º 14
0
 public function setAccess(Project $project, $access_level)
 {
     $project_id = $project->getID();
     $old_access = $project->getAccess();
     switch ($access_level) {
         case Project::ACCESS_PRIVATE:
             $this->_getDao()->setIsPrivate($project_id);
             $is_private = true;
             break;
         case Project::ACCESS_PUBLIC:
             $this->_getDao()->setIsPublic($project_id);
             $is_private = false;
             break;
         case Project::ACCESS_PUBLIC_UNRESTRICTED:
             $this->_getDao()->setUnrestricted($project_id);
             $is_private = false;
             break;
         default:
             $GLOBALS['Response']->addFeedback('error', 'bad value ' . $access_level);
             return;
     }
     group_add_history('access', $access_level, $project_id);
     $this->getEventManager()->processEvent('project_is_private', array('group_id' => $project_id, 'project_is_private' => $is_private));
     $this->getEventManager()->processEvent(Event::PROJECT_ACCESS_CHANGE, array('project_id' => $project_id, 'access' => $access_level, 'old_access' => $old_access));
 }
Ejemplo n.º 15
0
 //audit trail
 if (isset($form_status) && $form_status && $group->getStatus() != $form_status) {
     group_add_history('status', $Language->getText('admin_groupedit', 'status_' . $group->getStatus()) . " :: " . $Language->getText('admin_groupedit', 'status_' . $form_status), $group_id);
 }
 if ($group->isPublic() != $form_public) {
     group_add_history('is_public', $group->isPublic(), $group_id);
     $em->processEvent('project_is_private', array('group_id' => $group_id, 'project_is_private' => $form_public ? 0 : 1));
 }
 if ($group->getType() != $group_type) {
     group_add_history('group_type', $group->getType(), $group_id);
 }
 if ($group->getHTTPDomain() != $form_domain) {
     group_add_history('http_domain', $group->getHTTPDomain(), $group_id);
 }
 if ($group->getUnixBox() != $form_box) {
     group_add_history('unix_box', $group->getUnixBox(), $group_id);
 }
 if (isset($form_status) && $form_status) {
     db_query("UPDATE groups SET is_public={$form_public},status='{$form_status}'," . "license='{$form_license}',type='{$group_type}'," . "unix_box='{$form_box}',http_domain='{$form_domain}', " . "type='{$group_type}' WHERE group_id={$group_id}");
 }
 $feedback .= $Language->getText('admin_groupedit', 'feedback_info');
 $group = $pm->getProject($group_id, false, true);
 // ZD: Raise an event for group update
 if (isset($form_status) && $form_status && ($form_status == "H" || $form_status == "P")) {
     $em->processEvent('project_is_suspended_or_pending', array('group_id' => $group_id));
 } else {
     if (isset($form_status) && $form_status && $form_status == "A") {
         $em->processEvent('project_is_active', array('group_id' => $group_id));
     } else {
         if (isset($form_status) && $form_status && $form_status == "D") {
             $em->processEvent('project_is_deleted', array('group_id' => $group_id));
Ejemplo n.º 16
0
/** 
 * Log permission change in project history
 */
function permission_add_history($group_id, $permission_type, $object_id)
{
    global $Language;
    $res = permission_db_authorized_ugroups($permission_type, $object_id);
    $type = permission_get_object_type($permission_type, $object_id);
    $name = permission_get_object_name($permission_type, $object_id);
    if (db_numrows($res) < 1) {
        // No ugroup defined => no permissions set
        group_add_history('perm_reset_for_' . $type, 'default', $group_id, array($name));
        return;
    }
    $ugroup_list = '';
    while ($row = db_fetch_array($res)) {
        if ($ugroup_list) {
            $ugroup_list .= ', ';
        }
        $ugroup_list .= ugroup_get_name_from_id($row['ugroup_id']);
    }
    group_add_history('perm_granted_for_' . $type, $ugroup_list, $group_id, array($name));
}
Ejemplo n.º 17
0
     if ($delete_cc) {
         $ath->deleteCC($delete_cc);
     }
     //Delete attached files
     $delete_attached = $request->get('delete_attached');
     if ($delete_attached) {
         $ath->deleteAttachedFiles($delete_attached);
     }
     //Delete dependencies if any
     $delete_depend = $request->get('delete_depend');
     if ($delete_depend) {
         $ath->deleteDependencies($delete_depend);
     }
     //update group history
     $old_value = $ath->getName();
     group_add_history('mass_change', $old_value, $group_id);
     //
     //      Show just one feedback entry if no errors
     //
     if (!$was_error) {
         $GLOBALS['Response']->addFeedback('info', $Language->getText('tracker_index', 'mass_update_success'));
         if ($ath->getStopNotification()) {
             $GLOBALS['Response']->addFeedback('warning', $Language->getText('tracker_index', 'notification_stopped'));
         }
     }
     require './browse.php';
     break;
 case 'postaddcomment':
     //
     //  Attach a comment to an artifact
     //  Used by non-admins
Ejemplo n.º 18
0
    */
    switch ($request->get('func')) {
        case 'adduser':
            // add user to this project
            $form_unix_name = $request->get('form_unix_name');
            $res = account_add_user_to_group($group_id, $form_unix_name);
            break;
        case 'rmuser':
            // remove a user from this portal
            $rm_id = $request->getValidated('rm_id', 'uint', 0);
            account_remove_user_from_group($group_id, $rm_id);
            break;
        case 'change_group_type':
            $form_project_type = $request->getValidated('form_project_type', 'uint', 0);
            if (user_is_super_user() && $group->getType() != $form_project_type) {
                group_add_history('group_type', $group->getType(), $group_id);
                $template = TemplateSingleton::instance();
                $group->setType($form_project_type);
                //set also flag on trackers to be copied or not on project instanciation
                if ($template->isTemplate($form_project_type)) {
                    db_query("UPDATE artifact_group_list SET instantiate_for_new_projects='1' WHERE group_id='{$group_id}'");
                } else {
                    db_query("UPDATE artifact_group_list SET instantiate_for_new_projects='0' WHERE group_id='{$group_id}'");
                }
                // get current information, force update on group and project objects
                $group = $pm->getProject($group_id, true);
                $GLOBALS['Response']->addFeedback('info', $Language->getText('project_admin_index', 'changed_group_type'));
            }
            break;
    }
}
Ejemplo n.º 19
0
/**
 * Delete ugroup 
 *
 * @return false if error
 */
function ugroup_delete($group_id, $ugroup_id)
{
    global $Language;
    if (!$ugroup_id) {
        $GLOBALS['Response']->addFeedback('error', $Language->getText('project_admin_ugroup_utils', 'ug_not_given'));
        return false;
    }
    $project = ProjectManager::instance()->getProject($group_id);
    $ugroup_manager = new UGroupManager();
    $ugroup = $ugroup_manager->getUGroupWithMembers($project, $ugroup_id);
    $sql = "DELETE FROM ugroup WHERE group_id=" . db_ei($group_id) . " AND ugroup_id=" . db_ei($ugroup_id);
    $result = db_query($sql);
    if (!$result || db_affected_rows($result) < 1) {
        $GLOBALS['Response']->addFeedback('error', $Language->getText('project_admin_editgroupinfo', 'upd_fail', db_error() ? db_error() : ' '));
        return false;
    }
    $GLOBALS['Response']->addFeedback('info', $Language->getText('project_admin_ugroup_utils', 'g_del'));
    // Now remove users
    $sql = "DELETE FROM ugroup_user WHERE ugroup_id=" . db_ei($ugroup_id);
    $result = db_query($sql);
    if (!$result) {
        $GLOBALS['Response']->addFeedback('error', $Language->getText('project_admin_ugroup_utils', 'cant_remove_u', db_error()));
        return false;
    }
    $GLOBALS['Response']->addFeedback('info', $Language->getText('project_admin_ugroup_utils', 'all_u_removed'));
    // raise an event for ugroup deletion
    $em = EventManager::instance();
    $em->processEvent('project_admin_ugroup_deletion', array('group_id' => $group_id, 'ugroup_id' => $ugroup_id, 'ugroup' => $ugroup));
    // Last, remove permissions for this group
    $perm_cleared = permission_clear_ugroup($group_id, $ugroup_id);
    if (!$perm_cleared) {
        $GLOBALS['Response']->addFeedback('error', $Language->getText('project_admin_ugroup_utils', 'cant_remove_perm', db_error()));
        return false;
    } else {
        if ($perm_cleared > 1) {
            $perm_cleared--;
            $GLOBALS['Response']->addFeedback('warning', $Language->getText('project_admin_ugroup_utils', 'perm_warning', $perm_cleared));
        }
    }
    // Now log in project history
    group_add_history('del_ug', '', $group_id, array($ugroup->getName()));
    return true;
}
Ejemplo n.º 20
0
/**
 * Remove a user from a project
 *
 * @param Integer $groupId      Project id
 * @param Integer $userId       User id
 * @param Boolean $adminAction  Default value set to true, manage the displayed message according to the person that asked for the action (admin/self remove) 
 */
function account_remove_user_from_group($groupId, $userId, $adminAction = true)
{
    $pm = ProjectManager::instance();
    $res = db_query("DELETE FROM user_group WHERE group_id='{$groupId}' AND user_id='{$userId}' AND admin_flags <> 'A'");
    if (!$res || db_affected_rows($res) < 1) {
        $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('project_admin_index', 'user_not_removed'));
    } else {
        // Raise an event
        $em = EventManager::instance();
        $em->processEvent('project_admin_remove_user', array('group_id' => $groupId, 'user_id' => $userId));
        //
        //  get the Group object
        //
        $group = $pm->getProject($groupId);
        if (!$group || !is_object($group) || $group->isError()) {
            exit_no_group();
        }
        $atf = new ArtifactTypeFactory($group);
        if (!$group || !is_object($group) || $group->isError()) {
            $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('project_admin_index', 'not_get_atf'));
        }
        // Get the artfact type list
        $at_arr = $atf->getArtifactTypes();
        if ($at_arr && count($at_arr) > 0) {
            for ($j = 0; $j < count($at_arr); $j++) {
                if (!$at_arr[$j]->deleteUser($userId)) {
                    $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('project_admin_index', 'del_tracker_perm_fail', $at_arr[$j]->getName()));
                }
            }
        }
        // Remove user from ugroups attached to this project
        if (!ugroup_delete_user_from_project_ugroups($groupId, $userId)) {
            $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('project_admin_index', 'del_user_from_ug_fail'));
        }
        $name = user_getname($userId);
        if ($adminAction) {
            $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('project_admin_index', 'user_removed') . ' (' . $name . ')');
        } else {
            $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('project_admin_index', 'self_user_remove') . ' (' . $group->getPublicName() . ')');
        }
        group_add_history('removed_user', user_getname($userId) . " ({$userId})", $groupId);
        return true;
    }
    return false;
}
Ejemplo n.º 21
0
    } else {
        exit_error($Language->getText('global', 'error'), $Language->getText('docman_admin_index', 'error_nodoc'));
    }
} elseif (strstr($mode, "groupadd")) {
    $query = "insert into doc_groups(groupname,group_id,group_rank) " . "values ('" . htmlspecialchars($groupname) . "'," . "'{$group_id}'," . "'{$group_rank}')";
    db_query($query);
    $feedback .= $Language->getText('docman_admin_index', 'feedback_group_added');
    group_main_page($group_id);
} elseif (strstr($mode, "editgroups")) {
    group_main_page($group_id);
} elseif (strstr($mode, "docdelete")) {
    // Get title
    $query = "SELECT title FROM doc_data WHERE docid={$docid}";
    $result = db_query($query);
    $row = db_fetch_array($result);
    $title = $row['title'];
    $query = "DELETE FROM doc_data WHERE docid={$docid}";
    $result = db_query($query);
    if (!$result) {
        $feedback .= " " . $Language->getText('docman_admin_index', 'error_deleting_doc');
        echo db_error();
    } else {
        $feedback .= " " . $Language->getText('docman_admin_index', 'doc_deleted');
        // Log in project history
        group_add_history('doc_deleted', $title, $group_id, array($title));
    }
    main_page($group_id);
} else {
    main_page($group_id);
}
//end else
Ejemplo n.º 22
0
    }
}
if (getStringFromRequest('updatedbrec')) {
    $dbid = getIntFromRequest('dbid');
    $pw = getStringFromRequest('pw');
    $pwconfirm = getStringFromRequest('pwconfirm');
    $newdbtypeid = getIntFromRequest('newdbtypeid');
    if ($pw == $pwconfirm) {
        //sync new password, and flag it as 'pending (an) update'
        $res = db_query("\n\t\t\tUPDATE prdb_dbs \n\t\t\tSET dbuserpass = '******', \n\t\t\t\tstate = '4'\n\t\t\tWHERE dbid = '{$dbid}' \n\t\t\tAND group_id = '{$group_id}'\n\t\t");
        if (!$res || db_affected_rows($res) < 1) {
            $feedback .= "Update failure - " . db_error() . "";
        } else {
            $res = db_query("\n\t\t\t\tSELECT * \n\t\t\t\tFROM prdb_types \n\t\t\t\tWHERE dbtypeid='{$newdbtypeid}'\n\t\t\t");
            $row_db = db_fetch_array($res);
            group_add_history('Updated database - (type: ' . $row_db['dbsoftware'] . ')', '', $group_id);
        }
    } else {
        $feedback .= "Operation failed.  Password and Password Confirm are not the same";
    }
}
if (getStringFromRequest('deletedbconfirm')) {
    $dbid = getIntFromRequest('dbid');
    //schedule for deletion
    $res = db_query("\n\t\tUPDATE prdb_dbs \n\t\tSET state=3 \n\t\tWHERE dbid='{$dbid}'\n\t\tAND group_id='{$group_id}'\n\t");
    if (!$res || db_affected_rows($res) < 1) {
        $feedback .= 'Cannot delete database: ' . db_error();
    } else {
        $feedback .= "Database scheduled for deletion";
    }
}
Ejemplo n.º 23
0
    $groups = array();
    if ($request->exist('list_of_groups')) {
        $groups = array_filter(array_map('intval', explode(",", $request->get('list_of_groups'))));
    }
    foreach ($groups as $group_id) {
        $project = $pm->getProject($group_id);
        $pm->activate($project);
    }
    if ($special_access) {
        $GLOBALS['Response']->redirect('/my/');
    } else {
        $GLOBALS['Response']->redirect('/admin/');
    }
} else {
    if ($action == 'delete') {
        group_add_history('deleted', 'x', $group_id);
        db_query("UPDATE groups SET status='D'" . " WHERE group_id='{$group_id}'");
        $em->processEvent('project_is_deleted', array('group_id' => $group_id));
        if ($special_access) {
            $GLOBALS['Response']->redirect('/my/');
        } else {
            $GLOBALS['Response']->redirect('/admin/');
        }
    }
}
// get current information
$res_grp = db_query("SELECT * FROM groups WHERE status='P' ORDER BY register_time");
if (db_numrows($res_grp) < 1) {
    site_admin_header(array('title' => $Language->getText('admin_approve_pending', 'no_pending')));
    echo $Language->getText('admin_approve_pending', 'no_pending');
} else {
Ejemplo n.º 24
0
 /**
  * Make project available
  *
  * @param Project $project
  *
  * @return Boolean
  */
 public function activate(Project $project)
 {
     $dao = $this->_getDao();
     if ($dao->updateStatus($project->getId(), 'A')) {
         include_once 'proj_email.php';
         group_add_history('approved', 'x', $project->getId());
         $em = $this->getEventManager();
         $em->processEvent('approve_pending_project', array('group_id' => $project->getId()));
         if (!send_new_project_email($project->getId())) {
             $GLOBALS['Response']->addFeedback('warning', $project->getPublicName() . " - " . $GLOBALS['Language']->getText('global', 'mail_failed', array($GLOBALS['sys_email_admin'])));
         }
         return true;
     }
     return false;
 }