Ejemplo n.º 1
0
 public function get_list()
 {
     $path = get_post('path');
     $path = rtrim($path, '/');
     $result = $this->baidu_pcs->get_list($path);
     $list = array();
     foreach ($result as $item) {
         $item['name'] = str_replace($path . '/', '', $item['name']);
         $item['size'] = human_filesize($item['size'], 0);
         $list[] = $item;
     }
     unset($result);
     if ($path != '/' && $path != '') {
         $parent_dir = array('name' => '..', 'size' => '0B', 'date' => max(array_column($list, 'date')), 'type' => 'd');
         array_unshift($list, $parent_dir);
     }
     return include BASE_PATH . '/templates/list.php';
 }
Ejemplo n.º 2
0
 function display_wad_table($limit = 0)
 {
     echo "\n<table>\n\t<tr>\n\t\t<th></th>\n\t\t<th>File</th>\n\t\t<th>Size</th>\n\t\t<th>Uploaded by</th>\n\t\t<th>Date and time</th>\n\t\t<th>MD5</th>\n\t</tr>\n";
     $db = getsql();
     $limitstring = '';
     if ($limit > 0) {
         $limitstring = " LIMIT {$limit}";
     }
     $q = $db->query("SELECT * FROM `wads` ORDER BY `time` DESC {$limitstring}");
     if ($q->num_rows < 1) {
         echo "\n<div id='serversbox'>\n\t<div style='width: 100%; text-align: center'>\n\t\tThere are no WADs uploaded yet.\n\t\t";
         if (is_authed()) {
             echo "\n\t\t<br />\n\t\tFeel free to upload one from the main WADs page.\n\t\t";
         }
         echo "\n\t</div>\n</div>\n\t\t\t\t\t";
     } elseif ($q->num_rows > 0) {
         while ($o = $q->fetch_object()) {
             $id = $o->id;
             $size = human_filesize(filesize(disciple_json()->serverdata . '/wads/' . $o->filename));
             $filename = $o->filename;
             $uploader = $o->uploader;
             $uploader_name = user_info($uploader)->username;
             $time = date('Y-m-d \\a\\t H:i:s', $o->time);
             echo "\n<tr id='wadrow-{$id}'>\n\t<td>\n";
             if (is_authed()) {
                 if (user_info()->userlevel >= UL_ADMINISTRATOR || $uploader == $_SESSION['id']) {
                     echo "<a href='javascript:deleteWad({$id});' title='Delete'><i class='material-icons'>delete</i></a>";
                 }
                 if (user_info()->userlevel >= UL_ADMINISTRATOR) {
                     if ($db->query("SELECT * FROM `wadbans` WHERE `md5`='" . $o->md5 . "'")->num_rows == 0) {
                         echo "<a href='javascript:banWad({$id});' title='Ban'><i class='material-icons'>not_interested</i></a>";
                     } else {
                         echo "<a href='javascript:unbanWad({$id});' title='Unban'><i class='material-icons'>done</i></a>";
                     }
                 }
             }
             echo "\n</td>\n<td><a href='/wads/{$filename}'>{$filename}</a></td>\n<td>{$size}</td>\n<td>{$uploader_name}</td>\n<td>{$time}</td>\n<td id='wadmd5-{$id}'><a href='javascript:wadMd5({$id});'>Show</a></td>\n</tr>\n";
         }
         echo "</table>";
     }
 }
Ejemplo n.º 3
0
function cache_get($url, $cache_file, $verbose = true, $update = false, $cache_life = 43200)
{
    $message = '';
    $content = '';
    clearstatcache();
    if ($url == '') {
        $message .= '[empty url]';
    } else {
        if (file_exists($cache_file) && time() - filemtime($cache_file) <= $cache_life) {
            $message .= '[use cache]';
            $content = @file_get_contents($cache_file);
        } else {
            $message .= '[update cache : ';
            if ($update && file_exists($cache_file) && curl_get_file_size($url) <= filesize($cache_file)) {
                $message .= 'cache file is already bigger';
                $content = @file_get_contents($cache_file);
            } else {
                if (($content = curl_download($url)) !== false) {
                    // @file_get_contents($url)
                    rmkdir(dirname($cache_file));
                    if (($size = @file_put_contents($cache_file, $content)) === false) {
                        $message .= 'not updatable (' . $cache_file . ')';
                    } else {
                        $message .= 'updated (' . human_filesize($size) . ')';
                    }
                    if (strpos($url, 'http://www.magic-ville.com') !== false) {
                        time_nanosleep(0, 500000000);
                    }
                    // Avoid anti-leech mechanism on MV (30 queries every 15 sec)
                } else {
                    $message .= 'not downloadable (' . $url . ')';
                }
            }
            $message .= ']';
        }
    }
    if ($verbose) {
        echo $message;
    }
    return $content;
}
Ejemplo n.º 4
0
 /**
  * Takes a given path and prints the content in json format.
  */
 public static function get_content($app, $path)
 {
     $path = __DIR__ . '/../data/' . $path;
     $path = rtrim($path, '/');
     require_once __DIR__ . '/helper.php';
     // get dir content
     $files = array();
     $folders = array();
     list_dir($path, $files, $folders);
     $files = array_merge($folders, $files);
     // get info
     foreach ($files as $k => $v) {
         $i = get_file_info($v['path'], array('name', 'size', 'date', 'fileperms'));
         if ($v['folder']) {
             $files[$k] = array('name' => $i['name'], 'size' => '---', 'date' => date('Y-m-d H:i:s', $i['date']), 'perm' => unix_perm_string($i['fileperms']), 'folder' => True);
         } else {
             $files[$k] = array('name' => $i['name'], 'size' => human_filesize($i['size']), 'date' => date('Y-m-d H:i:s', $i['date']), 'perm' => unix_perm_string($i['fileperms']), 'folder' => False);
         }
         $files[$k]['link'] = str_replace(__DIR__ . '/../data/', '', $v['path']);
     }
     return json_encode(array('status' => 'ok', 'files' => $files));
 }
Ejemplo n.º 5
0
/**
 * Generate HTML table given path
 */
function generateHTMLTableFromFileSystem($relative_path, $www_root, $file_extension = 'mp4')
{
    $relative_path = rtrim($relative_path, '\\/');
    echo "<table>\n";
    echo "<tr><th valign=\"top\"><img src=\"/icons/blank.gif\" alt=\"[ICO]\"></th><th> Name </th><th> Size <th> <tr>\n";
    //Show link to parent directory
    echo "<tr>\n";
    echo "<td valign=\"top\"><img src=\"/icons/back.gif\" alt=\"[PARENTDIR]\"></td>";
    echo "<td> <a href='index.html?relative_path=" . dirname($relative_path) . "'>Parent Directory</A> </td>\n";
    echo "<td align=\"right\">  - </td>\n";
    echo "</tr>\n";
    echo "<tr><th colspan=\"5\"><hr></th></tr>\n";
    if (is_dir("{$www_root}/{$relative_path}")) {
        foreach (scandir("{$www_root}/{$relative_path}") as $f) {
            if ($f !== '.' and $f !== '..' and $f !== '.AppleDouble') {
                if (is_dir("{$www_root}/{$relative_path}/{$f}")) {
                    //Show link to another directory
                    echo "<tr>\n";
                    echo "<td valign=\"top\"><img src=\"/icons/folder.gif\" alt=\"[DIR]\"></td>\n";
                    echo "<td> <a href='index.html?relative_path=" . "{$relative_path}/{$f}" . "'>{$f}</A> </td>\n";
                    echo "<td align=\"right\">  - </td>\n";
                    echo "</tr>\n";
                } else {
                    if (strcasecmp($file_extension, substr($f, -3)) == 0) {
                        //show player
                        echo "<tr>\n";
                        echo "<td valign=\"top\"><img src=\"/icons/movie.gif\" alt=\"[movie]\"></td>\n";
                        echo "<td> <a href='player.html?file=" . "{$relative_path}/{$f}" . "'>{$f}</A> </td>\n";
                        echo "<td align=\"right\">" . human_filesize(filesize("{$www_root}/{$relative_path}/{$f}")) . "</td>\n";
                        echo "</tr>\n";
                    }
                }
            }
        }
    }
    echo "<tr><th colspan=\"5\"><hr></th></tr>\n";
    echo "</table>\n";
}
Ejemplo n.º 6
0
 private static function makeImageBlock(Post $post, $display)
 {
     /**
      * The following block is only for posts with an image attached.
      */
     if ($post->hasImage() && !$post->imgbanned) {
         $md5Filename = str_replace('/', '-', $post->md5);
         $humanFilesize = $post->fsize > 0 ? human_filesize($post->fsize) . ", " : "";
         list($thumbW, $thumbH) = tn_Size($post->w, $post->h);
         if ($display == self::DISPLAY_OP && ($post->w > 125 || $post->h > 125)) {
             //OP thumbs are 250x250 rather than 125x125
             $thumbW *= 2;
             $thumbH *= 2;
         }
         $thumb = "<a class='fileThumb' href='{$post->getImgUrl()}' target='_blank'>" . "<img src='{$post->getThumbUrl()}' alt='' data-md5='{$post->md5}' data-md5-filename='{$md5Filename}' data-ext='{$post->ext}' data-full-img='{$post->getImgUrl()}' width='{$thumbW}' height='{$thumbH}' data-width='{$post->w}' data-height='{$post->h}' />" . "</a>";
         $chanMedia = $post->board == 'f' ? '//i.4cdn.org/f/src/' . $post->filename . $post->ext : '//i.4cdn.org/' . $post->board . '/src/' . $post->tim . $post->ext;
         $fullImgLink = $post->getExtension() == '.swf' ? $post->getSwfUrl() : $post->getImgUrl();
         $fileDiv = div('', 'file')->set('id', 'f' . $post->no);
         $fileInfo = div('', 'fileInfo');
         $fileText = span('', 'fileText')->set('id', 'fT' . $post->no)->set('data-filename', $post->filename . $post->ext);
         $fileText->append(a($post->filename . $post->ext, $chanMedia)->set("target", "_blank")->set("title", $post->filename . $post->ext)->set("class", 'imageLink')->set('rel', 'noreferrer'))->append('&nbsp;')->append("({$humanFilesize}{$post->w}x{$post->h}, " . ($post->board == 'f' ? $post->tag . ")" : "<span title='{$post->filename}{$post->ext}'>{$post->tim}{$post->ext}</span>)&nbsp;"));
         if ($post->getExtension() != '.swf') {
             $fileText->append(a('iqdb', "http://iqdb.org/?url={$post->getThumbUrl()}")->set("target", "_blank") . '&nbsp;' . a('google', "http://www.google.com/searchbyimage?image_url={$post->getThumbUrl()}")->set("target", "_blank"));
         }
         $fileText->append('&nbsp;' . a('reposts', "/{$post->board}/search/md5/{$post->getMD5Hex()}")->set("target", "_blank") . '&nbsp;' . a('full', $fullImgLink)->set("target", '_blank'));
         $fileInfo->append($fileText);
         $fileDiv->append($fileInfo);
         $fileDiv->append($thumb);
         return $fileDiv;
     } else {
         if ($post->imgbanned) {
             return Site::parseHtmlFragment("post/banned_image.html");
         } else {
             return "";
         }
     }
 }
Ejemplo n.º 7
0
     $item_elt = substr($item_elt, 0, -strlen($item_ext) - 1);
 }
 if ($is_dir) {
     $item_elt = $item_elt != '.' ? "{$item_elt}/" : '/';
 } elseif (isset($_ext) && (!$item_ext || $item_ext == 'sqlite')) {
     $item_elt = "{$item_elt}{$_ext}";
 }
 echo '<tr>';
 echo '<td class="filename"><a href="', $item_elt, '">', $item_elt, '</a>';
 if ($item_ext == 'sqlite') {
     echo ' (sqlite)';
 }
 echo '</td>';
 echo '<td>';
 if (!$is_dir) {
     echo human_filesize(filesize("{$_filename}/{$item}"));
 } else {
     echo '-';
 }
 echo '</td>';
 echo '<td>';
 if ($is_dir) {
     echo $item_elt != '/' ? 'Directory' : 'Root';
 } elseif (substr($item_elt, 0, 5) == '.meta' || substr($item_elt, 0, 4) == '.acl') {
     echo 'RDF';
 } elseif (isset($_RAW_EXT[$item_ext]['short'])) {
     if ($_RAW_EXT[$item_ext]['short'] != 'text') {
         $is_dir = true;
     }
     // fake a dir to disable the edit button
     echo $_RAW_EXT[$item_ext]['type'];
    public function display()
    {
        if ($this->in->exists('mcsavevote')) {
            $this->saveRating();
        }
        $arrPathArray = registry::get_const('patharray');
        if (is_numeric($this->url_id)) {
            //For URL: index.php/MediaCenter/Downloads/MyFileName-17.html
            $arrMediaData = $this->pdh->get('mediacenter_media', 'data', array($this->url_id));
            if ($arrMediaData != false && count($arrMediaData)) {
                $strRef = $this->in->get('ref') != "" ? '&ref=' . $this->in->get('ref') : '';
                $intMediaID = $this->url_id;
                $intCategoryId = $this->pdh->get('mediacenter_media', 'category_id', array($this->url_id));
                $intAlbumID = $this->pdh->get('mediacenter_media', 'album_id', array($this->url_id));
                $blnShowUnpublished = $arrPermissions['change_state'] || $this->user->check_auth('a_mediacenter_manage', false);
                if (!$arrMediaData['published'] && !$blnShowUnpublished) {
                    message_die($this->user->lang('article_unpublished'));
                }
                $arrCategoryData = $this->pdh->get('mediacenter_categories', 'data', array($intCategoryId));
                $intPublished = $arrCategoryData['published'];
                if (!$intPublished && !$this->user->check_auth('a_mediacenter_manage', false)) {
                    message_die($this->user->lang('category_unpublished'));
                }
                //Check Permissions
                $arrPermissions = $this->pdh->get('mediacenter_categories', 'user_permissions', array($intCategoryId, $this->user->id));
                if (!$arrPermissions['read']) {
                    message_die($this->user->lang('category_noauth'), $this->user->lang('noauth_default_title'), 'access_denied', true);
                }
                $arrTags = $this->pdh->get('mediacenter_media', 'tags', array($intMediaID));
                //Create Maincontent
                $intType = $this->pdh->get('mediacenter_media', 'type', array($intMediaID));
                $strExtension = strtolower(pathinfo($arrMediaData['filename'], PATHINFO_EXTENSION));
                $arrPlayableVideos = array('mp4', 'webm', 'ogg');
                $arrAdditionalData = unserialize($arrMediaData['additionaldata']);
                $strPermalink = $this->user->removeSIDfromString($this->env->buildlink() . $this->controller_path_plain . $this->pdh->get('mediacenter_media', 'path', array($intMediaID, false, array(), false)));
                if ($intType === 0) {
                    $this->tpl->assign_vars(array('MC_MEDIA_DOWNLOADS' => $arrMediaData['downloads'], 'MC_MEDIA_FILENAME' => $arrMediaData['filename'], 'S_MC_EXTERNALFILEONLY' => $arrMediaData['filename'] == "" && $arrMediaData['externalfile'] != "" ? true : false, 'MC_MEDIA_EXTENSION' => pathinfo($arrMediaData['filename'], PATHINFO_EXTENSION), 'MC_MEDIA_SIZE' => human_filesize($arrAdditionalData['size']), 'MC_EMBEDD_HTML' => htmlspecialchars('<a href="' . $strPermalink . '">' . $this->pdh->get('mediacenter_media', 'name', array($intMediaID)) . '</a>'), 'MC_EMBEDD_BBCODE' => htmlspecialchars("[url='" . $strPermalink . "']" . $this->pdh->get('mediacenter_media', 'name', array($intMediaID)) . "[/url]")));
                } elseif ($intType === 1) {
                    //Video
                    $blnIsEmbedly = false;
                    if (isset($arrAdditionalData['html'])) {
                        //Is embedly Video
                        $strVideo = $arrAdditionalData['html'];
                        $blnIsEmbedly = true;
                    } else {
                        $strExternalExtension = strtolower(pathinfo($arrMediaData['externalfile'], PATHINFO_EXTENSION));
                        if (strlen($arrMediaData['externalfile']) && in_array($strExternalExtension, $arrPlayableVideos)) {
                            $this->tpl->css_file($this->root_path . 'plugins/mediacenter/includes/videojs/video-js.min.css');
                            $this->tpl->js_file($this->root_path . 'plugins/mediacenter/includes/videojs/video.js');
                            $this->tpl->add_js('videojs.options.flash.swf = "' . $this->server_path . 'plugins/mediacenter/includes/videojs/video-js.swf"; ', 'docready');
                            switch ($strExternalExtension) {
                                case 'mp4':
                                    $strSource = '  <source src="' . $arrMediaData['externalfile'] . '" type=\'video/mp4\' />';
                                    break;
                                case 'webm':
                                    $strSource = '  <source src="' . $arrMediaData['externalfile'] . '" type=\'video/webm\' />';
                                    break;
                                case 'ogg':
                                    $strSource = '   <source src="' . $arrMediaData['externalfile'] . '" type=\'video/ogg\' />';
                                    break;
                            }
                            $strVideo = '  <video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" width="640" height="364"
						      poster="" data-setup="{}">
						    ' . $strSource . '
						    <p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p>
						  </video>';
                        } elseif (in_array($strExtension, $arrPlayableVideos)) {
                            $this->tpl->css_file($this->root_path . 'plugins/mediacenter/includes/videojs/video-js.min.css');
                            $this->tpl->js_file($this->root_path . 'plugins/mediacenter/includes/videojs/video.js');
                            $this->tpl->add_js('videojs.options.flash.swf = "' . $this->server_path . 'plugins/mediacenter/includes/videojs/video-js.swf"; ', 'docready');
                            $strLocalFile = $this->pfh->FolderPath('files', 'mediacenter', 'absolute') . $arrMediaData['localfile'];
                            switch ($strExtension) {
                                case 'mp4':
                                    $strSource = '  <source src="' . $strLocalFile . '" type=\'video/mp4\' />';
                                    break;
                                case 'webm':
                                    $strSource = '  <source src="' . $strLocalFile . '" type=\'video/webm\' />';
                                    break;
                                case 'ogg':
                                    $strSource = '   <source src="' . $strLocalFile . '" type=\'video/ogg\' />';
                                    break;
                            }
                            $strVideo = '  <video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" width="640" height="364"
						      poster="" data-setup="{}">
						    ' . $strSource . '
						    <p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p>
						  </video>';
                        } else {
                            $strVideo = 'Cannot play this video type.';
                        }
                    }
                    $strEmbeddHTML = $blnIsEmbedly ? $arrAdditionalData['html'] : '<a href="' . $strPermalink . '">' . $this->pdh->get('mediacenter_media', 'name', array($intMediaID)) . '</a>';
                    $this->tpl->assign_vars(array('MC_VIDEO' => $strVideo, 'MC_EMBEDD_HTML' => htmlspecialchars($strEmbeddHTML), 'MC_EMBEDD_BBCODE' => htmlspecialchars("[url='" . $strPermalink . "']" . $this->pdh->get('mediacenter_media', 'name', array($intMediaID)) . "[/url]")));
                } else {
                    //Image
                    $strThumbfolder = $this->pfh->FolderPath('thumbs', 'mediacenter');
                    if (file_exists($strThumbfolder . $arrMediaData['localfile'] . '.' . $strExtension)) {
                        $strImage = $strThumbfolder . $arrMediaData['localfile'] . '.' . $strExtension;
                    } else {
                        $strImage = $this->pfh->FolderPath('files', 'mediacenter', 'relative') . $arrMediaData['localfile'];
                    }
                    $arrImageDimesions = getimagesize($strImage);
                    $strImage = str_replace($this->root_path, $this->server_path, $strImage);
                    $strOtherImages = "";
                    $arrOtherFiles = $this->pdh->get('mediacenter_media', 'other_ids', array($intMediaID, $strRef != "" ? true : false));
                    $this->jquery->lightbox(md5($intMediaID), array('slideshow' => true, 'transition' => "elastic", 'slideshowSpeed' => 4500, 'slideshowAuto' => false, 'type' => 'photo', 'title_function' => "var url = \$(this).data('url');\nvar title = \$(this).attr('title');\nif(url == undefined){ url = \$(this).attr('href');}\nvar desc = \$(this).data('desc');\nif(desc == undefined) { desc = ''; } else { desc = '<br />'+desc;}\nreturn '<a href=\"' + url + '\">'+title+'</a>'+desc;"));
                    foreach ($arrOtherFiles as $intFileID) {
                        if ($intFileID === $intMediaID) {
                            continue;
                        }
                        if ($this->pdh->get('mediacenter_media', 'type', array($intFileID)) === 2) {
                            $strName = $this->pdh->get('mediacenter_media', 'name', array($intFileID));
                            $strOtherImage = $this->controller_path . $this->pdh->get('mediacenter_media', 'path', array($intFileID));
                            $strDesc = $this->pdh->get('mediacenter_media', 'description', array($intFileID));
                            $strDesc = strip_tags($this->bbcode->remove_bbcode($strDesc));
                            $strOtherImages .= '<a href="' . $strOtherImage . '&image" data-url="' . $strOtherImage . '" data-desc="' . $strDesc . '" class="lightbox_' . md5($intMediaID) . '" rel="' . md5($intMediaID) . '" title="' . sanitize($strName) . '"><img src="" /></a>';
                        }
                    }
                    $this->tpl->assign_vars(array('MC_IMAGE' => $strImage, 'MC_MEDIA_FILENAME' => $arrMediaData['filename'], 'MC_MEDIA_IMAGEDIMENSIONS' => $arrImageDimesions[0] . ' x ' . $arrImageDimesions[1], 'MC_LIGHTBOX' => md5($intMediaID), 'MC_OTHER_IMAGES' => $strOtherImages, 'MC_DESC_STRIPPED' => strip_tags($this->bbcode->remove_bbcode($arrMediaData['description'])), 'MC_EMBEDD_HTML_BIG' => htmlspecialchars('<a href="' . $strPermalink . '"><img src="' . $strPermalink . '?image" alt="" /></a>'), 'MC_EMBEDD_HTML_SMALL' => htmlspecialchars('<a href="' . $strPermalink . '"><img src="' . $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 2, true)) . '" alt="" /></a>'), 'MC_EMBEDD_BBCODE_SMALL' => htmlspecialchars("[url='" . $strPermalink . "'][img]" . $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 2, true)) . "[/img][/url]"), 'MC_EMBEDD_BBCODE_BIG' => htmlspecialchars("[url='" . $strPermalink . "'][img]" . $strPermalink . "?image[/img][/url]")));
                    foreach ($arrAdditionalData as $key => $val) {
                        if ($key === 'size') {
                            $val = human_filesize($val);
                        } elseif ($key === 'CreationTime') {
                            if ($val === 0) {
                                continue;
                            }
                            $val = $this->time->createTimeTag((int) $val, $this->time->user_date($val, true));
                        } elseif ($key === 'FNumber') {
                            $val = 'f/' . $val;
                        }
                        if ($key == 'Longitude' || $key == 'Latitude' || $key == 'Orientation') {
                            continue;
                        }
                        if (!strlen($val)) {
                            continue;
                        }
                        $this->tpl->assign_block_vars('mc_more_image_details', array('LABEL' => $this->user->lang('mc_' . $key), 'VALUE' => strlen($val) ? sanitize($val) : '&nbsp;'));
                    }
                    if (isset($arrAdditionalData['Longitude']) && isset($arrAdditionalData['Latitude']) && (int) $this->config->get('show_maps', 'mediacenter') == 1) {
                        $this->tpl->assign_vars(array('S_MC_COORDS' => true, 'MC_MEDIA_LONGITUDE' => $arrAdditionalData['Longitude'], 'MC_MEDIA_LATITUDE' => $arrAdditionalData['Latitude']));
                    }
                }
                $nextID = $this->pdh->get('mediacenter_media', 'next_media', array($intMediaID, $strRef != "" ? true : false));
                $prevID = $this->pdh->get('mediacenter_media', 'prev_media', array($intMediaID, $strRef != "" ? true : false));
                $arrInvolvedUser = $this->pdh->get('comment', 'involved_users', array('mediacenter', $intMediaID));
                $arrInvolvedUser[] = $this->pdh->get('mediacenter_media', 'user_id', array($intMediaID));
                $arrInvolvedUser = array_unique($arrInvolvedUser);
                $this->comments->SetVars(array('attach_id' => $intMediaID, 'page' => 'mediacenter', 'auth' => 'a_mediacenter_manage', 'ntfy_type' => 'mediacenter_media_comment_new', 'ntfy_title' => $this->pdh->get('mediacenter_media', 'name', array($intMediaID)), 'ntfy_link' => $this->controller_path_plain . $this->pdh->get('mediacenter_media', 'path', array($intMediaID)), 'ntfy_user' => $arrInvolvedUser));
                $intCommentsCount = $this->comments->Count();
                //Reset Notifications
                if ($this->user->is_signedin()) {
                    $arrCommentIDs = $this->pdh->get('comment', 'filtered_list', array('mediacenter', $intMediaID));
                    if (count($arrCommentIDs)) {
                        $this->ntfy->markAsRead('mediacenter_media_comment_new', $this->user->id, array_keys($arrCommentIDs));
                    }
                    $this->ntfy->markAsRead('mediacenter_media_new', $this->user->id, $intMediaID);
                }
                $arrToolbarItems = array();
                if ($arrPermissions['create'] || $this->user->check_auth('a_mediacenter_manage', false)) {
                    $arrToolbarItems[] = array('icon' => 'fa-plus', 'js' => 'onclick="editMedia(0)"', 'title' => $this->user->lang('mc_add_media'));
                }
                if ($arrPermissions['update'] || $this->user->check_auth('a_mediacenter_manage', false)) {
                    $arrToolbarItems[] = array('icon' => 'fa-pencil-square-o', 'js' => 'onclick="editMedia(' . $intMediaID . ')"', 'title' => $this->user->lang('mc_edit_media'));
                }
                if ($arrPermissions['delete']) {
                    $arrToolbarItems[] = array('icon' => 'fa-trash-o', 'js' => 'onclick="$(\'#del_articles\').click()"', 'title' => $this->user->lang('mc_delete_media'));
                }
                if ($arrPermissions['change_state']) {
                    if ($this->pdh->get('mediacenter_media', 'published', array($intMediaID))) {
                        $arrToolbarItems[] = array('icon' => 'fa-eye-slash', 'js' => 'onclick="$(\'#set_unpublished\').click()"', 'title' => $this->user->lang('article_unpublish'));
                    } else {
                        $arrToolbarItems[] = array('icon' => 'fa-eye', 'js' => 'onclick="$(\'#set_published\').click()"', 'title' => $this->user->lang('article_publish'));
                    }
                }
                $this->confirm_delete($this->user->lang('mc_confirm_delete_media'));
                $jqToolbar = $this->jquery->toolbar('pages', $arrToolbarItems, array('position' => 'bottom'));
                $strAlbumEditID = $this->pdh->get('mediacenter_media', 'album_id', array($intMediaID)) ? $this->pdh->get('mediacenter_media', 'album_id', array($intMediaID)) : 'c' . $intCategoryId;
                $this->tpl->assign_vars(array('MC_MEDIA_PREVIEW_IMAGE' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 2, false, 'mcPreviewImageBig')), 'MC_MEDIA_PREVIEW_IMAGE_URL' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 2, true)), 'MC_MEDIA_NAME' => $this->pdh->get('mediacenter_media', 'name', array($intMediaID)), 'MC_MEDIA_LINK' => $this->controller_path . $this->pdh->get('mediacenter_media', 'path', array($intMediaID)), 'MC_MEDIA_VIEWS' => $this->pdh->get('mediacenter_media', 'views', array($intMediaID)), 'MC_MEDIA_AUTHOR' => $this->pdh->geth('user', 'name', array($this->pdh->get('mediacenter_media', 'user_id', array($intMediaID)), '', '', true)), 'MC_MEDIA_DATE' => $this->time->createTimeTag($this->pdh->get('mediacenter_media', 'date', array($intMediaID)), $this->pdh->geth('mediacenter_media', 'date', array($intMediaID))), 'MC_MEDIA_ALBUM' => strlen($this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true))) ? $this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true)) : '', 'MC_MEDIA_DESCRIPTION' => $this->bbcode->toHTML($this->pdh->get('mediacenter_media', 'description', array($intMediaID))), 'MC_MEDIA_TYPE' => $intType, 'MC_BREADCRUMB' => $intAlbumID ? str_replace('class="current"', '', $this->pdh->get('mediacenter_albums', 'breadcrumb', array($intAlbumID))) : str_replace('class="current"', '', $this->pdh->get('mediacenter_categories', 'breadcrumb', array($intCategoryId))), 'S_MC_TAGS' => count($arrTags) ? true : false, 'S_NEXT_MEDIA' => $nextID !== false ? true : false, 'S_PREV_MEDIA' => $prevID !== false ? true : false, 'U_NEXT_MEDIA' => $nextID ? $this->controller_path . $this->pdh->get('mediacenter_media', 'path', array($nextID)) . $strRef : '', 'U_PREV_MEDIA' => $prevID ? $this->controller_path . $this->pdh->get('mediacenter_media', 'path', array($prevID)) . $strRef : '', 'MEDIA_NEXT_TITLE' => $nextID ? $this->pdh->get('mediacenter_media', 'name', array($nextID)) : '', 'MEDIA_PREV_TITLE' => $prevID ? $this->pdh->get('mediacenter_media', 'name', array($prevID)) : '', 'MC_MEDIA_SOCIAL_BUTTONS' => $this->social->createSocialButtons($this->env->link . $this->controller_path_plain . $this->pdh->get('mediacenter_media', 'path', array($intMediaID)), strip_tags($this->pdh->get('mediacenter_media', 'name', array($intMediaID)))), 'MC_MEDIA_RATING' => $arrCategoryData['allow_voting'] ? $this->jquery->starrating($intMediaID, $this->controller_path . 'MediaCenter/' . $this->SID . '&mcsavevote&link_hash=' . $this->CSRFGetToken('savevote'), array('score' => $arrMediaData['votes_count'] ? round($arrMediaData['votes_sum'] / $arrMediaData['votes_count']) : 0, 'number' => 10)) : '', 'MC_MEDIA_COMMENTS_COUNTER' => $intCommentsCount == 1 ? $intCommentsCount . ' ' . $this->user->lang('comment') : $intCommentsCount . ' ' . $this->user->lang('comments'), 'S_MC_COMMENTS' => $arrCategoryData['allow_comments'] ? true : false, 'MC_COMMENTS' => $this->comments->Show(), 'MC_TOOLBAR' => $jqToolbar['id'], 'S_MC_TOOLBAR' => $arrPermissions['create'] || $arrPermissions['update'] || $arrPermissions['delete'] || $arrPermissions['change_state'], 'MC_MEDIA_ID' => $intMediaID, 'MC_CATEGORY_ID' => $intCategoryId, 'MC_PERMALINK' => $strPermalink, 'MC_S_PUBLISHED' => $this->pdh->get('mediacenter_media', 'published', array($intMediaID)) ? true : false));
                $this->social->callSocialPlugins($this->pdh->get('mediacenter_media', 'name', array($intMediaID)), truncate($this->bbcode->remove_bbcode($this->pdh->get('mediacenter_media', 'description', array($intMediaID))), 200), $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 2, true)));
                if (count($arrTags) && $arrTags[0] != "") {
                    foreach ($arrTags as $tag) {
                        $this->tpl->assign_block_vars('tag_row', array('TAG' => $tag, 'U_TAG' => $this->controller_path . 'MediaCenter/Tags/' . $tag));
                    }
                }
                //Update Views
                if (!$this->env->is_bot($this->user->data['session_browser'])) {
                    $this->pdh->put('mediacenter_media', 'update_view', array($intMediaID));
                }
                if ($arrPermissions['create'] || $arrPermissions['update']) {
                    $this->jquery->dialog('editMedia', $this->user->lang('mc_edit_media'), array('url' => $this->controller_path . "EditMedia/Media-'+id+'/" . $this->SID . "&aid=" . $strAlbumEditID, 'withid' => 'id', 'width' => 920, 'height' => 740, 'onclose' => $this->env->link . $this->controller_path_plain . $this->page_path . $this->SID));
                }
                if ($arrPermissions['delete'] || $arrPermissions['change_state']) {
                    $this->jquery->dialog('deleteMedia', $this->user->lang('mc_delete_media'), array('custom_js' => 'deleteMediaSubmit(aid);', 'confirm', 'withid' => 'aid', 'message' => $this->user->lang('mc_confirm_delete_media')), 'confirm');
                    $this->tpl->add_js("function deleteMediaSubmit(aid){\n\t\t\t\t\twindow.location='" . $this->controller_path . $this->page_path . $this->SID . '&mcdelete&link_hash=' . $this->CSRFGetToken('delete') . "&aid='+aid;\n\t\t\t\t}");
                }
                // -- EQDKP ---------------------------------------------------------------
                $this->core->set_vars(array('page_title' => $this->pdh->get('mediacenter_media', 'name', array($intMediaID)) . ' - ' . $this->user->lang('mediacenter'), 'template_path' => $this->pm->get_data('mediacenter', 'template_path'), 'template_file' => 'media.html', 'display' => true));
            } else {
                redirect($this->controller_path_plain . 'MediaCenter/' . $this->SID);
            }
        } elseif (isset($arrPathArray[1]) && $arrPathArray[1] === 'tags') {
            $strTag = $this->url_id;
            //Items per Page
            $intPerPage = $this->config->get('per_page', 'mediacenter');
            //Grid or List
            $intLayout = $this->in->exists('layout') ? $this->in->get('layout', 0) : 1;
            $hptt_page_settings = array('name' => 'hptt_mc_categorylist', 'table_main_sub' => '%intMediaID%', 'table_subs' => array('%intCategoryID%', '%intMediaID%'), 'page_ref' => 'manage_media.php', 'show_numbers' => false, 'selectboxes_checkall' => true, 'show_detail_twink' => false, 'table_sort_dir' => 'desc', 'table_sort_col' => 3, 'table_presets' => array(array('name' => 'mediacenter_media_previewimage', 'sort' => false, 'th_add' => 'width="20"', 'td_add' => ''), array('name' => 'mediacenter_media_frontendlist', 'sort' => true, 'th_add' => '', 'td_add' => ''), array('name' => 'mediacenter_media_type', 'sort' => true, 'th_add' => 'width="20"', 'td_add' => ''), array('name' => 'mediacenter_media_date', 'sort' => true, 'th_add' => 'width="20"', 'td_add' => 'nowrap="nowrap"'), array('name' => 'mediacenter_media_views', 'sort' => true, 'th_add' => 'width="20"', 'td_add' => '')));
            $start = $this->in->get('start', 0);
            $page_suffix = '&amp;layout=' . $intLayout;
            $sort_suffix = '&sort=' . $this->in->get('sort', '3|desc');
            $strBaseLayoutURL = $this->strPath . $this->SID . '&sort=' . $this->in->get('sort', '3|desc') . '&start=' . $start . '&layout=';
            $strBaseSortURL = $this->strPath . $this->SID . '&start=' . $start . '&layout=' . $intLayout . '&sort=';
            $arrSortOptions = $this->user->lang('mc_sort_options');
            $arrMediaInCategory = $this->pdh->get('mediacenter_media', 'id_list_for_tags', array($strTag));
            if (count($arrMediaInCategory)) {
                $view_list = $arrMediaInCategory;
                $hptt = $this->get_hptt($hptt_page_settings, $view_list, $view_list, array(), 'tag' . md5($strTag));
                $hptt->setPageRef($this->strPath);
                $this->tpl->assign_vars(array('S_IN_CATEGORY' => true, 'S_LAYOUT_LIST' => $intLayout == 1 ? true : false, 'MEDIA_LIST' => $hptt->get_html_table($this->in->get('sort'), $page_suffix, $start, $intPerPage, null, false, array('mediacenter_media', 'checkbox_check')), 'PAGINATION' => generate_pagination($this->strPath . $this->SID . $sort_suffix . $page_suffix, count($view_list), $intPerPage, $start)));
                $arrRealViewList = $hptt->get_view_list();
                foreach ($arrRealViewList as $intMediaID) {
                    $this->tpl->assign_block_vars('mc_media_row', array('PREVIEW_IMAGE' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 2)), 'PREVIEW_IMAGE_URL' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 2, true)), 'NAME' => $this->pdh->get('mediacenter_media', 'name', array($intMediaID)), 'LINK' => $this->controller_path . $this->pdh->get('mediacenter_media', 'path', array($intMediaID)), 'VIEWS' => $this->pdh->get('mediacenter_media', 'views', array($intMediaID)), 'COMMENTS' => $this->pdh->get('mediacenter_media', 'comment_count', array($intMediaID)), 'AUTHOR' => $this->core->icon_font('fa-user') . ' ' . $this->pdh->geth('user', 'name', array($this->pdh->get('mediacenter_media', 'user_id', array($intMediaID)), '', '', true)), 'DATE' => $this->time->createTimeTag($this->pdh->get('mediacenter_media', 'date', array($intMediaID)), $this->pdh->geth('mediacenter_media', 'date', array($intMediaID))), 'CATEGORY_AND_ALBUM' => strlen($this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true))) ? ' &bull; ' . $this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true)) : '', 'DESCRIPTION' => $this->bbcode->remove_bbcode($this->pdh->get('mediacenter_media', 'description', array($intMediaID))), 'TYPE' => $this->pdh->geth('mediacenter_media', 'type', array($intMediaID))));
                }
            }
            $this->tpl->assign_vars(array('MC_CATEGORY_NAME' => ucfirst(sanitize($strTag)), 'MC_CATEGORY_MEDIA_COUNT' => count($arrMediaInCategory), 'MC_LAYOUT_DD' => new hdropdown('selectlayout', array('options' => $this->user->lang('mc_layout_types'), 'value' => $intLayout, 'id' => 'selectlayout', 'class' => 'dropdown')), 'MC_SORT_DD' => new hdropdown('selectsort', array('options' => $arrSortOptions, 'value' => $this->in->get('sort', '3|desc'), 'id' => 'selectsort', 'class' => 'dropdown')), 'MC_BASEURL_LAYOUT' => $strBaseLayoutURL, 'MC_BASEURL_SORT' => $strBaseSortURL));
            // -- EQDKP ---------------------------------------------------------------
            $this->core->set_vars(array('page_title' => ucfirst(sanitize($strTag)) . ' - ' . $this->user->lang('mediacenter'), 'template_path' => $this->pm->get_data('mediacenter', 'template_path'), 'template_file' => 'tags.html', 'display' => true));
        } elseif (strlen($this->url_id)) {
            //For Category-View: index.php/MediaCenter/Downloads/
            //Also Subcategories possible:
            // index.php/MediaCenter/Blablupp/Sowieso/Downloads/
            $arrPathParts = registry::get_const('patharray');
            $strCategoryAlias = $this->url_id;
            if ($strCategoryAlias != $arrPathParts[0]) {
                $strCategoryAlias = $this->url_id = $arrPathParts[0];
            }
            $intCategoryId = $this->pdh->get('mediacenter_categories', 'resolve_alias', array($strCategoryAlias));
            if ($intCategoryId) {
                $arrCategoryData = $this->pdh->get('mediacenter_categories', 'data', array($intCategoryId));
                $intPublished = $arrCategoryData['published'];
                if (!$intPublished) {
                    message_die($this->user->lang('category_unpublished'));
                }
                //Check Permissions
                $arrPermissions = $this->pdh->get('mediacenter_categories', 'user_permissions', array($intCategoryId, $this->user->id));
                if (!$arrPermissions['read']) {
                    message_die($this->user->lang('category_noauth'), $this->user->lang('noauth_default_title'), 'access_denied', true);
                }
                if ($this->in->exists('map') && (int) $this->config->get('show_maps', 'mediacenter') == 1) {
                    $arrMediaInCategory = $this->pdh->get('mediacenter_media', 'id_list_for_category', array($intCategoryId, $blnShowUnpublished ? false : true, true));
                    $intCount = 0;
                    foreach ($arrMediaInCategory as $intMediaID) {
                        $arrAdditionalData = $this->pdh->get('mediacenter_media', 'additionaldata', array($intMediaID));
                        if (isset($arrAdditionalData['Longitude']) && isset($arrAdditionalData['Latitude'])) {
                            $this->tpl->assign_block_vars('mc_media_row', array('LNG' => $arrAdditionalData['Longitude'], 'LAT' => $arrAdditionalData['Latitude'], 'NAME' => $this->pdh->get('mediacenter_media', 'name', array($intMediaID)), 'LINK' => $this->server_path . $this->controller_path_plain . $this->pdh->get('mediacenter_media', 'path', array($intMediaID)), 'PREVIEW_IMAGE' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 2))));
                            $intCount++;
                        }
                    }
                    $this->tpl->assign_vars(array('MC_CATEGORY_NAME' => $arrCategoryData['name'], 'MC_CATEGORY_ID' => $intCategoryId, 'MC_BREADCRUMB' => $this->pdh->get('mediacenter_categories', 'breadcrumb', array($intCategoryId)), 'MC_CATEGORY_MEDIA_COUNT' => $intCount));
                    // -- EQDKP ---------------------------------------------------------------
                    $this->core->set_vars(array('page_title' => $arrCategoryData['name'] . ' - ' . $this->user->lang('mediacenter'), 'template_path' => $this->pm->get_data('mediacenter', 'template_path'), 'template_file' => 'map.html', 'display' => true));
                } else {
                    $arrMediaInCategory = $this->pdh->get('mediacenter_media', 'id_list_for_category', array($intCategoryId, $blnShowUnpublished ? false : true, true));
                    $intMapCount = 0;
                    foreach ($arrMediaInCategory as $intMediaID) {
                        $arrAdditionalData = $this->pdh->get('mediacenter_media', 'additionaldata', array($intMediaID));
                        if (isset($arrAdditionalData['Longitude']) && isset($arrAdditionalData['Latitude'])) {
                            $intMapCount++;
                        }
                    }
                }
                $blnShowUnpublished = $arrPermissions['change_state'] || $this->user->check_auth('a_mediacenter_manage', false);
                $arrChilds = $this->pdh->get('mediacenter_categories', 'childs', array($intCategoryId));
                foreach ($arrChilds as $intChildID) {
                    $this->tpl->assign_block_vars('child_row', array('CATEGORY_NAME' => $this->pdh->get('mediacenter_categories', 'name', array($intChildID)), 'CATEGORY_ID' => $intChildID, 'CATEGORY_LINK' => $this->controller_path . $this->pdh->get('mediacenter_categories', 'path', array($intChildID)), 'MEDIA_COUNT' => $this->pdh->get('mediacenter_categories', 'media_count', array($intChildID)), 'S_HAS_CHILDS' => count($this->pdh->get('mediacenter_categories', 'childs', array($intChildID))) > 0 ? true : false));
                }
                //Items per Page
                $intPerPage = $arrCategoryData['per_page'];
                //Grid or List
                $intLayout = $this->in->exists('layout') ? $this->in->get('layout', 0) : (int) $arrCategoryData['layout'];
                $hptt_page_settings = array('name' => 'hptt_mc_categorylist', 'table_main_sub' => '%intMediaID%', 'table_subs' => array('%intCategoryID%', '%intMediaID%'), 'page_ref' => 'manage_media.php', 'show_numbers' => false, 'selectboxes_checkall' => true, 'show_detail_twink' => false, 'table_sort_dir' => 'desc', 'table_sort_col' => 3, 'table_presets' => array(array('name' => 'mediacenter_media_previewimage', 'sort' => false, 'th_add' => 'width="20"', 'td_add' => ''), array('name' => 'mediacenter_media_frontendlist', 'sort' => true, 'th_add' => '', 'td_add' => ''), array('name' => 'mediacenter_media_type', 'sort' => true, 'th_add' => 'width="20"', 'td_add' => ''), array('name' => 'mediacenter_media_date', 'sort' => true, 'th_add' => 'width="20"', 'td_add' => 'nowrap="nowrap"'), array('name' => 'mediacenter_media_views', 'sort' => true, 'th_add' => 'width="20"', 'td_add' => '')));
                if ($arrPermissions['delete'] || $arrPermissions['change_state']) {
                    $hptt_page_settings['show_select_boxes'] = true;
                }
                $start = $this->in->get('start', 0);
                $page_suffix = '&amp;layout=' . $intLayout;
                $sort_suffix = '&sort=' . $this->in->get('sort', '3|desc');
                $strBaseLayoutURL = $this->strPath . $this->SID . '&sort=' . $this->in->get('sort', '3|desc') . '&start=' . $start . '&layout=';
                $strBaseSortURL = $this->strPath . $this->SID . '&start=' . $start . '&layout=' . $intLayout . '&sort=';
                $arrSortOptions = $this->user->lang('mc_sort_options');
                $arrMediaInCategory = $this->pdh->get('mediacenter_media', 'id_list_for_category', array($intCategoryId, $blnShowUnpublished ? false : true, true));
                if (count($arrMediaInCategory)) {
                    $view_list = $arrMediaInCategory;
                    $hptt = $this->get_hptt($hptt_page_settings, $view_list, $view_list, array('%link_url_suffix%' => '&amp;ref=cat'), 'cat_' . $intCategoryId . '.0');
                    $hptt->setPageRef($this->strPath);
                    $this->tpl->assign_vars(array('S_IN_CATEGORY' => true, 'S_LAYOUT_LIST' => $intLayout == 1 ? true : false, 'MEDIA_LIST' => $hptt->get_html_table($this->in->get('sort'), $page_suffix, $start, $intPerPage, null, false, array('mediacenter_media', 'checkbox_check')), 'PAGINATION' => generate_pagination($this->strPath . $this->SID . $sort_suffix . $page_suffix, count($view_list), $intPerPage, $start)));
                    $arrRealViewList = $hptt->get_view_list();
                    foreach ($arrRealViewList as $intMediaID) {
                        $this->tpl->assign_block_vars('mc_media_row', array('ID' => $intMediaID, 'PREVIEW_IMAGE' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 2)), 'PREVIEW_IMAGE_URL' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 2, true)), 'NAME' => $this->pdh->get('mediacenter_media', 'name', array($intMediaID)), 'LINK' => $this->controller_path . $this->pdh->get('mediacenter_media', 'path', array($intMediaID)) . '&ref=cat', 'VIEWS' => $this->pdh->get('mediacenter_media', 'views', array($intMediaID)), 'COMMENTS' => $this->pdh->get('mediacenter_media', 'comment_count', array($intMediaID)), 'AUTHOR' => $this->core->icon_font('fa-user') . ' ' . $this->pdh->geth('user', 'name', array($this->pdh->get('mediacenter_media', 'user_id', array($intMediaID)), '', '', true)), 'DATE' => $this->time->createTimeTag($this->pdh->get('mediacenter_media', 'date', array($intMediaID)), $this->pdh->geth('mediacenter_media', 'date', array($intMediaID))), 'CATEGORY_AND_ALBUM' => strlen($this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true))) ? ' &bull; ' . $this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true)) : '', 'DESCRIPTION' => $this->bbcode->remove_bbcode($this->pdh->get('mediacenter_media', 'description', array($intMediaID))), 'TYPE' => $this->pdh->geth('mediacenter_media', 'type', array($intMediaID)), 'S_PUBLISHED' => $this->pdh->get('mediacenter_media', 'published', array($intMediaID)) ? true : false, 'S_CHECKBOX' => $arrPermissions['delete'] || $arrPermissions['change_state']));
                    }
                }
                $arrAlbums = $this->pdh->get('mediacenter_albums', 'albums_for_category', array($intCategoryId));
                foreach ($arrAlbums as $intAlbumID) {
                    $view_list = $this->pdh->get('mediacenter_media', 'id_list', array($intAlbumID, true));
                    $this->tpl->assign_block_vars('album_list', array('NAME' => $this->pdh->get('mediacenter_albums', 'name', array($intAlbumID)), 'LINK' => $this->controller_path . $this->pdh->get('mediacenter_albums', 'path', array($intAlbumID)), 'S_PERSONAL' => $this->pdh->get('mediacenter_albums', 'personal_album', array($intAlbumID)) ? true : false, 'S_ALBUM' => true, 'MEDIA_COUNT' => count($view_list), 'USER' => $this->pdh->get('user', 'name', array($this->pdh->get('mediacenter_albums', 'user_id', array($intAlbumID)))), 'ID' => $intAlbumID));
                }
                $strPermalink = $this->user->removeSIDfromString($this->env->buildlink() . $this->controller_path_plain . $this->pdh->get('mediacenter_categories', 'path', array($intCategoryId, false)));
                $arrToolbarItems = array();
                if ($arrPermissions['create'] || $this->user->check_auth('a_mediacenter_manage', false)) {
                    $arrToolbarItems[] = array('icon' => 'fa-plus', 'js' => 'onclick="editMedia(0)"', 'title' => $this->user->lang('mc_add_media'));
                    $this->jquery->dialog('editMedia', $this->user->lang('mc_add_media'), array('url' => $this->controller_path . "EditMedia/Media-'+id+'/" . $this->SID . "&aid=c" . $intCategoryId, 'withid' => 'id', 'width' => 920, 'height' => 740, 'onclose' => $this->env->link . $this->controller_path_plain . $this->page_path . $this->SID));
                }
                if ($this->user->check_auth('a_mediacenter_manage', false)) {
                    $arrToolbarItems[] = array('icon' => 'fa-list', 'js' => 'onclick="window.location=\'' . $this->server_path . "plugins/mediacenter/admin/manage_media.php" . $this->SID . '&cid=' . $intCategoryId . '\';"', 'title' => $this->user->lang('mc_manage_media'));
                    $arrToolbarItems[] = array('icon' => 'fa-pencil', 'js' => 'onclick="window.location=\'' . $this->server_path . "plugins/mediacenter/admin/manage_categories.php" . $this->SID . '&cid=' . $intCategoryId . '\';"', 'title' => $this->user->lang('mc_manage_category'));
                }
                $jqToolbar = $this->jquery->toolbar('pages', $arrToolbarItems, array('position' => 'bottom'));
                $arrMenuItems = array();
                if ($arrPermissions['delete']) {
                    $arrMenuItems[] = array('name' => $this->user->lang('delete'), 'type' => 'button', 'icon' => 'fa-trash-o', 'perm' => true, 'link' => '#del_articles');
                }
                if ($arrPermissions['change_state']) {
                    $arrMenuItems[] = array('name' => $this->user->lang('mc_change_state_publish'), 'type' => 'button', 'icon' => 'fa-eye', 'perm' => true, 'link' => '#set_published');
                    $arrMenuItems[] = array('name' => $this->user->lang('mc_change_state_unpublish'), 'type' => 'button', 'icon' => 'fa-eye-slash', 'perm' => true, 'link' => '#set_unpublished');
                }
                $this->confirm_delete($this->user->lang('mc_confirm_delete_media'));
                $this->tpl->assign_vars(array('MC_CATEGORY_NAME' => $arrCategoryData['name'], 'MC_CATEGORY_ID' => $intCategoryId, 'MC_BREADCRUMB' => $this->pdh->get('mediacenter_categories', 'breadcrumb', array($intCategoryId)), 'MC_CATEGORY_MEDIA_COUNT' => $this->pdh->get('mediacenter_categories', 'media_count', array($intCategoryId)), 'MC_CATEGORY_DESCRIPTION' => $this->bbcode->parse_shorttags(xhtml_entity_decode($arrCategoryData['description'])), 'MC_LAYOUT_DD' => new hdropdown('selectlayout', array('options' => $this->user->lang('mc_layout_types'), 'value' => $intLayout, 'id' => 'selectlayout', 'class' => 'dropdown')), 'MC_SORT_DD' => new hdropdown('selectsort', array('options' => $arrSortOptions, 'value' => $this->in->get('sort', '3|desc'), 'id' => 'selectsort', 'class' => 'dropdown')), 'MC_BASEURL_LAYOUT' => $strBaseLayoutURL, 'MC_BASEURL_SORT' => $strBaseSortURL, 'MC_PERMALINK' => $strPermalink, 'MC_EMBEDD_HTML' => htmlspecialchars('<a href="' . $strPermalink . '">' . $this->pdh->get('mediacenter_categories', 'name', array($intCategoryId)) . '</a>'), 'MC_EMBEDD_BBCODE' => htmlspecialchars("[url='" . $strPermalink . "']" . $this->pdh->get('mediacenter_categories', 'name', array($intCategoryId)) . "[/url]"), 'S_MC_TOOLBAR' => $arrPermissions['create'] || $this->user->check_auth('a_mediacenter_manage', false), 'MC_TOOLBAR' => $jqToolbar['id'], 'MC_BUTTON_MENU' => $this->jquery->ButtonDropDownMenu('manage_members_menu', $arrMenuItems, array("input[name=\"selected_ids[]\"]"), '', $this->user->lang('mc_selected_media') . '...', ''), 'S_MC_BUTTON_MENU' => count($arrMenuItems) > 0 ? true : false, 'S_SHOW_MAP' => $intMapCount && $this->config->get('show_maps', 'mediacenter') ? true : false));
                // -- EQDKP ---------------------------------------------------------------
                $this->core->set_vars(array('page_title' => $arrCategoryData['name'] . ' - ' . $this->user->lang('mediacenter'), 'template_path' => $this->pm->get_data('mediacenter', 'template_path'), 'template_file' => 'category.html', 'display' => true));
            } else {
                message_die($this->user->lang('article_not_found'));
            }
        } else {
            //-- Index Page of MediaCenter --------------------------------------------
            $this->tpl->js_file($this->root_path . 'plugins/mediacenter/includes/js/responsiveslides.min.js');
            $this->tpl->add_js('
		$("#slider_mc_featured").responsiveSlides({
	        auto: true,
	        pager: true,
	        nav: true,
	        speed: 3000,
			timeout: 5000,
			pause: true,
			namespace: "mc_featured",
	      });
		', 'docready');
            //Get Categorys
            $arrCategories = $this->pdh->get('mediacenter_categories', 'published_id_list', array($this->user->id));
            foreach ($arrCategories as $intCategoryId) {
                if ($this->pdh->get('mediacenter_categories', 'parent', array($intCategoryId)) == 0) {
                    $this->tpl->assign_block_vars('category_row', array('CATEGORY_NAME' => $this->pdh->get('mediacenter_categories', 'name', array($intCategoryId)), 'CATEGORY_ID' => $intCategoryId, 'CATEGORY_LINK' => $this->controller_path . $this->pdh->get('mediacenter_categories', 'path', array($intCategoryId)), 'MEDIA_COUNT' => $this->pdh->get('mediacenter_categories', 'media_count', array($intCategoryId)), 'S_HAS_CHILDS' => count($this->pdh->get('mediacenter_categories', 'childs', array($intCategoryId))) > 0 ? true : false));
                    $arrChilds = $this->pdh->get('mediacenter_categories', 'childs', array($intCategoryId));
                    foreach ($arrChilds as $intChildID) {
                        $this->tpl->assign_block_vars('category_row.child_row', array('CATEGORY_NAME' => $this->pdh->get('mediacenter_categories', 'name', array($intChildID)), 'CATEGORY_ID' => $intChildID, 'CATEGORY_LINK' => $this->controller_path . $this->pdh->get('mediacenter_categories', 'path', array($intChildID)), 'MEDIA_COUNT' => $this->pdh->get('mediacenter_categories', 'media_count', array($intChildID)), 'S_HAS_CHILDS' => count($this->pdh->get('mediacenter_categories', 'childs', array($intChildID))) > 0 ? true : false));
                    }
                }
            }
            //Get featured files
            $arrFeaturedFiles = $this->pdh->get('mediacenter_media', 'featured_media', array());
            $arrFeaturedFiles = $this->pdh->sort($arrFeaturedFiles, 'mediacenter_media', 'date', 'desc');
            $arrFeaturedFiles = $this->pdh->limit($arrFeaturedFiles, 0, 5);
            foreach ($arrFeaturedFiles as $intMediaID) {
                $this->tpl->assign_block_vars('mc_featured_row', array('PREVIEW_IMAGE' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 2)), 'NAME' => $this->pdh->get('mediacenter_media', 'name', array($intMediaID)), 'LINK' => $this->controller_path . $this->pdh->get('mediacenter_media', 'path', array($intMediaID)), 'VIEWS' => $this->pdh->get('mediacenter_media', 'views', array($intMediaID)), 'AUTHOR' => $this->core->icon_font('fa-user') . ' ' . $this->pdh->geth('user', 'name', array($this->pdh->get('mediacenter_media', 'user_id', array($intMediaID)), '', '', true)), 'DATE' => $this->time->createTimeTag($this->pdh->get('mediacenter_media', 'date', array($intMediaID)), $this->pdh->geth('mediacenter_media', 'date', array($intMediaID))), 'CATEGORY_AND_ALBUM' => $this->pdh->geth('mediacenter_media', 'category_id', array($intMediaID, true)) . (strlen($this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true))) ? ' &bull; ' . $this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true)) : ''), 'DESCRIPTION' => $this->bbcode->remove_bbcode($this->pdh->get('mediacenter_media', 'description', array($intMediaID))), 'TYPE' => $this->pdh->geth('mediacenter_media', 'type', array($intMediaID))));
            }
            //Get newest files
            $arrNewestMedia = $this->pdh->get('mediacenter_media', 'newest_media', array(6));
            foreach ($arrNewestMedia as $intMediaID) {
                $this->tpl->assign_block_vars('mc_newest_row', array('PREVIEW_IMAGE' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 1)), 'PREVIEW_IMAGE_URL' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 1, true)), 'NAME' => $this->pdh->get('mediacenter_media', 'name', array($intMediaID)), 'LINK' => $this->controller_path . $this->pdh->get('mediacenter_media', 'path', array($intMediaID)), 'VIEWS' => $this->pdh->get('mediacenter_media', 'views', array($intMediaID)), 'AUTHOR' => $this->core->icon_font('fa-user') . ' ' . $this->pdh->geth('user', 'name', array($this->pdh->get('mediacenter_media', 'user_id', array($intMediaID)), '', '', true)), 'DATE' => $this->time->createTimeTag($this->pdh->get('mediacenter_media', 'date', array($intMediaID)), $this->pdh->geth('mediacenter_media', 'date', array($intMediaID))), 'CATEGORY_AND_ALBUM' => $this->pdh->geth('mediacenter_media', 'category_id', array($intMediaID, true)) . (strlen($this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true))) ? ' &bull; ' . $this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true)) : ''), 'DESCRIPTION' => $this->bbcode->remove_bbcode($this->pdh->get('mediacenter_media', 'description', array($intMediaID))), 'TYPE' => $this->pdh->geth('mediacenter_media', 'type', array($intMediaID))));
            }
            //Get most viewed files
            $arrMostViewedMedia = $this->pdh->get('mediacenter_media', 'most_viewed', array(6));
            foreach ($arrMostViewedMedia as $intMediaID) {
                $this->tpl->assign_block_vars('mc_mostviewed_row', array('PREVIEW_IMAGE' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 1)), 'PREVIEW_IMAGE_URL' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 1, true)), 'NAME' => $this->pdh->get('mediacenter_media', 'name', array($intMediaID)), 'LINK' => $this->controller_path . $this->pdh->get('mediacenter_media', 'path', array($intMediaID)), 'VIEWS' => $this->pdh->get('mediacenter_media', 'views', array($intMediaID)), 'AUTHOR' => $this->core->icon_font('fa-user') . ' ' . $this->pdh->geth('user', 'name', array($this->pdh->get('mediacenter_media', 'user_id', array($intMediaID)), '', '', true)), 'DATE' => $this->time->createTimeTag($this->pdh->get('mediacenter_media', 'date', array($intMediaID)), $this->pdh->geth('mediacenter_media', 'date', array($intMediaID))), 'CATEGORY_AND_ALBUM' => $this->pdh->geth('mediacenter_media', 'category_id', array($intMediaID, true)) . (strlen($this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true))) ? ' &bull; ' . $this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true)) : ''), 'DESCRIPTION' => $this->bbcode->remove_bbcode($this->pdh->get('mediacenter_media', 'description', array($intMediaID))), 'TYPE' => $this->pdh->geth('mediacenter_media', 'type', array($intMediaID))));
            }
            //Get last commented files
            $arrLatestCommentMedia = $this->pdh->get('mediacenter_media', 'last_comments', array(6));
            foreach ($arrLatestCommentMedia as $intMediaID) {
                $this->tpl->assign_block_vars('mc_lastcomments_row', array('PREVIEW_IMAGE' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 1)), 'PREVIEW_IMAGE_URL' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 1, true)), 'NAME' => $this->pdh->get('mediacenter_media', 'name', array($intMediaID)), 'LINK' => $this->controller_path . $this->pdh->get('mediacenter_media', 'path', array($intMediaID)), 'VIEWS' => $this->pdh->get('mediacenter_media', 'views', array($intMediaID)), 'AUTHOR' => $this->core->icon_font('fa-user') . ' ' . $this->pdh->geth('user', 'name', array($this->pdh->get('mediacenter_media', 'user_id', array($intMediaID)), '', '', true)), 'DATE' => $this->time->createTimeTag($this->pdh->get('mediacenter_media', 'date', array($intMediaID)), $this->pdh->geth('mediacenter_media', 'date', array($intMediaID))), 'CATEGORY_AND_ALBUM' => $this->pdh->geth('mediacenter_media', 'category_id', array($intMediaID, true)) . (strlen($this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true))) ? ' &bull; ' . $this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true)) : ''), 'DESCRIPTION' => $this->bbcode->remove_bbcode($this->pdh->get('mediacenter_media', 'description', array($intMediaID))), 'TYPE' => $this->pdh->geth('mediacenter_media', 'type', array($intMediaID)), 'S_MC_TOOLBAR' => $arrPermissions['create'] || $this->user->check_auth('a_mediacenter_manage', false), 'MC_TOOLBAR' => $jqToolbar['id']));
            }
            //Get Best rated files
            $arrBestRatedMedia = $this->pdh->get('mediacenter_media', 'best_rated', array(6));
            foreach ($arrBestRatedMedia as $intMediaID) {
                $this->tpl->assign_block_vars('mc_bestrated_row', array('PREVIEW_IMAGE' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 1)), 'PREVIEW_IMAGE_URL' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 1, true)), 'NAME' => $this->pdh->get('mediacenter_media', 'name', array($intMediaID)), 'LINK' => $this->controller_path . $this->pdh->get('mediacenter_media', 'path', array($intMediaID)), 'VIEWS' => $this->pdh->get('mediacenter_media', 'views', array($intMediaID)), 'AUTHOR' => $this->core->icon_font('fa-user') . ' ' . $this->pdh->geth('user', 'name', array($this->pdh->get('mediacenter_media', 'user_id', array($intMediaID)), '', '', true)), 'DATE' => $this->time->createTimeTag($this->pdh->get('mediacenter_media', 'date', array($intMediaID)), $this->pdh->geth('mediacenter_media', 'date', array($intMediaID))), 'CATEGORY_AND_ALBUM' => $this->pdh->geth('mediacenter_media', 'category_id', array($intMediaID, true)) . (strlen($this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true))) ? ' &bull; ' . $this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true)) : ''), 'DESCRIPTION' => $this->bbcode->remove_bbcode($this->pdh->get('mediacenter_media', 'description', array($intMediaID))), 'TYPE' => $this->pdh->geth('mediacenter_media', 'type', array($intMediaID)), 'S_MC_TOOLBAR' => $arrPermissions['create'] || $this->user->check_auth('a_mediacenter_manage', false), 'MC_TOOLBAR' => $jqToolbar['id']));
            }
            $arrToolbarItems = array();
            if ($arrPermissions['create'] || $this->user->check_auth('a_mediacenter_manage', false)) {
                $arrToolbarItems[] = array('icon' => 'fa-plus', 'js' => 'onclick="editMedia(0)"', 'title' => $this->user->lang('mc_add_media'));
                $this->jquery->dialog('editMedia', $this->user->lang('mc_add_media'), array('url' => $this->controller_path . "EditMedia/Media-'+id+'/" . $this->SID, 'withid' => 'id', 'width' => 920, 'height' => 740, 'onclose' => $this->env->link . $this->controller_path_plain . $this->page_path . $this->SID));
            }
            if ($this->user->check_auth('a_mediacenter_manage', false)) {
                $arrToolbarItems[] = array('icon' => 'fa-list', 'js' => 'onclick="window.location=\'' . $this->server_path . "plugins/mediacenter/admin/manage_categories.php" . $this->SID . '\';"', 'title' => $this->user->lang('mc_manage_media'));
            }
            $jqToolbar = $this->jquery->toolbar('pages', $arrToolbarItems, array('position' => 'bottom'));
            $arrStats = $this->pdh->get('mediacenter_media', 'statistics');
            foreach ($arrStats as $key => $val) {
                if ($key === 'size') {
                    $val = human_filesize($val);
                }
                $this->tpl->assign_vars(array('S_MC_STATS_' . strtoupper($key) => sprintf($this->user->lang('mc_statistics_' . $key), $val)));
            }
            $this->tpl->assign_vars(array('S_MC_SHOW_FEATURED' => intval($this->config->get('show_featured', 'mediacenter')) && count($arrFeaturedFiles), 'S_MC_SHOW_NEWEST' => intval($this->config->get('show_newest', 'mediacenter')) && count($arrNewestMedia), 'S_MC_SHOW_CATEGORIES' => intval($this->config->get('show_categories', 'mediacenter')), 'S_MC_SHOW_BESTRATED' => intval($this->config->get('show_bestrated', 'mediacenter')) && count($arrBestRatedMedia), 'S_MC_SHOW_MOSTVIEWED' => intval($this->config->get('show_mostviewed', 'mediacenter')) && count($arrMostViewedMedia), 'S_MC_SHOW_LATESTCOMMENTS' => intval($this->config->get('show_latestcomments', 'mediacenter')) && count($arrLatestCommentMedia), 'S_MC_TOOLBAR' => $arrPermissions['create'] || $this->user->check_auth('a_mediacenter_manage', false), 'MC_TOOLBAR' => $jqToolbar['id']));
            // -- EQDKP ---------------------------------------------------------------
            $this->core->set_vars(array('page_title' => $this->user->lang('mediacenter'), 'template_path' => $this->pm->get_data('mediacenter', 'template_path'), 'template_file' => 'mediacenter_index.html', 'display' => true));
        }
    }
Ejemplo n.º 9
0
$return = array();
include_once DOC_ROOT . '/include/classes/png_reader.class.php';
function human_filesize($bytes)
{
    $sz = 'BKMGTP';
    $factor = floor((strlen($bytes) - 1) / 3);
    $hrsize = $bytes / pow(1024, $factor);
    $decimals = 1;
    return sprintf("%.{$decimals}f", $hrsize) . @$sz[$factor];
}
$filename = IMAGEBASEDIR . safeFileName($_GET['img']);
$return['Name'] = pathinfo($filename, PATHINFO_BASENAME);
if (file_exists($filename)) {
    $size = getimagesize($filename);
    $return['Kind'] = $size['mime'];
    $return['Size'] = human_filesize(filesize($filename));
    $return['Created'] = date('Y-m-d H:i:s', filemtime($filename));
    $return['Dimensions'] = $size[0] . ' x ' . $size[1];
    //$return['Owner'] = $_SESSION['email'];
    if (exif_imagetype($filename) == IMAGETYPE_JPEG) {
        $exif = exif_read_data($filename);
        preg_match('/IMG_ID: (?P<id>\\d+)/', $exif['Copyright'], $img);
        $copyright = explode(":", $exif['Copyright']);
        $return['Owner'] = $copyright[1] . '&nbsp;';
        $return['Image ID'] = $copyright[3] . '&nbsp;';
        $origdesc = $exif['ImageDescription'];
        $desc = explode(';', trim($origdesc));
        if (is_array(json_decode($origdesc, true))) {
            // parse as JSON
            $json = json_decode($origdesc, true);
            $return['Description'] = $json;
Ejemplo n.º 10
0
<?php

require_once 'fileNames.php';
if ($handle = opendir($logFilesDir)) {
    $files = array();
    /* This is the correct way to loop over the directory. */
    $fcounter = 0;
    while (false !== ($entry = readdir($handle))) {
        $logFileType = pathinfo($entry, PATHINFO_EXTENSION);
        //print_r($logFileType); echo "<br>";
        if ($logFileType == "txt" || $logFileType == "log") {
            $fPath = $logFilesDir . $entry;
            $created = filectime($fPath);
            $fSize = human_filesize(filesize($fPath));
            //$files[]=array($created, $entry);
            $files[$fcounter]["name"] = $entry;
            $files[$fcounter]["size"] = $fSize;
            $files[$fcounter]["time"] = $created;
            $files[$fcounter]["path"] = $fPath;
            $fcounter++;
        }
    }
    closedir($handle);
    if ($files) {
        $kiiis = array();
        if (isset($linedata)) {
            $kiis = array_keys($linedata);
            foreach ($kiis as $ck => $cpath) {
                $carr = explode("/", $cpath);
                $len = count($carr) - 1;
                $fnam = $carr[$len];
Ejemplo n.º 11
0
        ?>
                                        <span class="mailbox-attachment-icon"><i class="fa fa-file-o"></i></span>
                                        <div class="mailbox-attachment-info">
                                            <a href="../uploads/<?php 
        echo $data['up_file' . $i];
        ?>
"
                                               class="mailbox-attachment-name">
                                                <i class="fa fa-paperclip"></i>
                                                <?php 
        echo htmlspecialchars($data['file' . $i]);
        ?>
                                            </a>
                                            <span class="mailbox-attachment-size">
                                                <?php 
        echo human_filesize(UPLOAD_PATH . '/' . $data['up_file' . $i]);
        ?>
                                            </span>
                                        </div>
                                    <?php 
    }
    ?>
                                </li>
                            <?php 
}
?>
                        </ul>
                    </div>


                    <!-- 公開日 -->
 /**
  * Prefilled error messages.
  *
  * @param int $status The $status var from FileUploader::uploadTo()
  * @return string The proper error message.
  */
 public function getErrorMessage($status)
 {
     switch ($status) {
         case UPLOAD_ERR_OK:
             // You should avoid this. Is not an error!
             return _("Upload completato con successo.");
         case UPLOAD_ERR_NO_FILE:
             return _("Non è stato selezionato alcun file.");
         case UPLOAD_ERR_INI_SIZE:
             return _("Il file eccede i limiti di sistema.");
         case UPLOAD_ERR_FORM_SIZE:
             DEBUG && error(_("Non affidarti a UPLOAD_ERR_FORM_SIZE!"));
             return _("Il file eccede i limiti imposti.");
         case UPLOAD_EXTRA_ERR_OVERSIZE:
             return sprintf(_("Il file pesa %s. Non può superare %s."), human_filesize($_FILES[$this->fileEntry]['size']), human_filesize($this->args['max-filesize']));
         case UPLOAD_EXTRA_ERR_CANT_SAVE_FILE:
             return _("Impossibile salvare il file.");
         case UPLOAD_EXTRA_ERR_CANT_READ_MIMETYPE:
             return _("Il MIME del file non è validabile.");
         case UPLOAD_EXTRA_ERR_UNALLOWED_MIMETYPE:
             $mime = get_mimetype($_FILES[$this->fileEntry]['tmp_name']);
             return sprintf(_("Il file é di un <em>MIME type</em> non concesso: <em>%s</em>."), esc_html($mime));
         case UPLOAD_EXTRA_ERR_UNALLOWED_FILE:
             $mime = get_mimetype($_FILES[$this->fileEntry]['tmp_name']);
             $allowed_filetypes = $this->mimeTypes->getFiletypes($this->args['category'], $mime);
             return multi_text(count($allowed_filetypes), sprintf(_("Il file ha un'estensione non valida. Estensioni attese: <em>%s</em>."), esc_html(implode(', ', $allowed_filetypes))), sprintf(_("Il file ha un'estensione non valida. Estensione attesa: <em>%s</em>."), esc_html($allowed_filetypes[0])));
         case UPLOAD_EXTRA_ERR_FILENAME_TOO_SHORT:
             return _("Il file ha un nome troppo breve.");
         case UPLOAD_EXTRA_ERR_FILENAME_TOO_LONG:
             return _("Il file ha un nome troppo lungo.");
         case UPLOAD_EXTRA_ERR_GENERIC_ERROR:
             return _("Errore di caricamento.");
         default:
             DEBUG && error(sprintf(_("Stato di errore non previsto: '%d'"), $status));
             return _("Errore durante l'upload.");
     }
 }
Ejemplo n.º 13
0
        if (!empty($path_parts['dirname'])) {
            $path_all_parts = explode('/', $path_parts['dirname']);
            $dirname = array_pop($path_all_parts);
            if (wp_all_import_isValidMd5($dirname)) {
                $path = str_replace($dirname, preg_replace('%^(.{3}).*(.{3})$%', '$1***$2', $dirname), str_replace('temp/', '', $path));
            }
        }
    } else {
        $path = str_replace("\\", '/', preg_replace('%^(\\w+://[^:]+:)[^@]+@%', '$1*****@', $path));
    }
    if (in_array($import_type, array('upload', 'file'))) {
        $path = preg_replace('%.*wp-content/%', 'wp-content/', $path);
    }
    ?>
						<p><?php 
    printf(__('WP All Import will import the file <span style="color:#40acad;">%s</span>, which is <span style="color:#000; font-weight:bold;">%s</span>', 'wp_all_import_plugin'), $path, isset($locfilePath) ? human_filesize(filesize($locfilePath)) : __('undefined', 'wp_all_import_plugin'));
    ?>
</p>

						<?php 
    if (strpos($xpath, '[') !== false) {
        ?>
						<p><?php 
        printf(__('WP All Import will process the records matching the XPath expression: <span style="color:#46ba69; font-weight:bold;">%s</span>', 'wp_all_import_plugin'), $xpath);
        ?>
</p>
						<?php 
    } elseif ($post['delimiter'] and $isWizard) {
        ?>
						<p><?php 
        printf(__('WP All Import will process <span style="color:#46ba69; font-weight:bold;">%s</span> rows in your file', 'wp_all_import_plugin'), $count);
Ejemplo n.º 14
0
            $i = $s_lenght + 1;
        }
    }
    if ($pos != 0) {
        return substr($string, $pos, $s_lenght - $pos);
    } else {
        return 0;
    }
}
function human_filesize($bytes, $decimals = 2)
{
    $sz = 'BKMGTP';
    $factor = floor((strlen($bytes) - 1) / 3);
    return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$sz[$factor];
}
//Inclusão do arquivo de conexão com o banco e instanciamento da conexao
include "../model/conecta-mi-db.php";
//**********RECEBIMENTO DAS VARIÁRVEIS**********/
$bdMi = new MYSQL_MIDB();
$numeroMemorando = remove_zeros($_GET['idMemorando']);
$usuario = $_SESSION["login"];
if (is_dir("server/php/files/{$usuario}/{$numeroMemorando}")) {
    if ($handle = opendir("server/php/files/{$usuario}/{$numeroMemorando}")) {
        while (false !== ($file = readdir($handle))) {
            if ($file != "." && $file != "..") {
                echo "{$file} ----------- " . human_filesize(filesize("server/php/files/{$usuario}/{$numeroMemorando}/{$file}"), 2) . "<br>";
            }
        }
        closedir($handle);
    }
}
Ejemplo n.º 15
0
<?php

namespace phinde;

require 'www-header.php';
$es = new Elasticsearch($GLOBALS['phinde']['elasticsearch']);
$esStatus = $es->getIndexStatus();
$queue = new Queue();
$gearStatus = $queue->getServerStatus();
/**
 * @link http://jeffreysambells.com/2012/10/25/human-readable-filesize-php
 */
function human_filesize($bytes, $decimals = 2)
{
    $size = array('B', 'kiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB');
    $factor = floor((strlen($bytes) - 1) / 3);
    return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . ' ' . @$size[$factor];
}
$esStatus['size_human'] = human_filesize($esStatus['size']);
$esStatus['documents_human'] = number_format($esStatus['documents'], 0, '.', ' ');
render('status', array('esStatus' => $esStatus, 'gearStatus' => $gearStatus));
        if (isset($office_campaign->expected_datajson_status->download_content_length)) {
            ?>
        <tr>
            <th id="metrics-datajson-file-size">
                <a class="info-icon" href="<?php 
            echo site_url('docs') . '#datajson_file_size';
            ?>
">
                    <span class="glyphicon glyphicon-info-sign"></span>
                </a>
                File Size
            </th>             
            <td>
                <span>
                    <?php 
            echo human_filesize($office_campaign->expected_datajson_status->download_content_length);
            ?>
                </span>         
            </td>
        </tr>   
        <?php 
        }
        ?>
		


        <?php 
        if (isset($office_campaign->expected_datajson_status->filetime) && $office_campaign->expected_datajson_status->filetime > 0) {
            ?>
        <tr>
            <th id="metrics-datajson-last-modified">
Ejemplo n.º 17
0
            if (substr($res, 0, 3) == '.\\\\') {
                $res = substr($res, 3);
            }
            ?>
                    <span class="glyphicon glyphicon-<?php 
            echo is_file($res) ? 'file' : 'folder-open';
            ?>
" aria-hidden="true" style="color: #B2B2B2"></span>&nbsp;&nbsp;<a href="<?php 
            echo $res;
            ?>
" target="_blank"><?php 
            echo $res;
            ?>
</a>
                    <span class="text-muted"><?php 
            echo is_file($res) ? '&nbsp;(' . human_filesize(filesize($res)) . ' bytes)' : '';
            ?>
</span>
                    <br />
                <?php 
        }
    } else {
        echo '<p class="text-center text-muted">Sin resultados</p>';
    }
    die;
}
if (isset($_GET['url'])) {
    $url = $i_url = strip_tags($_GET['url']);
    if (substr($url, 0, 1) != '.' . DIRECTORY_SEPARATOR) {
        $url = '.' . DIRECTORY_SEPARATOR . $url;
    }
Ejemplo n.º 18
0
    ?>

<html>
	<head>
		<title>Download created</title>
		<style>
			nl { 
				font-family: monospace 
			}
		</style>
	</head>
	<body>
		<h1>Download key created</h1>
		Your new single-use download link:<br>
		<nl><?php 
    echo "http://" . $_SERVER['HTTP_HOST'] . DOWNLOAD_PATH . "?" . $new;
    echo "<br>";
    echo "Size: " . human_filesize(filesize(PROTECTED_DOWNLOAD), 2);
    ?>
</nl>
	</body>
</html>

<?php 
} else {
    /*
     *	Someone stumbled upon this link with the wrong password
     *	Fake a 404 so it does not look like this is a correct path
     */
    header("HTTP/1.0 404 Not Found");
}
Ejemplo n.º 19
0
                <th>User</th>
                <th>Action</th>
              </tr>
            </thead>
            <tbody>
<?php 
include 'core.inc.php';
include 'APIfile.php';
function human_filesize($bytes, $decimals = 2)
{
    $sz = 'BKMGTP';
    $factor = floor((strlen($bytes) - 1) / 3);
    return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$sz[$factor];
}
$directory = 'uploads';
if ($handle = opendir($directory . '/')) {
    $count = 1;
    while ($file = readdir($handle)) {
        if ($file != '.' && $file != '..') {
            echo "\n              <tr>\n                <td>" . $count . "</td>\n                <td>" . $file . "</td>\n                <td>" . human_filesize(filesize($directory . '/' . $file)) . "</td>\n                <td>" . mybox_get_filetype_by_filename($file) . "</td>\n                <td><input type=\"submit\" value=\"Download\" onclick=\"window.location='" . $directory . '/' . $file . "';\" /> </td>\n                <td>by " . mybox_get_username_by_filename($file) . "</td>\n              </tr>\n              </tr>\n            \n        ";
            $count = $count + 1;
        }
    }
}
?>
          </tbody>
          </table>
        </div>
      </div>
</body>
</html>
Ejemplo n.º 20
0
echo '<th>' . __('Date end') . '</th>';
echo '<th>' . __('Location') . '</th>';
echo '<th>' . __('Hash') . '</th>';
echo '<th>' . __('Master file') . '</th>';
echo '<th>' . __('Master position') . '</th>';
echo '<th>' . __('Slave file') . '</th>';
echo '<th>' . __('Slave position') . '</th>';
echo '<th>' . __('Donwload') . '</th>';
echo '<th>' . __('Load') . '</th>';
echo '</tr>';
foreach ($data['dump'] as $dump) {
    echo '<tr>';
    echo '<td>' . str_replace('_', '-', $dump['name']) . '</td>';
    echo '<td>' . $dump['ip'] . '</td>';
    echo '<td><a href="">' . $dump['database'] . '</a></td>';
    echo '<td>' . human_filesize($dump['size'], 2) . '</td>';
    //echo '<td>' . human_filesize(shell_exec("stat -c %s ".$dump['file_name'])) . '</td>';
    echo '<td>' . $dump['time'] . '</td>';
    echo '<td>' . $dump['date_start'] . '</td>';
    echo '<td>' . $dump['date_end'] . '</td>';
    echo '<td><img src="' . IMG . 'country/type1/fr.gif" /> Sartrouville (10.10.16.7)</td>';
    echo '<td>' . $dump['md5'] . '</td>';
    $master = json_decode($dump['master_data'], true);
    echo '<td>' . $master['File'] . '</td>';
    echo '<td>' . $master['Position'] . '</td>';
    $slave = json_decode($dump['slave_data'], true);
    echo '<td>' . $slave[0]['Master_Log_File'] . '</td>';
    echo '<td>' . $slave[0]['Exec_Master_Log_Pos'] . '</td>';
    echo '<td>';
    $dispo = false;
    if (file_exists($dump['file_name'])) {
Ejemplo n.º 21
0
Archivo: taskls.php Proyecto: mergar/cw
function show_logs()
{
    global $workdir;
    $db = new SQLite3("{$workdir}/var/db/cbsdtaskd.sqlite");
    $db->busyTimeout(5000);
    $sql = "SELECT id,st_time,end_time,cmd,status,errcode,logfile FROM taskd WHERE owner='cbsdweb' ORDER BY id DESC;";
    $result = $db->query($sql);
    //->fetchArray(SQLITE3_ASSOC);
    $row = array();
    $i = 0;
    ?>
	<table class="images">
	<thead>
	<tr>
		<th>id</th>
		<th>cmd</th>
		<th>start time</th>
		<th>end time</th>
		<th>status</th>
		<th>errcode</th>
		<th>logfile</th>
		<th>logsize</th>
	</tr>
	</thead><tbody>
	<?php 
    while ($res = $result->fetchArray(SQLITE3_ASSOC)) {
        if (!isset($res['id'])) {
            continue;
        }
        $id = $res['id'];
        $cmd = $res['cmd'];
        $start_time = $res['st_time'];
        $end_time = $res['end_time'];
        $status = $res['status'];
        $errcode = $res['errcode'];
        $logfile = $res['logfile'];
        if (file_exists($logfile)) {
            $tmplogsize = filesize($logfile);
            $logsize = human_filesize($tmplogsize, 0);
        } else {
            $logsize = 0;
        }
        $i++;
        switch ($status) {
            case 0:
                //pending
                $hdr = '<tr style="background-color:#51FF5F">';
                break;
            case 1:
                //in progress
                $hdr = '<tr style="background-color:#F3FF05">';
                break;
            case 2:
                //complete
                switch ($errcode) {
                    case 0:
                        $hdr = '<tr style="background-color:#EDECEA">';
                        break;
                    default:
                        //errcode not 0
                        $hdr = '<tr style="background-color:#FFA7A1">';
                        break;
                }
                break;
        }
        $s_time = date("Y-M-d H:i", strtotime($start_time));
        $e_time = date("Y-M-d H:i", strtotime($end_time));
        if ($logsize != 0) {
            $logfiletd = "<td><a href=\"showtasklog.php?log={$logfile}\">{$logfile}</a></td>";
        } else {
            $logfiletd = "<td>{$logfile}</td>";
        }
        $str = <<<EOF
\t\t\t<td>{$id}</td>
\t\t\t<td>{$cmd}</td>
\t\t\t<td>{$s_time}</td>
\t\t\t<td>{$e_time}</td>
\t\t\t<td>{$status}</td>
\t\t\t<td>{$errcode}</td>
\t\t\t{$logfiletd}
\t\t\t<td>{$logsize}</td>
\t\t\t</tr>
EOF;
        echo $hdr . $str;
    }
    echo "</tbody></table>";
}
Ejemplo n.º 22
0
        $values[__('Prerequisitos del Asistente')] = $proposal->reqasistente;
    }
    if (!empty($values)) {
        // show proposal aditional info
        do_table_values($values, 'narrow');
    }
}
// show public files of proposals if it's programmed
if ((Action == 'viewproposal' || Action == 'viewdeletedproposal') && ($proposal->id_status == 8 || $proposal->id_ponente == $USER->id || Context == 'admin')) {
    //show files
    $files = get_records('prop_files', 'id_propuesta', $proposal->id);
    $filelist = '';
    if (!empty($files)) {
        foreach ($files as $f) {
            if (!empty($f->public) || !empty($USER) && $proposal->id_ponente == $USER->id || Context == 'admin') {
                $size = human_filesize($f->size);
                $title = htmlspecialchars($f->title, ENT_COMPAT, 'utf-8');
                if (Context == 'main') {
                    $url = get_url('general/proposals/' . $proposal->id . '/files/' . $f->id . '/' . $f->name);
                } elseif (Context == 'asistente') {
                    $url = get_url('person/proposals/' . $proposal->id . '/files/' . $f->id . '/' . $f->name);
                } elseif (Context == 'ponente') {
                    $url = get_url('speaker/proposals/' . $proposal->id . '/files/' . $f->id . '/' . $f->name);
                } elseif (Context == 'admin') {
                    $url = get_url('admin/proposals/' . $proposal->id . '/files/' . $f->id . '/' . $f->name);
                }
                if (empty($f->public)) {
                    $private = '*';
                } else {
                    $private = '';
                }
                    ?>
</td>
								<td class="blue"><?php 
                    echo $file['dirname'];
                    ?>
</td>
								<td class="orange"><?php 
                    echo $file['dirname'] . '/' . $file['filename'];
                    ?>
</td>
								<td class="orange"><?php 
                    echo $file['occurrences'];
                    ?>
</td>
								<td><?php 
                    echo str_replace('.00', '', human_filesize($file['filesize']));
                    ?>
</td>
							</tr><?php 
                }
            }
            ?>
				</tbody>
			</table>
		<?php 
        } else {
            ?>
			<p class="orange">No files were found</p>
		<?php 
        }
        ?>
Ejemplo n.º 24
0
<?php 

function human_filesize($bytes, $decimals = 2) {
  $sz = 'BKMGTP';
  $factor = floor((strlen($bytes) - 1) / 3);
  return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$sz[$factor];
}

    $csv_dir  = sfConfig::get('sf_data_dir').sfConfig::get("app_rockstep_csv_dir");
    $filename = 'classes.csv';
    $date = 0;
    $size = 0;

     if (is_file($csv_dir.$filename)) {
     		$date = date('d.m.Y H:m:s', filemtime($csv_dir.$filename));
     		$bytes = filesize($csv_dir.$filename);
     		$size = human_filesize($bytes, 1);
     }

?>


<p>
  <small>
  	Erstellt am: <?php echo $date ?><br/>
  	Grösse: <?php echo $size ?>
  </small>
</p>

	</div>
</div>
Ejemplo n.º 25
0
?>

<table>
<tr><th>Path</th><td><a href="<?php 
echo $file;
?>
"><?php 
echo $file;
?>
</a></td></tr>
<tr><th>Last updated</th><td><?php 
echo date("Y-m-d H:i:s", filemtime($file));
?>
</td></tr>
<tr><th>File size</th><td><?php 
echo human_filesize(filesize($file));
?>
B</td></tr>
<tr><th>Resolution</th><td><?php 
echo $imagesize[0];
?>
 × <?php 
echo $imagesize[1];
?>
</td></tr>
<tr><th>Logfiles</th><td><?php 
echo $loglist;
?>
</tr>
<tr><th>Raw data</th><td><?php 
echo $tiledata;
Ejemplo n.º 26
0
 function __construct()
 {
     parent::__construct("Server Control Panel", "", Site::LEVEL_TERRANCE);
     $this->appendToBody(Site::parseHtmlFragment("scp.html", ['<!-- uptime -->'], [`uptime` . '<br>' . human_filesize(disk_free_space(__DIR__), 2) . " free"]));
 }
Ejemplo n.º 27
0
        ?>
         <?php 
    } elseif (is_dir($path)) {
        ?>
          <a href="?path=<?php 
        echo urlencode($relativePath);
        ?>
#fileManagement"><span class="glyphicon glyphicon-folder-close" aria-hidden="true"></span>&nbsp;&nbsp;<?php 
        echo htmlspecialchars(basename($path));
        ?>
         <?php 
    }
    ?>
        </td>
        <td><?php 
    echo human_filesize(filesize($path));
    ?>
</td>
        <td>
         <?php 
    if (is_file($path)) {
        ?>
          <?php 
        if (in_array(substr($path, strrpos($path, '.') + 1), array('txt', 'sh', 'pls'))) {
            ?>
           <a title="Edit" href="edit.php?file=<?php 
            echo urlencode($relativePath);
            ?>
&path=<?php 
            echo urlencode($filesPath);
            ?>
Ejemplo n.º 28
0
          <div class="panel panel-default">
            <div class="panel-heading">All files</div>
            <div class="panel-body">
              <table class="table table-striped table-hover">
                <thead>
                  <tr>
                    <th>File</th>
                    <th class="hidden-xs">Valid until</th>
                    <th>Owner</th>
                  </tr>
                </thead>
                <tbody>
<?php 
            if (!empty($result)) {
                foreach ($result as $file) {
                    echo "                  <tr>\n                    <td> <i class=\"fa " . getFaIcon($file['filename']) . "\" style=\"display:table-cell;\"></i> <a style=\"display:table-cell;\" href=\"" . dirname(curPageUrl()) . "/" . $file['randname'] . "\" target=\"_blank\">" . $file['filename'] . "</a> <span style=\"display:table-cell; color:#bbb; padding-left:5px;\" class=\"hidden-xs\"> (" . human_filesize(filesize($conf['datadir'] . "/" . $file['randname'])) . ")</span>";
                    if ($file['password'] != '') {
                        echo " &nbsp; <i class=\"fa fa-key\"> </i>";
                    }
                    echo "</td>\n                    <td class=\"hidden-xs\"> ";
                    if ($file['validuntil'] == 'unlimited') {
                        echo 'unlimited';
                    } else {
                        echo date("Y-m-d", strtotime($file['validuntil']));
                    }
                    echo " </td>\n                    <td> " . $file['owner'] . "</td>\n                  </tr>\n";
                }
            }
            echo "\n                </tbody>\n              </table>\n            </div>\n          </div>\n        </div>";
        }
        ?>
Ejemplo n.º 29
0
function listing ($list) {
	global $directory, $homedir, $sort, $reverse, $win, $cols, $date_format, $self;
	echo '<tr class="listing">
	<th style="text-align: center; vertical-align: middle"></th>
';
	$d = 'tool=Files&dir=' . urlencode($directory) . '&amp;';
	if (!$reverse && $sort == 'filename') $r = '&amp;reverse=true'; else $r = '';
	echo "\t<th class=\"filename\"><a href=\"$self?{$d}sort=filename$r\">" . word('filename') . "</a></th>\n";
	if (!$reverse && $sort == 'size') $r = '&amp;reverse=true'; else $r = '';
	echo "\t<th class=\"size\"><a href=\"$self?{$d}sort=size$r\">" . word('size') . "</a></th>\n";
	if (!$win) {
		if (!$reverse && $sort == 'permission') $r = '&amp;reverse=true'; else $r = '';
		echo "\t<th class=\"permission_header\"><a href=\"$self?{$d}sort=permission$r\">" . word('permission') . "</a></th>\n";
		if (!$reverse && $sort == 'owner') $r = '&amp;reverse=true'; else $r = '';
		echo "\t<th class=\"owner\"><a href=\"$self?{$d}sort=owner$r\">" . word('owner') . "</a></th>\n";
		if (!$reverse && $sort == 'group') $r = '&amp;reverse=true'; else $r = '';
		echo "\t<th class=\"group\"><a href=\"$self?{$d}sort=group$r\">" . word('group') . "</a></th>\n";
	}
	echo '	<th class="functions">' . word('functions') . '</th>
</tr>
';
	for ($i = 0; $i < sizeof($list); $i++) {
		$file = $list[$i];
		$timestamps  = 'mtime: ' . date($date_format, $file['mtime']) . ', ';
		$timestamps .= 'atime: ' . date($date_format, $file['atime']) . ', ';
		$timestamps .= 'ctime: ' . date($date_format, $file['ctime']);
		echo '<tr class="listing">
	<td class="checkbox"><input type="checkbox" name="checked' . $i . '" value="true" onfocus="activate(\'other\')" /></td>
	<td class="filename" title="' . html($timestamps) . '">';
		if ($file['is_link']) {
	
			echo html($file['filename']) . ' &rarr; ';
			$real_file = relative2absolute($file['target'], $directory);
			if (@is_readable($real_file)) {
				if (@is_dir($real_file)) {
					echo '[ <a href="' . $self . '?tool=Files&dir=' . urlencode($real_file) . '">' . html($file['target']) . '</a> ]';
				} else {
					echo '<a href="' . $self . '?tool=Files&action=view&amp;file=' . urlencode($real_file) . '">' . html($file['target']) . '</a>';
				}
			} else {
				echo html($file['target']);
			}
		} elseif ($file['is_dir']) {
			echo ' [ ';
			if ($win || $file['is_executable']) {
				echo '<a href="' . $self . '?tool=Files&dir=' . urlencode($file['path']) . '">' . html($file['filename']) . '</a>';
			} else {
				echo html($file['filename']);
			}
			echo ' ]';
		} else {
			if (substr($file['filename'], 0, 1) == '.') {
				echo '';
			} else {
				echo '';
			}
			if ($file['is_file'] && $file['is_readable']) {
			   echo '<a href="' . $self . '?tool=Files&action=view&amp;file=' . urlencode($file['path']) . '">' . html($file['filename']) . '</a>';
			} else {
				echo html($file['filename']);
			}
		}
		if ($file['size'] >= 1000) {
			$human = ' title="' . human_filesize($file['size']) . '"';
		} else {
			$human = '';
		}
		echo "\t<td class=\"size\"$human>{$file['size']} B</td>\n";
		if (!$win) {
			echo "\t<td class=\"permission\" title=\"" . decoct($file['permission']) . '">';
			$l = !$file['is_link'] && (!function_exists('posix_getuid') || $file['owner'] == posix_getuid());
			if ($l) echo '<a href="' . $self . '?tool=Files&action=permission&amp;file=' . urlencode($file['path']) . '&amp;dir=' . urlencode($directory) . '">';
			echo html(permission_octal2string($file['permission']));
			if ($l) echo '</a>';
			echo "</td>\n";
			if (array_key_exists('owner_name', $file)) {
				echo "\t<td class=\"owner\" title=\"uid: {$file['owner']}\">{$file['owner_name']}</td>\n";
			} else {
				echo "\t<td class=\"owner\">{$file['owner']}</td>\n";
			}
			if (array_key_exists('group_name', $file)) {
				echo "\t<td class=\"group\" title=\"gid: {$file['group']}\">{$file['group_name']}</td>\n";
			} else {
				echo "\t<td class=\"group\">{$file['group']}</td>\n";
			}
		}
		echo '	<td class="functions">
		<input type="hidden" name="file' . $i . '" value="' . html($file['path']) . '" />
';
		$actions = array();
		if (function_exists('symlink')) {
			$actions[] = 'create_symlink';
		}
		if (@is_writable(dirname($file['path']))) {
			$actions[] = 'delete';
			$actions[] = 'rename';
			$actions[] = 'move';
		}
		if ($file['is_file'] && $file['is_readable']) {
			$actions[] = 'copy';
			$actions[] = 'download';
			if ($file['is_writable']) $actions[] = 'edit';
		}
		if (!$win && function_exists('exec') && $file['is_file'] && $file['is_executable'] && file_exists('/bin/sh')) {
			$actions[] = 'execute';
		}
		if (sizeof($actions) > 0) {
			echo '		<select class="small" name="action' . $i . '" size="1">
		<option value="">' . str_repeat('&nbsp;', 30) . '</option>
';
			foreach ($actions as $action) {
				echo "\t\t<option value=\"$action\">" . word($action) . "</option>\n";
			}
			echo '		</select>
		<input class="small" type="submit" name="submit' . $i . '" value=" &gt; " onfocus="activate(\'other\')" />
';
		}
		echo '	</td>
</tr>
';
	}
	echo '<tr class="listing_footer">
	<td style="text-align: right; vertical-align: top"></td>
	<td colspan="' . ($cols - 1) . '">
		<input type="hidden" name="num" value="' . sizeof($list) . '" />
		<input type="hidden" name="focus" value="" />
		<input type="hidden" name="olddir" value="' . html($directory) . '" />
';
	$actions = array();
	if (@is_writable(dirname($file['path']))) {
		$actions[] = 'delete';
		$actions[] = 'move';
	}
	$actions[] = 'copy';
	echo '		<select class="small" name="action_all" size="1">
		<option value="">' . str_repeat('&nbsp;', 30) . '</option>
';
	foreach ($actions as $action) {
		echo "\t\t<option value=\"$action\">" . word($action) . "</option>\n";
	}
	echo '		</select>
		<input class="small" type="submit" name="submit_all" value=" &gt; " onfocus="activate(\'other\')" />
	</td>
</tr>
';
}
Ejemplo n.º 30
0
                static $regex = '/^Content-Length: *+\\K\\d++$/im';
                if (!($fp = @fopen($url, 'rb'))) {
                    return false;
                }
                if (isset($http_response_header) && preg_match($regex, implode("\n", $http_response_header), $matches)) {
                    return (int) $matches[0];
                }
                return strlen(stream_get_contents($fp));
            }
            // http://php.net/manual/fr/function.filesize.php#106569
            function human_filesize($bytes, $decimals = 2, $base = 1000)
            {
                $sz = 'BKMGTP';
                $factor = floor((strlen($bytes) - 1) / 3);
                return sprintf("%.{$decimals}f", $bytes / pow($base, $factor)) . @$sz[$factor];
            }
            if (false !== ($size = remote_filesize($file))) {
                if ($human) {
                    $size = human_filesize($size, $decimals, $base);
                }
                $server->success($size);
            } else {
                $server->error("Could not guess the file size");
            }
        } else {
            $server->error("Invalid protocol");
        }
    } else {
        $server->error("Invalid data, missing file");
    }
})->output();