public function __construct(Project $project, $count, $selected)
 {
     $this->label = util_unconvert_htmlspecialchars($project->getPublicName());
     $this->count = $count;
     $this->value = $project->getGroupId();
     $this->selected = $selected;
 }
 public function __construct(array $result)
 {
     $hp = Codendi_HTMLPurifier::instance();
     $this->project_name = util_unconvert_htmlspecialchars($result['group_name']);
     $this->project_unix_name = $result['unix_group_name'];
     $this->project_description = $hp->purify($result['short_description'], CODENDI_PURIFIER_BASIC, $result['group_id']);
 }
Esempio n. 3
0
 public function __construct(array $hit, Project $project)
 {
     $this->project_name = util_unconvert_htmlspecialchars($project->getPublicName());
     $this->has_highlight = !empty($this->highlight);
     $this->display_permissions = isset($hit['fields']['permissions']);
     if ($this->display_permissions) {
         $this->permissions = implode(', ', $hit['fields']['permissions']);
     }
 }
Esempio n. 4
0
 /**
  * getSummaryPageContent
  *
  * Return the text to display on the summary page
  * @return arr[title], arr[content]
  */
 function getSummaryPageContent()
 {
     $hp = Codendi_HTMLPurifier::instance();
     $user = UserManager::instance()->getCurrentUser();
     $ret = array('title' => $GLOBALS['Language']->getText('include_project_home', 'latest_file_releases'), 'content' => '');
     $packages = $this->_getPackagesForUser($user->getId());
     if (count($packages)) {
         $ret['content'] .= '
             <table cellspacing="1" cellpadding="5" width="100%" border="0">
                 <tr class="boxitem">
                     <td>
                         ' . $GLOBALS['Language']->getText('include_project_home', 'package') . '
                     </td>
                     <td>
                         ' . $GLOBALS['Language']->getText('include_project_home', 'version') . '
                     </td>
                     <td>
                         ' . $GLOBALS['Language']->getText('include_project_home', 'download') . '
                     </td>
                 </tr>
         ';
         require_once 'FileModuleMonitorFactory.class.php';
         $fmmf = new FileModuleMonitorFactory();
         foreach ($packages as $package) {
             // the icon is different whether the package is monitored or not
             if ($fmmf->isMonitoring($package['package_id'], $user, false)) {
                 $monitor_img = $GLOBALS['HTML']->getImage("ic/notification_stop.png", array('alt' => $GLOBALS['Language']->getText('include_project_home', 'stop_monitoring'), 'title' => $GLOBALS['Language']->getText('include_project_home', 'stop_monitoring')));
             } else {
                 $monitor_img = $GLOBALS['HTML']->getImage("ic/notification_start.png", array('alt' => $GLOBALS['Language']->getText('include_project_home', 'start_monitoring'), 'title' => $GLOBALS['Language']->getText('include_project_home', 'start_monitoring')));
             }
             $ret['content'] .= '
               <TR class="boxitem">
               <TD>
                 <B>' . $hp->purify(util_unconvert_htmlspecialchars($package['package_name']), CODENDI_PURIFIER_CONVERT_HTML) . '</B>&nbsp;
                 <a HREF="/file/filemodule_monitor.php?filemodule_id=' . $package['package_id'] . '&group_id=' . $this->getGroupId() . '">' . $monitor_img . '     
                 </a>
               </TD>';
             // Releases to display
             $ret['content'] .= '<TD>' . $hp->purify($package['release_name'], CODENDI_PURIFIER_CONVERT_HTML) . '&nbsp;<A href="/file/shownotes.php?group_id=' . $this->getGroupId() . '&release_id=' . $package['release_id'] . '">' . $GLOBALS['HTML']->getImage("ic/text.png", array('alt' => $GLOBALS['Language']->getText('include_project_home', 'release_notes'), 'title' => $GLOBALS['Language']->getText('include_project_home', 'release_notes'))) . ' 
               </TD>
               <TD><A HREF="/file/showfiles.php?group_id=' . $this->getGroupId() . '&release_id=' . $package['release_id'] . '">' . $GLOBALS['Language']->getText('include_project_home', 'download') . '</A></TD></TR>';
         }
         $ret['content'] .= '</table>';
     } else {
         $ret['content'] .= '<b>' . $GLOBALS['Language']->getText('include_project_home', 'no_files_released') . '</b>';
     }
     $ret['content'] .= '
         <div align="center">
             <a href="/file/showfiles.php?group_id=' . $this->getGroupId() . '">[' . $GLOBALS['Language']->getText('include_project_home', 'view_all_files') . ']</A>
         </div>
     ';
     return $ret;
 }
Esempio n. 5
0
 /**
  *   sendNotice - Notifies of document submissions
  */
 function sendNotice($new = true)
 {
     $BCC = $this->Group->getDocEmailAddress();
     if (strlen($BCC) > 0) {
         $subject = '[' . $this->Group->getPublicName() . '] New document - ' . $this->getName();
         $body = "Project: " . $this->Group->getPublicName() . "\n";
         $body .= "Group: " . $groupname . "\n";
         $body .= "Document title: " . $this->getName() . "\n";
         $body .= "Document description: " . util_unconvert_htmlspecialchars($this->getDescription()) . "\n";
         $body .= "Submitter: " . $this->getCreatorRealName() . " (" . $this->getCreatorUserName() . ") \n";
         $body .= "\n\n-------------------------------------------------------" . "\nFor more info, visit:" . "\n\n" . util_make_url('/docman/index.php?group_id=' . $this->Group->getID());
         util_send_message('', $subject, $body, '', $BCC);
     }
     return true;
 }
Esempio n. 6
0
 /**
  * Output the raw follow-up comment
  *
  * @param Integer $comment_id Id of the follow-up comment
  *
  * @return void
  */
 function displayFollowupComment($comment_id)
 {
     echo util_unconvert_htmlspecialchars($this->getFollowup($comment_id));
 }
Esempio n. 7
0
 /**
  * Format the comment text to a given format according to parameters
  *
  * @param Integer $groupId       Project id
  * @param Boolean $commentFormat $value's format
  * @param String  $value         Comment content
  * @param Boolean $output        Output format
  *
  * @return String
  */
 public function formatFollowUp($groupId, $commentFormat, $value, $output)
 {
     $commentText = '';
     if ($output == self::OUTPUT_EXPORT) {
         return util_unconvert_htmlspecialchars($value);
     } else {
         $hp = $this->getHTMLPurifier();
         if ($output == self::OUTPUT_MAIL_TEXT) {
             if ($commentFormat == self::FORMAT_HTML) {
                 $commentText = $hp->purify(util_unconvert_htmlspecialchars($value), CODENDI_PURIFIER_STRIP_HTML);
             } else {
                 $commentText = $value;
             }
             $commentText = util_unconvert_htmlspecialchars($commentText);
         } else {
             if ($commentFormat == self::FORMAT_HTML) {
                 $level = CODENDI_PURIFIER_LIGHT;
             } else {
                 $level = CODENDI_PURIFIER_BASIC;
             }
             $commentText = $hp->purify(util_unconvert_htmlspecialchars($value), $level, $groupId);
         }
         return $commentText;
     }
 }
Esempio n. 8
0
    if (permission_exist('DOCUMENT_READ', $docid)) {
        if (!permission_is_authorized('DOCUMENT_READ', $docid, user_getid(), $object_group_id)) {
            exit_error($Language->getText('global', 'perm_denied'), $Language->getText('global', 'error_perm_denied'));
        }
    } else {
        if (!permission_is_authorized('DOCGROUP_READ', $row['doc_group'], user_getid(), $object_group_id)) {
            exit_error($Language->getText('global', 'perm_denied'), $Language->getText('global', 'error_perm_denied'));
        }
    }
    if (user_isloggedin()) {
        //Insert a new entry in the doc_log table only for restricted documents
        $sql = "INSERT INTO doc_log(user_id,docid,time) " . "VALUES ('" . user_getid() . "','" . $docid . "','" . time() . "')";
        $res_insert = db_query($sql);
    }
    // HTML or text files that were copy/pasted are displayed in a Codendi-formatted page.
    // Uploaded files are always displayed as-is.
    if (($row['filetype'] == 'text/html' || $row['filetype'] == 'text/plain') && $row['filesize'] == 0) {
        docman_header(array('title' => $row['title'], 'help' => 'DocumentManager.html'));
        if ($object_group_id != $from_group_id) {
            $group_name = util_get_group_name_from_id($object_group_id);
            print '<H3><span class="feedback">' . $Language->getText('docman_display_doc', 'warning_different_group', array($group_name)) . '</span></H3>';
        }
        // Document data can now contain HTML tags but not php code
        print util_unconvert_htmlspecialchars($row['data']);
        docman_footer($params);
    } else {
        session_redirect("/docman/download.php?docid=" . $docid);
    }
} else {
    exit_error($Language->getText('global', 'error'), $Language->getText('docman_display_doc', 'error_wrongid'));
}
Esempio n. 9
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());
}
Esempio n. 10
0
 /**
  * Retrieves the converted HTML special characters
  *
  * @param String $name
  *
  * @return String
  */
 function unconvertHTMLSpecialChars($name)
 {
     return util_unconvert_htmlspecialchars($this->convertName($name));
 }
 public function __construct(Project $project)
 {
     $this->project_name = util_unconvert_htmlspecialchars($project->getPublicName());
     $this->project_uri = '/projects/' . $project->getUnixName();
 }
Esempio n. 12
0
    $ydata2[$i] = 0;
    $i = 1;
    $xdata[$i] = $i;
    $xlabel[$i] = $month . "-" . $day + 1;
    $ydata1[$i] = 0;
    $ydata2[$i] = 0;
    $i = 2;
}
$graph = new Graph(600, 350);
$graph->addDebug("We appended {$i} rows of data to the graphing set.");
$graph->addDebug("{$begin_time}");
$graph->addDebug("{$sql}");
$data1 = $graph->AddData($xdata, $ydata1, $xlabel);
$data2 = $graph->AddData($xdata, $ydata2, $xlabel);
$graph->DrawGrid('gray');
$graph->LineGraph($data1, 'red');
$graph->LineGraph($data2, 'blue');
$pm = ProjectManager::instance();
$graph->SetTitle("Codendi Statistics: " . util_unconvert_htmlspecialchars($pm->getProject($group_id)->getPublicName()));
$graph->SetSubTitle("Page Views (red) and Downloads (blue) for the past {$i} days");
$graph->SetxTitle('Date');
$graph->SetyTitle('Views (red) / Downloads (blue)');
$graph->DrawAxis();
//$graph->showDebug();
// If PHP3 then assume GD library < 1.6 with only GIF Support
// if PHP4 then we have GD library >= 1.6 with only PNG Support
if (substr(phpversion(), 0, 1) == "3") {
    $graph->ShowGraph('gif');
} else {
    $graph->ShowGraph('png');
}
Esempio n. 13
0
 public function getUnconvertedPublicName()
 {
     return util_unconvert_htmlspecialchars($this->data_array['group_name']);
 }
 function _set_doesnot_belong_to_project_error($item, $group)
 {
     $this->feedback->log('warning', $GLOBALS['Language']->getText('plugin_docman', 'item_does_not_belong', array($item->getId(), util_unconvert_htmlspecialchars($group->getPublicName()))));
     $this->_viewParams['redirect_to'] = str_replace('group_id=' . $this->request->get('group_id'), 'group_id=' . $item->getGroupId(), $_SERVER['REQUEST_URI']);
     $this->view = 'Redirect';
 }
 public function projectName()
 {
     return util_unconvert_htmlspecialchars($this->project_name);
 }
Esempio n. 16
0
 /**
  *
  *
  */
 function displayCreateTrackerFromTemplate($requested_create_mode, Project $project, Tracker $tracker_template = null)
 {
     $hp = Codendi_HTMLPurifier::instance();
     $GLOBALS['Response']->includeFooterJavascriptFile(TRACKER_BASE_URL . '/scripts/TrackerTemplateSelector.js');
     $GLOBALS['Response']->includeFooterJavascriptFile(TRACKER_BASE_URL . '/scripts/TrackerCheckUgroupConsistency.js');
     $js = '';
     $trackers = $this->getTrackerFactory()->getTrackersByGroupId(100);
     foreach ($trackers as $tracker) {
         $js .= '<option value="' . $tracker->getId() . '">' . $hp->purify($tracker->getName()) . '</option>';
     }
     $js = "codendi.tracker.defaultTemplates = '" . $hp->purify($js, CODENDI_PURIFIER_JS_QUOTE) . "';";
     $GLOBALS['Response']->includeFooterJavascriptSnippet($js);
     $gf = new GroupFactory();
     $radio = $this->getCreateTrackerRadio('gallery', $requested_create_mode);
     echo '<h3><label>' . $radio . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'from_tmpl') . '</label></h3>';
     //
     echo '<div class="tracker_create_mode">';
     echo '<noscript>Project Id: <input type="text" name="group_id_template" value=""><br/>Tracker Id: <input type="text" name="atid_template" value=""></noscript>';
     echo '<table>';
     echo '<tr>';
     echo '<th align="left">' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'tmpl_src_prj') . '</th>';
     echo '<th align="left">' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'tmpl_src_trk') . '</th>';
     echo '</tr>';
     echo '<tr>';
     echo '<td valign="top">';
     $group_id_template = 100;
     $atid_template = -1;
     if ($tracker_template) {
         $group_id_template = $tracker_template->getProject()->getID();
         $atid_template = $tracker_template->getId();
     }
     $selectedHtml = 'selected="selected"';
     echo '<select name="group_id_template" size="15" id="tracker_new_project_list" autocomplete="off">';
     echo '<option value="100" ' . ($group_id_template == 100 ? $selectedHtml : '') . '>' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'tmpl_src_prj_default') . '</option>';
     echo '<optgroup label="' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'tmpl_src_prj_my') . '">';
     $project_selected = false;
     $results = $gf->getMemberGroups();
     while ($row = db_fetch_array($results)) {
         $selected = '';
         if ($group_id_template == $row['group_id']) {
             $selected = $selectedHtml;
             $project_selected = true;
         }
         echo '<option value="' . $hp->purify($row['group_id']) . '" ' . ($group_id_template == $row['group_id'] ? $selectedHtml : '') . '>' . $hp->purify(util_unconvert_htmlspecialchars($row['group_name'])) . '</option>';
     }
     echo '</optgroup>';
     $hide = 'style="display:none;"';
     $other = '';
     if ($tracker_template && !$project_selected) {
         $hide = '';
         $other .= '<option value="' . (int) $tracker_template->getProject()->getID() . '" ' . $selectedHtml . '>';
         $other .= $hp->purify(util_unconvert_htmlspecialchars($tracker_template->getProject()->getPublicName()), CODENDI_PURIFIER_CONVERT_HTML);
         $other .= '</option>';
     }
     echo '<optgroup id="tracker_new_other" ' . $hide . ' label="' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'tmpl_src_prj_other') . '">';
     echo $other;
     echo '</optgroup>';
     echo '</select>';
     echo '<br/>' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'tmpl_src_autocomplete_desc') . '<br /><input type="text" name="tracker_new_prjname" id="tracker_new_prjname" placeholder="' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'tmpl_src_autocomplete_hint') . '" />';
     echo '</td>';
     echo '<td valign="top">';
     echo '<select name="atid_template" size="15" id="tracker_list_trackers_from_project">';
     $trackers = $this->getTrackerFactory()->getTrackersByGroupId($group_id_template);
     if (count($trackers) > 0) {
         foreach ($trackers as $tracker) {
             echo '<option value="' . $tracker->getId() . '" ' . ($atid_template == $tracker->getId() ? $selectedHtml : '') . '>' . $hp->purify($tracker->getName()) . '</option>';
         }
     } else {
         echo '<option>' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'tmpl_src_no_trk') . '</option>';
     }
     echo '</select>';
     echo '</td>';
     echo '</tr>';
     echo '</table>';
     echo '</div>';
 }
Esempio n. 17
0
        $no_rows = 1;
        echo '<H2>' . $Language->getText('search_index', 'no_match_found', htmlentities(stripslashes($words), ENT_QUOTES, 'UTF-8')) . '</H2>';
        echo db_error();
        //		echo $sql;
    } else {
        if ($rows_returned > 25) {
            $rows = 25;
        }
        echo '<H3>' . $Language->getText('search_index', 'search_res', array(htmlentities(stripslashes($words), ENT_QUOTES, 'UTF-8'), $rows_returned)) . "</H3><P>\n\n";
        $title_arr = array();
        $title_arr[] = $Language->getText('search_index', 'project_name');
        $title_arr[] = $Language->getText('search_index', 'description');
        echo html_build_list_table_top($title_arr);
        echo "\n";
        for ($i = 0; $i < $rows; $i++) {
            print "<TR class=\"" . html_get_alt_row_color($i) . "\"><TD><A HREF=\"/projects/" . db_result($result, $i, 'unix_group_name') . "/\">" . "<IMG SRC=\"" . util_get_image_theme('msg.png') . "\" BORDER=0 HEIGHT=12 WIDTH=10> " . db_result($result, $i, 'group_name') . "</A></TD>" . "<TD>" . $hp->purify(util_unconvert_htmlspecialchars(db_result($result, $i, 'short_description')), CODENDI_PURIFIER_LIGHT) . "</TD></TR>\n";
        }
        echo "</TABLE>\n";
    }
} else {
    if ($type_of_search == "people") {
        /*
        	If multiple words, separate them and put LIKE in between
        */
        $array = explode(" ", $words);
        $words1 = implode($array, "%' {$crit} user_name LIKE '%");
        $words2 = implode($array, "%' {$crit} realname LIKE '%");
        /*
        	Query to find users
        */
        $sql = "SELECT user_name,user_id,realname " . "FROM user " . "WHERE ((user_name LIKE '%{$words1}%') OR (realname LIKE '%{$words2}%')) AND ((status='A') OR (status='R')) ORDER BY user_name LIMIT {$offset},26";
Esempio n. 18
0
 /**
  *	mailFollowup - send out an email update for this artifact.
  *
  *	@param	int		(1) initial/creation (2) update.
  *	@param	array	Array of additional addresses to mail to.
  *	@param	array	Array of fields changed in this update .
  *	@access private.
  *	@return	boolean	success.
  */
 function mailFollowup($type, $more_addresses = false, $changes = '')
 {
     if (!$changes) {
         $changes = array();
     }
     $sess = session_get_user();
     if ($type == 1) {
         // Initial opening
         if ($sess) {
             $body = $this->ArtifactType->getName() . " item #" . $this->getID() . ", was opened at " . date(_('Y-m-d H:i'), $this->getOpenDate()) . " by " . $sess->getRealName();
         } else {
             $body = $this->ArtifactType->getName() . " item #" . $this->getID() . ", was opened at " . date(_('Y-m-d H:i'), $this->getOpenDate());
         }
     } else {
         if ($sess) {
             $body = $this->ArtifactType->getName() . " item #" . $this->getID() . ", was changed at " . date(_('Y-m-d H:i'), $this->getOpenDate()) . " by " . $sess->getRealName();
         } else {
             $body = $this->ArtifactType->getName() . " item #" . $this->getID() . ", was changed at " . date(_('Y-m-d H:i'), $this->getOpenDate());
         }
     }
     $body .= "\nYou can respond by visiting: " . "\n" . util_make_url('/tracker/?func=detail&atid=' . $this->ArtifactType->getID() . "&aid=" . $this->getID() . "&group_id=" . $this->ArtifactType->Group->getID()) . "\nOr by replying to this e-mail entering your response between the following markers: " . "\n" . ARTIFACT_MAIL_MARKER . "\n(enter your response here)" . "\n" . ARTIFACT_MAIL_MARKER . "\n\n" . $this->marker('status', $changes) . "Status: " . $this->getStatusName() . "\n" . $this->marker('priority', $changes) . "Priority: " . $this->getPriority() . "\n" . "Submitted By: " . $this->getSubmittedRealName() . " (" . $this->getSubmittedUnixName() . ")" . "\n" . $this->marker('assigned_to', $changes) . "Assigned to: " . $this->getAssignedRealName() . " (" . $this->getAssignedUnixName() . ")" . "\n" . $this->marker('summary', $changes) . "Summary: " . util_unconvert_htmlspecialchars($this->getSummary()) . " \n";
     // Now display the extra fields
     $efd = $this->getExtraFieldDataText();
     foreach ($efd as $efid => $ef) {
         $body .= $this->marker('extra_fields', $changes, $efid);
         $body .= $ef["name"] . ": " . $ef["value"] . "\n";
     }
     $subject = '[' . $this->ArtifactType->Group->getUnixName() . '-' . $this->ArtifactType->getName() . '][' . $this->getID() . '] ' . util_unconvert_htmlspecialchars($this->getSummary());
     if ($type > 1) {
         // get all the email addresses that are monitoring this request or the ArtifactType
         $monitor_ids =& $this->getMonitorIds();
     } else {
         // initial creation, we just get the users monitoring the ArtifactType
         $monitor_ids =& $this->ArtifactType->getMonitorIds();
     }
     $emails = array();
     if ($more_addresses) {
         $emails[] = $more_addresses;
     }
     //we don't email the current user
     if ($this->getAssignedTo() != user_getid()) {
         $monitor_ids[] = $this->getAssignedTo();
     }
     if ($this->getSubmittedBy() != user_getid()) {
         $monitor_ids[] = $this->getSubmittedBy();
     }
     //initial submission
     if ($type == 1) {
         //if an email is set for this ArtifactType
         //add that address to the BCC: list
         if ($this->ArtifactType->getEmailAddress()) {
             $emails[] = $this->ArtifactType->getEmailAddress();
         }
     } else {
         //update
         if ($this->ArtifactType->emailAll()) {
             $emails[] = $this->ArtifactType->getEmailAddress();
         }
     }
     $body .= "\n\nInitial Comment:" . "\n" . util_unconvert_htmlspecialchars($this->getDetails()) . "\n\n----------------------------------------------------------------------";
     if ($type > 1) {
         /*
         	Now include the followups
         */
         $result2 = $this->getMessages();
         $rows = db_numrows($result2);
         if ($result2 && $rows > 0) {
             for ($i = 0; $i < $rows; $i++) {
                 //
                 //	for messages posted by non-logged-in users,
                 //	we grab the email they gave us
                 //
                 //	otherwise we use the confirmed one from the users table
                 //
                 if (db_result($result2, $i, 'user_id') == 100) {
                     $emails[] = db_result($result2, $i, 'from_email');
                 } else {
                     $monitor_ids[] = db_result($result2, $i, 'user_id');
                 }
                 $body .= "\n\n";
                 if ($i == 0) {
                     $body .= $this->marker('details', $changes);
                 }
                 $body .= "Comment By: " . db_result($result2, $i, 'realname') . " (" . db_result($result2, $i, 'user_name') . ")" . "\nDate: " . date(_('Y-m-d H:i'), db_result($result2, $i, 'adddate')) . "\n\nMessage:" . "\n" . util_unconvert_htmlspecialchars(db_result($result2, $i, 'body')) . "\n\n----------------------------------------------------------------------";
             }
         }
     }
     $body .= "\n\nYou can respond by visiting: " . "\n" . util_make_url('/tracker/?func=detail&atid=' . $this->ArtifactType->getID() . "&aid=" . $this->getID() . "&group_id=" . $this->ArtifactType->Group->getID());
     //only send if some recipients were found
     if (count($emails) < 1 && count($monitor_ids) < 1) {
         return true;
     }
     if (count($monitor_ids) < 1) {
         $monitor_ids = array();
     } else {
         $monitor_ids = array_unique($monitor_ids);
     }
     $from = $this->ArtifactType->getReturnEmailAddress();
     $extra_headers = 'Reply-to: ' . $from;
     // load the e-mail addresses of the users
     $users =& user_get_objects($monitor_ids);
     if (count($users) > 0) {
         foreach ($users as $user) {
             if ($user->getStatus() == "A") {
                 //we are only sending emails to active users
                 $emails[] = $user->getEmail();
             }
         }
     }
     //		print($body);
     //now remove all duplicates from the email list
     if (count($emails) > 0) {
         $BCC = implode(',', array_unique($emails));
         util_send_message('', $subject, $body, $from, $BCC, '', $extra_headers);
     }
     //util_handle_message($monitor_ids,$subject,$body,$BCC);
     return true;
 }
Esempio n. 19
0
function prepare_textarea($textarea)
{
    // Turn all HTML entities in ASCII and remove all \r characters
    // because even MS Office apps don't like it in text cells (Excel)
    return str_replace(chr(13), "", util_unconvert_htmlspecialchars($textarea));
}
Esempio n. 20
0
 public function project_backlog()
 {
     return $GLOBALS['Language']->getText('plugin_agiledashboard', 'project_backlog', util_unconvert_htmlspecialchars($this->project_name));
 }
Esempio n. 21
0
 /**
  * package_to_soap : return the soap FRSPackage structure giving a PHP FRSPackage Object.
  * @access private
  * 
  * WARNING : We check the permissions here : only the readable packages are returned.
  *
  * @param Object{FRSPackage} $package the package to convert.
  * @return array the SOAPFRSPackage corresponding to the FRSPackage Object
  */
 function package_to_soap($package)
 {
     $return = null;
     if ($package->isError()) {
         //skip if error
     } else {
         // check if current user is allowed to see this package
         if ($package->userCanRead()) {
             $return = array('package_id' => $package->getPackageID(), 'group_id' => $package->getGroupID(), 'name' => util_unconvert_htmlspecialchars($package->getName()), 'status_id' => $package->getStatusID(), 'rank' => $package->getRank(), 'approve_license' => $package->getApproveLicense());
         }
     }
     return $return;
 }
Esempio n. 22
0
    }
    $html .= '</table>';
    return $html;
}
// Check if group_id is valid
$vGroupId = new Valid_GroupId();
$vGroupId->required();
if ($request->valid($vGroupId)) {
    $group_id = $request->get('group_id');
} else {
    exit_no_group();
}
$currentproject = new project($group_id);
site_project_header(array('title' => $Language->getText('project_showdetails', 'proj_details'), 'group' => $group_id, 'toptab' => 'summary'));
print '<P><h3>' . $Language->getText('project_showdetails', 'proj_details') . '</h3>';
// Now fetch the project details
$result = db_query("SELECT license_other " . "FROM groups " . "WHERE group_id=" . db_ei($group_id));
if (!$result || db_numrows($result) < 1) {
    echo db_error();
    exit_error($Language->getText('project_showdetails', 'proj_not_found'), $Language->getText('project_showdetails', 'no_detail'));
}
$license_other = db_result($result, 0, 'license_other');
$currentproject->displayProjectsDescFieldsValue();
if ($license_other != '') {
    print '<P>';
    print '<b><u>' . $Language->getText('project_admin_editgroupinfo', 'license_comment') . '</u></b>';
    print '<P>' . $hp->purify(util_unconvert_htmlspecialchars($license_other), CODENDI_PURIFIER_BASIC, $group_id);
}
echo getReferencesTable($group_id);
print '<P><a href="/project/?group_id=' . $group_id . '"> ' . $Language->getText('project_showdetails', 'back_main') . ' </a>';
site_project_footer(array());
 private function getSearchPresenter(Search_SearchQuery $query, $results)
 {
     $project_search_types = array();
     $site_search_types = array();
     $additional_search_tabs = array();
     $redirect_to_services = true;
     $this->event_manager->processEvent(Event::SEARCH_TYPES_PRESENTERS, array('project' => $query->getProject(), 'words' => $query->getWords(), 'project_presenters' => &$project_search_types, 'site_presenters' => &$site_search_types, 'redirect_to_services' => &$redirect_to_services));
     $additional_project_search_types = $this->getAdditionnalProjectWidePresentersIfNeeded($query->getProject(), $query->getWords(), $redirect_to_services);
     $project_search_types = array_merge($additional_project_search_types, $project_search_types);
     $search_panes = array();
     if (!$query->getProject()->isError()) {
         $project_name = util_unconvert_htmlspecialchars($query->getProject()->getPublicName());
         $search_panes[] = new Search_SearchPanePresenter($GLOBALS['Language']->getText('search_index', 'project_wide_search', $project_name), $project_search_types, $GLOBALS['Language']->getText('search_index', 'no_searchable_services'));
     }
     $search_panes[] = $this->getSiteWidePane($site_search_types);
     $this->event_manager->processEvent(Event::FETCH_ADDITIONAL_SEARCH_TABS, array('additional_search_tabs' => &$additional_search_tabs));
     return new Search_Presenter_SearchPresenter($query->getTypeOfSearch(), $query->getWords(), $results, $search_panes, $additional_search_tabs, $query->getProject());
 }
 public function isValueEqual($history_field_value, $field_value)
 {
     return $history_field_value == util_unconvert_htmlspecialchars($field_value);
 }
Esempio n. 25
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;
 }
Esempio n. 26
0
 function _getProjectTabs($toptab, &$project)
 {
     global $sys_default_domain;
     $pm = ProjectManager::instance();
     $tabs = array();
     $group_id = $project->getGroupId();
     $user = UserManager::instance()->getCurrentUser();
     if ($this->restrictedMemberIsNotProjectMember($user, $group_id)) {
         $allowed_services = array('summary');
         $this->getEventManager()->processEvent(Event::GET_SERVICES_ALLOWED_FOR_RESTRICTED, array('allowed_services' => &$allowed_services));
     }
     foreach ($project->getServicesData() as $short_name => $service_data) {
         if ((string) $short_name == "admin") {
             // for the admin service, we will check if the user is allowed to use the service
             // it means : 1) to be a super user, or
             //            2) to be project admin
             if (!user_is_super_user()) {
                 if (!user_isloggedin()) {
                     continue;
                     // we don't include the service in the $tabs
                 } else {
                     if (!user_ismember($group_id, 'A')) {
                         continue;
                         // we don't include the service in the $tabs
                     }
                 }
             }
         }
         $permissions_overrider = PermissionsOverrider_PermissionsOverriderManager::instance();
         if (!$this->isProjectSuperPublic($group_id) && $this->restrictedMemberIsNotProjectMember($user, $group_id) && !$permissions_overrider->doesOverriderAllowUserToAccessProject($user, $project)) {
             if (!in_array($short_name, $allowed_services)) {
                 continue;
             }
         }
         if (!$service_data['is_used']) {
             continue;
         }
         if (!$service_data['is_active']) {
             continue;
         }
         $hp = Codendi_HTMLPurifier::instance();
         // Get URL, and eval variables
         //$project->services[$short_name]->getUrl(); <- to use when service will be fully served by satellite
         if ($service_data['is_in_iframe']) {
             $link = '/service/?group_id=' . $group_id . '&amp;id=' . $service_data['service_id'];
         } else {
             $link = $hp->purify($service_data['link']);
         }
         if ($group_id == 100) {
             if (strstr($link, '$projectname')) {
                 // NOTE: if you change link variables here, change them also in src/common/project/RegisterProjectStep_Confirmation.class.php and src/www/project/admin/servicebar.php
                 // Don't check project name if not needed.
                 // When it is done here, the service bar will not appear updated on the current page
                 $link = str_replace('$projectname', $pm->getProject($group_id)->getUnixName(), $link);
             }
             $link = str_replace('$sys_default_domain', $GLOBALS['sys_default_domain'], $link);
             if ($GLOBALS['sys_force_ssl']) {
                 $sys_default_protocol = 'https';
             } else {
                 $sys_default_protocol = 'http';
             }
             $link = str_replace('$sys_default_protocol', $sys_default_protocol, $link);
             $link = str_replace('$group_id', $group_id, $link);
         }
         $enabled = is_numeric($toptab) && $toptab == $service_data['service_id'] || $short_name && $toptab == $short_name;
         if ($short_name == 'summary') {
             $label = '<span>';
             if (ForgeConfig::get('sys_display_project_privacy_in_service_bar')) {
                 // Add a default tab to explain project privacy
                 if ($project->isPublic()) {
                     $privacy = 'public';
                 } else {
                     $privacy = 'private';
                 }
                 $privacy_text = $GLOBALS['Language']->getText('project_privacy', 'tooltip_' . $this->getProjectPrivacy($project));
                 $label .= '<span class="project-title-container project_privacy_' . $privacy . '" data-content="' . $privacy_text . '" data-placement="bottom">[';
                 $label .= $GLOBALS['Language']->getText('project_privacy', $privacy);
                 $label .= ']</span>';
                 $label .= '&nbsp;';
             }
             $label .= $hp->purify(util_unconvert_htmlspecialchars($project->getPublicName()), CODENDI_PURIFIER_CONVERT_HTML) . '&nbsp;&raquo;</span>';
         } else {
             $label = '<span title="' . $hp->purify($service_data['description']) . '">';
             $label .= $hp->purify($service_data['label']) . '</span>';
         }
         $name = $hp->purify($service_data['label']);
         $icon = $this->getServiceIcon($short_name);
         if (isset($service_data['icon'])) {
             $icon = $service_data['icon'];
         }
         $tabs[] = array('link' => $link, 'icon' => $icon, 'name' => $name, 'label' => $label, 'enabled' => $enabled, 'description' => $hp->purify($service_data['description']), 'id' => $hp->purify('sidebar-' . $short_name));
     }
     return $tabs;
 }
Esempio n. 27
0
    if ($svn_service) {
        $truncated_mails_impacted_services[] = $svn_service->getInternationalizedName();
    }
    $presenter = new ProjectTruncatedEmailsPresenter($currentproject, $truncated_mails_impacted_services);
    echo $renderer->renderToString('truncated_emails', $presenter);
}
print "<P><h3>" . $Language->getText('project_admin_editgroupinfo', 'editing_g_info_for', $row_grp['group_name']) . '</h3>';
$hp = Codendi_HTMLPurifier::instance();
print '
<P>
<P>' . $Language->getText('project_admin_editgroupinfo', 'descriptive_g_name') . '<font color="red">*</font>
<BR><INPUT type="text" size="50" maxlen="40" name="form_group_name" value="' . $hp->purify(util_unconvert_htmlspecialchars($row_grp['group_name']), CODENDI_PURIFIER_CONVERT_HTML) . '">

<P>' . $Language->getText('project_admin_editgroupinfo', 'short_desc') . '<font color="red">*</font>
<BR><TEXTAREA cols="70" rows="3" wrap="virtual" name="form_shortdesc">
' . $hp->purify(util_unconvert_htmlspecialchars($row_grp['short_description']), CODENDI_PURIFIER_CONVERT_HTML) . '</TEXTAREA>';
$displayfieldvalue = array();
for ($i = 0; $i < sizeof($descfieldsinfos); $i++) {
    for ($j = 0; $j < sizeof($descfieldsvalue); $j++) {
        if ($descfieldsvalue[$j]['group_desc_id'] == $descfieldsinfos[$i]['group_desc_id']) {
            $displayfieldvalue[$i] = $descfieldsvalue[$j]['value'];
        }
    }
    $descname = $descfieldsinfos[$i]["desc_name"];
    if (preg_match('/(.*):(.*)/', $descname, $matches)) {
        if ($Language->hasText($matches[1], $matches[2])) {
            $descname = $Language->getText($matches[1], $matches[2]);
        }
    }
    echo "<P><u>" . $hp->purify($descname, CODENDI_PURIFIER_LIGHT, $group_id);
    if ($descfieldsinfos[$i]["desc_required"] == 1) {
 public function process()
 {
     $request = $this->getRequest();
     // Grant access only to site admin
     if (!$request->getCurrentUser()->isSuperUser()) {
         header('Location: ' . get_server_url());
     }
     $project_name_from_autocomplete = $request->get('fts_project');
     $project_manager = $this->getProjectManager();
     $project = $project_manager->getProjectFromAutocompleter($project_name_from_autocomplete);
     if ($project) {
         $this->reindexAll($project->getId());
         $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_fulltextsearch', 'waiting_for_reindexation', array(util_unconvert_htmlspecialchars($project->getPublicName()))));
     }
     $this->redirectToIndex();
 }
Esempio n. 29
0
    /**
     * Display the artifact dependencies list for all artifacts in change_ids 
     *
     * @param change_ids: the artifacts for that we search dependencies
     * @return string
     */
    function showDependencies($change_ids)
    {
        global $Language;
        $hp = Codendi_HTMLPurifier::instance();
        $result = $this->getDependencies($change_ids);
        $rows = db_numrows($result);
        $out = '';
        // Nobody in the dependencies list -> return now
        if ($rows > 0) {
            $title_arr = array();
            $title_arr[] = $Language->getText('tracker_include_artifact', 'artifact');
            $title_arr[] = $Language->getText('tracker_include_artifact', 'summary');
            $title_arr[] = $Language->getText('tracker_import_admin', 'tracker');
            $title_arr[] = $Language->getText('tracker_include_artifact', 'group');
            $title_arr[] = $Language->getText('tracker_include_type', 'occurrence');
            $title_arr[] = $Language->getText('tracker_include_canned', 'delete');
            $out .= html_build_list_table_top($title_arr);
            $fmt = "\n" . '<TR class="%s"><td>%s</td><td>%s</td><td align="center">%s</td>' . '<td align="center">%s</td><td align="center">%s</td><td align="center">%s</td></tr>';
            // Loop through the denpendencies and format them
            $occ = 0;
            $dependent_on_artifact_id = -1;
            $row_color = 0;
            for ($i = 0; $i < $rows; $i++) {
                if ($dependent_on_artifact_id != db_result($result, $i, 'is_dependent_on_artifact_id')) {
                    if ($dependent_on_artifact_id != -1) {
                        $html_delete = '
	<INPUT TYPE="CHECKBOX" NAME="delete_depend[]" VALUE="' . $hp->purify($depend_ids, CODENDI_PURIFIER_CONVERT_HTML) . '">';
                        $out .= sprintf($fmt, util_get_alt_row_color($row_color), '<a href="/tracker/?func=gotoid&group_id=' . (int) $group_id . '&aid=' . (int) $dependent_on_artifact_id . '">' . $hp->purify($dependent_on_artifact_id, CODENDI_PURIFIER_CONVERT_HTML) . "</a>", $hp->purify(util_unconvert_htmlspecialchars($summary), CODENDI_PURIFIER_BASIC, $this->getGroupId()), $hp->purify($tracker_label, CODENDI_PURIFIER_CONVERT_HTML), $hp->purify($group_label, CODENDI_PURIFIER_CONVERT_HTML), $occ, $html_delete);
                        $row_color++;
                        $occ = 0;
                    }
                    $dependent_on_artifact_id = db_result($result, $i, 'is_dependent_on_artifact_id');
                    $summary = db_result($result, $i, 'summary');
                    $tracker_label = db_result($result, $i, 'name');
                    $group_label = db_result($result, $i, 'group_name');
                    $group_id = db_result($result, $i, 'group_id');
                    $depend_ids = db_result($result, $i, 'artifact_depend_id');
                } else {
                    $depend_ids .= "," . db_result($result, $i, 'artifact_depend_id');
                }
                $occ++;
            }
            // for
            $html_delete = '
	<INPUT TYPE="CHECKBOX" NAME="delete_depend[]" VALUE="' . $depend_ids . '">';
            $out .= sprintf($fmt, util_get_alt_row_color($row_color), '<a href="/tracker/?func=gotoid&group_id=' . (int) $group_id . '&aid=' . (int) $dependent_on_artifact_id . '">' . $hp->purify($dependent_on_artifact_id, CODENDI_PURIFIER_CONVERT_HTML) . "</a>", $hp->purify(util_unconvert_htmlspecialchars($summary), CODENDI_PURIFIER_BASIC, $this->getGroupId()), $hp->purify($tracker_label, CODENDI_PURIFIER_CONVERT_HTML), $hp->purify($group_label, CODENDI_PURIFIER_CONVERT_HTML), $occ, $html_delete);
            // final touch...
            $out .= "</TABLE>";
        }
        return $out;
    }
#! /usr/bin/php5 -f
<?php 
require $gfwww . 'include/squal_pre.php';
db_begin();
$rel = db_query("SELECT id,bin_data FROM artifact_file ORDER BY id ASC;");
echo db_error();
$rows = db_numrows($rel);
for ($i = 0; $i < $rows; $i++) {
    $res = db_query("UPDATE artifact_file \n\t\tSET bin_data='" . base64_encode(util_unconvert_htmlspecialchars(db_result($rel, $i, 'bin_data'))) . "' \n\t\tWHERE id='" . db_result($rel, $i, 'id') . "'");
    echo db_error();
    echo "<br />Num: {$i} | id: " . db_result($rel, $i, 'id');
}
db_commit();
if (db_error()) {
    echo db_error() . "\n";
} else {
    echo "SUCCESS\n";
}
db_query("vacuum analyze;");