/**
  * Formatiert den String <code>$value</code>
  *
  * @param $value zu formatierender String
  * @param $format_type Formatierungstype
  * @param $format Format
  *
  * Unterstützte Formatierugen:
  *
  * - <Formatierungstype>
  *    + <Format>
  *
  * - sprintf
  *    + siehe www.php.net/sprintf
  * - date
  *    + siehe www.php.net/date
  * - strftime
  *    + dateformat
  *    + datetime
  *    + siehe www.php.net/strftime
  * - number
  *    + siehe www.php.net/number_format
  *    + array( <Kommastelle>, <Dezimal Trennzeichen>, <Tausender Trennzeichen>)
  * - email
  *    + array( 'attr' => <Linkattribute>, 'params' => <Linkparameter>,
  * - url
  *    + array( 'attr' => <Linkattribute>, 'params' => <Linkparameter>,
  * - truncate
  *    + array( 'length' => <String-Laenge>, 'etc' => <ETC Zeichen>, 'break_words' => <true/false>,
  * - nl2br
  *    + siehe www.php.net/nl2br
  * - rexmedia
  *    + formatiert ein Medium via OOMedia
  * - custom
  *    + formatiert den Wert anhand einer Benutzer definierten Callback Funktion
  */
 function format($value, $format_type, $format)
 {
     // Stringformatierung mit sprintf()
     if ($format_type == 'sprintf') {
         $value = rex_formatter::_formatSprintf($value, $format);
     } elseif ($format_type == 'date') {
         $value = rex_formatter::_formatDate($value, $format);
     } elseif ($format_type == 'strftime') {
         $value = rex_formatter::_formatStrftime($value, $format);
     } elseif ($format_type == 'number') {
         $value = rex_formatter::_formatNumber($value, $format);
     } elseif ($format_type == 'email') {
         $value = rex_formatter::_formatEmail($value, $format);
     } elseif ($format_type == 'url') {
         $value = rex_formatter::_formatUrl($value, $format);
     } elseif ($format_type == 'truncate') {
         $value = rex_formatter::_formatTruncate($value, $format);
     } elseif ($format_type == 'nl2br') {
         $value = rex_formatter::_formatNl2br($value, $format);
     } elseif ($format_type == 'rexmedia' && $value != '') {
         $value = rex_formatter::_formatRexMedia($value, $format);
     } elseif ($format_type == 'rexurl' && $value != '') {
         $value = rex_formatter::_formatRexUrl($value, $format);
     } elseif ($format_type == 'custom') {
         $value = rex_formatter::_formatCustom($value, $format);
     }
     return $value;
 }
 /**
  * Formatiert den String <code>$value</code>
  *
  * @param $value zu formatierender String
  * @param $format_type Formatierungstype
  * @param $format Format
  *
  * Unterstützte Formatierugen:
  *
  * - <Formatierungstype>
  *    + <Format>
  *
  * - sprintf
  *    + siehe www.php.net/sprintf
  * - date
  *    + siehe www.php.net/date
  * - strftime
  *    + dateformat
  *    + datetime
  *    + siehe www.php.net/strftime
  * - number
  *    + siehe www.php.net/number_format
  *    + array( <Kommastelle>, <Dezimal Trennzeichen>, <Tausender Trennzeichen>)
  * - email
  *    + array( 'attr' => <Linkattribute>, 'params' => <Linkparameter>,
  * - url
  *    + array( 'attr' => <Linkattribute>, 'params' => <Linkparameter>,
  * - truncate
  *    + array( 'length' => <String-Laenge>, 'etc' => <ETC Zeichen>, 'break_words' => <true/false>,
  * - nl2br
  *    + siehe www.php.net/nl2br
  * - rexmedia
  *    + formatiert ein Medium via OOMedia
  * - custom
  *    + formatiert den Wert anhand einer Benutzer definierten Callback Funktion
  */
 function format($value, $format_type, $format)
 {
     global $I18N, $REX;
     if ($value === null || $value == '') {
         return '';
     }
     // Stringformatierung mit sprintf()
     if ($format_type == 'sprintf') {
         $value = rex_formatter::_formatSprintf($value, $format);
     } elseif ($format_type == 'date') {
         $value = rex_formatter::_formatDate($value, $format);
     } elseif ($format_type == 'strftime') {
         $value = rex_formatter::_formatStrftime($value, $format);
     } elseif ($format_type == 'number') {
         $value = rex_formatter::_formatNumber($value, $format);
     } elseif ($format_type == 'email') {
         $value = rex_formatter::_formatEmail($value, $format);
     } elseif ($format_type == 'url') {
         $value = rex_formatter::_formatUrl($value, $format);
     } elseif ($format_type == 'truncate') {
         $value = rex_formatter::_formatTruncate($value, $format);
     } elseif ($format_type == 'nl2br') {
         $value = rex_formatter::_formatNl2br($value, $format);
     } elseif ($format_type == 'rexmedia' && $value != '') {
         $value = rex_formatter::_formatRexMedia($value, $format);
     } elseif ($format_type == 'custom') {
         $value = rex_call_func($format, $value);
     }
     return $value;
 }
 function formatValue()
 {
     $value = $this->getValue();
     $format_type = $this->getFormatType();
     if ($format_type != '') {
         $value = rex_formatter::format($value, $format_type, $this->getFormat());
     }
     return $value;
 }
Exemplo n.º 4
0
 /**
  * Extends rex_extension::registerPoint() with FirePHP logging.
  */
 public static function registerPoint(rex_extension_point $extensionPoint)
 {
     $coreTimer = rex::getProperty('timer');
     $absDur = $coreTimer->getFormattedDelta();
     // start timer for this extensionPoint
     $timer = new rex_timer();
     $res = parent::registerPoint($extensionPoint);
     $epDur = $timer->getFormattedDelta();
     $memory = rex_formatter::bytes(memory_get_usage(true), [3]);
     self::$log[] = ['type' => 'EP', 'ep' => $extensionPoint->getName(), 'started' => $absDur, 'duration' => $epDur, 'memory' => $memory, 'subject' => $extensionPoint->getSubject(), 'params' => $extensionPoint->getParams(), 'read_only' => $extensionPoint->isReadonly(), 'result' => $res, 'timer' => $epDur];
     return $res;
 }
 function get()
 {
     global $REX;
     if ($this->checkPermission()) {
         $callable = array($this, '_get');
         $cachekey = $this->funcCache->computeCacheKey($callable, array($REX['USER']->getUserLogin()));
         $cacheBackend = $this->funcCache->getCache();
         $configForm = '';
         if ($this->config) {
             $configForm = $this->config ? $this->config->get() : '';
             // config changed -> remove cache to reflect changes
             if ($this->config->changed()) {
                 $cacheBackend->remove($cachekey);
             }
         }
         // refresh clicked in actionbar
         if (rex_get('refresh', 'string') == $this->getId()) {
             $cacheBackend->remove($cachekey);
         }
         // prueft ob inhalte des callables gecacht vorliegen
         $content = $this->funcCache->call($callable, array($REX['USER']->getUserLogin()));
         // wenn gecachter inhalt leer ist, vom cache entfernen und nochmals checken
         // damit leere komponenten sofort angezeigt werden, wenn neue inhalte verfuegbar sind
         if ($content == '') {
             $cacheBackend->remove($cachekey);
             $content = $this->funcCache->call($callable, array($REX['USER']->getUserLogin()));
         }
         $cachestamp = $cacheBackend->getLastModified($cachekey);
         if (!$cachestamp) {
             $cachestamp = time();
         }
         // falls kein gueltiger cache vorhanden
         $cachetime = rex_formatter::format($cachestamp, 'strftime', 'datetime');
         $content = strtr($content, array('%%actionbar%%' => $this->getActionBar()));
         $content = strtr($content, array('%%cachetime%%' => $cachetime));
         $content = strtr($content, array('%%config%%' => $configForm));
         // refresh clicked in actionbar
         if (rex_get('ajax-get', 'string') == $this->getId()) {
             // clear output-buffer
             while (@ob_end_clean()) {
             }
             rex_send_resource($content);
             exit;
         }
         return $content;
     }
     return '';
 }
 function format($row)
 {
     global $I18N;
     $format = parent::format($row);
     if (strlen($format) != 0) {
         return $format;
     }
     $value = $row[$this->name];
     if ($this->format_type == '') {
         if ($this->format == '') {
             $this->format = '%' . $this->name . '%';
         }
         // Alle Spaltenamen ersetzen durch deren Werte %id%, %name%, etc.
         $value = $this->parseString($this->format, $row);
     } else {
         $value = rex_formatter::format($value, $this->format_type, $this->format);
     }
     return $this->link($value, $this->parseParams($row));
 }
Exemplo n.º 7
0
function rex_metainfo_content_sidebar($extionPointParams)
{
    $params = $extionPointParams->getParams();
    $article = rex_article::get($params['article_id'], $params['clang']);
    $articleStatusTypes = rex_article_service::statusTypes();
    $panel = '';
    $panel .= '<dl class="dl-horizontal">';
    $panel .= '<dt>' . rex_i18n::msg('created_by') . '</dt>';
    $panel .= '<dd>' . $article->getValue('createuser') . '</dd>';
    $panel .= '<dt>' . rex_i18n::msg('created_on') . '</dt>';
    $panel .= '<dd>' . rex_formatter::strftime($article->getValue('createdate'), 'date') . '</dd>';
    $panel .= '<dt>' . rex_i18n::msg('updated_by') . '</dt>';
    $panel .= '<dd>' . $article->getValue('updateuser') . '</dd>';
    $panel .= '<dt>' . rex_i18n::msg('updated_on') . '</dt>';
    $panel .= '<dd>' . rex_formatter::strftime($article->getValue('updatedate'), 'date') . '</dd>';
    $panel .= '<dt>' . rex_i18n::msg('status') . '</dt>';
    $panel .= '<dd class="' . $articleStatusTypes[$article->getValue('status')][1] . '">' . $articleStatusTypes[$article->getValue('status')][0] . '</dd>';
    $panel .= '</dl>';
    $fragment = new rex_fragment();
    $fragment->setVar('title', rex_i18n::msg('metadata'), false);
    $fragment->setVar('body', $panel, false);
    $content = $fragment->parse('core/page/section.php');
    return $content;
}
Exemplo n.º 8
0
/**
 * Ausgabe des Medienpool Formulars.
 */
function rex_mediapool_Mediaform($form_title, $button_title, $rex_file_category, $file_chooser, $close_form)
{
    global $ftitle, $warning, $info;
    $s = '';
    $cats_sel = new rex_media_category_select();
    $cats_sel->setStyle('class="form-control"');
    $cats_sel->setSize(1);
    $cats_sel->setName('rex_file_category');
    $cats_sel->setId('rex-mediapool-category');
    $cats_sel->addOption(rex_i18n::msg('pool_kats_no'), '0');
    $cats_sel->setAttribute('onchange', 'this.form.submit()');
    $cats_sel->setSelected($rex_file_category);
    if (isset($warning)) {
        if (is_array($warning)) {
            if (count($warning) > 0) {
                $s .= rex_view::error(implode('<br />', $warning));
            }
        } elseif ($warning != '') {
            $s .= rex_view::error($warning);
        }
        $warning = '';
    }
    if (isset($info)) {
        if (is_array($info)) {
            if (count($info) > 0) {
                $s .= rex_view::success(implode('<br />', $info));
            }
        } elseif ($info != '') {
            $s .= rex_view::success($info);
        }
        $info = '';
    }
    if (!isset($ftitle)) {
        $ftitle = '';
    }
    $arg_fields = '';
    foreach (rex_request('args', 'array') as $arg_name => $arg_value) {
        $arg_fields .= '<input type="hidden" name="args[' . $arg_name . ']" value="' . $arg_value . '" />' . "\n";
    }
    $opener_input_field = rex_request('opener_input_field', 'string');
    if ($opener_input_field != '') {
        $arg_fields .= '<input type="hidden" name="opener_input_field" value="' . htmlspecialchars($opener_input_field) . '" />' . "\n";
    }
    $add_submit = '';
    if ($close_form && $opener_input_field != '') {
        $add_submit = '<button class="btn btn-save" type="submit" name="saveandexit" value="' . rex_i18n::msg('pool_file_upload_get') . '"' . rex::getAccesskey(rex_i18n::msg('pool_file_upload_get'), 'save') . '>' . rex_i18n::msg('pool_file_upload_get') . '</button>';
    }
    $panel = '';
    $formElements = [];
    $e = [];
    $e['label'] = '<label for="rex-mediapool-title">' . rex_i18n::msg('pool_file_title') . '</label>';
    $e['field'] = '<input class="form-control" type="text" id="rex-mediapool-title" name="ftitle" value="' . htmlspecialchars($ftitle) . '" />';
    $formElements[] = $e;
    $e = [];
    $e['label'] = '<label for="rex-mediapool-category">' . rex_i18n::msg('pool_file_category') . '</label>';
    $e['field'] = $cats_sel->get();
    $formElements[] = $e;
    $fragment = new rex_fragment();
    $fragment->setVar('elements', $formElements, false);
    $panel .= $fragment->parse('core/form/form.php');
    $panel .= rex_extension::registerPoint(new rex_extension_point('MEDIA_FORM_ADD', ''));
    if ($file_chooser) {
        $e = [];
        $e['label'] = '<label for="rex-mediapool-choose-file">' . rex_i18n::msg('pool_file_file') . '</label>';
        $e['field'] = '<input id="rex-mediapool-choose-file" type="file" name="file_new" />';
        $e['note'] = '<h3>' . rex_i18n::msg('phpini_settings') . '</h3>
                        <dl class="dl-horizontal">
                        ' . (rex_ini_get('file_uploads') == 0 ? '<dt><span class="text-warning">' . rex_i18n::msg('pool_upload') . '</span></dt><dd><span class="text-warning">' . rex_i18n::msg('pool_upload_disabled') . '</span></dd>' : '') . '
                            <dt>' . rex_i18n::msg('pool_max_uploadsize') . ':</dt><dd>' . rex_formatter::bytes(rex_ini_get('upload_max_filesize')) . '</dd>
                            <dt>' . rex_i18n::msg('pool_max_uploadtime') . ':</dt><dd>' . rex_ini_get('max_input_time') . 's</dd>
                        </dl>';
        $fragment = new rex_fragment();
        $fragment->setVar('elements', [$e], false);
        $panel .= $fragment->parse('core/form/form.php');
    }
    $formElements = [];
    $e = [];
    $e['field'] = '<button class="btn btn-save" type="submit" name="save" value="' . $button_title . '"' . rex::getAccesskey($button_title, 'save') . '>' . $button_title . '</button>';
    $formElements[] = $e;
    $e = [];
    $e['field'] = $add_submit;
    $formElements[] = $e;
    $fragment = new rex_fragment();
    $fragment->setVar('elements', $formElements, false);
    $buttons = $fragment->parse('core/form/submit.php');
    $fragment = new rex_fragment();
    $fragment->setVar('title', $form_title, false);
    $fragment->setVar('body', $panel, false);
    $fragment->setVar('buttons', $buttons, false);
    $content = $fragment->parse('core/page/section.php');
    $s .= ' <form action="' . rex_url::currentBackendPage() . '" method="post" enctype="multipart/form-data">
                <fieldset>
                    <input type="hidden" name="media_method" value="add_file" />
                    ' . $arg_fields . '
                    ' . $content . '
                </fieldset>
            ';
    if ($close_form) {
        $s .= '</form>' . "\n";
    }
    return $s;
}
 /**
  * Formatiert einen übergebenen String anhand der rexFormatter Klasse
  *
  * @param $value Zu formatierender String
  * @param $format Array mit den Formatierungsinformationen
  *
  * @return string
  */
 function formatValue($value, $format)
 {
     if (!is_array($format)) {
         return $value;
     }
     return rex_formatter::format($value, $format[0], $format[1]);
 }
Exemplo n.º 10
0
 /**
  * Returns the formatted time difference.
  *
  * @param int $precision Factor which will be multiplied, for convertion into different units (e.g. 1000 for milli,...)
  * @param int $decimals  Number of decimals points
  *
  * @return string Formatted time difference
  */
 public function getFormattedDelta($precision = self::MILLISEC, $decimals = 3)
 {
     $time = $this->getDelta($precision);
     return rex_formatter::number($time, [$decimals]);
 }
Exemplo n.º 11
0
 /**
  * Returns the timestamp.
  *
  * @param string $format See {@link rex_formatter::strftime}
  *
  * @return int|string Unix timestamp or formatted string if $format is given
  */
 public function getTimestamp($format = null)
 {
     if (is_null($format)) {
         return $this->timestamp;
     }
     return rex_formatter::strftime($this->timestamp, $format);
 }
Exemplo n.º 12
0
     $field .= ' checked="checked" ';
 }
 $field .= ' value="1" />';
 $formElements = [];
 $n = [];
 $n['reverse'] = true;
 $n['label'] = '<label>' . rex_i18n::msg('template_categories_all') . '</label>';
 $n['field'] = $field;
 $formElements[] = $n;
 $fragment = new rex_fragment();
 $fragment->setVar('elements', $formElements, false);
 $panel .= $fragment->parse('core/form/checkbox.php');
 $formElements = [];
 $n = [];
 $n['id'] = 'rex-id-categories';
 $n['label'] = '<label for="rex-id-categories-select">' . rex_formatter::widont(rex_i18n::msg('template_categories_custom')) . '</label>';
 $n['field'] = $cat_select->get();
 $n['note'] = rex_i18n::msg('ctrl');
 $formElements[] = $n;
 $fragment = new rex_fragment();
 $fragment->setVar('flush', true);
 $fragment->setVar('elements', $formElements, false);
 $panel .= $fragment->parse('core/form/form.php');
 $panel .= '
             </fieldset>
         </div>
     </div>';
 $formElements = [];
 $n = [];
 $n['field'] = '<a class="btn btn-abort" href="' . rex_url::currentBackendPage() . '">' . rex_i18n::msg('form_abort') . '</a>';
 $formElements[] = $n;
Exemplo n.º 13
0
     $where .= ' AND (' . implode(' OR ', $types) . ')';
 }
 $qry = 'SELECT * FROM ' . $REX['TABLE_PREFIX'] . 'file f WHERE ' . $where . ' ORDER BY f.updatedate desc, f.file_id desc';
 // ----- EXTENSION POINT
 $qry = rex_register_extension_point('MEDIA_LIST_QUERY', $qry, array('category_id' => $rex_file_category));
 //   $files->debugsql = 1;
 $files->setQuery($qry);
 print '<tbody>';
 for ($i = 0; $i < $files->getRows(); $i++) {
     $file_id = $files->getValue('file_id');
     $file_name = $files->getValue('filename');
     $file_oname = $files->getValue('originalname');
     $file_title = $files->getValue('title');
     $file_type = $files->getValue('filetype');
     $file_size = $files->getValue('filesize');
     $file_stamp = rex_formatter::format($files->getValue('updatedate'), 'strftime', 'datetime');
     $file_updateuser = $files->getValue('updateuser');
     $encoded_file_name = urlencode($file_name);
     // Eine titel Spalte schätzen
     $alt = '';
     foreach (array('title') as $col) {
         if ($files->hasValue($col) && $files->getValue($col) != '') {
             $alt = htmlspecialchars($files->getValue($col));
             break;
         }
     }
     // Eine beschreibende Spalte schätzen
     $desc = '';
     foreach (array('med_description') as $col) {
         if ($files->hasValue($col) && $files->getValue($col) != '') {
             $desc = '<p class="rex-tx1">' . htmlspecialchars($files->getValue($col)) . '</p>';
Exemplo n.º 14
0
     $file_ext = substr(strrchr($file_name, '.'), 1);
     $icon_class = ' rex-mime-default';
     if (rex_media::isDocType($file_ext)) {
         $icon_class = ' rex-mime-' . $file_ext;
     }
     $thumbnail = '<i class="rex-mime' . $icon_class . '" title="' . $alt . '" data-extension="' . $file_ext . '"></i><span class="sr-only">' . $file_name . '</span>';
     if (rex_media::isImageType(rex_file::extension($file_name)) && $thumbs) {
         $thumbnail = '<img class="thumbnail" src="' . rex_url::media($file_name) . '" alt="' . $alt . '" title="' . $alt . '" />';
         if ($media_manager) {
             $thumbnail = '<img class="thumbnail" src="' . rex_url::backendController(['rex_media_type' => 'rex_mediapool_preview', 'rex_media_file' => $encoded_file_name]) . '" alt="' . $alt . '" title="' . $alt . '" />';
         }
     }
 }
 // ----- get file size
 $size = $file_size;
 $file_size = rex_formatter::bytes($size);
 if ($file_title == '') {
     $file_title = '[' . rex_i18n::msg('pool_file_notitle') . ']';
 }
 $file_title .= ' [' . $file_id . ']';
 // ----- opener
 $opener_link = '';
 if ($opener_input_field == 'TINYIMG') {
     if (rex_media::isImageType(rex_file::extension($file_name))) {
         $opener_link .= '<a class="btn btn-select" href="javascript:insertImage(\'$file_name\',\'' . $files->getValue('title') . '\')">' . rex_i18n::msg('pool_image_get') . '</a>';
     }
 } elseif ($opener_input_field == 'TINY') {
     $opener_link .= '<a class="btn btn-select" href="javascript:insertLink(\'' . $file_name . '\');"">' . rex_i18n::msg('pool_link_get') . '</a>';
 } elseif ($opener_input_field != '') {
     $opener_link = '<a class="btn btn-xs btn-select" href="javascript:selectMedia(\'' . $file_name . '\', \'' . addslashes(htmlspecialchars($files->getValue('title'))) . '\');">' . rex_i18n::msg('pool_file_get') . '</a>';
     if (substr($opener_input_field, 0, 14) == 'REX_MEDIALIST_') {
Exemplo n.º 15
0
	<div id="rex-ftr">
		<ul>
			<li><a href="http://www.yakamara.de" target="_blank" class="black"<?php 
echo rex_tabindex();
?>
>yakamara.de</a> | </li>
      <li><a href="http://www.redaxo.de" target="_blank" class="black"<?php 
echo rex_tabindex();
?>
>redaxo.de</a> | </li>
			<?php 
if (isset($REX_USER)) {
    echo '<li><a href="index.php?page=credits" class="black">' . $I18N->msg('credits') . '</a> | </li>';
}
?>
      <li><a href="http://forum.redaxo.de"<?php 
echo rex_tabindex();
?>
>?</a></li>
		</ul>
		<p><?php 
echo showScripttime();
?>
 sec | <?php 
echo rex_formatter::format(time(), 'strftime', 'date');
?>
</p>
	</div>
   </body>
</html>
Exemplo n.º 16
0
 /**
  * @return string
  */
 public function getFormattedSize()
 {
     return rex_formatter::bytes($this->getSize());
 }
Exemplo n.º 17
0
 /**
  * Formates the filesize of the given file into a userfriendly form.
  *
  * @param string $file   Path to the file
  * @param array  $format
  *
  * @return string Formatted filesize
  */
 public static function formattedSize($file, $format = [])
 {
     return rex_formatter::bytes(filesize($file), $format);
 }
Exemplo n.º 18
0
 function _getList($lines, $caption = '', $summary = '')
 {
     global $REX, $I18N;
     $table_attr = '';
     if (!empty($summary)) {
         $table_attr .= ' summary="' . $summary . '"';
     }
     $table_head = '';
     if (!empty($caption)) {
         $table_head .= '<caption>' . $caption . '</caption>';
     }
     $list = '
   <table class="rex-table"' . $table_attr . '>
     ' . $table_head . '
     <colgroup>
       <col width="40" />
       <col width="140" />
       <col width="160" />
       <col width="*" />
     </colgroup>
     <thead>
       <tr>
         <th class="rex-icon"></th>
         <th>' . $I18N->msg('cronjob_log_date') . '</th>
         <th>' . $I18N->msg('cronjob_name') . '</th>
         <th>' . $I18N->msg('cronjob_log_message') . '</th>
       </tr>
     </thead>
     <tbody>';
     if (!is_array($lines) || count($lines) == 0) {
         $list .= '
       <tr><td colspan="4">' . $I18N->msg('cronjob_log_no_data') . '</td></tr>';
     } else {
         foreach ($lines as $line) {
             $data = explode(' | ', $line, 5);
             for ($i = 0; $i < 5; $i++) {
                 if (!isset($data[$i])) {
                     $data[$i] = '';
                 }
             }
             $data[0] = rex_formatter::format(strtotime($data[0]), 'strftime', 'datetime');
             $class = trim($data[1]) == 'ERROR' ? 'rex-warning' : 'rex-info';
             $data[4] = str_replace(' | ', '<br />', htmlspecialchars($data[4]));
             if ($data[2] == '--') {
                 $icon = '<span class="rex-i-element rex-i-cronjob" title="' . $I18N->msg('cronjob_not_editable') . '"><span class="rex-i-element-text">' . $I18N->msg('cronjob_not_editable') . '</span></span>';
             } else {
                 $icon = '<a href="index.php?page=cronjob&amp;list=cronjobs&amp;func=edit&amp;oid=' . trim($data[2]) . '" title="' . $I18N->msg('cronjob_edit') . '"><span class="rex-i-element rex-i-cronjob"><span class="rex-i-element-text">' . $I18N->msg('cronjob_edit') . '</span></span></a>';
             }
             $list .= '
       <tr class="' . $class . '">
         <td class="rex-icon">' . $icon . '</td>
         <td>' . $data[0] . '</td>
         <td>' . htmlspecialchars($data[3]) . '</td>
         <td>' . $data[4] . '</td>
       </tr>';
         }
     }
     $list .= '
     </tbody>
   </table>';
     return $list;
 }
Exemplo n.º 19
0
 public function testCustom()
 {
     $value = 77;
     $format = 'octdec';
     $this->assertEquals(63, rex_formatter::custom($value, $format));
     $format = [function ($params) {
         return $params['subject'] . ' ' . $params['some'];
     }, ['some' => 'more params']];
     $this->assertEquals('77 more params', rex_formatter::custom($value, $format));
 }
 /**
  * Formatiert einen übergebenen String anhand der rexFormatter Klasse
  *
  * @param $value Zu formatierender String
  * @param $format Array mit den Formatierungsinformationen
  * @param $escape Flag, Ob escapen von $value erlaubt ist
  *
  * @return string
  */
 function formatValue($value, $format, $escape, $field = null)
 {
     if (is_array($format)) {
         // Callbackfunktion -> Parameterliste aufbauen
         if ($this->isCustomFormat($format)) {
             $format[2] = isset($format[2]) ? $format[2] : array();
             $format[1] = array($format[1], array('list' => $this, 'field' => $field, 'value' => $value, 'format' => $format[0], 'escape' => $escape, 'params' => $format[2]));
         }
         $value = rex_formatter::format($value, $format[0], $format[1]);
     }
     // Nur escapen, wenn formatter aufgerufen wird, der kein html zurückgeben können soll
     if ($escape && !$this->isCustomFormat($format) && $format[0] != 'rexmedia' && $format[0] != 'rexurl') {
         $value = htmlspecialchars($value);
     }
     return $value;
 }
Exemplo n.º 21
0
<?php

rex_extension::register('STRUCTURE_CONTENT_SIDEBAR', function (rex_extension_point $ep) {
    $params = $ep->getParams();
    $subject = $ep->getSubject();
    $article = rex_article::get($params['article_id'], $params['clang']);
    $articleStatusTypes = rex_article_service::statusTypes();
    $panel = '';
    $panel .= '<dl class="dl-horizontal text-left">';
    $panel .= '<dt>' . rex_i18n::msg('created_by') . '</dt>';
    $panel .= '<dd>' . $article->getValue('createuser') . '</dd>';
    $panel .= '<dt>' . rex_i18n::msg('created_on') . '</dt>';
    $panel .= '<dd>' . rex_formatter::strftime($article->getValue('createdate'), 'date') . '</dd>';
    $panel .= '<dt>' . rex_i18n::msg('updated_by') . '</dt>';
    $panel .= '<dd>' . $article->getValue('updateuser') . '</dd>';
    $panel .= '<dt>' . rex_i18n::msg('updated_on') . '</dt>';
    $panel .= '<dd>' . rex_formatter::strftime($article->getValue('updatedate'), 'date') . '</dd>';
    $panel .= '<dt>' . rex_i18n::msg('status') . '</dt>';
    $panel .= '<dd class="' . $articleStatusTypes[$article->getValue('status')][1] . '">' . $articleStatusTypes[$article->getValue('status')][0] . '</dd>';
    $panel .= '</dl>';
    $fragment = new rex_fragment();
    $fragment->setVar('title', '<i class="rex-icon rex-icon-info"></i> ' . rex_i18n::msg('metadata'), false);
    $fragment->setVar('body', $panel, false);
    $fragment->setVar('collapse', true);
    $fragment->setVar('collapsed', true);
    $content = $fragment->parse('core/page/section.php');
    return $content . $subject;
});
 }
 $qry = "SELECT * FROM " . $REX['TABLE_PREFIX'] . "file f WHERE " . $where . " ORDER BY f.updatedate desc";
 // ----- EXTENSION POINT
 $qry = rex_register_extension_point('MEDIA_LIST_QUERY', $qry, array('category_id' => $rex_file_category));
 $files = rex_sql::factory();
 //   $files->debugsql = 1;
 $files->setQuery($qry);
 print '<tbody>';
 for ($i = 0; $i < $files->getRows(); $i++) {
     $file_id = $files->getValue('file_id');
     $file_name = $files->getValue('filename');
     $file_oname = $files->getValue('originalname');
     $file_title = $files->getValue('title');
     $file_type = $files->getValue('filetype');
     $file_size = $files->getValue('filesize');
     $file_stamp = rex_formatter::format($files->getValue('updatedate'), "strftime", "datetime");
     $file_updateuser = $files->getValue('updateuser');
     $encoded_file_name = urlencode($file_name);
     // Eine titel Spalte schätzen
     $alt = '';
     foreach (array('title') as $col) {
         if ($files->hasValue($col) && $files->getValue($col) != '') {
             $alt = htmlspecialchars($files->getValue($col));
             break;
         }
     }
     // Eine beschreibende Spalte schätzen
     $desc = '';
     foreach (array('med_description') as $col) {
         if ($files->hasValue($col) && $files->getValue($col) != '') {
             $desc = htmlspecialchars($files->getValue($col));
Exemplo n.º 23
0
     } else {
         // --------------------- ARTIKEL NORMAL VIEW | NO EDIT NO ENTER
         $art_status = $artStatusTypes[$sql->getValue('status')][0];
         $art_status_class = $artStatusTypes[$sql->getValue('status')][1];
         $art_status_icon = $artStatusTypes[$sql->getValue('status')][2];
         $tmpl_td = '';
         if ($withTemplates) {
             $tmpl = isset($TEMPLATE_NAME[$sql->getValue('template_id')]) ? $TEMPLATE_NAME[$sql->getValue('template_id')] : '';
             $tmpl_td = '<td data-title="' . rex_i18n::msg('header_template') . '">' . $tmpl . '</td>';
         }
         $echo .= '<tr>
                         <td class="rex-table-icon"><i class="rex-icon' . $class . '"></i></td>
                         <td class="rex-table-id" data-title="' . rex_i18n::msg('header_id') . '">' . $sql->getValue('id') . '</td>
                         <td data-title="' . rex_i18n::msg('header_article_name') . '">' . htmlspecialchars($sql->getValue('name')) . '</td>
                         ' . $tmpl_td . '
                         <td data-title="' . rex_i18n::msg('header_date') . '">' . rex_formatter::strftime($sql->getDateTimeValue('createdate'), 'date') . '</td>
                         <td class="rex-table-priority" data-title="' . rex_i18n::msg('header_priority') . '">' . htmlspecialchars($sql->getValue('priority')) . '</td>
                         <td class="rex-table-action"><span class="text-muted"><i class="rex-icon rex-icon-edit"></i> ' . rex_i18n::msg('change') . '</span></td>
                         <td class="rex-table-action"><span class="text-muted"><i class="rex-icon rex-icon-delete"></i> ' . rex_i18n::msg('delete') . '</span></td>
                         <td class="rex-table-action"><span class="' . $art_status_class . ' text-muted"><i class="rex-icon ' . $art_status_icon . '"></i> ' . $art_status . '</span></td>
                     </tr>';
     }
     $sql->next();
 }
 // tbody nur anzeigen, wenn später auch inhalt drinnen stehen wird
 if ($sql->getRows() > 0 || $function == 'add_art') {
     $echo .= '
             </tbody>';
 }
 $echo .= '
         </table>';
Exemplo n.º 24
0
 /**
  * {@inheritdoc}
  */
 public function getVersion($format = null)
 {
     $version = $this->getProperty('version');
     if ($format) {
         return rex_formatter::version($version, $format);
     }
     return $version;
 }
Exemplo n.º 25
0
    <footer class="rex-global-footer">
        <nav class="rex-nav-footer">
            <ul class="list-inline">
                <li><a href="#rex-start-of-page"><i class="fa fa-arrow-up"></i></a></li>
                <li><a href="http://www.yakamara.de" target="_blank">yakamara.de</a></li>
                <li><a href="http://www.redaxo.org" target="_blank">redaxo.org</a></li>
                <li><a href="http://www.redaxo.org/de/forum/" target="_blank"><?php 
echo rex_i18n::msg('footer_joinforum');
?>
</a></li>
                <li><a href="<?php 
echo rex::getUser() ? rex_url::backendPage('credits') : 'http://www.redaxo.org/" target="_blank';
?>
"><?php 
echo rex_i18n::msg('footer_credits');
?>
</a></li>
                <li><?php 
echo rex_i18n::msg('footer_datetime', rex_formatter::strftime(time(), 'date'));
?>
</li>
                <li><!--DYN--><?php 
echo rex_i18n::msg('footer_scripttime', $this->time);
?>
<!--/DYN--></li>
            </ul>
        </nav>
    </footer>
Exemplo n.º 26
0
         ';
     } else {
         // --------------------- ARTIKEL NORMAL VIEW | NO EDIT NO ENTER
         $add_td = '';
         if ($REX_USER->hasPerm('advancedMode[]')) {
             $add_td = '<td class="rex-icon">' . $sql->getValue('id') . '</td>';
         }
         $art_status = $artStatusTypes[$sql->getValue('status')][0];
         $art_status_class = $artStatusTypes[$sql->getValue('status')][1];
         echo '<tr>
           <td class="rex-icon"><img src="media/' . $icon . '" alt="' . htmlspecialchars($sql->getValue('name')) . '" title="' . htmlspecialchars($sql->getValue('name')) . '" /></td>
           ' . $add_td . '
           <td>' . htmlspecialchars($sql->getValue('name')) . '</td>
           <td>' . htmlspecialchars($sql->getValue('prior')) . '</td>
           <td>' . $TEMPLATE_NAME[$sql->getValue('template_id')] . '</td>
           <td>' . rex_formatter::format($sql->getValue('createdate'), 'strftime', 'date') . '</td>
           <td>' . $startpage . '</td>
           <td><span class="rex-strike">' . $I18N->msg('change') . '</span></td>
           <td><span class="rex-strike">' . $I18N->msg('delete') . '</span></td>
           <td class="' . $art_status_class . '"><span class="rex-strike">' . $art_status . '</span></td>
         </tr>
         ';
     }
     $sql->counter++;
 }
 // tbody nur anzeigen, wenn später auch inhalt drinnen stehen wird
 if ($sql->getRows() > 0 || $function == 'add_art') {
     echo '
     </tbody>';
 }
 echo '
Exemplo n.º 27
0
         // --------------------- ARTIKEL NORMAL VIEW | NO EDIT NO ENTER
         $art_status = $artStatusTypes[$sql->getValue('status')][0];
         $art_status_class = $artStatusTypes[$sql->getValue('status')][1];
         $art_status_icon = $artStatusTypes[$sql->getValue('status')][2];
         $tmpl_td = '';
         if ($withTemplates) {
             $tmpl = isset($TEMPLATE_NAME[$sql->getValue('template_id')]) ? $TEMPLATE_NAME[$sql->getValue('template_id')] : '';
             $tmpl_td = '<td>' . $tmpl . '</td>';
         }
         $echo .= '<tr>
                         <td><i class="rex-icon' . $class . '"></i></td>
                         <td>' . $sql->getValue('id') . '</td>
                         <td>' . htmlspecialchars($sql->getValue('name')) . '</td>
                         <td>' . htmlspecialchars($sql->getValue('priority')) . '</td>
                         ' . $tmpl_td . '
                         <td>' . rex_formatter::strftime($sql->getDateTimeValue('createdate'), 'date') . '</td>
                         <td><span class="text-muted"><i class="rex-icon rex-icon-edit"></i> ' . rex_i18n::msg('change') . '</span></td>
                         <td><span class="text-muted"><i class="rex-icon rex-icon-delete"></i> ' . rex_i18n::msg('delete') . '</span></td>
                         <td><span class="' . $art_status_class . ' text-muted"><i class="rex-icon ' . $art_status_icon . '"></i> ' . $art_status . '</span></td>
                     </tr>';
     }
     $sql->next();
 }
 // tbody nur anzeigen, wenn später auch inhalt drinnen stehen wird
 if ($sql->getRows() > 0 || $function == 'add_art') {
     $echo .= '
             </tbody>';
 } elseif ($sql->getRows() == 0) {
     $echo .= '
         <tbody>
             <tr>