Пример #1
0
function result_column_to_array($result, $col = 0)
{
    /*
    	backwards compatibility
    */
    return util_result_column_to_array($result, $col);
}
/**
 * callback function used during the RSS export
 *
 * @param array $dataRow array containing data for the current row
 * @return string additionnal information added in the RSS document
 */
function rssProjectCallback($dataRow)
{
    // $default_trove_cat defined in local.inc
    $result = db_query('SELECT trove_cat.fullpath ' . 'FROM trove_group_link, trove_cat ' . 'WHERE trove_group_link.trove_cat_root=' . $GLOBALS['default_trove_cat'] . ' ' . 'AND trove_group_link.trove_cat_id=trove_cat.trove_cat_id ' . 'AND group_id=\'' . $dataRow['group_id'] . '\'');
    $return = '';
    $return .= ' | date registered: ' . date('M jS Y', $dataRow['register_time']);
    $return .= ' | category: ' . str_replace(' ', '', implode(',', util_result_column_to_array($result)));
    $return .= ' | license: ' . $dataRow['license'];
    return $return;
}
 /**
  *	Retrieve the artifact report list order by scope
  *
  *	@param	group_artifact_id: the artifact type
  *
  *	@return	array
  */
 function getReports_ids()
 {
     // If user is unknown then get only project-wide and system wide reports
     // else get personal reports in addition  project-wide and system wide.
     $sql = "SELECT report_graphic_id FROM plugin_graphontrackers_report_graphic WHERE ";
     if ($this->user_id == 100) {
         $sql .= "(group_artifact_id=" . db_ei($this->group_artifact_id) . " AND scope='P') OR scope='S' " . "ORDER BY report_graphic_id";
     } else {
         $sql .= "(group_artifact_id=" . db_ei($this->group_artifact_id) . " AND (user_id=" . db_ei($this->user_id) . " OR scope='P')) OR " . "scope='S' ORDER BY report_graphic_id";
     }
     $res = db_query($sql);
     return util_result_column_to_array($res);
 }
function get_trove_sub_projects($cat_id)
{
    if (!$cat_id) {
        return '';
    }
    echo '<P>IN SUBPROJECT' . $cat_id;
    //return an array of trove categories under $cat_id
    $sql = "SELECT trove_cat_id FROM trove_cat WHERE parent IN ({$cat_id})";
    $result = db_query($sql);
    echo db_error();
    $rows = db_numrows($result);
    for ($i = 0; $i < $rows; $i++) {
        $trove_list = array_merge(get_trove_sub_projects(db_result($result, $i, 0)), $trove_list);
    }
    return array_merge(util_result_column_to_array($result), $trove_list);
}
 function ReportProjectTime($group_id, $type, $start = 0, $end = 0)
 {
     $this->Report();
     if (!$start) {
         $start = mktime(0, 0, 0, date('m'), 1, date('Y'));
     }
     if (!$end) {
         $end = time();
     } else {
         $end--;
     }
     if (!$group_id) {
         $this->setError('No User_id');
         return false;
     }
     //
     //	Task report
     //
     if (!$type || $type == 'tasks') {
         $res = db_query("SELECT pt.summary,sum(rtt.hours) AS hours \n\t\t\tFROM rep_time_tracking rtt, project_task pt, project_group_list pgl\n\t\t\tWHERE pgl.group_project_id=pt.group_project_id\n\t\t\tAND pgl.group_id='{$group_id}'\n\t\t\tAND rtt.report_date BETWEEN '{$start}' AND '{$end}' \n\t\t\tAND rtt.project_task_id=pt.project_task_id\n\t\t\tGROUP BY pt.summary\n\t\t\tORDER BY hours DESC");
         //
         //	Category report
         //
     } elseif ($type == 'category') {
         $res = db_query("SELECT rtc.category_name, sum(rtt.hours) AS hours \n\t\t\tFROM rep_time_tracking rtt, rep_time_category rtc, project_task pt, project_group_list pgl\n\t\t\tWHERE pgl.group_id='{$group_id}' \n\t\t\tAND pgl.group_project_id=pt.group_project_id\n\t\t\tAND rtt.project_task_id=pt.project_task_id\n\t\t\tAND rtt.report_date BETWEEN '{$start}' AND '{$end}' \n\t\t\tAND rtt.time_code=rtc.time_code\n\t\t\tGROUP BY rtc.category_name\n\t\t\tORDER BY hours DESC");
         //
         //	Percentage this user spent on a specific subproject
         //
     } elseif ($type == 'subproject') {
         $res = db_query("SELECT pgl.project_name, sum(rtt.hours) AS hours \n\t\t\tFROM rep_time_tracking rtt, project_task pt, project_group_list pgl\n\t\t\tWHERE pgl.group_id='{$group_id}'\n\t\t\tAND rtt.report_date BETWEEN '{$start}' AND '{$end}' \n\t\t\tAND rtt.project_task_id=pt.project_task_id\n\t\t\tAND pt.group_project_id=pgl.group_project_id\n\t\t\tGROUP BY pgl.project_name\n\t\t\tORDER BY hours DESC");
     } else {
         //
         //	Biggest Users
         //
         $res = db_query("SELECT u.realname, sum(rtt.hours) AS hours \n\t\t\tFROM users u, rep_time_tracking rtt, project_task pt, project_group_list pgl\n\t\t\tWHERE pgl.group_id='{$group_id}'\n\t\t\tAND rtt.report_date BETWEEN '{$start}' AND '{$end}' \n\t\t\tAND rtt.project_task_id=pt.project_task_id\n\t\t\tAND pt.group_project_id=pgl.group_project_id\n\t\t\tAND u.user_id=rtt.user_id\n\t\t\tGROUP BY u.realname\n\t\t\tORDER BY hours DESC");
     }
     $this->start_date = $start;
     $this->end_date = $end;
     if (!$res || db_error()) {
         $this->setError('ReportUserAct:: ' . db_error());
         return false;
     }
     $this->labels = util_result_column_to_array($res, 0);
     $this->setData($res, 1);
     return true;
 }
Пример #6
0
function svn_utils_technician_box($group_id, $name = '_commiter', $checked = 'xzxz', $text_100 = 'None')
{
    global $Language;
    if (!$group_id) {
        return $Language->getText('svn_utils', 'g_id_err');
    } else {
        $result = svn_data_get_technicians($group_id);
        if (!in_array($checked, util_result_column_to_array($result))) {
            // Selected 'my commits' but never commited
            $checked = 'xzxz';
        }
        $userids = util_result_column_to_array($result, 0);
        $usernames = util_result_column_to_array($result, 1);
        // Format user name according to preferences
        $UH = new UserHelper();
        foreach ($usernames as &$username) {
            $username = $UH->getDisplayNameFromUserName($username);
        }
        return html_build_select_box_from_arrays($userids, $usernames, $name, $checked, true, $text_100, false, '', false, '', CODENDI_PURIFIER_CONVERT_HTML);
    }
}
Пример #7
0
/**
* MSPGetProjects
* Return the projects by user.
*
* @author	Luis Hurtado	luis@gforgegroup.com
* @param	session_hash	User session
* @return	Groups		User groups
* @date		2005-01-19
*
*/
function &MSPGetProjects($session_hash)
{
    if (!session_continue($session_hash)) {
        $array['success'] = false;
        $array['errormessage'] = 'Could Not Continue Session';
    }
    $group_res = db_query("SELECT groups.group_id FROM groups NATURAL JOIN user_group WHERE user_id='" . user_getid() . "' AND project_flags='2'");
    $group_ids =& util_result_column_to_array($group_res, 'group_id');
    $groups =& group_get_objects($group_ids);
    return $groups;
}
Пример #8
0
 /**
  *	getGroups - get an array of groups this user is a member of.
  *
  *	@return array	Array of groups.
  */
 function &getGroups()
 {
     $sql = "SELECT group_id\n\t\t\tFROM user_group\n\t\t\tWHERE user_id='" . $this->getID() . "'";
     $res = db_query($sql);
     $arr =& util_result_column_to_array($res, 0);
     return group_get_objects($arr);
 }
Пример #9
0
    $category_str = '';
}
//build page title to make bookmarking easier
//if a user was selected, add the user_name to the title
//same for status
support_header(array('title' => 'Browse Support Requests' . ($_assigned_to ? ' For: ' . user_getname($_assigned_to) : '') . ($_status && $_status != 100 ? ' By Status: ' . support_data_get_status_name($_status) : '')));
//now build the query using the criteria built above
$sql = "SELECT support.priority,support.group_id,support.support_id,support.summary," . "support_category.category_name,support_status.status_name," . "support.open_date AS date,users.user_name AS submitted_by,user2.user_name AS assigned_to_user " . "FROM support,support_category,support_status,users,users user2 " . "WHERE users.user_id=support.submitted_by " . " {$status_str} {$assigned_str} {$category_str} " . "AND user2.user_id=support.assigned_to " . "AND support_category.support_category_id=support.support_category_id " . "AND support_status.support_status_id=support.support_status_id " . "AND support.group_id='{$group_id}'" . $order_by;
/*
        creating a custom technician box which includes "any" and "unassigned"
*/
$res_tech = support_data_get_technicians($group_id);
$tech_id_arr = util_result_column_to_array($res_tech, 0);
$tech_id_arr[] = '0';
//this will be the 'any' row
$tech_name_arr = util_result_column_to_array($res_tech, 1);
$tech_name_arr[] = 'Any';
$tech_box = html_build_select_box_from_arrays($tech_id_arr, $tech_name_arr, '_assigned_to', $_assigned_to, true, 'Unassigned');
/*
	Show the new pop-up boxes to select assigned to and/or status
*/
echo '<H2>Browse Support Requests by</H2>
	<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="6"><FORM ACTION="' . $PHP_SELF . '" METHOD="GET">
	<INPUT TYPE="HIDDEN" NAME="group_id" VALUE="' . $group_id . '">
	<INPUT TYPE="HIDDEN" NAME="set" VALUE="custom">
	<TR><TD><b>Assigned User:</b></TD><TD><b>Status:</b></TD><TD><b>Category:</b></TD></TR>
	<TR><TD><FONT SIZE="-1">' . $tech_box . '</TD><TD><FONT SIZE="-1">' . support_status_box('_status', $_status, 'Any') . '</TD>' . '<TD><FONT SIZE="-1">' . support_category_box($group_id, $name = '_category', $_category, 'Any') . '</TD>' . '<TD><FONT SIZE="-1"><INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="Browse"></TD></TR></FORM></TABLE>';
//echo "<p>$sql\n";
$result = db_query($sql, 51, $offset);
if ($result && db_numrows($result) > 0) {
    echo '
Пример #10
0
function &user_get_objects_by_name($username_arr)
{
    $res = db_query("SELECT user_id FROM users WHERE user_name IN ('" . implode($username_arr, '\',\'') . "')");
    $arr =& util_result_column_to_array($res, 0);
    return user_get_objects($arr);
}
Пример #11
0
 /**
  *	sendAttachNotice - contains the logic to send out email attachement followups when a message is posted.
  *
  *	@param int	attach_id	- The id of the file that has been attached
  *
  *	@return boolean success.
  */
 function sendAttachNotice($attach_id)
 {
     if ($attach_id) {
         $ids =& $this->Forum->getMonitoringIDs();
         //
         //	See if there is anyone to send messages to
         //
         if (!count($ids) > 0 && !$this->Forum->getSendAllPostsTo()) {
             return true;
         }
         $body = "\nRead and respond to this message at: " . "\n" . util_make_url('/forum/message.php?msg_id=' . $this->getID()) . "\nBy: " . $this->getPosterRealName() . "\n\n";
         $body .= "A file has been uploaded to this message, you can download it at: " . "\n" . util_make_url('/forum/attachment.php?attachid=' . $attach_id . "&group_id=" . $this->Forum->Group->getID() . "&forum_id=" . $this->Forum->getID()) . "\n\n";
         $body .= "\n\n______________________________________________________________________" . "\nYou are receiving this email because you elected to monitor this forum." . "\nTo stop monitoring this forum, login to " . $GLOBALS['sys_name'] . " and visit: " . "\n" . util_make_url('/forum/monitor.php?forum_id=' . $this->Forum->getID() . '&group_id=' . $this->Forum->Group->getID() . '&stop=1');
         $extra_headers = "Return-Path: <noreply@" . $GLOBALS['sys_default_domain'] . ">\n";
         $extra_headers .= "Errors-To: <noreply@" . $GLOBALS['sys_default_domain'] . ">\n";
         $extra_headers .= "Sender: <noreply@" . $GLOBALS['sys_default_domain'] . ">\n";
         $extra_headers .= "Reply-To: " . $this->Forum->getReturnEmailAddress() . "\n";
         $extra_headers .= "Precedence: Bulk\n" . "List-Id: " . $this->Forum->getName() . " <forum" . $this->Forum->getId() . "@" . $GLOBALS['sys_default_domain'] . ">\n" . "List-Help: " . util_make_url('/forum/forum.php?id=' . $this->Forum->getId()) . "\n" . "Message-Id: <forumpost" . $this->getId() . "@" . $GLOBALS['sys_default_domain'] . ">";
         $parentid = $this->getParentId();
         if (!empty($parentid)) {
             $extra_headers .= "\nIn-Reply-To: " . $this->Forum->getReturnEmailAddress() . "\n" . "References: <forumpost" . $this->getParentId() . "@" . $GLOBALS['sys_default_domain'] . ">";
         }
         $subject = "[" . $this->Forum->getUnixName() . "][" . $this->getID() . "] " . util_unconvert_htmlspecialchars($this->getSubject());
         if (count($ids) != 0) {
             $sql = "SELECT email FROM users WHERE status='A' AND user_id IN ('" . implode($ids, '\',\'') . "')";
             $bccres = db_query($sql);
         }
         ($BCC =& implode(util_result_column_to_array($bccres), ',')) . ',' . $this->Forum->getSendAllPostsTo();
         $User = user_get_object($this->getPosterID());
         util_send_message('', $subject, $body, "noreply@" . $GLOBALS['sys_default_domain'], $BCC, 'Forum', $extra_headers);
         return true;
     }
     return false;
 }
Пример #12
0
function plugin_tracker_permission_fetch_selection_field($permission_type, $object_id, $group_id, $html_name = "ugroups[]", $html_disabled = false, $selected = array())
{
    $html = '';
    // Get ugroups already defined for this permission_type
    if (empty($selected)) {
        $res_ugroups = permission_db_authorized_ugroups($permission_type, $object_id);
        $nb_set = db_numrows($res_ugroups);
    } else {
        $res_ugroups = $selected;
        $nb_set = count($res_ugroups);
    }
    // Now retrieve all possible ugroups for this project, as well as the default values
    $sql = "SELECT ugroup_id,is_default FROM permissions_values WHERE permission_type='{$permission_type}'";
    $res = db_query($sql);
    $predefined_ugroups = '';
    $default_values = array();
    if (db_numrows($res) < 1) {
        $html .= "<p><b>" . $GLOBALS['Language']->getText('global', 'error') . "</b>: " . $GLOBALS['Language']->getText('project_admin_permissions', 'perm_type_not_def', $permission_type);
        return $html;
    } else {
        while ($row = db_fetch_array($res)) {
            if ($predefined_ugroups) {
                $predefined_ugroups .= ' ,';
            }
            $predefined_ugroups .= $row['ugroup_id'];
            if ($row['is_default']) {
                $default_values[] = $row['ugroup_id'];
            }
        }
    }
    $sql = "SELECT * FROM ugroup WHERE group_id=" . $group_id . " OR ugroup_id IN (" . $predefined_ugroups . ") ORDER BY ugroup_id";
    $res = db_query($sql);
    $array = array();
    while ($row = db_fetch_array($res)) {
        $name = util_translate_name_ugroup($row[1]);
        $array[] = array('value' => $row[0], 'text' => $name);
    }
    if (empty($selected)) {
        if ($nb_set) {
            $res_ugroups = util_result_column_to_array($res_ugroups);
        } else {
            $res_ugroups = $default_values;
        }
    }
    $html .= html_build_multiple_select_box($array, $html_name, $res_ugroups, 8, false, util_translate_name_ugroup('ugroup_nobody_name_key'), false, '', false, '', false, CODENDI_PURIFIER_CONVERT_HTML, $html_disabled);
    return $html;
}
Пример #13
0
function frs_display_release_form($is_update, &$release, $group_id, $title, $url)
{
    global $frspf, $frsrf, $frsff;
    $hp =& Codendi_HTMLPurifier::instance();
    if (is_array($release)) {
        if (isset($release['date'])) {
            $release_date = $release['date'];
        }
        $release = new FRSRelease($release);
    }
    if ($is_update) {
        $files = $release->getFiles();
        if (count($files) > 0) {
            for ($i = 0; $i < count($files); $i++) {
                if (!$frsff->compareMd5Checksums($files[$i]->getComputedMd5(), $files[$i]->getReferenceMd5())) {
                    $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('file_admin_editreleases', 'md5_fail', array(basename($files[$i]->getFileName()), $files[$i]->getComputedMd5())));
                }
            }
        }
    }
    file_utils_admin_header(array('title' => $GLOBALS['Language']->getText('file_admin_editreleases', 'release_new_file_version'), 'help' => 'frs.html#delivery-manager-administration'));
    echo '<H3>' . $hp->purify($title, CODENDI_PURIFIER_CONVERT_HTML) . '</H3>';
    $sql = "SELECT * FROM frs_processor WHERE (group_id = 100 OR group_id = " . db_ei($group_id) . ") ORDER BY rank";
    $result = db_query($sql);
    $processor_id = util_result_column_to_array($result, 0);
    $processor_name = util_result_column_to_array($result, 1);
    foreach ($processor_name as $key => $value) {
        $processor_name[$key] = $hp->purify($value, CODENDI_PURIFIER_JS_QUOTE);
    }
    $sql = "SELECT * FROM frs_filetype ORDER BY type_id";
    $result1 = db_query($sql);
    $type_id = util_result_column_to_array($result1, 0);
    $type_name = util_result_column_to_array($result1, 1);
    $url_news = get_server_url() . "/file/showfiles.php?group_id=" . $group_id;
    echo '<script type="text/javascript">';
    echo "var processor_id = ['" . implode("', '", $processor_id) . "'];";
    echo "var processor_name = ['" . implode("', '", $processor_name) . "'];";
    echo "var type_id = ['" . implode("', '", $type_id) . "'];";
    echo "var type_name = ['" . implode("', '", $type_name) . "'];";
    echo "var group_id = " . $group_id . ";";
    echo "var relname = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'relname') . "';";
    echo "var choose = '" . $GLOBALS['Language']->getText('file_file_utils', 'must_choose_one') . "';";
    echo "var browse = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'browse') . "';";
    echo "var local_file = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'local_file') . "';";
    echo "var scp_ftp_files = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'scp_ftp_files') . "';";
    echo "var upload_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'upload') . "';";
    echo "var add_file_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'add_file') . "';";
    echo "var add_change_log_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'add_change_log') . "';";
    echo "var view_change_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'view_change') . "';";
    echo "var refresh_files_list = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'refresh_file_list') . "';";
    echo "var release_mode = '" . ($is_update ? 'edition' : 'creation') . "';";
    if ($is_update) {
        $pm = PermissionsManager::instance();
        $dar = $pm->getAuthorizedUgroups($release->getReleaseID(), FRSRelease::PERM_READ);
        $ugroups_name = array();
        foreach ($dar as $row) {
            $ugroups_name[] = util_translate_name_ugroup($row['name']);
        }
        echo "var ugroups_name = '" . implode(", ", $ugroups_name) . "';";
        echo "var default_permissions_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'release_perm') . "';";
    } else {
        echo "var default_permissions_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'default_permissions') . "';";
    }
    echo '</script>';
    //set variables for news template
    $relname = $GLOBALS['Language']->getText('file_admin_editreleases', 'relname');
    if (!$is_update) {
        echo '<p>' . $GLOBALS['Language']->getText('file_admin_editreleases', 'contain_multiple_files') . '</p>';
    }
    ?>
    
    <FORM id="frs_form" NAME="frsRelease" ENCTYPE="multipart/form-data" METHOD="POST" ACTION="<?php 
    echo $url;
    ?>
" CLASS="form-inline">
        <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="<? echo $GLOBALS['sys_max_size_upload']; ?>">
        <input type="hidden" name="postReceived" value="" />
        <?php 
    if ($release->getReleaseId()) {
        echo '<input type="hidden" id="release_id" name="release[release_id]" value="' . $release->getReleaseId() . '" />';
    }
    ?>
        <TABLE BORDER="0" width="100%">
        <TR><TD><FIELDSET><LEGEND><?php 
    echo $GLOBALS['Language']->getText('file_admin_editreleases', 'fieldset_properties');
    ?>
</LEGEND>
        <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="2">
            <TR>
                <TD>
                    <B><?php 
    echo $GLOBALS['Language']->getText('file_admin_editpackages', 'p_name');
    ?>
:</B>
                </TD>
                <TD>
    <?php 
    $res =& $frspf->getFRSPackagesFromDb($group_id);
    $rows = count($res);
    if (!$res || $rows < 1) {
        echo '<p class="highlight">' . $GLOBALS['Language']->getText('file_admin_qrs', 'no_p_available') . '</p>';
    } else {
        echo '<SELECT NAME="release[package_id]" id="package_id">';
        for ($i = 0; $i < $rows; $i++) {
            echo '<OPTION VALUE="' . $res[$i]->getPackageID() . '"';
            if ($res[$i]->getPackageID() == $release->getPackageId()) {
                echo ' selected';
            }
            echo '>' . $hp->purify(util_unconvert_htmlspecialchars($res[$i]->getName()), CODENDI_PURIFIER_CONVERT_HTML) . '</OPTION>';
        }
        echo '</SELECT>';
    }
    ?>
                </TD><td></td>
                <TD>
                    <B><?php 
    echo $GLOBALS['Language']->getText('file_admin_editreleases', 'release_name');
    ?>
: <span class="highlight"><strong>*</strong></span></B>
                </TD>
                <TD>
                    <INPUT TYPE="TEXT" id="release_name" name="release[name]" onBlur="update_news()" value="<?php 
    echo $hp->purify($release->getName());
    ?>
">
                </TD>
            </TR>
            <TR>
                <TD>
                    <B><?php 
    echo $GLOBALS['Language']->getText('file_admin_editreleases', 'release_date');
    ?>
:</B>
                </TD>
                <TD>
                <?php 
    echo $GLOBALS['HTML']->getDatePicker('release_date', 'release[date]', isset($release_date) ? $hp->purify($release_date) : format_date('Y-m-d', $release->getReleaseDate()));
    ?>
                </TD>
                <td></td>
                <TD>
                    <B><?php 
    echo $GLOBALS['Language']->getText('global', 'status');
    ?>
:</B>
                </TD>
                <TD>
                    <?php 
    print frs_show_status_popup($name = 'release[status_id]', $release->getStatusID()) . "<br>";
    ?>
                </TD>
            </TR></TABLE></FIELDSET>
        </TD></TR>
        <TR><TD><FIELDSET><LEGEND><?php 
    echo $GLOBALS['Language']->getText('file_admin_editreleases', 'fieldset_uploaded_files');
    ?>
</LEGEND>
    <?php 
    $titles = array();
    $titles[] = $is_update ? $GLOBALS['Language']->getText('file_admin_editreleases', 'delete_col') : '';
    $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'filename');
    $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'processor');
    $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'file_type');
    $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'md5sum');
    $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'comment');
    $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'user');
    if ($is_update) {
        $titles[] = $GLOBALS['Language']->getText('file_admin_editreleasepermissions', 'release');
        $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'release_date');
    }
    echo html_build_list_table_top($titles, false, false, false, 'files');
    ?>
            <tbody id="files_body">
    
    <?php 
    $files =& $release->getFiles();
    for ($i = 0; $i < count($files); $i++) {
        $fname = $files[$i]->getFileName();
        $list = split('/', $fname);
        $fname = $list[sizeof($list) - 1];
        $user_id = $files[$i]->getUserID();
        $userName = isset($user_id) ? UserManager::instance()->getUserById($files[$i]->getUserID())->getRealName() : "";
        echo '<TR>';
        echo '<TD><INPUT TYPE="CHECKBOX" NAME="release_files_to_delete[]" VALUE="' . $files[$i]->getFileID() . '"</TD>';
        echo '<TD>' . $hp->purify($fname, CODENDI_PURIFIER_CONVERT_HTML) . '<INPUT TYPE="HIDDEN" NAME="release_files[]" VALUE="' . $files[$i]->getFileID() . '"></TD>';
        echo '<TD>' . frs_show_processor_popup($group_id, $name = 'release_file_processor[]', $files[$i]->getProcessorID()) . '</TD>';
        echo '<TD>' . frs_show_filetype_popup($name = 'release_file_type[]', $files[$i]->getTypeID()) . '</TD>';
        //In case of difference between the inserted md5 and the computed one
        //we dispaly an editable text field to let the user insert the right value
        //to avoid the error message next time
        $value = 'value = "' . $files[$i]->getReferenceMd5() . '"';
        if ($frsff->compareMd5Checksums($files[$i]->getComputedMd5(), $files[$i]->getReferenceMd5())) {
            $value = 'value = "' . $files[$i]->getComputedMd5() . '" readonly="true"';
        }
        echo '<TD><INPUT TYPE="TEXT" NAME="release_reference_md5[]" ' . $value . ' SIZE="36" ></TD>';
        $comment = $files[$i]->getComment();
        echo '<TD><textarea NAME="release_comment[]" cols="20", rows="1" >' . $comment . '</textarea></TD>';
        echo '<TD><INPUT TYPE="TEXT" NAME="user" value = "' . $userName . '" readonly="true"></TD>';
        echo '<TD>' . frs_show_release_popup2($group_id, $name = 'new_release_id[]', $files[$i]->getReleaseID()) . '</TD>';
        echo '<TD><INPUT TYPE="TEXT" NAME="release_time[]" VALUE="' . format_date('Y-m-d', $files[$i]->getReleaseTime()) . '" SIZE="10" MAXLENGTH="10"></TD></TR>';
    }
    echo '<INPUT TYPE="HIDDEN" id="nb_files" NAME="nb_files" VALUE="' . count($files) . '">';
    ?>
                        
                        <tr id="row_0">
                            <td></td>
                            <td>
                                <input type="hidden" name="js" value="no_js"/>
                                <select name="ftp_file[]" id="ftp_file_0">
                                    <option value="-1"><?php 
    echo $GLOBALS['Language']->getText('file_file_utils', 'must_choose_one');
    ?>
</option>
    <?php 
    //iterate and show the files in the upload directory
    $file_list = $frsff->getUploadedFileNames($release->getProject());
    foreach ($file_list as $file) {
        echo '<option value="' . $file . '">' . $hp->purify($file, CODENDI_PURIFIER_CONVERT_HTML) . '</option>';
    }
    echo '<script type="text/javascript">';
    echo "var available_ftp_files = ['" . implode("', '", $file_list) . "'];";
    echo '</script>';
    ?>
                                </select>
    
                                <span id="or">or</span>
                                <input type="file" name="file[]" id="file_0" />
                            </td>
                            <td>
                                <?php 
    print frs_show_processor_popup($group_id, $name = 'file_processor');
    ?>
                            </td>
                            <td>
                                <?php 
    print frs_show_filetype_popup($name = 'file_type');
    ?>
                            </td>
                            <td>
                                <input name="reference_md5" value="" size="36" type="TEXT">
                            </td>
                        </tr>
                    </tbody>
                </table>
                <?php 
    echo '<span class="small" style="color:#666"><i>' . $GLOBALS['Language']->getText('file_admin_editreleases', 'upload_file_msg', formatByteToMb($GLOBALS['sys_max_size_upload'])) . '</i> </span>';
    echo '<div id=\'files_help\'><span class="smaller">';
    include $GLOBALS['Language']->getContent('file/qrs_attach_file');
    echo '</span></div>';
    ?>
            </FIELDSET>
            </TD></TR>
            <TR><TD><FIELDSET><LEGEND><?php 
    echo $GLOBALS['Language']->getText('file_admin_editreleases', 'fieldset_notes');
    ?>
</LEGEND>
            <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="2" WIDTH="100%">
            <TR id="notes_title">
                <TD VALIGN="TOP" width="10%">
                    <span id="release_notes"><B><?php 
    echo $GLOBALS['Language']->getText('file_admin_editreleases', 'release_notes');
    ?>
:  </B></span>
                </TD>
            </TR>
            <TR id="upload_notes">
                <TD>
                    <input id="uploaded_notes" type="file" name="uploaded_release_notes"  size="30">
                </TD>
            </TR>
            <TR id="release_notes_area">
                <TD width="100%">
                    <TEXTAREA NAME="release[release_notes]" rows="7" cols="70"><?php 
    echo $hp->purify($release->getNotes(), CODENDI_PURIFIER_CONVERT_HTML);
    ?>
</TEXTAREA>
                </TD>
            </TR>
            <TR id="change_log_title">
                <TD VALIGN="TOP" width="10%">
                    <span id="change_log"><B><?php 
    echo $GLOBALS['Language']->getText('file_admin_editreleases', 'change_log');
    ?>
:  </B></span>
                </TD>
            </TR>
            <TR id="upload_change_log">
                <TD>
                    <input type="file" id="uploaded_change_log" name="uploaded_change_log"  size="30">
                </TD>
            </TR>
            <TR id="change_log_area">
                <TD width="40%">
                    <TEXTAREA ID="text_area_change_log" NAME="release[change_log]" ROWS="7" COLS="70"><?php 
    echo $hp->purify($release->getChanges(), CODENDI_PURIFIER_CONVERT_HTML);
    ?>
</TEXTAREA>
                </TD>
            </TR>
            </TABLE></FIELDSET>
            </TD></TR>
            <TR>
                <TD>
                    <FIELDSET><LEGEND><?php 
    echo $GLOBALS['Language']->getText('file_admin_editreleases', 'fieldset_permissions');
    ?>
</LEGEND>
                        <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="2">
    
                            <TR id="permissions">
                                <TD>
                                    <DIV id="permissions_list">
                                        <?php 
    if ($is_update) {
        permission_display_selection_frs("RELEASE_READ", $release->getReleaseID(), $group_id);
    } else {
        permission_display_selection_frs("PACKAGE_READ", $release->getPackageID(), $group_id);
    }
    ?>
                                    </DIV>
                                </TD>
                            </TR>
                        </TABLE>
                    </FIELDSET>
                </TD>
            </TR> 
            <?php 
    if (user_ismember($group_id, 'A') || user_ismember($group_id, 'N2') || user_ismember($group_id, 'N1')) {
        echo '
            <TR><TD><FIELDSET><LEGEND>' . $GLOBALS['Language']->getText('file_admin_editreleases', 'fieldset_news') . '</LEGEND>
                <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="2">
                    <TR>
                        <TD VALIGN="TOP">
                            <B> ' . $GLOBALS['Language']->getText('file_admin_editreleases', 'submit_news') . ' :</B>
                        </TD>
                        <TD>
                            <INPUT ID="submit_news" TYPE="CHECKBOX" NAME="release_submit_news" VALUE="1">
                            
                        </TD>	
                    </TR>
                    <TR id="tr_subject">
                        <TD VALIGN="TOP" ALIGN="RIGHT">
                            <B> ' . $GLOBALS['Language']->getText('file_admin_editreleases', 'subject') . ' :</B>
                        </TD>
                        <TD>
                            <INPUT TYPE="TEXT" ID="release_news_subject" NAME="release_news_subject" VALUE=" ' . $GLOBALS['Language']->getText('file_admin_editreleases', 'file_news_subject', $relname) . '" SIZE="40" MAXLENGTH="60">
                        </TD>
                    </TR>	
                    <TR id="tr_details">
                        <TD VALIGN="TOP" ALIGN="RIGHT">
                            <B> ' . $GLOBALS['Language']->getText('file_admin_editreleases', 'details') . ' :</B>
                        </TD>
                        <TD>
                            <TEXTAREA ID="release_news_details" NAME="release_news_details" ROWS="7" COLS="50">' . $GLOBALS['Language']->getText('file_admin_editreleases', 'file_news_details', array($relname, $url_news)) . ' </TEXTAREA>
                        </TD>
                    </TR>
                    <TR id="tr_public">
                        <TD ROWSPAN=2 VALIGN="TOP" ALIGN="RIGHT">
                            <B> ' . $GLOBALS['Language']->getText('news_submit', 'news_privacy') . ' :</B>
                        </TD>
                        <TD>
                            <INPUT TYPE="RADIO" ID="publicnews" NAME="private_news" VALUE="0" CHECKED>' . $GLOBALS['Language']->getText('news_submit', 'public_news') . '
                        </TD>
                    </TR > 
                    <TR id="tr_private">
                        <TD>
                            <INPUT TYPE="RADIO" ID="privatenews" NAME="private_news" VALUE="1">' . $GLOBALS['Language']->getText('news_submit', 'private_news') . '
                        </TD>
                    </TR></DIV>
                </TABLE></FIELDSET>
            </TD></TR>';
    }
    $fmmf = new FileModuleMonitorFactory();
    $count = count($fmmf->getFilesModuleMonitorFromDb($release->getPackageId()));
    if ($count > 0) {
        echo '<TR><TD><FIELDSET><LEGEND>' . $GLOBALS['Language']->getText('file_admin_editreleases', 'fieldset_notification') . '</LEGEND>';
        echo '<TABLE BORDER="0" CELLPADDING="2" CELLSPACING="2">';
        echo '<TR><TD>' . $GLOBALS['Language']->getText('file_admin_editreleases', 'users_monitor', $count) . '</TD></TR>';
        echo '<TR><TD><B>' . $GLOBALS['Language']->getText('file_admin_editreleases', 'mail_file_rel_notice') . '</B><INPUT TYPE="CHECKBOX" NAME="notification" VALUE="1" CHECKED>';
        echo '</TD></TR>';
        echo '</TABLE></FIELDSET></TD></TR>';
    }
    ?>
            
            <TR>
                <TD ALIGN="CENTER">
                    
                    <INPUT TYPE="HIDDEN" NAME="create" VALUE="bla">
                    <INPUT TYPE="SUBMIT" ID="create_release"  VALUE="<?php 
    echo $is_update ? $GLOBALS['Language']->getText('file_admin_editreleases', 'edit_release') : $GLOBALS['Language']->getText('file_admin_qrs', 'release_file');
    ?>
">
                    <input type="submit" ID="cancel_release" name="cancel" value="<?php 
    echo $GLOBALS['Language']->getText('global', 'btn_cancel');
    ?>
" />
                </TD>
            </TR>
        </TABLE>
    </FORM>
    
    <?php 
    file_utils_footer(array());
}
Пример #14
0
if (!is_dir($groupdir_prefix)) {
    @mkdir($groupdir_prefix, 0755, true);
}
if (!isset($homedir_prefix)) {
    // this should be set in local.inc
    ${$homedir_prefix} = '/home';
}
if (!is_dir($homedir_prefix)) {
    @mkdir($homedir_prefix, 0755, true);
}
$res = db_query("SELECT distinct users.user_name,users.unix_pw,users.user_id\n\tFROM users,user_group,groups\n\tWHERE users.user_id=user_group.user_id \n\tAND user_group.group_id=groups.group_id\n\tAND groups.status='A'\n\tAND user_group.cvs_flags IN ('0','1')\n\tAND users.status='A'\n\tORDER BY user_id ASC");
$err .= db_error();
$users =& util_result_column_to_array($res, 'user_name');
$group_res = db_query("SELECT unix_group_name, (is_public=1 AND enable_anonscm=1 AND type_id=1) AS enable_pserver FROM groups WHERE status='A' AND type_id='1'");
$err .= db_error();
$groups = util_result_column_to_array($group_res, 'unix_group_name');
//
//	this is where we give a user a home
//
foreach ($users as $user) {
    if (is_dir($homedir_prefix . "/" . $user)) {
    } else {
        @mkdir($homedir_prefix . "/" . $user);
    }
    system("chown {$user}:" . USER_DEFAULT_GROUP . " " . $homedir_prefix . "/" . $user);
}
//
//	Create home dir for groups
//
foreach ($groups as $group) {
    //test if the FTP upload dir exists and create it if not
Пример #15
0
 function callback($data_row)
 {
     $sql = "SELECT trove_cat.fullpath " . "FROM trove_group_link,trove_cat " . "WHERE trove_group_link.trove_cat_root=18 " . "AND trove_group_link.trove_cat_id=trove_cat.trove_cat_id " . "AND group_id={$data_row['group_id']}";
     $result = db_query($sql);
     $ret = ' | date registered: ' . date('M jS Y', $data_row['register_time']);
     $ret .= ' | category: ' . str_replace(' ', '', implode(util_result_column_to_array($result), ','));
     return $ret . ' | license: ' . $data_row['license'];
 }
Пример #16
0
 function setDates($result, $column)
 {
     $arr =& util_result_column_to_array($result, $column);
     for ($i = 0; $i < count($arr); $i++) {
         $this->labels[$i] = date('M d', $arr[$i]);
     }
 }
Пример #17
0
function html_build_select_box($result, $name, $checked_val = "xzxz", $show_100 = true, $text_100 = '', $show_any = false, $text_any = '', $show_unchanged = false, $text_unchanged = '', $purify_level = CODENDI_PURIFIER_CONVERT_HTML, $show_unknown_value = true)
{
    global $Language;
    /*
    	Takes a result set, with the first column being the "id" or value
    	and the second column being the text you want displayed
    
    	The second parameter is the name you want assigned to this form element
    
    	The third parameter is optional. Pass the value of the item that should be checked
    
    	The fourth parameter is an optional boolean - whether or not to show the '100 row'
    
    	The fifth parameter is optional - what to call the '100 row' defaults to none
    */
    // Position default values for special menu items
    if ($text_100 == '') {
        $text_100 = $Language->getText('global', 'none');
    }
    if ($text_any == '') {
        $text_any = $Language->getText('global', 'any');
    }
    if ($text_unchanged == '') {
        $text_unchanged = $Language->getText('global', 'unchanged');
    }
    return html_build_select_box_from_arrays(util_result_column_to_array($result, 0), util_result_column_to_array($result, 1), $name, $checked_val, $show_100, $text_100, $show_any, $text_any, $show_unchanged, $text_unchanged, $purify_level, $show_unknown_value);
}
Пример #18
0
 function &getTaskClosed()
 {
     return util_result_column_to_array($this->res, 8);
 }
Пример #19
0
function permission_display_selection_frs($permission_type, $object_id = null, $group_id)
{
    $html = '';
    // Get ugroups already defined for this permission_type
    $res_ugroups = permission_db_authorized_ugroups($permission_type, $object_id);
    $nb_set = db_numrows($res_ugroups);
    // Now retrieve all possible ugroups for this project, as well as the default values
    $sql = "SELECT ugroup_id,is_default FROM permissions_values WHERE permission_type='" . db_es($permission_type) . "'";
    $res = db_query($sql);
    $predefined_ugroups = '';
    $default_values = array();
    if (db_numrows($res) < 1) {
        $html .= "<p><b>" . $GLOBALS['Language']->getText('global', 'error') . "</b>: " . $GLOBALS['Language']->getText('project_admin_permissions', 'perm_type_not_def', $permission_type);
        return $html;
    } else {
        while ($row = db_fetch_array($res)) {
            if ($predefined_ugroups) {
                $predefined_ugroups .= ' ,';
            }
            $predefined_ugroups .= $row['ugroup_id'];
            if ($row['is_default']) {
                $default_values[] = $row['ugroup_id'];
            }
        }
    }
    $sql = "SELECT * FROM ugroup WHERE group_id=" . db_ei($group_id) . " OR ugroup_id IN (" . $predefined_ugroups . ") ORDER BY ugroup_id";
    $res = db_query($sql);
    $array = array();
    while ($row = db_fetch_array($res)) {
        $name = util_translate_name_ugroup($row[1]);
        $array[] = array('value' => $row[0], 'text' => $name);
    }
    $html .= html_build_multiple_select_box($array, "ugroups[]", $nb_set ? util_result_column_to_array($res_ugroups) : $default_values, 8, false, util_translate_name_ugroup('ugroup_nobody_name_key'), false, '', false, '', false);
    $html .= '<p>' . $GLOBALS['Language']->getText('project_admin_permissions', 'admins_create_modify_ug', array("/project/admin/editugroup.php?func=create&group_id={$group_id}", "/project/admin/ugroup.php?group_id={$group_id}"));
    echo $html;
}
Пример #20
0
/** Return array of ugroup_id for all user-defined ugoups that user is part of 
 * and having tracker-related permissions on the $group_artifact_id tracker */
function ugroup_db_list_tracker_ugroups_for_user($group_id, $group_artifact_id, $user_id)
{
    $sql = "SELECT distinct ug.ugroup_id FROM ugroup ug, ugroup_user ugu, permissions p " . "WHERE ugu.user_id=" . db_ei($user_id) . " AND ug.group_id=" . db_ei($group_id) . " AND ugu.ugroup_id=ug.ugroup_id " . " AND p.ugroup_id = ugu.ugroup_id " . " AND p.object_id LIKE '" . db_ei($group_artifact_id) . "%' " . " AND p.permission_type LIKE 'TRACKER%'";
    return util_result_column_to_array(db_query($sql));
}
Пример #21
0
 /**
  * 	updateExtraFields - updates the extra data elements for this artifact
  *	e.g. the extra fields created and defined by the admin.
  *
  *	@param	array	Array of extra fields like: array(15=>'foobar',22=>'1');
  *	@param	array	Array where changes to the extra fields should be logged
  *	@return true on success / false on failure
  */
 function updateExtraFields($extra_fields, &$changes)
 {
     /*
     	This is extremely complex code - we have take the passed array
     	and see if we need to insert it into the db, and may have to 
     	add history rows for the audit trail
     	start by getting all the available extra fields from ArtifactType
     		For each field from ArtifacType, check the passed array - 
     			This prevents someone from passing bogus extra field entries - they will be ignored
     			if the passed entry is blank, may have to force a default value
     			if the passed array is different from the existing data in db, 
     				delete old entry and insert new entries, along with possible audit trail
     			else
     				skip it and continue to next item
     */
     if (empty($extra_fields)) {
         return true;
     }
     //get a list of extra fields for this artifact_type
     $ef = $this->ArtifactType->getExtraFields();
     $efk = array_keys($ef);
     //now we'll update this artifact for each extra field
     for ($i = 0; $i < count($efk); $i++) {
         $efid = $efk[$i];
         $type = $ef[$efid]['field_type'];
         //
         //	Force each field to have some value if it is a numeric field
         //	text fields will just be purged and skipped
         //
         if (!array_key_exists($efid, $extra_fields) || !$extra_fields[$efid]) {
             if ($type == ARTIFACT_EXTRAFIELDTYPE_STATUS) {
                 $this->setError('Status Custom Field Must Be Set');
                 return false;
             } elseif ($type == ARTIFACT_EXTRAFIELDTYPE_SELECT || $type == ARTIFACT_EXTRAFIELDTYPE_RADIO) {
                 $extra_fields[$efid] = '100';
             } elseif ($type == ARTIFACT_EXTRAFIELDTYPE_MULTISELECT || $type == ARTIFACT_EXTRAFIELDTYPE_CHECKBOX) {
                 $extra_fields[$efid] = array('100');
             } else {
                 $resdel = db_query("DELETE FROM artifact_extra_field_data\n\t\t\t\t\tWHERE\n\t\t\t\t\tartifact_id='" . $this->getID() . "'\n\t\t\t\t\tAND extra_field_id='" . $efid . "'");
                 continue;
             }
         }
         //
         //	get the old rows of data
         //
         $resd = db_query("SELECT * FROM artifact_extra_field_data\n\t\t\t\tWHERE\n\t\t\t\tartifact_id='" . $this->getID() . "'\n\t\t\t\tAND extra_field_id='" . $efid . "'");
         $rows = db_numrows($resd);
         if ($resd && $rows) {
             //
             //POTENTIAL PROBLEM - no entry was there before, but adding one now - may need history
             //
             //
             //	Compare for history purposes
             //
             // these types have arrays associated to them, so they need
             // special handling to check for differences
             if ($type == ARTIFACT_EXTRAFIELDTYPE_MULTISELECT || $type == ARTIFACT_EXTRAFIELDTYPE_CHECKBOX) {
                 // check the differences between the old values and the new values
                 $old_values = util_result_column_to_array($resd, "field_data");
                 $added_values = array_diff($extra_fields[$efid], $old_values);
                 $deleted_values = array_diff($old_values, $extra_fields[$efid]);
                 if (!empty($added_values) || !empty($deleted_values)) {
                     // there are differences...
                     $field_name = $ef[$efid]['field_name'];
                     $changes["extra_fields"][$efid] = 1;
                     // Do a history entry only for deleted values
                     if (!empty($deleted_values)) {
                         $this->addHistory($field_name, $this->ArtifactType->getElementName($deleted_values));
                     }
                     $resdel = db_query("DELETE FROM artifact_extra_field_data\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\tartifact_id='" . $this->getID() . "'\n\t\t\t\t\t\tAND extra_field_id='" . $efid . "'");
                 } else {
                     continue;
                 }
             } elseif (addslashes(db_result($resd, 0, 'field_data')) == htmlspecialchars($extra_fields[$efid])) {
                 //element did not change
                 continue;
             } else {
                 //element DID change - do a history entry
                 $field_name = $ef[$efid]['field_name'];
                 $changes["extra_fields"][$efid] = 1;
                 $resdel = db_query("DELETE FROM artifact_extra_field_data\n\t\t\t\t\tWHERE\n\t\t\t\t\tartifact_id='" . $this->getID() . "'\n\t\t\t\t\tAND extra_field_id='" . $efid . "'");
                 if ($type == ARTIFACT_EXTRAFIELDTYPE_SELECT || $type == ARTIFACT_EXTRAFIELDTYPE_RADIO || $type == ARTIFACT_EXTRAFIELDTYPE_STATUS) {
                     //don't add history for text fields
                     $this->addHistory($field_name, $this->ArtifactType->getElementName(db_result($resd, 0, 'field_data')));
                 }
             }
         } else {
             //no history for this extra field exists
         }
         //
         //	See if anything was even passed for this extra_field_id
         //
         if (!$extra_fields[$efid]) {
             //nothing in field to update - text fields may be blank
         } else {
             //determine the type of field and whether it should have multiple rows supporting it
             $type = $ef[$efid]['field_type'];
             if ($type == ARTIFACT_EXTRAFIELDTYPE_CHECKBOX || $type == ARTIFACT_EXTRAFIELDTYPE_MULTISELECT) {
                 $multi_rows = true;
                 $count = count($extra_fields[$efid]);
                 for ($fin = 0; $fin < $count; $fin++) {
                     $sql = "INSERT INTO artifact_extra_field_data (artifact_id,extra_field_id,field_data) \n\t\t\t\t\t\t\tvalues ('" . $this->getID() . "','" . $efid . "',\n\t\t\t\t\t\t\t'" . $extra_fields[$efid][$fin] . "')";
                     $res = db_query($sql);
                     if (!$res) {
                         $this->setError('Artifact::updateExtraFields:: ' . $sql . db_error());
                         return false;
                     }
                 }
             } else {
                 $multi_rows = false;
                 $count = 1;
                 $res = db_query("INSERT INTO artifact_extra_field_data (artifact_id,extra_field_id,field_data) \n\t\t\t\t\t\tvalues ('" . $this->getID() . "','" . $efid . "',\n\t\t\t\t\t\t'" . htmlspecialchars($extra_fields[$efid]) . "')");
                 if (!$res) {
                     $this->setError('Artifact::updateExtraFields:: ' . db_error());
                     return false;
                 }
             }
         }
     }
     unset($this->extra_field_data);
     return true;
 }
Пример #22
0
    print "<p>" . _('Unix Group Name:') . " " . $row_grp['unix_group_name'] . "</p>";
    print "<p>" . _('Submitted Description:') . "</p><blockquote>" . $row_grp['register_purpose'] . "</blockquote>";
    if ($row_grp['license'] == "other") {
        print "<p>" . _('License Other:') . "</p><blockquote>" . $row_grp['license_other'] . "</blockquote>";
    }
    if (isset($row_grp['status_comment'])) {
        print "<p>" . _('Pending reason:') . "</p><span class=\"important\">" . $row_grp['status_comment'] . "</span>";
    }
    $res = db_query("SELECT u.user_id\n\t\t\t FROM users u, user_group ug\n\t\t\t WHERE ug.group_id='" . $row_grp['group_id'] . "' AND u.user_id=ug.user_id;");
    if (db_numrows($res) >= 1) {
        $submitter =& user_get_object(db_result($res, 0, 'user_id'));
        echo '<p>' . sprintf(_('Submitted by %1$s (%2$s)'), $submitter->getRealName(), $submitter->getUnixName()) . '</p>';
    }
    echo "<p>&nbsp;</p><hr /><p>&nbsp;</p>";
}
//list of group_id's of pending projects
$arr = util_result_column_to_array($res_grp, 0);
$group_list = implode($arr, ',');
echo '
	<div align="center">
	<form action="' . getStringFromServer('PHP_SELF') . '" method="post">
	<input type="hidden" name="action" value="activate" />
	<input type="hidden" name="list_of_groups" value="' . $group_list . '" />
	<input type="submit" name="submit" value="' . _('Approve All On This Page') . '" />
	</form></div>
	';
site_admin_footer(array());
// Local Variables:
// mode: php
// c-file-style: "bsd"
// End:
Пример #23
0
function commits_technician_box($projectname, $name = '_commiter', $checked = 'xzxz', $text_100 = 'None')
{
    global $Language;
    if (!$projectname) {
        return $Language->getText('cvs_commit_utils', 'error_nogid');
    } else {
        $result = commits_data_get_technicians($projectname);
        if (!in_array($checked, util_result_column_to_array($result))) {
            // Selected 'my commits' but never commited
            $checked = 'xzxz';
        }
        return html_build_select_box($result, $name, $checked, true, $text_100);
    }
}
Пример #24
0
 /**
  *	getAssignedTo - get an array of user_id's that you are assigned to.
  *
  *	@return	array	The array of user_id's.
  */
 function &getAssignedTo()
 {
     if (!$this->getID()) {
         $this->assignedto = array();
         return $this->assignedto;
     }
     if (!$this->assignedto) {
         $this->assignedto =& util_result_column_to_array(db_query("SELECT assigned_to_id \n\t\t\t\tFROM project_assigned_to \n\t\t\t\tWHERE project_task_id='" . $this->getID() . "'"));
     }
     return $this->assignedto;
 }
Пример #25
0
 /**
  * Return the user ids of registered users in the CC list
  *
  * @return array
  */
 function getCCIdList()
 {
     $sql = "SELECT u.user_id " . "FROM artifact_cc cc, user u " . "WHERE cc.email = u.user_name " . "AND cc.artifact_id=" . db_ei($this->getID());
     $res = db_query($sql);
     return util_result_column_to_array($res);
 }
Пример #26
0
 /**
  *  getMonitorIDs - Return an array of user_id's of the list of people monitoring this package.
  *
  *  @return	array	The array of user_id's.
  */
 function &getMonitorIDs()
 {
     $res = db_query("SELECT user_id\n\t\t\tFROM filemodule_monitor\n\t\t\tWHERE filemodule_id='" . $this->getID() . "'");
     return util_result_column_to_array($res);
 }
Пример #27
0
/**
 * stats_sf_stats() - Get SourceForge stats
 */
function stats_sf_stats()
{
    /*
    	pages/day
    */
    $sql = "SELECT * FROM stats_agg_pages_by_day";
    $result = db_query($sql);
    $rows = db_numrows($result);
    if (!$result || $rows < 1) {
        echo '<h1>Stats Problem</h1>';
        echo db_error();
    } else {
        $j = 0;
        for ($i = 0; $i < $rows; $i++) {
            //echo $i." - ".($i%7)."<br />";
            if ($i % 7 == 0) {
                //echo $i."<br />";
                //increment the new weekly array
                //and set the beginning date for this week
                $j++;
                $name_string[$j] = db_result($result, $i, 'day');
                $vals[$j] = 0;
            }
            //add today to the week
            $vals[$j] += db_result($result, $i, 'count');
        }
        $j++;
        $vals[$j] = '';
        $name_string[$j] = '';
        GraphIt($name_string, $vals, 'Page Views By Week');
    }
    echo '<p>&nbsp;</p>';
    /*
    	pages/hour
    * /
    	$sql="SELECT * FROM stats_agg_pages_by_hour";
    
    	$result = db_query ($sql);
    	$rows = db_numrows($result);
    
    	if (!$result || $rows < 1) {
    		echo '<h1>Stats Problem</h1>';
    		echo db_error();
    	} else {
    		GraphResult($result,'Page Views By Hour');
    	}
    	echo '<p>';
    */
    /*
    	Groups added by week
    */
    $sql = "select (round((register_time/604800),0)*604800) AS time ,count(*) from groups group by time";
    $result = db_query($sql);
    $rows = db_numrows($result);
    if (!$result || $rows < 1) {
        echo '<h1>Stats Problem</h1>';
        echo db_error();
    } else {
        $count = array();
        $dates = array();
        $count = util_result_column_to_array($result, 1);
        for ($i = 0; $i < $rows; $i++) {
            //convert the dates and add to an array
            $dates[$i] = date(_('Y-m-d H:i'), db_result($result, $i, 0));
        }
        GraphIt($dates, $count, 'New Projects Added Each Week');
    }
    echo '<p>&nbsp;</p>';
    /*
    	Users added by week
    */
    $sql = "select (round((add_date/604800),0)*604800) AS time ,count(*) from users group by time";
    $result = db_query($sql);
    $rows = db_numrows($result);
    if (!$result || $rows < 1) {
        echo '<h1>Stats Problem</h1>';
        echo db_error();
    } else {
        $count = array();
        $dates = array();
        $count = util_result_column_to_array($result, 1);
        for ($i = 0; $i < $rows; $i++) {
            //convert the dates and add to an array
            $dates[$i] = date(_('Y-m-d H:i'), db_result($result, $i, 0));
        }
        GraphIt($dates, $count, 'New Users Added Each Week');
    }
    echo '<p>&nbsp;</p>';
}
Пример #28
0
    $datatype = 1;
}
if (!$start) {
    $start = time() - $days * 60 * 60 * 24;
    $formattedmonth = date('Ym', $start);
}
if (!$end) {
    $end = time();
} else {
    $end--;
}
$sql = "SELECT u.realname,sum(commits) AS count \n\t\tFROM stats_cvs_user scu, users u\n\t\tWHERE u.user_id=scu.user_id \n\t\tAND scu.month >= '{$formattedmonth}'\n\t\tAND group_id='{$group_id}'\n\t\tGROUP BY realname ORDER BY count DESC";
//echo $sql;
//exit;
$res = db_query($sql);
if (db_error()) {
    exit_error('Error', db_error());
}
// Create the graph. These two calls are always required
$graph = new PieGraph(640, 480, "auto");
//$graph->SetMargin(50,10,35,50);
$graph->title->Set("Commits By User (" . date('m/d/Y', $start) . "-" . date('m/d/Y', $end) . ")");
$graph->subtitle->Set($sys_name);
// Create the tracker open plot
report_pie_arr(util_result_column_to_array($res, 0), util_result_column_to_array($res, 1));
$p1 = new PiePlot3D($pie_vals);
$p1->ExplodeSlice(0);
$p1->SetLegends($pie_labels);
$graph->Add($p1);
// Display the graph
$graph->Stroke();
Пример #29
0
//  Set up this script to run as the site admin
//
$res = db_query("SELECT user_id FROM user_group WHERE admin_flags='A' AND group_id='1'");
if (!$res) {
    //echo db_error();
    exit(1);
}
if (db_numrows($res) == 0) {
    // There are no Admins yet, aborting without failing
    //echo "SUCCESS\n";
    exit(0);
}
$id = db_result($res, 0, 0);
session_set_new($id);
$res = db_query("SELECT group_id FROM groups WHERE status != 'P'");
$groups =& group_get_objects(util_result_column_to_array($res));
for ($g = 0; $g < count($groups); $g++) {
    //make group dirs
    $newdirlocation = $GLOBALS['sys_upload_dir'] . '/' . $groups[$g]->getUnixName();
    $cmd = "/bin/mkdir {$newdirlocation}";
    //echo "\n$cmd";
    if (!is_dir($newdirlocation)) {
        exec($cmd, $out);
    }
    $frsps =& get_frs_packages($groups[$g]);
    //echo count($frsps);
    for ($p = 0; $p < count($frsps); $p++) {
        if (!is_object($frsps[$p])) {
            continue;
        }
        //make package dirs
Пример #30
0
if (db_numrows($res) == 0) {
    // There are no Admins yet, aborting without failing
    echo "SUCCESS\n";
    exit(0);
}
$id = db_result($res, 0, 0);
session_set_new($id);
//
//	Clear out role settings in case this was run before
//
db_begin();
db_query("UPDATE user_group SET role_id=1");
db_query("DELETE FROM role_setting");
db_query("DELETE FROM role WHERE role_id>1");
$res = db_query("SELECT group_id FROM groups WHERE status != 'P'");
$arr = util_result_column_to_array($res);
for ($i = 0; $i < count($arr); $i++) {
    $g =& group_get_object($arr[$i]);
    //
    //
    //  Set Default Roles
    //
    //
    $role = new Role($g);
    $todo = array_keys($role->defaults);
    for ($c = 0; $c < count($todo); $c++) {
        $role = new Role($g);
        if (!$role->createDefault($todo[$c])) {
            echo $role->getErrorMessage();
            db_rollback();
            echo "Could Not Create Default Roles: " . $arr[$i];