function handle_output(&$event, $param)
 {
     if ($event->data['do'] != 'imageshack') {
         return;
     }
     global $lang;
     echo '<h1 id="media__ns">' . $this->getLang('name') . '</h1>';
     echo '<p>' . $this->getLang('intro') . '</p>';
     echo '<form action="' . DOKU_BASE . 'lib/exe/mediamanager.php" method="post" enctype="multipart/form-data">';
     echo '<input type="hidden" name="do" value="imageshack" />';
     echo '<input type="file" name="imageshack_file" />';
     echo '<input type="submit" value="' . $lang['btn_upload'] . '" class="button" />';
     echo '</form>';
     // output the uploads stored in the current session
     if (is_array($_SESSION['imageshack'])) {
         $files = array_reverse($_SESSION['imageshack']);
         $twibble = 1;
         foreach ($files as $item) {
             $twibble *= -1;
             $zebra = $twibble == -1 ? 'odd' : 'even';
             list($ext, $mime, $dl) = mimetype($item['name']);
             $class = preg_replace('/[^_\\-a-z0-9]+/i', '_', $ext);
             $class = 'select mediafile mf_' . $class;
             echo '<div class="' . $zebra . '">' . NL;
             echo '<a name="h_' . $item['link'] . '" class="' . $class . '">' . hsc($item['name']) . '</a> ';
             echo '<span class="info">(' . $item['width'] . '&#215;' . $item['height'] . ' ' . filesize_h($item['size']) . ')</span>' . NL;
             echo ' <a href="' . $item['adlink'] . '" target="_blank"><img src="' . DOKU_BASE . 'lib/images/magnifier.png" ' . 'alt="' . $lang['mediaview'] . '" title="' . $lang['mediaview'] . '" class="btn" /></a>' . NL;
             echo '<div class="example" id="ex_' . str_replace(':', '_', $item['link']) . '">';
             echo $lang['mediausage'] . ' <code>{{' . hsc($item['link']) . '}}</code>';
             echo '</div>';
             if ($item['width'] > 120 || $item['height'] > 100) {
                 $w = 120;
                 $h = 100;
             } else {
                 $w = $item['width'];
                 $h = $item['height'];
             }
             $src = ml($item['link'], array('w' => $w, 'h' => $h));
             $p = array();
             $p['width'] = $w;
             $p['height'] = $h;
             $p['alt'] = $item['name'];
             $p['class'] = 'thumb';
             $att = buildAttributes($p);
             // output
             echo '<div class="detail">';
             echo '<div class="thumb">';
             echo '<a name="d_' . $item['link'] . '" class="select">';
             echo '<img src="' . $src . '" ' . $att . ' />';
             echo '</a>';
             echo '</div>';
             echo '</div>';
             echo '<div class="clearer"></div>' . NL;
             echo '</div>' . NL;
         }
     }
     $event->preventDefault();
 }
Пример #2
0
 /**
  * @throws Exception max size, required or upload error
  */
 protected function _validate()
 {
     global $lang;
     parent::_validate();
     $file = $this->getParam('file');
     if ($file['error'] == 1 || $file['error'] == 2) {
         throw new Exception(sprintf($lang['uploadsize'], filesize_h(php_to_byte(ini_get('upload_max_filesize')))));
     } else {
         if ($file['error'] == 4) {
             if (!isset($this->opt['optional'])) {
                 throw new Exception(sprintf($this->getLang('e_required'), hsc($this->opt['label'])));
             }
         } else {
             if ($file['error'] || !is_uploaded_file($file['tmp_name'])) {
                 throw new Exception(hsc($this->opt['label']) . ' ' . $lang['uploadfail'] . ' (' . $file['error'] . ')');
             }
         }
     }
 }
Пример #3
0
 public function internalmedia($src, $title = NULL, $align = NULL, $width = NULL, $height = NULL, $cache = NULL, $linking = NULL, $return = false)
 {
     global $ID;
     list($src, $hash) = explode('#', $src, 2);
     resolve_mediaid(getNS($ID), $src, $exists);
     $noLink = false;
     $render = $linking == 'linkonly' ? false : true;
     $link = $this->_getMediaLinkConf($src, $title, $align, $width, $height, $cache, $render);
     list($ext, $mime, $dl) = mimetype($src, false);
     if (substr($mime, 0, 5) == 'image' && $render) {
         if ($linking == NULL || $linking == '' || $linking == 'details') {
             $linking = 'direct';
         }
         $link['url'] = ml($src, array('id' => $ID, 'cache' => $cache), $linking == 'direct');
     } elseif ($mime == 'application/x-shockwave-flash' && $render) {
         // don't link flash movies
         $noLink = true;
     } else {
         // add file icons
         $class = preg_replace('/[^_\\-a-z0-9]+/i', '_', $ext);
         $link['class'] .= ' mediafile mf_' . $class;
         $link['url'] = ml($src, array('id' => $ID, 'cache' => $cache), true);
         if ($exists) {
             $link['title'] .= ' (' . filesize_h(filesize(mediaFN($src))) . ')';
         }
     }
     if ($hash) {
         $link['url'] .= '#' . $hash;
     }
     //markup non existing files
     if (!$exists) {
         $link['class'] .= ' wikilink2';
     }
     //output formatted
     if ($linking == 'nolink' || $noLink) {
         $this->doc .= $link['name'];
     } else {
         $this->doc .= $this->_formatLink($link);
     }
 }
 /**
  * Display a result in a HTML table
  */
 function html_resulttable($result, $header = '', $pager = 0)
 {
     echo '<table class="inline">';
     if (is_array($header)) {
         echo '<tr>';
         foreach ($header as $h) {
             echo '<th>' . hsc($h) . '</th>';
         }
         echo '</tr>';
     }
     $count = 0;
     if (is_array($result)) {
         foreach ($result as $row) {
             echo '<tr>';
             foreach ($row as $k => $v) {
                 if ($k == 'res_x') {
                     continue;
                 }
                 if ($k == 'res_y') {
                     continue;
                 }
                 echo '<td class="plg_stats_X' . $k . '">';
                 if ($k == 'page') {
                     echo '<a href="' . wl($v) . '" class="wikilink1">';
                     echo hsc($v);
                     echo '</a>';
                 } elseif ($k == 'media') {
                     echo '<a href="' . ml($v) . '" class="wikilink1">';
                     echo hsc($v);
                     echo '</a>';
                 } elseif ($k == 'filesize') {
                     echo filesize_h($v);
                 } elseif ($k == 'url') {
                     $url = hsc($v);
                     $url = preg_replace('/^https?:\\/\\/(www\\.)?/', '', $url);
                     if (strlen($url) > 45) {
                         $url = substr($url, 0, 30) . ' &hellip; ' . substr($url, -15);
                     }
                     echo '<a href="' . $v . '" class="urlextern">';
                     echo $url;
                     echo '</a>';
                 } elseif ($k == 'ilookup') {
                     echo '<a href="' . wl('', array('id' => $v, 'do' => 'search')) . '">Search</a>';
                 } elseif ($k == 'lookup') {
                     echo '<a href="http://www.google.com/search?q=' . rawurlencode($v) . '">';
                     echo '<img src="' . DOKU_BASE . 'lib/plugins/statistics/ico/search/google.png" alt="Google" border="0" />';
                     echo '</a> ';
                     echo '<a href="http://search.yahoo.com/search?p=' . rawurlencode($v) . '">';
                     echo '<img src="' . DOKU_BASE . 'lib/plugins/statistics/ico/search/yahoo.png" alt="Yahoo!" border="0" />';
                     echo '</a> ';
                     echo '<a href="http://www.bing.com/search?q=' . rawurlencode($v) . '">';
                     echo '<img src="' . DOKU_BASE . 'lib/plugins/statistics/ico/search/bing.png" alt="Bing" border="0" />';
                     echo '</a> ';
                 } elseif ($k == 'engine') {
                     include_once dirname(__FILE__) . '/inc/searchengines.php';
                     if (isset($SEARCHENGINEINFO[$v])) {
                         echo '<a href="' . $SEARCHENGINEINFO[$v][1] . '">' . $SEARCHENGINEINFO[$v][0] . '</a>';
                     } else {
                         echo hsc(ucwords($v));
                     }
                 } elseif ($k == 'eflag') {
                     $this->html_icon('search', $v);
                 } elseif ($k == 'bflag') {
                     $this->html_icon('browser', $v);
                 } elseif ($k == 'osflag') {
                     $this->html_icon('os', $v);
                 } elseif ($k == 'cflag') {
                     $this->html_icon('flags', $v);
                 } elseif ($k == 'html') {
                     echo $v;
                 } else {
                     echo hsc($v);
                 }
                 echo '</td>';
             }
             echo '</tr>';
             if ($pager && $count == $pager) {
                 break;
             }
             $count++;
         }
     }
     echo '</table>';
     if ($pager) {
         $this->html_pager($pager, count($result) > $pager);
     }
 }
Пример #5
0
 /**
  * Send the diff for some media change
  *
  * @fixme this should embed thumbnails of images in HTML version
  * @param string   $subscriber_mail The target mail address
  * @param string   $template        Mail template ('uploadmail', ...)
  * @param string   $id              Media file for which the notification is
  * @param int|bool $rev             Old revision if any
  * @return bool                     true if successfully sent
  */
 public function send_media_diff($subscriber_mail, $template, $id, $rev = false)
 {
     global $conf;
     $file = mediaFN($id);
     list($mime, $ext) = mimetype($id);
     $trep = array('MIME' => $mime, 'MEDIA' => ml($id, '', true, '&', true), 'SIZE' => filesize_h(filesize($file)));
     if ($rev && $conf['mediarevisions']) {
         $trep['OLD'] = ml($id, "rev={$rev}", true, '&', true);
     } else {
         $trep['OLD'] = '---';
     }
     $headers = array('Message-Id' => $this->getMessageID($id, @filemtime($file)));
     if ($rev) {
         $headers['In-Reply-To'] = $this->getMessageID($id, $rev);
     }
     $this->send($subscriber_mail, 'upload', $id, $template, $trep, null, $headers);
 }
Пример #6
0
 /**
  * Download the tarball
  *
  * @return bool
  */
 private function _step_download()
 {
     $this->_say($this->getLang('dl_from'), $this->tgzurl);
     @set_time_limit(120);
     @ignore_user_abort();
     $http = new DokuHTTPClient();
     $http->timeout = 120;
     $data = $http->get($this->tgzurl);
     if (!$data) {
         $this->_warn($http->error);
         $this->_warn($this->getLang('dl_fail'));
         return false;
     }
     if (!io_saveFile($this->tgzfile, $data)) {
         $this->_warn($this->getLang('dl_fail'));
         return false;
     }
     $this->_say($this->getLang('dl_done'), filesize_h(strlen($data)));
     return true;
 }
Пример #7
0
        $ext = strtolower(substr(strrchr($entry,'.'), 1));
        if (is_file($root.$imglib.$entry) && in_array($ext,$tinyMCE_valid_imgs))
        {
			$arr_tinyMCE_image_files[$i][file_name] = $entry;			
			$i++;
        }
      }
      $d->close();
	  // sort the list of image filenames alphabetically.
	  sort($arr_tinyMCE_image_files);
	  for($k=0; $k<count($arr_tinyMCE_image_files); $k++){ 
      $entry = $arr_tinyMCE_image_files[$k][file_name];
	  $size = getimagesize($tinyMCE_base_url.$imglib.$entry);
	  $fsize = filesize($root.$imglib.$entry);
   ?>
            <option img_width="<?php echo $size[0]; ?>" img_height="<?php echo $size[1]; ?>" f_size="<?php echo filesize_h($fsize,2); ?>" value="<?php echo $entry?>" <?php echo ($entry == $img)?'selected':''?>><?php echo $entry?></option>
            <?php
	  }  
    }
    else
    {
      $errors[] = '{$lang_ibrowser_errornodir}';
    }
  ?>
          </select></td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td colspan="3"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="40%"><?php if ($tinyMCE_img_delete_allowed) { ?>
Пример #8
0
if (isset($_FILES['Filedata'])) {
    $_FILES['upload'] =& $_FILES['Filedata'];
    $JUMPTO = media_upload($NS, $AUTH);
    if ($JUMPTO == false) {
        header("HTTP/1.0 400 Bad Request");
        echo 'Upload failed';
    }
    echo 'ok';
    exit;
}
// give info on PHP catched upload errors
if ($_FILES['upload']['error']) {
    switch ($_FILES['upload']['error']) {
        case 1:
        case 2:
            msg(sprintf($lang['uploadsize'], filesize_h(php_to_byte(ini_get('upload_max_filesize')))), -1);
            break;
        default:
            msg($lang['uploadfail'] . ' (' . $_FILES['upload']['error'] . ')', -1);
    }
    unset($_FILES['upload']);
}
// handle upload
if ($_FILES['upload']['tmp_name']) {
    $JUMPTO = media_upload($NS, $AUTH);
    if ($JUMPTO) {
        $NS = getNS($JUMPTO);
    }
}
// handle meta saving
if ($IMG && $_REQUEST['do']['save']) {
Пример #9
0
/**
 * Print the media upload form if permissions are correct
 *
 * @author Andreas Gohr <*****@*****.**>
 * @author Kate Arzamastseva <*****@*****.**>
 */
function media_uploadform($ns, $auth, $fullscreen = false)
{
    global $lang;
    global $conf;
    global $INPUT;
    if ($auth < AUTH_UPLOAD) {
        echo '<div class="nothing">' . $lang['media_perm_upload'] . '</div>' . NL;
        return;
    }
    $auth_ow = $conf['mediarevisions'] ? AUTH_UPLOAD : AUTH_DELETE;
    $update = false;
    $id = '';
    if ($auth >= $auth_ow && $fullscreen && $INPUT->str('mediado') == 'update') {
        $update = true;
        $id = cleanID($INPUT->str('image'));
    }
    // The default HTML upload form
    $params = array('id' => 'dw__upload', 'enctype' => 'multipart/form-data');
    if (!$fullscreen) {
        $params['action'] = DOKU_BASE . 'lib/exe/mediamanager.php';
    } else {
        $params['action'] = media_managerURL(array('tab_files' => 'files', 'tab_details' => 'view'), '&');
    }
    $form = new Doku_Form($params);
    if (!$fullscreen) {
        echo '<div class="upload">' . $lang['mediaupload'] . '</div>';
    }
    $form->addElement(formSecurityToken());
    $form->addHidden('ns', hsc($ns));
    $form->addElement(form_makeOpenTag('p'));
    $form->addElement(form_makeFileField('upload', $lang['txt_upload'], 'upload__file'));
    $form->addElement(form_makeCloseTag('p'));
    $form->addElement(form_makeOpenTag('p'));
    $form->addElement(form_makeTextField('mediaid', noNS($id), $lang['txt_filename'], 'upload__name'));
    $form->addElement(form_makeButton('submit', '', $lang['btn_upload']));
    $form->addElement(form_makeCloseTag('p'));
    if ($auth >= $auth_ow) {
        $form->addElement(form_makeOpenTag('p'));
        $attrs = array();
        if ($update) {
            $attrs['checked'] = 'checked';
        }
        $form->addElement(form_makeCheckboxField('ow', 1, $lang['txt_overwrt'], 'dw__ow', 'check', $attrs));
        $form->addElement(form_makeCloseTag('p'));
    }
    echo NL . '<div id="mediamanager__uploader">' . NL;
    html_form('upload', $form);
    echo '</div>' . NL;
    echo '<p class="maxsize">';
    printf($lang['maxuploadsize'], filesize_h(media_getuploadsize()));
    echo '</p>' . NL;
}
Пример #10
0
	    		<?php 
sort($arr_tinyMCE_image_files);
foreach ($arr_tinyMCE_image_files as $e) {
    $p = $e->gid . $e->file_ext;
    $size = array($e->image_width, $e->image_height);
    $fsize = $e->file_size;
    ?>
			
						<option lang="<?php 
    echo $size[0];
    ?>
" id="<?php 
    echo $size[1];
    ?>
"  label="<?php 
    echo filesize_h($fsize, 2);
    ?>
" value="<?php 
    echo $p;
    ?>
" <?php 
    echo $e->file_name == $img ? 'selected' : '';
    ?>
><?php 
    echo $e->file_name;
    ?>
</option>
			
				<?php 
}
?>
Пример #11
0
/**
 * Formats and prints one file in the list in the thumbnails view
 *
 * @author Kate Arzamastseva <*****@*****.**>
 */
function media_printfile_thumbs($item, $auth, $jump = false, $display_namespace = false)
{
    global $lang;
    global $conf;
    // Prepare filename
    $file = utf8_decodeFN($item['file']);
    // output
    echo '<li><dl title="' . hsc($item['id']) . '">' . NL;
    echo '<dt>';
    if ($item['isimg']) {
        media_printimgdetail($item, true);
    } else {
        echo '<a name="d_:' . $item['id'] . '" class="image" title="' . $item['id'] . '" href="' . media_managerURL(array('image' => hsc($item['id']), 'ns' => getNS($item['id']), 'tab_details' => 'view')) . '">';
        echo media_printicon($item['id']);
        echo '</a>';
    }
    echo '</dt>' . NL;
    if (!$display_namespace) {
        $name = hsc($file);
    } else {
        $name = hsc($item['id']);
    }
    echo '<dd class="name"><a href="' . media_managerURL(array('image' => hsc($item['id']), 'ns' => getNS($item['id']), 'tab_details' => 'view')) . '" name="h_:' . $item['id'] . '">' . $name . '</a></dd>' . NL;
    if ($item['isimg']) {
        $size = '';
        $size .= (int) $item['meta']->getField('File.Width');
        $size .= '&#215;';
        $size .= (int) $item['meta']->getField('File.Height');
        echo '<dd class="size">' . $size . '</dd>' . NL;
    } else {
        echo '<dd class="size">&nbsp;</dd>' . NL;
    }
    $date = dformat($item['mtime']);
    echo '<dd class="date">' . $date . '</dd>' . NL;
    $filesize = filesize_h($item['size']);
    echo '<dd class="filesize">' . $filesize . '</dd>' . NL;
    echo '</dl></li>' . NL;
}
Пример #12
0
/**
 * Formats and prints one file in the list
 */
function media_printfile($item, $auth, $jump, $display_namespace = false)
{
    global $lang;
    global $conf;
    // Prepare zebra coloring
    // I always wanted to use this variable name :-D
    static $twibble = 1;
    $twibble *= -1;
    $zebra = $twibble == -1 ? 'odd' : 'even';
    // Automatically jump to recent action
    if ($jump == $item['id']) {
        $jump = ' id="scroll__here" ';
    } else {
        $jump = '';
    }
    // Prepare fileicons
    list($ext, $mime, $dl) = mimetype($item['file'], false);
    $class = preg_replace('/[^_\\-a-z0-9]+/i', '_', $ext);
    $class = 'select mediafile mf_' . $class;
    // Prepare filename
    $file = utf8_decodeFN($item['file']);
    // Prepare info
    $info = '';
    if ($item['isimg']) {
        $info .= (int) $item['meta']->getField('File.Width');
        $info .= '&#215;';
        $info .= (int) $item['meta']->getField('File.Height');
        $info .= ' ';
    }
    $info .= '<i>' . dformat($item['mtime']) . '</i>';
    $info .= ' ';
    $info .= filesize_h($item['size']);
    // output
    echo '<div class="' . $zebra . '"' . $jump . '>' . NL;
    if (!$display_namespace) {
        echo '<a name="h_:' . $item['id'] . '" class="' . $class . '">' . hsc($file) . '</a> ';
    } else {
        echo '<a name="h_:' . $item['id'] . '" class="' . $class . '">' . hsc($item['id']) . '</a><br/>';
    }
    echo '<span class="info">(' . $info . ')</span>' . NL;
    media_fileactions($item, $auth);
    echo '<div class="example" id="ex_' . str_replace(':', '_', $item['id']) . '">';
    echo $lang['mediausage'] . ' <code>{{:' . $item['id'] . '}}</code>';
    echo '</div>';
    if ($item['isimg']) {
        media_printimgdetail($item);
    }
    echo '<div class="clearer"></div>' . NL;
    echo '</div>' . NL;
}
 /**
  * Create html and plain table of the field
  * and collect values for subject and replyto
  *
  * @param helper_plugin_bureaucracy_field[] $fields
  * @param Mailer $mail
  * @return array of html and text table
  */
 protected function processFieldsBuildTable($fields, $mail)
 {
     global $ID;
     $table_html = '<table>';
     $table_text = '';
     foreach ($fields as $field) {
         $html = $text = '';
         $value = $field->getParam('value');
         $label = $field->getParam('label');
         switch ($field->getFieldType()) {
             case 'fieldset':
                 if (!empty($field->depends_on)) {
                     //print fieldset only if depend condition is true
                     foreach ($fields as $field_tmp) {
                         if ($field_tmp->getParam('label') === $field->depends_on[0] && $field_tmp->getParam('value') === $field->depends_on[1]) {
                             list($html, $text) = $this->mail_buildRow($label);
                         }
                     }
                 } else {
                     list($html, $text) = $this->mail_buildRow($label);
                 }
                 break;
             case 'file':
                 if ($value === null || $label === null) {
                     break;
                 }
                 //print attachment only if field was visible
                 $file = $field->getParam('file');
                 if (!$file['size']) {
                     $message = $this->getLang('attachmentMailEmpty');
                 } else {
                     if ($file['size'] > $this->getConf('maxEmailAttachmentSize')) {
                         $message = $file['name'] . ' ' . $this->getLang('attachmentMailToLarge');
                         msg(sprintf($this->getLang('attachmentMailToLarge_userinfo'), hsc($file['name']), filesize_h($this->getConf('maxEmailAttachmentSize'))), 2);
                     } else {
                         $message = $file['name'];
                         $mail->attachFile($file['tmp_name'], $file['type'], $file['name']);
                     }
                 }
                 list($html, $text) = $this->mail_buildRow($label, $message);
                 break;
             case 'subject':
                 $this->subject = $label;
                 break;
             case 'usemailtemplate':
                 if (!is_null($field->getParam('template'))) {
                     $this->mailtemplate = $this->replace($field->getParam('template'));
                     resolve_pageid(getNS($ID), $this->mailtemplate, $ignored);
                 }
                 break;
             default:
                 if ($value === null || $label === null) {
                     break;
                 }
                 list($html, $text) = $this->mail_buildRow($label, $value);
                 if (!is_null($field->getParam('replyto'))) {
                     $this->replyto[] = $value;
                 }
         }
         $table_html .= $html;
         $table_text .= $text;
     }
     $table_html .= '</table>';
     return array($table_html, $table_text);
 }
Пример #14
0
 /**
  * Print a simple listing table
  *
  * @param array  $data
  * @param float  $max
  * @param string $title
  * @param bool   $istraffic
  * @return void
  */
 private function listtable(&$data, $max, $title, $istraffic = false)
 {
     if (!$data) {
         $data = array();
     }
     arsort($data);
     $row = 1;
     $this->R->table_open();
     $this->R->tablerow_open();
     $this->head($title, 4);
     $this->R->tablerow_close();
     $this->R->tablerow_open();
     $this->head('#');
     $this->head($this->getLang('name'));
     if ($istraffic) {
         $this->head($this->getLang('traffic'), 2);
     } else {
         $this->head($this->getLang('hits'), 2);
     }
     $this->R->tablerow_close();
     foreach ($data as $key => $count) {
         if ($istraffic) {
             $val = filesize_h($count);
         } else {
             $val = $count;
         }
         $this->R->tablerow_open();
         $this->cell($row);
         $this->hcell($key);
         $this->cell($val);
         $this->cell($this->pct($count, $max));
         $this->R->tablerow_close();
         $row++;
         if ($row > $this->log->top_limit) {
             break;
         }
     }
     $this->R->table_close();
 }
 /**
  * Formats and prints one file in the list in the thumbnails view
  *
  * @see media_printfile_thumbs()
  */
 function _mod_media_printfile_thumbs($item, $auth, $jump = false, $display_namespace = false)
 {
     global $lang;
     global $conf;
     // Prepare filename
     $file = $this->_getOriginalFileName($item['id']);
     if ($file === false) {
         $file = utf8_decodeFN($item['file']);
     }
     // build fake media id
     $ns = getNS($item['id']);
     $fakeId = $ns === false ? $file : "{$ns}:{$file}";
     $fakeId_escaped = hsc($fakeId);
     // output
     echo '<li><dl title="' . $fakeId_escaped . '">' . NL;
     echo '<dt>';
     if ($item['isimg']) {
         media_printimgdetail($item, true);
     } else {
         echo '<a name="d_:' . $item['id'] . '" class="image" title="' . $fakeId_escaped . '" href="' . media_managerURL(array('image' => $fakeId, 'ns' => $ns, 'tab_details' => 'view')) . '">';
         echo media_printicon($fakeId_escaped);
         echo '</a>';
     }
     echo '</dt>' . NL;
     if (!$display_namespace) {
         $name = hsc($file);
     } else {
         $name = $fakeId_escaped;
     }
     echo '<dd class="name"><a href="' . media_managerURL(array('image' => $fakeId, 'ns' => $ns, 'tab_details' => 'view')) . '" name="h_:' . $item['id'] . '">' . $name . '</a></dd>' . NL;
     if ($item['isimg']) {
         $size = '';
         $size .= (int) $item['meta']->getField('File.Width');
         $size .= '&#215;';
         $size .= (int) $item['meta']->getField('File.Height');
         echo '<dd class="size">' . $size . '</dd>' . NL;
     } else {
         echo '<dd class="size">&#160;</dd>' . NL;
     }
     $date = dformat($item['mtime']);
     echo '<dd class="date">' . $date . '</dd>' . NL;
     $filesize = filesize_h($item['size']);
     echo '<dd class="filesize">' . $filesize . '</dd>' . NL;
     echo '</dl></li>' . NL;
 }
Пример #16
0
function getItems($path, $valid, $list)
{
    global $cfg;
    global $l;
    $path = str_replace('//', '/', $path);
    // remove double slash in path if any
    $retstr = '';
    if ($handle = @opendir($path)) {
        $files = array();
        $valids = implode('|', $valid);
        while (($file = readdir($handle)) !== false) {
            if (is_file($path . $file) && eregi('\\.(' . $valids . ')$', $file, $matches)) {
                $files[$path . $file] = $matches[0];
            }
        }
        closedir($handle);
        ksort($files);
        $dfmt = "m-d-Y";
        foreach ($files as $filename => $ext) {
            $size = @getimagesize($path . basename($filename));
            if ($size === false) {
                continue;
            }
            $fsize = filesize($path . basename($filename));
            $modified = date($dfmt, filemtime($path . basename($filename)));
            $created = date($dfmt, filectime($path . basename($filename)));
            $ctype = iType($size[2]);
            if ($list == true || $list == 1) {
                $retstr .= '<li class="cimgup" ifile="' . basename($filename) . '" iwidth="' . htmlentities($size[0], ENT_QUOTES) . '" iheight="' . htmlentities($size[1], ENT_QUOTES) . '" itype="' . htmlentities($size[2] . '|' . $ctype, ENT_QUOTES) . '" imdate="' . htmlentities($modified, ENT_QUOTES) . '" icdate="' . htmlentities($created, ENT_QUOTES) . '" isize="' . filesize_h($fsize, 2) . '">' . htmlentities(basename($filename), ENT_QUOTES, $l->getCharset()) . '</li>' . "\n";
            } else {
                $src = 'phpThumb/phpThumb.php?src=' . absPath(str_replace($cfg['root_dir'], '', $path)) . basename($filename) . '&w=48&h=48&far=1&bg=ffffff&f=jpg';
                $retstr .= '<li class="cimgup" ifile="' . basename($filename) . '" iwidth="' . htmlentities($size[0], ENT_QUOTES) . '" iheight="' . htmlentities($size[1], ENT_QUOTES) . '" itype="' . htmlentities($size[2] . '|' . $ctype, ENT_QUOTES) . '" imdate="' . htmlentities($modified, ENT_QUOTES) . '" icdate="' . htmlentities($created, ENT_QUOTES) . '" isize="' . filesize_h($fsize, 2) . '">' . '<img src="' . $src . '" width="48" height="48" alt="' . basename($filename) . '; ' . htmlentities($size[0], ENT_QUOTES) . ' x ' . htmlentities($size[1], ENT_QUOTES) . 'px;' . '" title="' . basename($filename) . '; ' . htmlentities($size[0], ENT_QUOTES) . ' x ' . htmlentities($size[1], ENT_QUOTES) . 'px;' . '"/>' . '</li>' . "\n";
            }
        }
        return $retstr;
    }
    echo $l->m('er_036');
    return false;
}
Пример #17
0
/**
 * Display size change
 *
 * @param int $sizechange - size of change in Bytes
 * @param Doku_Form $form - form to add elements to
 */
function html_sizechange($sizechange, Doku_Form $form)
{
    if (isset($sizechange)) {
        $class = 'sizechange';
        $value = filesize_h(abs($sizechange));
        if ($sizechange > 0) {
            $class .= ' positive';
            $value = '+' . $value;
        } elseif ($sizechange < 0) {
            $class .= ' negative';
            $value = '-' . $value;
        } else {
            $value = '±' . $value;
        }
        $form->addElement(form_makeOpenTag('span', array('class' => $class)));
        $form->addElement($value);
        $form->addElement(form_makeCloseTag('span'));
    }
}