Пример #1
0
    function showMessages()
    {
        $result = $this->getMessages();
        $rows = db_numrows($result);
        if ($rows > 0) {
            $title_arr = array();
            $title_arr[] = _('Message');
            echo $GLOBALS['HTML']->listTableTop($title_arr);
            for ($i = 0; $i < $rows; $i++) {
                echo '<tr ' . $GLOBALS['HTML']->boxGetAltRowStyle($i) . '><td><pre>
' . _('Date') . ': ' . date(_('Y-m-d H:i'), db_result($result, $i, 'adddate')) . '
' . _('Sender') . ': ';
                if (db_result($result, $i, 'user_id') == 100) {
                    echo db_result($result, $i, 'realname');
                } else {
                    echo util_make_link_u(db_result($result, $i, 'user_name'), db_result($result, $i, 'user_id'), db_result($result, $i, 'realname'));
                }
                echo "\n\n" . util_line_wrap(db_result($result, $i, 'body'), 65, "\n") . '</pre></td></tr>';
            }
            echo $GLOBALS['HTML']->listTableBottom();
        } else {
            echo '
				<h3>' . _('No Followups Have Been Posted') . '</h3>';
        }
    }
Пример #2
0
 /**
  *	sendNewModeratedMsgNotice - contains the logic to send out email notifications to the forum admins when a new moderated message is posted
  *
  *	@return boolean success.
  */
 function sendNewModeratedMsgNotice()
 {
     $ids =& $this->Forum->getForumAdminIDs();
     //
     //	See if there is anyone to send messages to
     //
     if (!count($ids) > 0 && !$this->Forum->getSendAllPostsTo()) {
         return true;
     }
     $f =& $this->getForum();
     $g =& $f->getGroup();
     $body = "\nRead to this message and approve/reject it at: " . "\n" . util_make_url('/forum/admin/pending.php?action=view_pending&group_id=' . $g->getID() . "&forum_id=" . $f->getID()) . "\nBy: " . $this->getPosterRealName() . "\n\n";
     $text = $this->getBody();
     $sanitizer = new TextSanitizer();
     $text = $sanitizer->convertNeededTagsForEmail($text);
     $text = strip_tags($this->removebbcode(util_line_wrap($text)));
     $text = $sanitizer->convertExtendedCharsForEmail($text);
     $body .= $text . "\n\n______________________________________________________________________" . "\nYou are receiving this email because the forum you administrate has a new moderated message awaiting your approval.";
     //$extra_headers = 'Reply-to: '.$this->Forum->getUnixName().'@'.$GLOBALS['sys_default_domain'];
     $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,$User->getEmail(),$BCC,$this->getPosterRealName(),$extra_headers);
     util_send_message('', $subject, $body, "noreply@" . $GLOBALS['sys_default_domain'], $BCC, 'Forum', $extra_headers);
     //		util_handle_message(array_unique($ids),$subject,$body,$this->Forum->getSendAllPostsTo(),'','forumgateway@'.$GLOBALS[sys_default_domain]);
     return true;
 }
Пример #3
0
function show_commit_details($result)
{
    global $group_id, $commit_id, $Language;
    /*
    	Accepts a result set from the commits table. Should include all columns from
    	the table, and it should be joined to USER to get the user_name.
    */
    $rows = db_numrows($result);
    $url = "/cvs/?func=detailcommit&commit_id={$commit_id}&group_id={$group_id}&order=";
    $list_log = '<pre>' . util_make_links(util_line_wrap(db_result($result, 0, 'description')), $group_id) . '</pre>';
    if ($commit_id) {
        $hdr = '[' . $Language->getText('cvs_commit_utils', 'commit') . $commit_id . '] - ';
    } else {
        $hdr = $Language->getText('cvs_commit_utils', 'checkin') . ' ';
    }
    echo '<h2>' . $hdr . uniformat_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, 0, 'c_when')) . '</h2></h2>';
    echo '<table WIDTH="100%" BORDER="0" CELLSPACING="1" CELLPADDING="2"><tr class="' . util_get_alt_row_color(0) . '"><td>' . $list_log . '</td></tr></table>';
    $crossref_fact = new CrossReferenceFactory($commit_id, ReferenceManager::REFERENCE_NATURE_CVSCOMMIT, $group_id);
    $crossref_fact->fetchDatas();
    if ($crossref_fact->getNbReferences() > 0) {
        echo '<h3> ' . $Language->getText('cross_ref_fact_include', 'references') . '</h3>';
        $crossref_fact->DisplayCrossRefs();
    }
    echo '<h3>' . $Language->getText('cvs_commit_utils', 'impacted_file') . '</h3>';
    $title_arr = array();
    $title_arr[] = $Language->getText('cvs_commit_utils', 'file');
    $title_arr[] = $Language->getText('cvs_commit_utils', 'rev');
    $title_arr[] = $Language->getText('cvs_commit_utils', 'branch');
    $title_arr[] = $Language->getText('cvs_commit_utils', 'type');
    $title_arr[] = $Language->getText('cvs_commit_utils', 'added_line');
    $title_arr[] = $Language->getText('cvs_commit_utils', 'removed_line');
    $links_arr = array();
    $links_arr[] = $url . 'filename';
    $links_arr[] = $url . 'revision';
    $links_arr[] = $url . 'branch';
    $links_arr[] = $url . 'type';
    $links_arr[] = $url . 'addedlines';
    $links_arr[] = $url . 'removedlines';
    echo html_build_list_table_top($title_arr, $links_arr);
    for ($i = 0; $i < $rows; $i++) {
        $commit_id = db_result($result, $i, 'id');
        $type = db_result($result, $i, 'type');
        $added = db_result($result, $i, 'addedlines');
        $removed = db_result($result, $i, 'removedlines');
        $revision = db_result($result, $i, 'revision');
        $filename = db_result($result, $i, 'dir') . '/' . db_result($result, $i, 'file');
        $type_text = $Language->getText('cvs_commit_utils', strtolower($type));
        if ($type == "Change" && $added == 999 && $removed == 999) {
            // the default values
            // back to rcs to complete
            $repo = db_result($result, $i, 'repository');
            $command = "rlog -r" . $revision . " " . $repo . "/" . $filename;
            $output = array();
            exec($command, $output, $ret);
            $added = 0;
            $removed = 0;
            $l = 0;
            while ($l < count($output)) {
                // parse the rlog result till getting "state: Exp;  lines:"
                $line = $output[$l];
                $l++;
                if (ereg('state: +Exp; +lines: +\\+([0-9]*) +\\-([0-9]*)$', $line, $na)) {
                    $added = $na[1];
                    $removed = $na[2];
                    $sql_up = "UPDATE cvs_checkins SET addedlines=" . $added . ", removedlines=" . $removed . " WHERE repositoryid=" . db_result($result, $i, 'repositoryid') . " AND dirid=" . db_result($result, $i, 'dirid') . " AND fileid=" . db_result($result, $i, 'fileid') . " AND revision=" . $revision;
                    $res = db_query($sql_up);
                    break;
                }
            }
        }
        if (!$filename) {
            $filename = '';
        } else {
            if ($type == 'Remove') {
                $filename = makeCvsDirLink($group_id, db_result($result, $i, 'file'), $filename, db_result($result, $i, 'dir'));
                $rev_text = '';
            } else {
                // Clean file path to remove duplicate separators
                $filename = preg_replace('/\\/\\//', '/', $filename);
                $filename = preg_replace('/\\.\\//', '', $filename);
                if ($type == 'Change') {
                    // horrible hack to 'guess previous revision' to diff with
                    $prev = explode(".", $revision);
                    $lastIndex = sizeof($prev);
                    $lastIndex = $lastIndex - 1;
                    if ($prev[$lastIndex] != '1') {
                        $prev[$lastIndex] = $prev[$lastIndex] - 1;
                        $previous = join(".", $prev);
                    } else {
                        $index = 0;
                        $new_prev = array();
                        while ($index <= $lastIndex - 2) {
                            $new_prev[$index] = $prev[$index];
                            $index++;
                        }
                        $previous = join('.', $new_prev);
                    }
                    $type = makeCvsLink($group_id, $filename, $type_text, '', '&r1=' . $previous . '&r2=' . $revision);
                }
                $rev_text = makeCvsLink($group_id, $filename, $revision, $revision, '&view=markup');
                $filename = makeCvsLink($group_id, $filename, $filename, '', '&view=log');
            }
        }
        ##$commits_url = '<A HREF="/commits/download.php/Commits'.$commit_id.'.txt?commit_id='.$id.'">'.$filename.'</a>';
        echo '
			<TR class="' . util_get_alt_row_color($i) . '">' . '<TD class="small"><b>' . $filename . '</b></TD>' . '<TD class="small">' . $rev_text . '</TD>' . '<TD class="small">' . db_result($result, $i, 'branch') . '</TD>' . '<TD class="small">' . $type . '</TD>' . '<TD class="small">' . $added . '</TD>' . '<TD class="small">' . $removed . '</TD></TR>';
    }
    /*
    	Show extra rows for <-- Prev / Next -->
    */
    echo '
		<TR><TD COLSPAN="2" class="small">';
    if ($offset > 0) {
        echo '<A HREF="?func=browse&group_id=' . $group_id . '&set=' . $set . '&offset=' . ($offset - 50) . '"><B>&lt; ' . $Language->getText('global', 'prev') . '</B></A>';
    } else {
        echo '&nbsp;';
    }
    echo '</TD><TD>&nbsp;</TD><TD COLSPAN="2" class="small">';
    if ($rows == 50) {
        echo '<A HREF="?func=browse&group_id=' . $group_id . '&set=' . $set . '&offset=' . ($offset + 50) . '"><B>' . $Language->getText('global', 'prev') . ' 50 &gt;</B></A>';
    } else {
        echo '&nbsp;';
    }
    echo '</TD></TR></TABLE>';
}
Пример #4
0
function svn_utils_show_revision_detail($result, $group_id, $group_name, $commit_id)
{
    global $Language;
    /*
      Accepts a result set from the svn_checkins table. Should include all columns from
      the table, and it should be joined to USER to get the user_name.
    */
    $rows = db_numrows($result);
    $url = "/svn/?func=detailrevision&commit_id={$commit_id}&group_id={$group_id}&order=";
    $list_log = '<pre>' . util_make_links(util_line_wrap(db_result($result, 0, 'description')), $group_id) . '</pre>';
    $revision = db_result($result, 0, 'revision');
    $hdr = '[' . $Language->getText('svn_browse_revision', 'rev') . ' #' . $revision . '] - ';
    echo '<h2>' . $hdr . format_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, 0, 'date')) . '</h2></h2>';
    echo '<table WIDTH="100%" BORDER="0" CELLSPACING="1" CELLPADDING="2"><tr class="' . util_get_alt_row_color(0) . '"><td>' . $list_log . '</td></tr></table>';
    $crossref_fact = new CrossReferenceFactory($revision, ReferenceManager::REFERENCE_NATURE_SVNREVISION, $group_id);
    $crossref_fact->fetchDatas();
    if ($crossref_fact->getNbReferences() > 0) {
        echo '<h3> ' . $Language->getText('cross_ref_fact_include', 'references') . '</h3>';
        $crossref_fact->DisplayCrossRefs();
    }
    echo '<h3> ' . $Language->getText('svn_utils', 'impacted_files') . '</h3>';
    $title_arr = array();
    $title_arr[] = $Language->getText('svn_utils', 'file');
    $title_arr[] = $Language->getText('svn_browse_revision', 'rev');
    $title_arr[] = $Language->getText('svn_utils', 'type');
    //$title_arr[]='AddedLines'; To be implemented
    //$title_arr[]='RemovedLines'; To be implemented
    $links_arr = array();
    $links_arr[] = $url . 'filename';
    $links_arr[] = $url . '';
    $links_arr[] = $url . 'type';
    $pm = ProjectManager::instance();
    $project = $pm->getProject($group_id);
    $root = $project->getUnixName();
    echo html_build_list_table_top($title_arr, $links_arr);
    for ($i = 0; $i < $rows; $i++) {
        $type = db_result($result, $i, 'type');
        $dirname = db_result($result, $i, 'dir');
        $filename = db_result($result, $i, 'file');
        $fullpath = $dirname . $filename;
        if ($filename) {
            // It' a file
            $viewfile_url = svn_utils_make_viewlink($group_name, $fullpath, $fullpath, "&pathrev={$revision}&view=log");
            $viewrev_url = svn_utils_make_viewlink($group_name, $fullpath, $revision, "&revision={$revision}&pathrev={$revision}&view=markup");
        } else {
            // It' a directory
            $viewfile_url = svn_utils_make_viewlink($group_name, $fullpath, $fullpath, "&pathrev={$revision}");
            $viewrev_url = svn_utils_make_viewlink($group_name, $fullpath, $revision, "&pathrev={$revision}&view=log");
        }
        if ($type == 'Change') {
            $viewtype_url = svn_utils_make_viewlink($group_name, $fullpath, $Language->getText('svn_utils', 'change'), "&r1=" . ($revision - 1) . "&r2={$revision}&diff_format=h&pathrev={$revision}");
        } else {
            if ($type == 'Add') {
                $viewtype_url = $Language->getText('svn_utils', 'add');
            } else {
                if ($type == 'Delete') {
                    $viewtype_url = $Language->getText('svn_utils', 'del');
                }
            }
        }
        echo '
	       <TR class="' . util_get_alt_row_color($i) . '">' . '<TD class="small"><b>' . $viewfile_url . '</b></TD>' . '<TD class="small" width="10%" align="center">' . $viewrev_url . '</TD>' . '<TD class="small" width="10%" align="center">' . $viewtype_url . '</TD>';
        //'<TD class="small">'.$added.'</TD>'. // To be done
        //'<TD class="small">'.$removed.'</TD></TR>'; // To be done
    }
    echo '</TD></TR></TABLE>';
}
Пример #5
0
function show_support_details($support_id)
{
    /*
    	Show the details rows from support_history
    */
    global $sys_datefmt;
    $result = support_data_get_messages($support_id);
    $rows = db_numrows($result);
    if ($rows > 0) {
        echo '
		<H3>Followups</H3>
		<P>';
        $title_arr = array();
        $title_arr[] = 'Message';
        echo html_build_list_table_top($title_arr);
        for ($i = 0; $i < $rows; $i++) {
            $email_arr = explode('@', db_result($result, $i, 'from_email'));
            echo '<TR BGCOLOR="' . html_get_alt_row_color($i) . '"><TD><PRE>
Date: ' . date($sys_datefmt, db_result($result, $i, 'date')) . '
Sender: ' . $email_arr[0] . '
' . util_line_wrap(db_result($result, $i, 'body'), 85, "\n") . '</PRE></TD></TR>';
        }
        echo '</TABLE>';
    } else {
        echo '
			<H3>No Followups Have Been Posted</H3>';
    }
}
Пример #6
0
 //inserting a new diary entry
 $sql = "INSERT INTO user_diary (user_id,date_posted,summary,details,is_public) VALUES " . "('" . user_getid() . "','" . time() . "','" . htmlspecialchars($summary) . "','" . htmlspecialchars($details) . "','{$is_public}')";
 $res = db_query($sql);
 if ($res && db_affected_rows($res) > 0) {
     $feedback .= _('Item Added');
     if ($is_public) {
         //send an email if users are monitoring
         $sql = "SELECT users.email from user_diary_monitor,users " . "WHERE user_diary_monitor.user_id=users.user_id " . "AND user_diary_monitor.monitored_user='******'";
         $result = db_query($sql);
         $rows = db_numrows($result);
         if ($result && $rows > 0) {
             $tolist = implode(util_result_column_to_array($result), ', ');
             $to = '';
             // send to noreply@
             $subject = "[ SF User Notes: " . $u->getRealName() . "] " . stripslashes($summary);
             $body = util_line_wrap(stripslashes($details)) . "\n\n______________________________________________________________________" . "\nYou are receiving this email because you elected to monitor this user." . "\nTo stop monitoring this user, login to " . $GLOBALS['sys_name'] . " and visit: " . "\nhttp://" . $GLOBALS['sys_default_domain'] . "/developer/monitor.php?diary_user="******" email sent - ({$rows}) people monitoring ";
         } else {
             $feedback .= ' email not sent - no one monitoring ';
             echo db_error();
         }
     } else {
         //don't send an email to monitoring users
         //since this is a private note
     }
 } else {
     form_release_key(getStringFromRequest("form_key"));
     $feedback .= _('Error Adding Item');
     echo db_error();
 }
Пример #7
0
     }
 } else {
     if ($add) {
         //inserting a new diary entry
         $sql = "INSERT INTO user_diary (user_id,date_posted,summary,details,is_public) VALUES " . "('" . user_getid() . "','" . time() . "','" . htmlspecialchars($summary) . "','" . htmlspecialchars($details) . "','{$is_public}')";
         $res = db_query($sql);
         if ($res && db_affected_rows($res) > 0) {
             $feedback .= ' Item Added ';
             if ($is_public) {
                 //send an email if users are monitoring
                 $sql = "SELECT users.email from user_diary_monitor,users " . "WHERE user_diary_monitor.user_id=users.user_id " . "AND user_diary_monitor.monitored_user='******'";
                 $result = db_query($sql);
                 $rows = db_numrows($result);
                 if ($result && $rows > 0) {
                     $tolist = implode(result_column_to_array($result), ', ');
                     $body = "To: noreply@{$GLOBALS['sys_default_domain']}" . "\nBCC: {$tolist}" . "\nSubject: [ SF User Notes: " . user_getrealname(user_getid()) . "] " . stripslashes($summary) . "\n\n" . util_line_wrap(stripslashes($details)) . "\n\n______________________________________________________________________" . "\nYou are receiving this email because you elected to monitor this user." . "\nTo stop monitoring this user, login to " . $GLOBALS['sys_default_name'] . " and visit: " . "\nhttp://{$GLOBALS['sys_default_host']}/developer/monitor.php?user="******"/bin/echo \"" . util_prep_string_for_sendmail($body) . "\" | {$GLOBALS['sys_sendmail_path']} -fnoreply@{$GLOBALS['sys_default_domain']} -t -i >& /dev/null &");
                     $feedback .= " email sent - ({$rows}) people monitoring ";
                 } else {
                     $feedback .= ' email not sent - no one monitoring ';
                     echo db_error();
                 }
             } else {
                 //don't send an email to monitoring users
                 //since this is a private note
             }
         } else {
             $feedback .= ' Error Adding Item ';
             echo db_error();
         }
     }
Пример #8
0
/**
 *	assumes $send_all_posts_to var is set up
 */
function handle_monitoring($forum_id, $msg_id)
{
    global $feedback, $send_all_posts_to;
    /*
    	Checks to see if anyone is monitoring this forum
    	If someone is, it sends them the message in email format
    */
    $sql = "SELECT users.email from forum_monitored_forums,users " . "WHERE forum_monitored_forums.user_id=users.user_id AND forum_monitored_forums.forum_id='{$forum_id}'";
    $result = db_query($sql);
    $rows = db_numrows($result);
    if ($result && $rows > 0 || $send_all_posts_to) {
        $tolist = $send_all_posts_to . ', ' . implode(result_column_to_array($result), ', ');
        $sql = "SELECT groups.unix_group_name,users.user_name,forum_group_list.forum_name," . "forum.group_forum_id,forum.thread_id,forum.subject,forum.date,forum.body " . "FROM forum,users,forum_group_list,groups " . "WHERE users.user_id=forum.posted_by " . "AND forum_group_list.group_forum_id=forum.group_forum_id " . "AND groups.group_id=forum_group_list.group_id " . "AND forum.msg_id='{$msg_id}'";
        $result = db_query($sql);
        if ($result && db_numrows($result) > 0) {
            $body = "To: noreply@{$GLOBALS['sys_default_domain']}" . "\nBCC: {$tolist}" . "\nSubject: [" . db_result($result, 0, 'unix_group_name') . " - " . db_result($result, 0, 'forum_name') . "] " . util_unconvert_htmlspecialchars(db_result($result, 0, 'subject')) . "\n\nRead and respond to this message at: " . "\nhttp://{$GLOBALS['sys_default_host']}/forum/message.php?msg_id=" . $msg_id . "\nBy: " . db_result($result, 0, 'user_name') . "\n\n" . util_line_wrap(util_unconvert_htmlspecialchars(db_result($result, 0, 'body'))) . "\n\n______________________________________________________________________" . "\nYou are receiving this email because you elected to monitor this forum." . "\nTo stop monitoring this forum, login to " . $GLOBALS['sys_default_name'] . " and visit: " . "\nhttp://{$GLOBALS['sys_default_host']}/forum/monitor.php?forum_id={$forum_id}";
            // echo "<pre>/bin/echo \"". util_prep_string_for_sendmail($body) ."\" | $GLOBALS[sys_sendmail_path] -fnoreply@$GLOBALS[sys_default_name] -t</pre>";
            exec("/bin/echo \"" . util_prep_string_for_sendmail($body) . "\" | {$GLOBALS['sys_sendmail_path']} -fnoreply@{$GLOBALS['sys_default_domain']} -t &");
            $feedback .= ' email sent - people monitoring ';
        } else {
            $feedback .= ' email not sent - people monitoring ';
            echo db_error();
        }
    } else {
        $feedback .= ' email not sent - no one monitoring ';
        echo db_error();
    }
}
Пример #9
0
    /**
     *  sendNotice - the logic to send an email/jabber notice for a release.
     *
     *  @return	boolean	success.
     */
    function sendNotice()
    {
        $arr =& $this->FRSPackage->getMonitorIDs();
        $date = date('Y-m-d H:i', time());
        $subject = sprintf(_('[%1$s Release] %2$s'), $this->FRSPackage->Group->getUnixName(), $this->FRSPackage->getName());
        $text = stripcslashes(sprintf(_('Project %1$s (%2$s) has released a new version of package "%3$s".
You can download it by following this link:

%4$s

You receive this email because you requested to be notified when new
versions of this package were released. If you don\'t wish to be
notified in the future, please login to %5$s and click this link:

%6$s'), $this->FRSPackage->Group->getPublicName(), $this->FRSPackage->Group->getUnixName(), $this->FRSPackage->getName(), util_make_url("/frs/?group_id=" . $this->FRSPackage->Group->getID() . "&release_id=" . $this->getID()), $GLOBALS['sys_name'], util_make_url("/frs/monitor.php?filemodule_id=" . $this->FRSPackage->getID() . "&group_id=" . $this->FRSPackage->Group->getID() . "&stop=1")));
        $text = util_line_wrap($text);
        if (count($arr)) {
            util_handle_message(array_unique($arr), $subject, $text);
        }
    }