Example #1
0
function moisanfr($tstamp = "")
{
    //retourne le mois et l'année  en français
    if ($_SESSION['version'] == ">=432") {
        setlocale(LC_TIME, "french");
    } else {
        setlocale("LC_TIME", "french");
    }
    $moisanfr = strFTime("%b %Y", $tstamp);
    return $moisanfr;
}
Example #2
0
    protected function getSingleComment(Comment $comment)
    {
        $text = $this->text;
        $id = $comment->getId();
        $author = htmlSpecialChars($comment->getUserDisplayName());
        $postDate = "";
        if ($comment->getDateCreated() !== null) {
            $postDate = strFTime('%a %d %b %Y %X', $comment->getDateCreated()->getTimestamp());
        }
        $body = nl2br(htmlSpecialChars($comment->getBodyRaw()));
        $avatarUrl = User::getAvatarUrlFromEmail($comment->getUserEmail(), 40);
        // Add link and rank to author when linked to account
        if ($comment->getUserId() > 0) {
            $author = '<a href="' . $text->e($text->getUrlPage("account", $comment->getUserId())) . '">' . $author . '</a>';
        }
        // Edit and delete links
        $actionLinksHtml = $this->getActionLinks($comment);
        // Reply and context links
        if ($this->viewedOutOfContext) {
            $replyOrContextLink = <<<EOT
                <a class="arrow" href="{$text->e($comment->getUrl($text))}">
                    {$text->t("comments.view_context")}
                </a>
EOT;
        } else {
            // No child comments possible yet
            $replyOrContextLink = "";
        }
        $output = <<<COMMENT
            <article class="comment" id="comment_{$id}">
                <header>
                    <img src="{$avatarUrl}" alt="" />
                    <h3 class="comment_title">{$author}</h3>
                    <p class="comment_actions">
                        {$actionLinksHtml}
                    </p>
                    <p class="comment_date">{$postDate}</p>
                </header>
                <p class="comment_body">{$body}</p>
                <footer>
                    <p>{$replyOrContextLink}</p>
                </footer>
            </article>
COMMENT;
        return $output;
    }
Example #3
0
    exec('locale -a | grep -i ' . qsa('^' . $lang . '_') . ' 2>>/dev/null', $out, $err);
    if ($err != 0) {
        gs_log(GS_LOG_NOTICE, 'Failed to find locales on your system');
    } else {
        $lfound = setLocale(LC_TIME, $out);
        if ($lfound === false) {
            gs_log(GS_LOG_NOTICE, 'Your system does not have any locales like "' . $lang . '_*"');
        } else {
            gs_log(GS_LOG_NOTICE, 'Using locale "' . $lfound . '" as a fallback');
        }
    }
}
$wdays = array('mo' => 'Mon', 'tu' => 'Tue', 'we' => 'Wed', 'th' => 'Thu', 'fr' => 'Fri', 'sa' => 'Sat', 'su' => 'Sun');
$wdaysl = array();
foreach ($wdays as $col => $wdca) {
    $wdaysl[$col] = mb_subStr(strFTime('%a', strToTime('last ' . $wdca)), 0, 1);
}
unset($wdays);
setLocale(LC_TIME, array($oldLocale, 'C'));
$i = 0;
$rs = $DB->execute('SELECT * from `queue_cf_timerules` WHERE `_queue_id`=' . $queue_id . ' ORDER BY `ord`');
while ($route = $rs->fetchRow()) {
    echo '<input type="hidden" name="tr_' . $route['id'] . '" value="' . $route['id'] . '" />';
    echo '<tr><td>';
    echo $route['ord'];
    echo '</td><td>';
    foreach ($wdaysl as $col => $v) {
        echo '<span class="nobr"><input type="checkbox" name="' . $route['id'] . '-d_', $col, '" id="ipt-' . $route['id'] . '-r_d_', $col, '" value="1" ', $route['d_' . $col] ? 'checked="checked" ' : '', '/>';
        echo '<label for="ipt-r_d_', $col, '">', $v, '</label></span>';
    }
    echo '</td>', "\n";
Example #4
0
File: util.php Project: rkania/GS3
function date_human($ts)
{
    $old_locale = setLocale(LC_TIME, '0');
    $lang = strToLower(subStr(gs_get_conf('GS_INTL_LANG', 'de_DE'), 0, 2));
    switch ($lang) {
        case 'de':
            $l = array('de_DE.UTF-8', 'de_DE.utf8', 'de_DE.iso88591', 'de_DE.iso885915@euro', 'de_DE.ISO8859-1', 'de_DE.ISO8859-15', 'de_DE@euro', 'de_DE', 'de');
            break;
        case 'en':
            $l = array('en_US.utf8', 'en_US.iso88591', 'en_US.ISO8859-1', 'en_US.US-ASCII', 'en_US', 'en');
            break;
        default:
            $l = array('C');
    }
    setLocale(LC_TIME, $l);
    if (date('Ymd', $ts) == date('Ymd')) {
        $dv = __('heute');
    } elseif (date('Ymd', $ts) == date('Ymd', strToTime('-1 days', $ts))) {
        $dv = __('gestern');
    } else {
        $dv = strFTime(__('%d. %b'), $ts);
    }
    $ret = $dv . ', ' . date(__('H:i'), $ts);
    setLocale(LC_TIME, array($old_locale, 'C'));
    return $ret;
}
Example #5
0
 /**
  * Gets a formatted date/time as HTML, ready for presenting to the user.
  * This format is more suitable for upcoming events, where the year doesn't
  * really matter, but the weekday does.
  * @param DateTimeInterface $dateTime The date/time.
  * @return string The Formatted date/time as HTML.
  */
 public function formatEventDateTime(DateTimeInterface $dateTime)
 {
     $dateFormat = $this->getDateFormat("calendar.format.eventdatetime");
     return strFTime($dateFormat, $dateTime->format('U'));
 }