Пример #1
0
    // If it's super user and license terms have not yet been agreed then redirect
    // to license agreement page
    if (user_is_super_user() && !license_already_displayed()) {
        session_redirect("/admin/approve_license.php");
    }
    // Make sure this page is not cached because
    // it uses the exact same URL for all user's
    // personal page
    header("Cache-Control: no-cache, no-store, must-revalidate");
    // for HTTP 1.1
    header("Pragma: no-cache");
    // for HTTP 1.0
    if (browser_is_netscape4()) {
        $feedback .= $Language->getText('my_index', 'err_badbrowser');
    }
    $title = $Language->getText('my_index', 'title', array($hp->purify(user_getrealname(user_getid()), CODENDI_PURIFIER_CONVERT_HTML) . ' (' . user_getname() . ')'));
    $GLOBALS['HTML']->includeJavascriptFile('/scripts/scriptaculous/scriptaculous.js');
    my_header(array('title' => $title, 'body_class' => array('widgetable')));
    echo '<p>' . $Language->getText('my_index', 'message') . '</p>';
    $lm = new WidgetLayoutManager();
    $lm->displayLayout(user_getid(), WidgetLayoutManager::OWNER_TYPE_USER);
    if (!$current_user->getPreference(Tuleap_Tour_WelcomeTour::TOUR_NAME)) {
        $GLOBALS['Response']->addTour(new Tuleap_Tour_WelcomeTour($current_user));
    }
    ?>
    </span>
<?php 
    $request =& HTTPRequest::instance();
    if ($request->get('pv') == 2) {
        $GLOBALS['Response']->pv_footer(array());
    } else {
Пример #2
0
 /**
  * Format the changes
  *
  * @param changes: array of changes
  * @param $field_perm an array with the permission associated to each field. false to no check perms
  * @param $visible_change only needed when using permissions. Returns true if there is any change 
  * that the user has permission to see
  *
  * @return string
  */
 function formatChanges($changes, $field_perm, &$visible_change)
 {
     global $art_field_fact, $Language;
     $visible_change = false;
     $out_hdr = '';
     $out = '';
     $out_com = '';
     $out_att = '';
     reset($changes);
     $fmt = "%20s | %-25s | %s" . $GLOBALS['sys_lf'];
     if ($this->hasFieldPermission($field_perm, 'assigned_to') || $this->hasFieldPermission($field_perm, 'multi_assigned_to') || !isset($field_perm['assigned_to']) && !isset($field_perm['multi_assigned_to'])) {
         if (user_isloggedin()) {
             $user_id = user_getid();
             $out_hdr = $Language->getText('tracker_include_artifact', 'changes_by') . ' ' . user_getrealname($user_id) . ' <' . user_getemail($user_id) . ">" . $GLOBALS['sys_lf'] . "";
             $out_hdr .= $Language->getText('tracker_import_utils', 'date') . ': ' . format_date($GLOBALS['Language']->getText('system', 'datefmt'), time()) . ' (' . user_get_timezone() . ')';
         } else {
             $out_hdr = $Language->getText('tracker_include_artifact', 'changes_by') . ' ' . $Language->getText('tracker_include_artifact', 'anon_user') . '        ' . $Language->getText('tracker_import_utils', 'date') . ': ' . format_date($GLOBALS['Language']->getText('system', 'datefmt'), time());
         }
     }
     //Process special cases first: follow-up comment
     if (array_key_exists('comment', $changes) && $changes['comment']) {
         $visible_change = true;
         $out_com = $GLOBALS['sys_lf'] . $GLOBALS['sys_lf'] . "---------------   " . $Language->getText('tracker_include_artifact', 'add_flup_comment') . "   ----------------" . $GLOBALS['sys_lf'] . "";
         if (isset($changes['comment']['type']) && $changes['comment']['type'] != $Language->getText('global', 'none') && $changes['comment']['type'] != '') {
             $out_com .= "[" . $changes['comment']['type'] . "]" . $GLOBALS['sys_lf'];
         }
         $out_com .= $this->formatFollowUp(null, $changes['comment']['format'], $changes['comment']['add'], self::OUTPUT_MAIL_TEXT);
         unset($changes['comment']);
     }
     //Process special cases first: file attachment
     if (array_key_exists('attach', $changes) && $changes['attach']) {
         $visible_change = true;
         $out_att = "" . $GLOBALS['sys_lf'] . $GLOBALS['sys_lf'] . "---------------    " . $Language->getText('tracker_include_artifact', 'add_attachment') . "     -----------------" . $GLOBALS['sys_lf'] . "";
         $out_att .= sprintf($Language->getText('tracker_include_artifact', 'file_name') . " %-30s " . $Language->getText('tracker_include_artifact', 'size') . ":%d KB" . $GLOBALS['sys_lf'] . "", $changes['attach']['name'], intval($changes['attach']['size'] / 1024));
         $out_att .= $changes['attach']['description'] . $GLOBALS['sys_lf'] . $changes['attach']['href'];
         unset($changes['attach']);
     }
     // All the rest of the fields now
     reset($changes);
     while (list($field_name, $h) = each($changes)) {
         // If both removed and added items are empty skip - Sanity check
         if ((isset($h['del']) && $h['del'] || isset($h['add']) && $h['add']) && $this->hasFieldPermission($field_perm, $field_name)) {
             $visible_change = true;
             $label = $field_name;
             $field = $art_field_fact->getFieldFromName($field_name);
             if ($field) {
                 $label = $field->getLabel();
                 if (isset($h['del'])) {
                     $h['del'] = SimpleSanitizer::unsanitize(util_unconvert_htmlspecialchars($h['del']));
                 }
                 if (isset($h['add'])) {
                     $h['add'] = SimpleSanitizer::unsanitize(util_unconvert_htmlspecialchars($h['add']));
                 }
             }
             $out .= sprintf($fmt, SimpleSanitizer::unsanitize($label), isset($h['del']) ? $h['del'] : "", isset($h['add']) ? $h['add'] : "");
         }
     }
     // while
     if ($out) {
         $out = $GLOBALS['sys_lf'] . $GLOBALS['sys_lf'] . sprintf($fmt, $Language->getText('tracker_include_artifact', 'what') . '    ', $Language->getText('tracker_include_artifact', 'removed'), $Language->getText('tracker_include_artifact', 'added')) . "------------------------------------------------------------------" . $GLOBALS['sys_lf'] . $out;
     }
     return $out_hdr . $out . $out_com . $out_att;
 }
Пример #3
0
<?php

//
// SourceForge: Breaking Down the Barriers to Open Source Development
// Copyright 1999-2000 (c) The SourceForge Crew
// http://sourceforge.net
//
// $Id: diary.php,v 1.2 2003/11/13 11:29:22 helix Exp $
require 'pre.php';
require 'vote_function.php';
if ($diary_user) {
    echo $HTML->header(array('title' => 'My Diary And Notes'));
    echo '
	<H2>Diary And Notes For: ' . user_getrealname($diary_user) . '</H2>
	<P>

	<P>';
    echo $HTML->box1_top('Existing Diary And Note Entries', false, false);
    if ($diary_id) {
        $sql = "SELECT * FROM user_diary WHERE user_id='{$diary_user}' AND id='{$diary_id}' AND is_public=1";
        $res = db_query($sql);
        if (!$res || db_numrows($res) < 1) {
            echo '<TR><TD COLSPAN=2>Entry Not Found For This User.</TD></TR>';
        } else {
            echo '<TR><TD COLSPAN=2><B>Date:</B> ' . date($sys_datefmt, db_result($res, $i, 'date_posted')) . '<BR>
			<B>Subject:</B> ' . db_result($res, $i, 'summary') . '<P>
			<B>Body:</B><BR>
			' . nl2br(db_result($res, $i, 'details')) . '
			</TD></TR>';
        }
    }
Пример #4
0
?>
</TD></TR>

<TR>

<TD>

<?php 
if (user_isloggedin()) {
    $csrf_token = new CSRFSynchronizerToken('sendmessage.php');
    $HTML->box1_top($Language->getText('include_user_home', 'send_message_to') . ' ' . $hp->purify($user->getRealName(), CODENDI_PURIFIER_CONVERT_HTML));
    echo '
	<FORM ACTION="/sendmessage.php" METHOD="POST">
	<INPUT TYPE="HIDDEN" NAME="touser" VALUE="' . $user->getId() . '">';
    echo $csrf_token->fetchHTMLInput();
    $my_name = $hp->purify(user_getrealname(user_getid()));
    $cc = isset($_REQUEST['cc']) ? $hp->purify(trim($_REQUEST['cc'])) : "";
    echo '
    <div>
        <script type="text/javascript" src="/scripts/blocks.js"></script>
        <script type="text/javascript">
        function addCCField() {
            hideBlock("cc_link");
            showBlock("cc_field");
        }
        </script>
        <div id="cc_link"  style="display:' . ($cc !== "" ? 'none' : 'block') . ';"><a href="" onclick="addCCField(); return false;" title="' . $Language->getText('include_user_home', 'add_cc') . '">' . $Language->getText('include_user_home', 'add_cc') . '</a></div>
        <div id="cc_field" style="display:' . ($cc === "" ? 'none' : 'block') . ';">
            <P><B>' . $Language->getText('include_user_home', 'cc') . ':</B><BR/>
            <INPUT TYPE="TEXT" id="cc" NAME="cc" VALUE="' . $cc . '"STYLE="width: 99%;"><BR/>
            ' . $Language->getText('include_user_home', 'fill_cc_list_msg') . '</P>
Пример #5
0
	<B>Your Email Address:</B><BR>
	<?php 
    $from_email = user_getname() . '@' . $GLOBALS['sys_users_host'];
    ?>
	<B><?php 
    echo $from_email;
    ?>
</B>
	<INPUT TYPE="HIDDEN" NAME="email" VALUE="<?php 
    echo $from_email;
    ?>
">
	<P>
	<B>Your Name:</B><BR>
	<B><?php 
    $my_name = user_getrealname(user_getid());
    echo $my_name;
    ?>
</B>
	<INPUT TYPE="HIDDEN" NAME="name" VALUE="<?php 
    echo $my_name;
    ?>
">
	<P>
	<B>Subject:</B><BR>
	<INPUT TYPE="TEXT" NAME="subject" SIZE="30" MAXLENGTH="40" VALUE="">
	<P>
	<B>Message:</B><BR>
	<TEXTAREA NAME="body" ROWS="15" COLS="50" WRAP="HARD"></TEXTAREA>
	<P>
	<CENTER>
Пример #6
0
function plugin_forumml_process_mail($plug, $reply = false)
{
    $request =& HTTPRequest::instance();
    $hp =& ForumML_HTMLPurifier::instance();
    // Instantiate a new Mail class
    $mail =& new Mail();
    // Build mail headers
    $to = mail_get_listname_from_list_id($request->get('list')) . "@" . $GLOBALS['sys_lists_host'];
    $mail->setTo($to);
    $from = user_getrealname(user_getid()) . " <" . user_getemail(user_getid()) . ">";
    $mail->setFrom($from);
    $vMsg = new Valid_Text('message');
    if ($request->valid($vMsg)) {
        $message = $request->get('message');
    }
    $subject = $request->get('subject');
    $mail->setSubject($subject);
    if ($reply) {
        // set In-Reply-To header
        $hres = plugin_forumml_get_message_headers($request->get('reply_to'));
        $reply_to = db_result($hres, 0, 'value');
        $mail->addAdditionalHeader("In-Reply-To", $reply_to);
    }
    $continue = true;
    if ($request->validArray(new Valid_Email('ccs')) && $request->exist('ccs')) {
        $cc_array = array();
        $idx = 0;
        foreach ($request->get('ccs') as $cc) {
            if (trim($cc) != "") {
                $cc_array[$idx] = $hp->purify($cc, CODENDI_PURIFIER_FULL);
                $idx++;
            }
        }
        // Checks sanity of CC List
        $err = '';
        if (!util_validateCCList($cc_array, $err)) {
            $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_forumml', 'invalid_mail', $err));
            $continue = false;
        } else {
            // add list of cc users to mail mime
            if (count($cc_array) > 0) {
                $cc_list = util_normalize_emails(implode(',', $cc_array));
                $mail->setCc($cc_list, true);
            }
        }
    }
    if ($continue) {
        // Process attachments
        // Define boundaries as specified in RFC:
        // http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html
        $boundary = '----=_NextPart';
        $boundaryStart = '--' . $boundary;
        $boundaryEnd = '--' . $boundary . '--';
        // Attachments headers
        if (isset($_FILES["files"]) && count($_FILES["files"]['name']) > 0) {
            $attachment = "";
            $text = "This is a multi-part message in MIME format.\n";
            $text = "{$boundaryStart}\n";
            $text .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
            $text .= "Content-Transfer-Encoding: 8bit\n\n";
            $text .= $message;
            $text .= "\n\n";
            foreach ($_FILES["files"]['name'] as $i => $fileName) {
                $attachment .= "{$boundaryStart}\n";
                $attachment .= "Content-Type:" . $_FILES["files"]["type"][$i] . "; name=" . $fileName . "\n";
                $attachment .= "Content-Transfer-Encoding: base64\n";
                $attachment .= "Content-Disposition: attachment; filename=" . $fileName . "\n\n";
                $attachment .= chunk_split(base64_encode(file_get_contents($_FILES["files"]["tmp_name"][$i])));
            }
            $attachment .= "\n{$boundaryEnd}\n";
            $body = $text . $attachment;
            // force MimeType to multipart/mixed as default (when instantiating new Mail object) is text/plain
            $mail->setMimeType('multipart/mixed; boundary="' . $boundary . '"');
            $mail->addAdditionalHeader("MIME-Version", "1.0");
        } else {
            $body = $message;
        }
        $mail->setBody($body);
        if ($mail->send()) {
            $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_forumml', 'mail_succeed'));
        } else {
            $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_forumml', 'mail_fail'));
            $continue = false;
        }
    }
    return $continue;
}
Пример #7
0
function my_header($params)
{
    $request =& HTTPRequest::instance();
    $pv = '';
    if ($request->get('pv') == 2) {
        $pv = '?pv=2';
        $GLOBALS['Response']->pv_header($params);
    } else {
        site_header($params);
    }
    $hp = Codendi_HTMLPurifier::instance();
    echo '<h2>' . $GLOBALS['Language']->getText('my_index', 'title', array($hp->purify(user_getrealname(user_getid()), CODENDI_PURIFIER_CONVERT_HTML) . ' (' . user_getname() . ')'));
    echo ' ' . help_button('LoginAndPersonalPage.html');
    echo '</h2>';
}
Пример #8
0
    pw_header();
    if ($feedback && !$just_logged_in) {
        if ($ok) {
            print "<p>{$feedback}</p>";
        } else {
            print "<div class=\"error\"><h2>Failed to change settings</h2><p>{$feedback}</div>";
        }
    }
    $newsletter = user_getnewsletter();
    if ($newsletter) {
        $newsletter = "checked";
    } else {
        $newsletter = "";
    }
    print '<P><span class="ptitle">User name:</span> ' . $user_name . '
	<br><span class="ptitle">Real name:</span> ' . user_getrealname() . '
	<br><span class="ptitle">Email:</span> ' . user_getemail() . ' (<a href="changeemail.php">change email</a>)
    <br><span class="ptitle">Password:</span> (<a href="changepass.php">change password</a>)

	<FORM ACTION="' . $PHP_SELF . '" METHOD="POST">
    <h2>Newsletter subscription</h2>
	<INPUT TYPE="checkbox" NAME="newsletter" ' . $newsletter . '>Email newsletter (at most once a month)
	<INPUT TYPE="SUBMIT" NAME="submit" VALUE="Update">
	</FORM>
	<P>';
    print '<h2>Forum profile</h2>';
    print '<p>';
    print pretty_user_name($db, $user_name, 'View your forum profile, including posts you\'ve made');
    print "<h2>Policies which you made</h2>";
    $query = "select dream_id, name, description, private from pw_dyn_dreammp where user_id = '" . user_getid() . "' order by private, name";
    $db->query($query);
Пример #9
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();
         }
     }
Пример #10
0
function plugin_forumml_process_mail($plug, $reply = false)
{
    $request =& HTTPRequest::instance();
    $hp =& ForumML_HTMLPurifier::instance();
    // Instantiate a new Mail class
    $mail = new Codendi_Mail();
    // Build mail headers
    $to = mail_get_listname_from_list_id($request->get('list')) . "@" . $GLOBALS['sys_lists_host'];
    $mail->setTo($to);
    $from = user_getrealname(user_getid()) . " <" . user_getemail(user_getid()) . ">";
    $mail->setFrom($from);
    $vMsg = new Valid_Text('message');
    if ($request->valid($vMsg)) {
        $message = $request->get('message');
    }
    $subject = $request->get('subject');
    $mail->setSubject($subject);
    if ($reply) {
        // set In-Reply-To header
        $hres = plugin_forumml_get_message_headers($request->get('reply_to'));
        $reply_to = db_result($hres, 0, 'value');
        $mail->addAdditionalHeader("In-Reply-To", $reply_to);
    }
    $continue = true;
    if ($request->validArray(new Valid_Email('ccs')) && $request->exist('ccs')) {
        $cc_array = array();
        $idx = 0;
        foreach ($request->get('ccs') as $cc) {
            if (trim($cc) != "") {
                $cc_array[$idx] = $hp->purify($cc, CODENDI_PURIFIER_FULL);
                $idx++;
            }
        }
        // Checks sanity of CC List
        $err = '';
        if (!util_validateCCList($cc_array, $err)) {
            $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_forumml', 'invalid_mail', $err));
            $continue = false;
        } else {
            // add list of cc users to mail mime
            if (count($cc_array) > 0) {
                $cc_list = util_normalize_emails(implode(',', $cc_array));
                $mail->setCc($cc_list, true);
            }
        }
    }
    if ($continue) {
        // Process attachments
        if (isset($_FILES["files"]) && count($_FILES["files"]['name']) > 0) {
            foreach ($_FILES["files"]['name'] as $i => $fileName) {
                $data = file_get_contents($_FILES["files"]["tmp_name"][$i]);
                $mime_type = $_FILES["files"]["type"][$i];
                $mail->addAttachment($data, $mime_type, $fileName);
            }
        }
        $mail->setBodyText($message);
        if ($mail->send()) {
            $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_forumml', 'mail_succeed'));
        } else {
            $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_forumml', 'mail_fail'));
            $continue = false;
        }
    }
    return $continue;
}
Пример #11
0
require_once 'common/event/EventManager.class.php';
require_once 'www/my/my_utils.php';
session_require(array('isloggedin' => '1'));
$em = EventManager::instance();
$um = UserManager::instance();
my_header(array('title' => $Language->getText('account_options', 'title')));
$purifier =& Codendi_HTMLPurifier::instance();
// get global user vars
$user = $um->getCurrentUser();
?>
<p><?php 
echo $Language->getText('account_options', 'welcome');
?>
,
    <b><?php 
echo $purifier->purify(user_getrealname(user_getid()), CODENDI_PURIFIER_CONVERT_HTML);
?>
</b>

<p><?php 
echo $Language->getText('account_options', 'welcome_intro');
echo '<fieldset><legend>' . $Language->getText('account_options', 'title') . '</legend>';
?>

<UL>
<LI><A href="/users/<?php 
echo $purifier->purify($user->getUserName());
?>
/">
<B><?php 
echo $Language->getText('account_options', 'view_developer_profile');