コード例 #1
0
 public function getMainInfo()
 {
     $user = User::getInstance(Stb::getInstance()->id);
     $oss_info = $user->getInfoFromOSS();
     $info = array('fname' => $user->getProfileParam('fname'), 'phone' => $user->getProfileParam('phone'), 'ls' => $user->getProfileParam('ls'), 'mac' => $user->getProfileParam('mac'));
     if (is_array($oss_info)) {
         $info = array_merge($info, $oss_info);
     }
     $info['last_change_status'] = $user->getProfileParam('last_change_status');
     if (Config::getSafe('enable_internal_billing', false) && !array_key_exists('end_date', $info)) {
         $expire_billing_date = $user->getProfileParam('expire_billing_date');
         if (strtotime($expire_billing_date) > 0) {
             $info['end_date'] = $expire_billing_date;
         }
     }
     if (!array_key_exists('account_balance', $info) && $user->getProfileParam('account_balance') != '') {
         $info['account_balance'] = $user->getProfileParam('account_balance');
     }
     if (array_key_exists('end_date', $info)) {
         $end_time = strtotime($info['end_date']);
         if ($end_time) {
             $days = ceil(($end_time - time()) / (24 * 3600));
             /// in format of php date() function
             $info['end_date'] = date(_('end_date_format'), strtotime($info['end_date'])) . ' (' . sprintf(ngettext('%d day', '%d days', $days), $days) . ')';
         }
     }
     if (Config::get('enable_tariff_plans')) {
         $info['tariff_plan'] = $user->getTariffPlanName();
     }
     return $info;
 }
コード例 #2
0
ファイル: Lang.class.php プロジェクト: erichub/Presence-V-0.1
 public static function getPluralText($singular, $plural, $number)
 {
     if (self::_getTextMode() == self::GETTEXT_MODE_NATIVE) {
         return ngettext($singular, $plural, $number);
     }
     return _ngettext($singular, $plural, $number);
 }
コード例 #3
0
ファイル: survey_utils.php プロジェクト: neymanna/fusionforge
/**
 * GForge Survey Facility
 *
 * Portions Copyright 1999-2001 (c) VA Linux Systems
 * The rest Copyright 2002-2004 (c) GForge Team
 * http://gforge.org/
 *
 * @version   $Id$
 *
 * This file is part of GForge.
 *
 * GForge is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * GForge is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GForge; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
function ShowResultsEditSurvey($result)
{
    global $group_id;
    $rows = db_NumRows($result);
    $cols = db_NumFields($result);
    echo "<h3>" . sprintf(ngettext('%1$s survey found', '%1$s surveys found', $rows), $rows) . "</h3>";
    if ($rows > 0) {
        echo "<table border=\"0\">\n";
        /*  Create  the  headers  */
        echo "<tr class=\"tableheading\">\n";
        for ($i = 0; $i < $cols; $i++) {
            echo "<th>" . db_fieldname($result, $i) . "</th>\n";
        }
        echo "</tr>";
        for ($j = 0; $j < $rows; $j++) {
            echo "<tr class=\".{$HTML->boxGetAltRowStyle}({$j})\">\n";
            echo "<td><a href=\"edit_survey.php?group_id={$group_id}&amp;survey_id=" . db_result($result, $j, 0) . "\">" . db_result($result, $j, 0) . "</a></td>";
            for ($i = 1; $i < $cols; $i++) {
                echo "<td>" . db_result($result, $j, $i) . "</td>\n";
            }
            echo "</tr>";
        }
        echo "</table>";
    }
}
コード例 #4
0
ファイル: PurgeCompleted.php プロジェクト: DSNS-LAB/Dmail
 /**
  * Purge completed tasks that were completed before the configured date.
  *
  * @return boolean  Whether any messages were purged from the mailbox.
  */
 public function execute()
 {
     global $injector, $prefs;
     /* Get the current UNIX timestamp minus the number of days specified
      * in 'purge_completed_keep'.  If a task has a timestamp prior to
      * this value, it will be deleted. */
     $del_time = new Horde_Date($_SERVER['REQUEST_TIME'] - $prefs->getValue('purge_completed_keep') * 86400);
     $del_time = $del_time->timestamp();
     $tasklists = Nag::listTasklists(true, Horde_Perms::DELETE, false);
     $tasks = Nag::listTasks(array('completed' => Nag::VIEW_COMPLETE, 'tasklists' => array_keys($tasklists)));
     $factory = $GLOBALS['injector']->getInstance('Nag_Factory_Driver');
     $count = 0;
     $tasks->reset();
     while ($task = $tasks->each()) {
         if ($task->completed_date && $task->completed_date < $del_time || !$task->completed_date && $task->modified && $task->modified->timestamp() < $del_time) {
             try {
                 $factory->create($task->tasklist)->delete($task->id);
                 ++$count;
             } catch (Nag_Exception $e) {
                 Horde::log($e->getMessage(), 'ERR');
             }
         }
     }
     $GLOBALS['notification']->push(sprintf(ngettext("Purging %d completed task.", "Purging %d completed tasks.", $count), $count), 'horde.message');
     return true;
 }
コード例 #5
0
ファイル: GT.php プロジェクト: Allopa/ZN-Framework-Starter
 public function datas($msgId1 = '', $msgId2 = '', $count = 0)
 {
     if (!is_string($msgId1) || !is_string($msgId2)) {
         return Error::set(lang('Error', 'stringParameter', '1.(msgId1) & 2.(msgId2)'));
     }
     return ngettext($msgId1, $msgId2, $count);
 }
コード例 #6
0
ファイル: StartNavigation.php プロジェクト: ratbird/hope
 public function initItem()
 {
     parent::initItem();
     if (is_object($GLOBALS['user']) && $GLOBALS['user']->id != 'nobody') {
         if (WidgetHelper::hasWidget($GLOBALS['user']->id, 'News')) {
             $news = StudipNews::CountUnread();
         }
         if (Config::get()->VOTE_ENABLE && WidgetHelper::hasWidget($GLOBALS['user']->id, 'Evaluations')) {
             $threshold = Config::get()->NEW_INDICATOR_THRESHOLD ? strtotime("-{" . Config::get()->NEW_INDICATOR_THRESHOLD . "} days 0:00:00") : 0;
             $statement = DBManager::get()->prepare("\n                    SELECT COUNT(*)\n                    FROM questionnaire_assignments\n                        INNER JOIN questionnaires ON (questionnaires.questionnaire_id = questionnaire_assignments.questionnaire_id)\n                    WHERE questionnaire_assignments.range_id = 'start'\n                        AND questionnaires.visible = 1\n                        AND questionnaires.startdate IS NOT NULL\n                        AND questionnaires.startdate > UNIX_TIMESTAMP()\n                        AND questionnaires.startdate > :threshold\n                        AND (questionnaires.stopdate IS NULL OR questionnaires.stopdate <= UNIX_TIMESTAMP())\n                ");
             $statement->execute(array('threshold' => $threshold));
             $vote = (int) $statement->fetchColumn();
             $query = "SELECT COUNT(IF(chdate > IFNULL(b.visitdate, :threshold) AND d.author_id != :user_id, a.eval_id, NULL))\n                          FROM eval_range a\n                          INNER JOIN eval d ON (a.eval_id = d.eval_id AND d.startdate < UNIX_TIMESTAMP() AND\n                                            (d.stopdate > UNIX_TIMESTAMP() OR d.startdate + d.timespan > UNIX_TIMESTAMP() OR (d.stopdate IS NULL AND d.timespan IS NULL)))\n                          LEFT JOIN object_user_visits b ON (b.object_id = d.eval_id AND b.user_id = :user_id AND b.type = 'eval')\n                          WHERE a.range_id = 'studip'\n                          GROUP BY a.range_id";
             $statement = DBManager::get()->prepare($query);
             $statement->bindValue(':user_id', $GLOBALS['user']->id);
             $statement->bindValue(':threshold', ($threshold = Config::get()->NEW_INDICATOR_THRESHOLD) ? strtotime("-{$threshold} days 0:00:00") : 0);
             $statement->execute();
             $vote += (int) $statement->fetchColumn();
         }
     }
     $homeinfo = _('Zur Startseite');
     if ($news) {
         $homeinfo .= ' - ';
         $homeinfo .= sprintf(ngettext('%u neue Ankündigung', '%u neue Ankündigungen', $news), $news);
     }
     if ($vote) {
         $homeinfo .= ' - ';
         $homeinfo .= sprintf(ngettext('%u neuer Fragebogen', '%u neue Fragebögen', $vote), $vote);
     }
     $this->setBadgeNumber($vote + $news);
     $this->setImage(Icon::create('home', 'navigation', ["title" => $homeinfo]));
 }
コード例 #7
0
ファイル: MessagingNavigation.php プロジェクト: ratbird/hope
 public function initItem()
 {
     global $user, $neux;
     parent::initItem();
     $my_messaging_settings = UserConfig::get($user->id)->MESSAGING_SETTINGS;
     $lastVisitedTimestamp = isset($my_messaging_settings['last_box_visit']) ? (int) $my_messaging_settings['last_box_visit'] : 0;
     $query = "SELECT SUM(mkdate > :time AND readed = 0) AS num_new,\n                         SUM(readed = 0) AS num_unread,\n                         SUM(readed = 1) AS num_read\n                  FROM message_user\n                  WHERE snd_rec = 'rec' AND user_id = :user_id AND deleted = 0";
     $statement = DBManager::get()->prepare($query);
     $statement->bindValue(':time', $lastVisitedTimestamp);
     $statement->bindValue(':user_id', $GLOBALS['user']->id);
     $statement->execute();
     list($neux, $neum, $altm) = $statement->fetch(PDO::FETCH_NUM);
     $this->setBadgeNumber($neum);
     if ($neux > 0) {
         $tip = sprintf(ngettext('Sie haben %d neue ungelesene Nachricht', 'Sie haben %d neue ungelesene Nachrichten', $neux), $neux);
     } else {
         if ($neum > 1) {
             $tip = sprintf(ngettext('Sie haben %d ungelesene Nachricht', 'Sie haben %d ungelesene Nachrichten', $neum), $neum);
         } else {
             if ($altm > 1) {
                 $tip = sprintf(ngettext('Sie haben %d alte empfangene Nachricht', 'Sie haben %d alte empfangene Nachrichten', $altm), $altm);
             } else {
                 $tip = _('Sie haben keine alten empfangenen Nachrichten');
             }
         }
     }
     $this->setImage(Icon::create('mail', 'navigation', ["title" => $tip]));
 }
コード例 #8
0
ファイル: Datetime.php プロジェクト: NicolasLarrouy/centreon
 /**
  * Convert a time in seconds to human readable string
  *
  * @param int $diff The time in seconds
  * @param int $precisionType The precision type for the string
  * @param int $precision The precision
  *                       The number of element if type is by format
  *                       The number of character if type is by characters
  * @return string
  */
 public static function humanReadable($diff, $precisionType = 1, $precision = 1)
 {
     /* List of format in Date interval */
     $listFormat = array('y' => array('year', 'years'), 'm' => array('month', 'months'), 'd' => array('day', 'days'), 'h' => array('hour', 'hours'), 'i' => array('min', 'min'), 's' => array('sec', 'sec'));
     $dateInterval = new DateInterval($diff);
     $formatedStr = '';
     $newFormatedStr = '';
     $count = 0;
     /* Prepare string */
     foreach ($listFormat as $format => $words) {
         if ($dateInterval->{$format} > 0) {
             if (strlen($newFormatedStr) > 0) {
                 $newFormatedStr .= ' ';
             }
             $newFormatedStr .= $dateInterval->{$format} . ' ' . ngettext($words[0], $words[1], $dateInterval->{$format});
             $count++;
         }
         /* Test for precision type format */
         if ($precisionType == self::PRECISION_FORMAT && $count >= $precision) {
             return $newFormatedStr;
         }
         /* Test for precision type character */
         if ($precisionType == self::PRECISION_CHAR && strlen($newFormatedStr) >= $precision) {
             if ($formatedStr === '') {
                 return $newFormatedStr;
             }
             return $formatedStr;
         }
         $formatedStr = $newFormatedStr;
     }
     return $formatedStr;
 }
コード例 #9
0
ファイル: Longemail.php プロジェクト: jubinpatel/horde
 /**
  */
 public function isValid(&$var, &$vars, $value, &$message)
 {
     $value = trim($value);
     if (empty($value)) {
         if ($var->isRequired()) {
             $message = _("This field is required.");
             return false;
         }
         return true;
     }
     $invalid = array();
     $rfc822 = $GLOBALS['injector']->getInstance('Horde_Mail_Rfc822');
     foreach (explode("\n", $value) as $address) {
         try {
             $rfc822->parseAddressList($address, array('validate' => true));
         } catch (Horde_Mail_Exception $e) {
             $invalid[] = $address;
         }
     }
     if (count($invalid)) {
         $message = sprintf(ngettext(_("\"%s\" is not a valid email address."), _("\"%s\" are not valid email addresses."), count($invalid)), implode(', ', $invalid));
         return false;
     }
     return true;
 }
コード例 #10
0
ファイル: Video.php プロジェクト: jubinpatel/horde
 /**
  * Return the rendered information about the Horde_Mime_Part object.
  *
  * @return array  See parent::render().
  */
 protected function _renderInfo()
 {
     global $registry;
     if ($registry->getView() == $registry::VIEW_MINIMAL) {
         return array();
     }
     $status = array();
     $mime_id = $this->_mimepart->getMimeId();
     $headers = Horde_Mime_Headers::parseHeaders($this->getConfigParam('imp_contents')->getBodyPart($mime_id, array('length' => 0, 'mimeheaders' => true, 'stream' => true))->data);
     if (($duration = $headers->getValue('content-duration')) !== null) {
         $text = array();
         if ($minutes = floor($duration / 60)) {
             $text[] = sprintf(ngettext(_("%d minute"), _("%d minutes"), $minutes), $minutes);
         }
         if ($seconds = $duration % 60) {
             $text[] = sprintf(ngettext(_("%d second"), _("%d seconds"), $seconds), $seconds);
         }
         $status[] = sprintf(_("This video file is reported to be %s in length."), implode(' ', $text));
     }
     if ($this->_thumbnailBinary()) {
         $status[] = _("This is a thumbnail of a video attachment.");
         $status[] = $this->getConfigParam('imp_contents')->linkViewJS($this->_mimepart, 'view_attach', '<img src="' . $this->getConfigParam('imp_contents')->urlView($this->_mimepart, 'view_attach', array('params' => array('imp_video_view' => 'view_thumbnail'))) . '" />', null, null, null);
     }
     if (empty($status)) {
         return array();
     }
     $s = new IMP_Mime_Status($status);
     $s->icon('mime/video.png');
     return array($this->_mimepart->getMimeId() => array('data' => '', 'status' => $s, 'type' => 'text/html; charset=UTF-8'));
 }
コード例 #11
0
ファイル: mediamanagerget.php プロジェクト: DeltaWolf7/Arc
function GetPath($path)
{
    $fullPath = system\Helper::arcGetPath(true) . "assets/" . $path . "/";
    $webPath = system\Helper::arcGetPath() . "assets" . $path;
    $files = scandir($fullPath);
    $html = "";
    foreach ($files as $file) {
        if ($file != "." && $file != "..") {
            $html .= "<tr>" . "<td style=\"width: 10px;\"><input type=\"checkbox\" id=\"{$file}\" onchange=\"mark('{$path}/{$file}')\"><label for=\"{$file}\"></label></td>";
            if (is_dir($fullPath . $file)) {
                // folder
                $fi = new FilesystemIterator($fullPath . $file, FilesystemIterator::SKIP_DOTS);
                $html .= "<td><i class=\"fa fa-folder-o\"></i> <a class=\"clickable\" onclick=\"getFolderPath('{$path}/{$file}')\">{$file}</a></td>" . "<td style=\"width: 10px;\">folder</td>" . "<td style=\"width: 10px;\">-</td>" . "<td style=\"width: 100px;\">" . iterator_count($fi) . ngettext(" item", " items", iterator_count($fi)) . "</td>" . "<td style=\"width: 100px;\">" . date("d M Y", filectime($fullPath . $file)) . "</td>";
            } else {
                // get file type
                $finfo = finfo_open(FILEINFO_MIME_TYPE);
                $filetype = finfo_file($finfo, $fullPath . $file);
                finfo_close($finfo);
                // file
                $html .= "<td><i class=\"" . GetFileTypeIcon($filetype) . "\"></i> <a class=\"clickable\" onclick=\"viewFile('{$webPath}/{$file}', '{$filetype}', '" . FileSizeConvert(filesize($fullPath . $file)) . "', '" . date("d M Y", filectime($fullPath . $file)) . "')\">{$file}<a/></td>" . "<td style=\"width: 10px;\">{$filetype}</td>" . "<td style=\"width: 10px;\"><a alt=\"Copy link to clipboard\" class=\"clickable\" onclick=\"copyToClipboard('{$webPath}/{$file}')\"><i class=\"fa fa-link\"></i></a></td>" . "<td style=\"width: 100px;\">" . FileSizeConvert(filesize($fullPath . $file)) . "</td>" . "<td style=\"width: 100px;\">" . date("d M Y", filectime($fullPath . $file)) . "</td>";
            }
            $html .= "</tr>";
        }
    }
    // no files
    if (count($files) == 2) {
        $html .= "<tr><td colspan=\"4\" class=\"text-center\">Folder is empty.</td></tr>";
    }
    return $html;
}
コード例 #12
0
ファイル: view_helper.php プロジェクト: iweave/unmark
function printMarksCount($num)
{
    if ($num > 0) {
        return sprintf(ngettext('%s mark', '%s marks', $num), $num);
    } else {
        return _('No marks');
    }
}
コード例 #13
0
ファイル: PurgeSentmail.php プロジェクト: horde/horde
 /**
  * Return information for the login task.
  *
  * @return string  Description of what the operation is going to do during
  *                 this login.
  */
 public function describe()
 {
     $mbox_list = array();
     foreach ($this->_getMboxes() as $val) {
         $mbox_list[] = $val->display_html;
     }
     return sprintf(ngettext("All messages in the mailbox \"%s\" older than %s days will be permanently deleted.", "All messages in the mailboxes \"%s\" older than %s days will be permanently deleted.", count($mbox_list)), implode(', ', $mbox_list), $GLOBALS['prefs']->getValue('purge_sentmail_keep'));
 }
コード例 #14
0
ファイル: Filter.php プロジェクト: jubinpatel/horde
 /**
  * Adds the From address from the message(s) to the blacklist and deletes
  * the message(s).
  *
  * @param IMP_Indices $indices  An indices object.
  * @param boolean $show_link    Show link to the blacklist management in
  *                              the notification message?
  *
  * @return boolean  True if the messages(s) were deleted.
  * @throws Horde_Exception
  */
 public function blacklistMessage($indices, $show_link = true)
 {
     if (!$this->_processBWlist($indices, _("your blacklist"), 'blacklistFrom', 'showBlacklist', $show_link) || !($msg_count = $GLOBALS['injector']->getInstance('IMP_Message')->delete($indices))) {
         return false;
     }
     $GLOBALS['notification']->push(ngettext("The message has been deleted.", "The messages have been deleted.", $msg_count), 'horde.message');
     return true;
 }
コード例 #15
0
ファイル: Native.php プロジェクト: jinshana/tangocms
 /**
  * Plural version of t()
  *
  * @param string $string1
  * @param string $string2
  * @param int $n
  * @param string $textDomain	Textdomain to use
  * @return string
  */
 public function nt($string1, $string2, $n, $textDomain = null)
 {
     if (empty($textDomain)) {
         return ngettext($string1, $string2, $n);
     } else {
         return dngettext($textDomain, $string1, $string2, $n);
     }
 }
コード例 #16
0
function make_feed_browser($search, $limit, $mode = 1)
{
    $owner_uid = $_SESSION["uid"];
    $rv = '';
    if ($search) {
        $search_qpart = "AND (UPPER(feed_url) LIKE UPPER('%{$search}%') OR\n\t\t\t\t\t\tUPPER(title) LIKE UPPER('%{$search}%'))";
    } else {
        $search_qpart = "";
    }
    if ($mode == 1) {
        /* $result = db_query("SELECT feed_url, subscribers FROM
        			 ttrss_feedbrowser_cache WHERE (SELECT COUNT(id) = 0 FROM ttrss_feeds AS tf
        			WHERE tf.feed_url = ttrss_feedbrowser_cache.feed_url
        			AND owner_uid = '$owner_uid') $search_qpart
        			ORDER BY subscribers DESC LIMIT $limit"); */
        $result = db_query("SELECT feed_url, site_url, title, SUM(subscribers) AS subscribers FROM\n\t\t\t\t\t\t(SELECT feed_url, site_url, title, subscribers FROM ttrss_feedbrowser_cache UNION ALL\n\t\t\t\t\t\t\tSELECT feed_url, site_url, title, subscribers FROM ttrss_linked_feeds) AS qqq\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t(SELECT COUNT(id) = 0 FROM ttrss_feeds AS tf\n\t\t\t\t\t\t\t\tWHERE tf.feed_url = qqq.feed_url\n\t\t\t\t\t\t\t\t\tAND owner_uid = '{$owner_uid}') {$search_qpart}\n\t\t\t\t\t\tGROUP BY feed_url, site_url, title ORDER BY subscribers DESC LIMIT {$limit}");
    } else {
        if ($mode == 2) {
            $result = db_query("SELECT *,\n\t\t\t\t\t\t(SELECT COUNT(*) FROM ttrss_user_entries WHERE\n\t\t\t\t\t \t\torig_feed_id = ttrss_archived_feeds.id) AS articles_archived\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\tttrss_archived_feeds\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t(SELECT COUNT(*) FROM ttrss_feeds\n\t\t\t\t\t\t\tWHERE ttrss_feeds.feed_url = ttrss_archived_feeds.feed_url AND\n\t\t\t\t\t\t\t\towner_uid = '{$owner_uid}') = 0\tAND\n\t\t\t\t\t\towner_uid = '{$owner_uid}' {$search_qpart}\n\t\t\t\t\t\tORDER BY id DESC LIMIT {$limit}");
        }
    }
    $feedctr = 0;
    while ($line = db_fetch_assoc($result)) {
        if ($mode == 1) {
            $feed_url = htmlspecialchars($line["feed_url"]);
            $site_url = htmlspecialchars($line["site_url"]);
            $subscribers = $line["subscribers"];
            $check_box = "<input onclick='toggleSelectListRow2(this)'\n\t\t\t\t\t\t\tdojoType=\"dijit.form.CheckBox\"\n\t\t\t\t\t\t\ttype=\"checkbox\" \">";
            $class = $feedctr % 2 ? "even" : "odd";
            $site_url = "<a target=\"_blank\"\n\t\t\t\t\t\t\thref=\"{$site_url}\">\n\t\t\t\t\t\t\t<span class=\"fb_feedTitle\">" . htmlspecialchars($line["title"]) . "</span></a>";
            $feed_url = "<a target=\"_blank\" class=\"fb_feedUrl\"\n\t\t\t\t\t\t\thref=\"{$feed_url}\"><img src='images/pub_set.svg'\n\t\t\t\t\t\t\tstyle='vertical-align : middle'></a>";
            $rv .= "<li>{$check_box} {$feed_url} {$site_url}" . "&nbsp;<span class='subscribers'>({$subscribers})</span></li>";
        } else {
            if ($mode == 2) {
                $feed_url = htmlspecialchars($line["feed_url"]);
                $site_url = htmlspecialchars($line["site_url"]);
                $title = htmlspecialchars($line["title"]);
                $check_box = "<input onclick='toggleSelectListRow2(this)' dojoType=\"dijit.form.CheckBox\"\n\t\t\t\t\t\t\ttype=\"checkbox\">";
                $class = $feedctr % 2 ? "even" : "odd";
                if ($line['articles_archived'] > 0) {
                    $archived = sprintf(ngettext("%d archived article", "%d archived articles", $line['articles_archived']), $line['articles_archived']);
                    $archived = "&nbsp;<span class='subscribers'>({$archived})</span>";
                } else {
                    $archived = '';
                }
                $site_url = "<a target=\"_blank\"\n\t\t\t\t\t\t\thref=\"{$site_url}\">\n\t\t\t\t\t\t\t<span class=\"fb_feedTitle\">" . htmlspecialchars($line["title"]) . "</span></a>";
                $feed_url = "<a target=\"_blank\" class=\"fb_feedUrl\"\n\t\t\t\t\t\t\thref=\"{$feed_url}\"><img src='images/pub_set.svg'\n\t\t\t\t\t\t\tstyle='vertical-align : middle'></a>";
                $rv .= "<li id=\"FBROW-" . $line["id"] . "\">" . "{$check_box} {$feed_url} {$site_url} {$archived}</li>";
            }
        }
        ++$feedctr;
    }
    if ($feedctr == 0) {
        $rv .= "<li style=\"text-align : center\"><p>" . __('No feeds found.') . "</p></li>";
    }
    return $rv;
}
コード例 #17
0
function seconds_to_string($secs, $short_tags = true)
{
    $units = array("weeks" => 7 * 24 * 3600, "days" => 24 * 3600, "hours" => 3600, "minutes" => 60, "seconds" => 1);
    foreach ($units as &$unit) {
        $quot = intval($secs / $unit);
        $secs -= $quot * $unit;
        $unit = $quot;
    }
    $string = '';
    //$filled_units=array();
    foreach ($units as $key => $value) {
        if ($value) {
            //$filled_units[$key]=$value;
            switch ($key) {
                case 'weeks':
                    if ($short_tags) {
                        $string .= sprintf("%dw", $value);
                    } else {
                        $string .= sprintf(ngettext("%d week", "%d weeks", $value), $value);
                    }
                    break 2;
                case 'days':
                    if ($short_tags) {
                        $string .= sprintf("%dd", $value);
                    } else {
                        $string .= ' ' . sprintf(ngettext("%d day", "%d days", $value), $value);
                    }
                    break 2;
                case 'hours':
                    if ($short_tags) {
                        $string .= sprintf("%hw", $value);
                    } else {
                        $string .= ' ' . sprintf(ngettext("%d hour", "%d hours", $value), $value);
                    }
                    break 2;
                case 'minutes':
                    if ($short_tags) {
                        $string .= sprintf("%dm", $value);
                    } else {
                        $string .= ' ' . sprintf(ngettext("%d minute", "%d minutes", $value), $value);
                    }
                    break 2;
                case 'seconds':
                    if ($short_tags) {
                        $string .= sprintf("%ds", $value);
                    } else {
                        $string .= ' ' . sprintf(ngettext("%d second", "%d seconds", $value), $value);
                    }
                    break;
            }
        }
    }
    $string = trim($string);
    return $string;
}
コード例 #18
0
ファイル: Import.php プロジェクト: jubinpatel/horde
 /**
  * Import a MBOX file into a mailbox.
  *
  * @param string $mbox       The mailbox name to import into (UTF-8).
  * @param string $form_name  The form field name that contains the MBOX
  *                           data.
  *
  * @return string  Notification message.
  * @throws Horde_Exception
  */
 public function import($mbox, $form_name)
 {
     $GLOBALS['browser']->wasFileUploaded($form_name, _("mailbox file"));
     $this->_mbox = $mbox;
     $res = $this->_import($_FILES[$form_name]['tmp_name'], $_FILES[$form_name]['type']);
     $mbox_name = basename(Horde_Util::dispelMagicQuotes($_FILES[$form_name]['name']));
     if ($res === false) {
         throw new IMP_Exception(sprintf(_("There was an error importing %s."), $mbox_name));
     }
     return sprintf(ngettext('Imported %d message from %s.', 'Imported %d messages from %s', $res), $res, $mbox_name);
 }
コード例 #19
0
ファイル: i18n.php プロジェクト: Jamp/sgas
 /**
  * Obtiene una traduccion al plural, cuando se pasan argumentos adicionales se remplaza con sprintf
  *
  * @param string $sentence1 mensaje en singular
  * @param string $sentence2 mensaje en plural
  * @param int $n conteo
  * @return string
  * */
 public static function nget($sentence1, $sentence2, $n)
 {
     /**
      * Obtengo la traduccion
      * */
     $sentence = ngettext($sentence1, $sentence2, $n);
     /**
      * Si se pasan multiples parametros
      * */
     if (func_num_args() > 3) {
         $sentence = $sentence = self::sprintf($sentence, func_get_args(), 3);
     }
     return $sentence;
 }
コード例 #20
0
 /**
  * Get the translation for a given key.
  *
  * @param  string | array  $key
  * @return string
  */
 public function trans($key, $number = null)
 {
     $this->locale();
     if ($number !== null) {
         if (!is_array($key)) {
             $key = array($key, $key);
         }
         return sprintf(ngettext($key[0], $key[1], $number), $number);
     }
     if (is_array($key)) {
         return gettext(reset($key));
     }
     return gettext($key);
 }
コード例 #21
0
/**
 * Display a hint for team/angeltype coordinators if there are unconfirmed users for his angeltype.
 */
function user_angeltypes_unconfirmed_hint()
{
    global $user;
    $unconfirmed_user_angeltypes = User_unconfirmed_AngelTypes($user);
    if ($unconfirmed_user_angeltypes === false) {
        engelsystem_error("Unable to load user angeltypes.");
    }
    if (count($unconfirmed_user_angeltypes) == 0) {
        return '';
    }
    $unconfirmed_links = [];
    foreach ($unconfirmed_user_angeltypes as $user_angeltype) {
        $unconfirmed_links[] = '<a href="' . page_link_to('angeltypes') . '&action=view&angeltype_id=' . $user_angeltype['angeltype_id'] . '">' . $user_angeltype['name'] . ' (+' . $user_angeltype['count'] . ')' . '</a>';
    }
    return info(sprintf(ngettext("There is %d unconfirmed angeltype.", "There are %d unconfirmed angeltypes.", count($unconfirmed_user_angeltypes)), count($unconfirmed_user_angeltypes)) . " " . _('Angel types which need approvals:') . ' ' . join(', ', $unconfirmed_links), true);
}
コード例 #22
0
ファイル: ar_fork.php プロジェクト: inikoo/fact
function get_wait_info($data)
{
    require_once 'common_natural_language.php';
    global $mysqli;
    $fork_key = $data['fork_key'];
    $sql = sprintf("select `Fork Key`,`Fork Result`,`Fork Scheduled Date`,`Fork Start Date`,`Fork State`,`Fork Type`,`Fork Operations Done`,`Fork Operations No Changed`,`Fork Operations Errors`,`Fork Operations Total Operations` from `Fork Dimension` where `Fork Key`=%d ", $fork_key);
    $res = $mysqli->query($sql);
    if ($row = $res->fetch_assoc()) {
        $result_extra_data = array();
        switch ($data['tag']) {
            case 'journals':
                $formated_tag = ' ' . ngettext('journal', 'journals', $row['Fork Operations Total Operations']);
                break;
            default:
                $formated_tag = ' ' . ngettext('record', 'records', $row['Fork Operations Total Operations']);
        }
        $etr = '';
        if ($row['Fork State'] == 'In Process') {
            //$msg=number($row['Fork Operations Done']+$row['Fork Operations Errors']+$row['Fork Operations No Changed']).'/'.$row['Fork Operations Total Operations'];
            $formated_status = _('In Process');
            $formated_progress = _('Processing') . ' ' . number($row['Fork Operations Done']) . ' ' . _('of') . ' ' . number($row['Fork Operations Total Operations']);
            $formated_progress .= $formated_tag;
            if ($row['Fork Operations Done'] > 1) {
                $etr = _('ETA') . ': ' . seconds_to_string(($row['Fork Operations Total Operations'] - $row['Fork Operations Done']) * (gmdate('U') - strtotime($row['Fork Start Date'])) / $row['Fork Operations Done']);
            }
        } elseif ($row['Fork State'] == 'Queued') {
            $formated_status = _('Queued');
            $formated_progress = _('Records to process') . ': ' . number($row['Fork Operations Total Operations']);
        } elseif ($row['Fork State'] == 'Finished') {
            $formated_status = _('Finished');
            $formated_progress = number($row['Fork Operations Done']) . $formated_tag . ' ' . _('processed');
        } elseif ($row['Fork State'] == 'Cancelled') {
            $formated_status = _('Cancelled');
            $formated_progress = number($row['Fork Operations Done']) . $formated_tag . ' ' . _('processed');
        } else {
            $formated_status = $row['Fork State'];
            $formated_progress = '';
        }
        $response = array('state' => 200, 'date' => gmdate('Y-m-d H:i:s'), 'fork_key' => $fork_key, 'fork_state' => $row['Fork State'], 'done' => number($row['Fork Operations Done']), 'no_changed' => number($row['Fork Operations No Changed']), 'errors' => number($row['Fork Operations Errors']), 'total' => number($row['Fork Operations Total Operations']), 'todo' => number($row['Fork Operations Total Operations'] - $row['Fork Operations Done']), 'result' => $row['Fork Result'], 'formated_status' => $formated_status, 'formated_progress' => $formated_progress . '<br>' . $etr, 'progress' => sprintf('%s/%s (%s)', number($row['Fork Operations Done']), number($row['Fork Operations Total Operations']), percentage($row['Fork Operations Done'], $row['Fork Operations Total Operations'])), 'tag' => $data['tag'], 'result_extra_data' => $result_extra_data, 'etr' => $etr);
        echo json_encode($response);
    } else {
        $response = array('state' => 400);
        echo json_encode($response);
    }
}
コード例 #23
0
function status($action, $result, $values = FALSE)
{
    if ($action == 'RENT') {
        if ($result == OK) {
            $message = '<h3>' . _('Bike') . ' ' . $values->bikenum . ': <span class="label label-primary">' . _('Open with code') . ' ' . $values->bike->currentcode . '.</span></h3>' . _('Change code immediately to') . ' <span class="label label-default">' . $values->newcode . '</span><br />' . _('(open, rotate metal part, set new code, rotate metal part back)') . '.';
            if (isset($values->note)) {
                $message .= "<br />" . _('Reported issue:') . " <em>" . $values->note . "</em>";
            }
            response($message);
        } elseif ($result == 100) {
            response(_('You can not rent any bikes. Contact the admins to lift the ban.'), ERROR);
        } elseif ($result == 101) {
            response(_('You can only rent') . " " . sprintf(ngettext('%d bike', '%d bikes', $values->userlimit), $values->userlimit) . " " . _('at once') . ".", ERROR);
        } elseif ($result == 102) {
            response(_('You can only rent') . " " . sprintf(ngettext('%d bike', '%d bikes', $values->userlimit), $values->userlimit) . " " . _('at once and you have already rented') . " " . $values->userlimit . ".", ERROR);
        } elseif ($result == 110) {
            response(_('Bike') . " " . $values->bikenum . " " . _('is not rentable now, you have to rent bike') . " " . $values->stacktopbike . " " . _('from this stand') . ".", ERROR);
        } elseif ($result == 120) {
            response(_('You have already rented the bike') . ' ' . $values->bikenum . '. ' . _('Code is') . ' <span class="label label-primary">' . $values->currentcode . '</span>. ' . _('Return bike by scanning QR code on a stand') . '.', ERROR);
        } elseif ($result == 121) {
            response(_('Bike') . " " . $values->bikenum . " " . _('is already rented by someone else') . ".", ERROR);
        } elseif ($result == 130) {
            response(_('You are below required credit') . " " . $values->requiredcredit . getcreditcurrency() . ". " . _('Please, recharge your credit.'), ERROR);
        }
    } elseif ($action == 'RETURN') {
        if ($result == OK) {
            $message = '<h3>' . _('Bike') . ' ' . $values->bikenum . ': <span class="label label-primary">' . _('Lock with code') . ' ' . $values->currentcode . '.</span></h3>';
            $message .= '<br />' . _('Please') . ', <strong>' . _('rotate the lockpad to') . ' <span class="label label-default">0000</span></strong> ' . _('when leaving') . '.';
            if (iscreditenabled() and isset($values->creditchange)) {
                $message .= '<br />' . _('Credit change') . ': -' . $values->creditchange . getcreditcurrency() . '.';
            }
            response($message);
        } elseif ($result == 100) {
            response(_('You have no rented bikes currently.'), ERROR);
        } elseif ($result == 101) {
            $message = _('You have') . ' ' . $values->countrented . ' ' . _('rented bikes currently. QR code return can be used only when 1 bike is rented. Please, use web');
            if ($connectors["sms"]) {
                $message .= _(' or SMS');
            }
            $message .= _(' to return the bikes.');
            response($message, ERROR);
        }
    }
    response('Unhandled status ' . $result . ' in ' . $action . ' in file ' . __FILE__ . '.', ERROR);
}
コード例 #24
0
ファイル: Audio.php プロジェクト: DSNS-LAB/Dmail
 /**
  * Return the rendered information about the Horde_Mime_Part object.
  *
  * @return array  See parent::render().
  */
 protected function _renderInfo()
 {
     $mime_id = $this->_mimepart->getMimeId();
     $headers = Horde_Mime_Headers::parseHeaders($this->getConfigParam('imp_contents')->getBodyPart($mime_id, array('length' => 0, 'mimeheaders' => true, 'stream' => true))->data);
     if (($duration = $headers->getValue('content-duration')) === null) {
         return array();
     }
     $text = array();
     if ($minutes = floor($duration / 60)) {
         $text[] = sprintf(ngettext(_("%d minute"), _("%d minutes"), $minutes), $minutes);
     }
     if ($seconds = $duration % 60) {
         $text[] = sprintf(ngettext(_("%d second"), _("%d seconds"), $seconds), $seconds);
     }
     $status = new IMP_Mime_Status(sprintf(_("This audio file is reported to be %s in length."), implode(' ', $text)));
     $status->icon('mime/audio.png');
     return array($this->_mimepart->getMimeId() => array('data' => '', 'status' => $status, 'type' => 'text/html; charset=UTF-8'));
 }
コード例 #25
0
ファイル: PurgeTrash.php プロジェクト: DSNS-LAB/Dmail
 /**
  * Purge old messages in the Trash mailbox.
  *
  * @return boolean  Whether any messages were purged from the mailbox.
  */
 public function execute()
 {
     global $injector, $notification, $prefs;
     /* Get the current UNIX timestamp minus the number of days
        specified in 'purge_trash_keep'.  If a message has a
        timestamp prior to this value, it will be deleted. */
     $del_time = new Horde_Date(time() - $prefs->getValue('purge_trash_keep') * 86400);
     /* Get the list of messages older than 'purge_trash_keep' days. */
     $query = new Horde_Imap_Client_Search_Query();
     $query->dateSearch($del_time, Horde_Imap_Client_Search_Query::DATE_BEFORE);
     $msg_ids = IMP_Mailbox::getPref(IMP_Mailbox::MBOX_TRASH)->runSearchQuery($query);
     /* Go through the message list and delete the messages. */
     if (!$injector->getInstance('IMP_Message')->delete($msg_ids, array('nuke' => true))) {
         return false;
     }
     $msgcount = count($msg_ids);
     $notification->push(sprintf(ngettext("Purging %d message from Trash mailbox.", "Purging %d messages from Trash mailbox.", $msgcount), $msgcount), 'horde.message');
     return true;
 }
コード例 #26
0
ファイル: i18n.php プロジェクト: ocidfigueroa/sice
 /**
  * Obtiene una traduccion al plural, cuando se pasan argumentos adicionales se remplaza con sprintf
  *
  * @param string $sentence1 mensaje en singular
  * @param string $sentence2 mensaje en plural
  * @param int $n conteo
  * @return string
  * */
 public static function nget($sentence1, $sentence2, $n)
 {
     /**
      * Obtengo la traduccion
      * */
     $sentence = ngettext($sentence1, $sentence2, $n);
     /**
      * Si se pasan multiples parametros
      * */
     if (func_num_args() > 3) {
         $args = func_get_args();
         /**
          * Se remplaza con vsprintf
          * */
         unset($args[0], $args[1], $args[2]);
         $sentence = vsprintf($sentence, $args);
     }
     return $sentence;
 }
コード例 #27
0
ファイル: media.php プロジェクト: nb/wp-cli
 /**
  * Regenerate thumbnail(s).
  *
  * ## OPTIONS
  *
  * [<attachment-id>...]
  * : One or more IDs of the attachments to regenerate.
  *
  * [--yes]
  * : Answer yes to the confirmation message.
  *
  * ## EXAMPLES
  *
  *     # re-generate all thumbnails, without confirmation
  *     wp media regenerate --yes
  *
  *     # re-generate all thumbnails that have IDs between 1000 and 2000
  *     seq 1000 2000 | xargs wp media regenerate
  */
 function regenerate($args, $assoc_args = array())
 {
     global $wpdb;
     if (empty($args)) {
         WP_CLI::confirm('Do you realy want to regenerate all images?', $assoc_args);
     }
     $query_args = array('post_type' => 'attachment', 'post__in' => $args, 'post_mime_type' => 'image', 'post_status' => 'any', 'posts_per_page' => -1, 'fields' => 'ids');
     $images = new WP_Query($query_args);
     $count = $images->post_count;
     if (!$count) {
         WP_CLI::warning('No images found.');
         return;
     }
     WP_CLI::log(sprintf('Found %1$d %2$s to regenerate.', $count, ngettext('image', 'images', $count)));
     foreach ($images->posts as $id) {
         $this->_process_regeneration($id);
     }
     WP_CLI::success(sprintf('Finished regenerating %1$s.', ngettext('the image', 'all images', $count)));
 }
コード例 #28
0
 public function participantesAction()
 {
     $this->autenticacao();
     $cancelar = $this->getRequest()->getPost('cancelar');
     if (isset($cancelar)) {
         return $this->_helper->redirector->goToRoute(array('controller' => 'caravana', 'action' => 'index'), null, true);
     }
     $cache = Zend_Registry::get('cache_common');
     $ps = $cache->load('prefsis');
     $idEncontro = (int) $ps->encontro["id_encontro"];
     $sessao = Zend_Auth::getInstance()->getIdentity();
     $idPessoa = $sessao["idPessoa"];
     $caravanaEncontro = new Application_Model_CaravanaEncontro();
     $rs = $caravanaEncontro->lerResponsavelCaravana($idEncontro, $idPessoa);
     $this->view->caravana = $rs;
     if ($this->getRequest()->isPost()) {
         $submit = $this->getRequest()->getPost('submit');
         if (isset($submit)) {
             $array_id_pessoas = explode(",", $this->getRequest()->getPost('array_id_pessoas'));
             // se não existir e-mail a ser adicionado a caravana
             // explode retorna array(0 => "") http://php.net/manual/pt_BR/function.explode.php
             if (count($array_id_pessoas) == 1 && empty($array_id_pessoas[0])) {
                 $this->_helper->flashMessenger->addMessage(array('warning' => _('No participant was selected.')));
             } else {
                 $where = array($this->view->caravana['id_caravana'], $idEncontro, $idEncontro);
                 $where = array_merge($where, $array_id_pessoas);
                 try {
                     $result = $caravanaEncontro->updateParticipantesCaravana($where);
                     if ($result) {
                         $success = sprintf(ngettext("One participant added to this caravan successfully.", "%d participants added to this caravan successfully.", $result), $result);
                         $this->_helper->flashMessenger->addMessage(array('success' => $success));
                     } else {
                         $this->_helper->flashMessenger->addMessage(array('warning' => _('No participant was added to this caravan.')));
                     }
                 } catch (Exception $e) {
                     $this->_helper->flashMessenger->addMessage(array('danger' => _('An unexpected error ocurred.<br/> Details:&nbsp;') . $e->getMessage()));
                 }
             }
         }
     }
     $this->view->participantes = $caravanaEncontro->buscaParticipantes($this->view->caravana['id_caravana'], $idEncontro);
 }
コード例 #29
0
ファイル: UsersList.class.php プロジェクト: skdong/nfs-ovd
 function getForm($form_params_ = array('action' => 'search'))
 {
     $str = '';
     $str .= '<div style="margin-bottom: 15px;">';
     $str .= '<form action="" method="GET">';
     foreach ($form_params_ as $k => $v) {
         $str .= '<input type="hidden" name="' . $k . '" value="' . $v . '"/>';
     }
     $str .= '<table><tr>';
     $str .= '<td>' . _('Search for user pattern: ') . '</td>';
     $str .= '<td><input type="text" name="search_item" value="' . $this->search_item . '" /> ';
     $str .= '<input type="submit" value="' . _('Search') . '" /><td>';
     $str .= '</tr><tr><td></td>';
     $str .= '<td>' . _('Search in: ');
     $str .= '<input type="checkbox" name="search_fields[]" value="login"';
     if (in_array('login', $this->search_fields)) {
         $str .= ' checked="checked"';
     }
     $str .= '>' . _('Login') . ' ';
     $str .= '<input type="checkbox" name="search_fields[]" value="displayname"';
     if (in_array('displayname', $this->search_fields)) {
         $str .= ' checked="checked"';
     }
     $str .= '>' . _('Display name') . ' ';
     $str .= '</td></tr>';
     $str .= '<tr><td></td>';
     $str .= '<td>';
     if ($this->partial_result == true) {
         $str .= '<span class="error">';
         $str .= sprintf(ngettext("<strong>Partial content:</strong> Only <strong>%d result</strong> displayed but there are more. Please restrict your search field.", "<strong>Partial content:</strong> Only <strong>%d results</strong> displayed but there are more. Please restrict your search field.", $this->search_limit), $this->search_limit);
         $str .= '</span>';
     } else {
         if (strlen($this->search_item) > 0) {
             $str .= sprintf(ngettext('<strong>%d</strong> result for "%s".', '<strong>%d</strong> results for "%s".', count($this->result)), count($this->result), $this->search_item);
         }
     }
     $str .= '</td></tr>';
     $str .= '</table>';
     $str .= '</form>';
     $str .= '</div>';
     return $str;
 }
コード例 #30
0
ファイル: CalendarExport.class.php プロジェクト: ratbird/hope
    function exportFromObjects($events)
    {
        global $_calendar_error;

        $this->_export($this->_writer->writeHeader());

        $this->count = 0;
        foreach ($events as $event) {
            $this->_export($this->_writer->write($event));
            $this->count++;
        }

        if (!sizeof($events)) {
            $message = _('Es wurden keine Termine exportiert.');
        } else {
            $message = sprintf(ngettext('Es wurde 1 Termin exportiert', 'Es wurden %s Termine exportiert', sizeof($events)), sizeof($events));
        }
        
        $this->_export($this->_writer->writeFooter());
    }