private function generateVisibilityOptions()
 {
     $options = array(array('value' => Project::ACCESS_PRIVATE, 'label' => $this->language->getText('project_admin_editgroupinfo', 'private_label'), 'selected' => $this->project_visibility === Project::ACCESS_PRIVATE ? 'selected = "selected"' : ''), array('value' => Project::ACCESS_PUBLIC, 'label' => $this->language->getText('project_admin_editgroupinfo', 'public_label'), 'selected' => $this->project_visibility === Project::ACCESS_PUBLIC ? 'selected = "selected"' : ''));
     if ($this->platform_allows_restricted) {
         $options[] = array('value' => Project::ACCESS_PUBLIC_UNRESTRICTED, 'label' => $this->language->getText('project_admin_editgroupinfo', 'unrestricted_label'), 'selected' => $this->project_visibility === Project::ACCESS_PUBLIC_UNRESTRICTED ? 'selected = "selected"' : '');
     }
     $this->options = $options;
 }
 /**
  * Get the html body for notification
  *
  * @param Boolean $is_update    It is an update, not a new artifact
  * @param String  $recipient    The recipient who will receive the notification
  * @param BaseLanguage $language The language of the message
  * @param Boolean $ignore_perms ???
  *
  * @return String
  */
 public function getBodyHtml($is_update, $recipient_user, BaseLanguage $language, $ignore_perms)
 {
     $format = 'html';
     $art = $this->getArtifact();
     $hp = Codendi_HTMLPurifier::instance();
     $followup = '';
     $changes = $this->mailDiffToPrevious($format, $recipient_user, $ignore_perms);
     // Display latest changes (diff)
     if ($comment = $this->getComment()) {
         $followup = $comment->fetchMailFollowUp($format);
     }
     $output = '<table style="width:100%">
         <tr>
             <td align="left" colspan="2">
                 <h1>' . $hp->purify($art->fetchMailTitle($recipient_user, $format, $ignore_perms)) . '
                 </h1>
             </td>
         </tr>';
     if ($followup || $changes) {
         $output .= '<tr>
                 <td colspan="2" align="left">
                     <h2>' . $language->getText('plugin_tracker_artifact_changeset', 'header_html_changeset') . '
                     </h2>
                 </td>
             </tr>';
         // Last comment
         if ($followup) {
             $output .= $followup;
         }
         // Last changes
         if ($changes) {
             //TODO check that the following is PHP compliant (what if I made a changes without a comment? -- comment is null)
             if (!empty($comment->body)) {
                 $output .= '
                     <tr>
                         <td colspan="2">
                             <hr size="1" />
                         </td>
                     </tr>';
             }
             $output .= '<tr>
                     <td> </td>
                     <td align="left">
                         <ul>' . $changes . '
                         </ul>
                     </td>
                 </tr>';
         }
         $artifact_link = get_server_url() . '/plugins/tracker/?aid=' . (int) $art->getId();
         $output .= '<tr>
                 <td> </td>
                 <td align="right">' . $this->fetchHtmlAnswerButton($artifact_link) . '</span>
                 </td>
             </tr>';
     }
     $output .= '</table>';
     //Display of snapshot
     $snapshot = $art->fetchMail($recipient_user, $format, $ignore_perms);
     if ($snapshot) {
         $output .= $snapshot;
     }
     return $output;
 }
예제 #3
0
파일: pre.php 프로젝트: rinodung/tuleap
        $user_manager->setUserTokenCookie($current_user);
    }
    if (!$cookie_manager->isCookie(CookieManager::USER_ID)) {
        $user_manager->setUserIdCookie($current_user);
    }
}
$theme_manager = new ThemeManager();
$HTML = $theme_manager->getTheme($current_user);
// If the Software license was declined by the site admin
// so stop all accesses to the site. Use exlicit path to avoid
// loading the license.php file in the register directory when
// invoking project/register.php
if (!IS_SCRIPT) {
    require_once dirname(__FILE__) . '/license.php';
    if (license_already_declined()) {
        exit_error($Language->getText('global', 'error'), $Language->getText('include_pre', 'site_admin_declines_license', $GLOBALS['sys_email_admin']));
    }
}
// Check if anonymous user is allowed to browse the site
// Bypass the test for:
// a) all scripts where you are not logged in by definition
// b) if it is a local access from localhost
// Check URL for valid hostname and valid protocol
if (!IS_SCRIPT) {
    $urlVerifFactory = new URLVerificationFactory();
    $urlVerif = $urlVerifFactory->getURLVerification($_SERVER);
    $urlVerif->assertValidUrl($_SERVER);
}
$request = HTTPRequest::instance();
//Check post max size
if ($request->exist('postExpected') && !$request->exist('postReceived')) {
 /**
  * Manage the mail content and send it
  * 
  * @param User    $user
  * @param FRSFile $file
  * @param String  $bodyContent
  * @param Array   $option
  * 
  * @return Boolean
  */
 function sendNotificationMail($user, $file, $bodyContent, $option)
 {
     $mail = new Mail();
     $language = new BaseLanguage($GLOBALS['sys_supported_languages'], $GLOBALS['sys_lang']);
     $language->loadLanguage($user->getLanguageID());
     $subject = $GLOBALS['sys_name'] . ' Error in ' . $file->getFileLocation();
     $mail->setFrom($GLOBALS['sys_noreply']);
     $mail->setBcc($user->getEmail());
     $mail->setSubject($subject);
     $mail->setBody($language->getText('mail_system_event', $bodyContent, $option));
     return $mail->send();
 }
예제 #5
0
 /**
  * Get the date in the user's expected format (depends on its locale)
  *
  * @param BaseLanguage $lang The user's language
  * @param int          $date The timestamp to transform
  * @param bool         $day_only True if display only the date, false if you want the time also
  *
  * @return string
  */
 public static function formatForLanguage(BaseLanguage $lang, $date, $day_only = false)
 {
     if ($day_only) {
         $user_date = format_date($lang->getText('system', 'datefmt_short'), $date, null);
     } else {
         $user_date = format_date($lang->getText('system', 'datefmt'), $date, null);
     }
     return $user_date;
 }
 /**
  * Get the html body for notification
  *
  * @param Tracker_DateReminder $reminder Reminder that will send notifications
  * @param Tracker_Artifact $artifact
  * @param String  $recipient    The recipient who will receive the notification
  * @param BaseLanguage $language The language of the message
  *
  * @return String
  */
 protected function getBodyHtml(Tracker_DateReminder $reminder, Tracker_Artifact $artifact, $recipient, BaseLanguage $language)
 {
     $format = Codendi_Mail_Interface::FORMAT_HTML;
     $hp = Codendi_HTMLPurifier::instance();
     $protocol = $GLOBALS['sys_force_ssl'] ? 'https' : 'http';
     $link = $protocol . '://' . $GLOBALS['sys_default_domain'] . TRACKER_BASE_URL . '/?aid=' . $artifact->getId();
     $output = '<h1>' . $hp->purify($artifact->fetchMailTitle($recipient, $format, false)) . '</h1>' . PHP_EOL;
     $output .= $language->getText('plugin_tracker_date_reminder', 'body_header', array($hp->purify($GLOBALS['sys_name']), $hp->purify($reminder->getField()->getLabel()), $reminder->getFieldValue($artifact)));
     $output .= '<br>';
     $output .= $language->getText('plugin_tracker_date_reminder', 'body_art_html_link', array($link));
     $output .= '<br>';
     return $output;
 }
 /**
  * Get the html body for notification
  *
  * @param Boolean $is_update    It is an update, not a new artifact
  * @param String  $recipient    The recipient who will receive the notification
  * @param BaseLanguage $language The language of the message
  * @param Boolean $ignore_perms ???
  *
  * @return String
  */
 public function getBodyHtml($is_update, $recipient_user, BaseLanguage $language, $ignore_perms)
 {
     $format = 'html';
     $art = $this->getArtifact();
     $hp = Codendi_HTMLPurifier::instance();
     $output = '<h1>' . $hp->purify($art->fetchMailTitle($recipient_user, $format, $ignore_perms)) . '</h1>' . PHP_EOL;
     $followup = '';
     // Display latest changes (diff)
     if ($comment = $this->getComment()) {
         $followup = $comment->fetchFollowUp($format, true, true);
     }
     $changes = $this->diffToPrevious($format, $recipient_user, $ignore_perms);
     if ($followup || $changes) {
         $output .= '<h2>' . $language->getText('plugin_tracker_artifact_changeset', 'header_html_changeset') . '</h2>';
         $output .= '<div class="tracker_artifact_followup_header">';
         // Last comment
         if ($followup) {
             $output .= $followup . PHP_EOL;
         }
         // Last changes
         if ($changes) {
             //TODO check that the following is PHP compliant (what if I made a changes without a comment? -- comment is null)
             if (!empty($comment->body)) {
                 $output .= '<hr size="1" />';
             }
             $output .= '<ul class="tracker_artifact_followup_changes">';
             $output .= $changes;
             $output .= '</ul>';
         }
         $output .= '</div>' . PHP_EOL;
         $output .= $this->fetchHtmlAnswerButton(get_server_url() . '/plugins/tracker/?aid=' . (int) $art->getId());
     }
     //Display of snapshot
     $snapshot = $art->fetchMail($recipient_user, $format, $ignore_perms);
     if ($snapshot) {
         $output .= $snapshot;
     }
     return $output;
 }