Example #1
0
 public function do_handle()
 {
     $allowFiles = substr(str_replace(".", "|", join("", $this->allowFiles)), 1);
     /* 获取参数 */
     $size = isset($_GET['size']) ? htmlspecialchars($_GET['size']) : $this->listSize;
     $start = isset($_GET['start']) ? htmlspecialchars($_GET['start']) : 0;
     $end = $start + $size;
     /* 获取文件列表 */
     $path = $_SERVER['DOCUMENT_ROOT'] . (substr($this->path, 0, 1) == "/" ? "" : "/") . $path;
     $files = getfiles($path, $allowFiles);
     if (!count($files)) {
         return json_encode(array("state" => "no match file", "list" => array(), "start" => $start, "total" => count($files)));
     }
     /* 获取指定范围的列表 */
     $len = count($files);
     for ($i = min($end, $len) - 1, $list = array(); $i < $len && $i >= 0 && $i >= $start; $i--) {
         $list[] = $files[$i];
     }
     //倒序
     //for ($i = $end, $list = array(); $i < $len && $i < $end; $i++){
     //    $list[] = $files[$i];
     //}
     /* 返回数据 */
     $result = json_encode(array("state" => "SUCCESS", "list" => $list, "start" => $start, "total" => count($files)));
     return $result;
 }
function smarty_function_randphoto($_params, &$_smarty)
{
    $bgdir = $_params['pageinfo']->cssdir . '/bgs/';
    $bgfiles = getfiles($bgdir);
    $filenum = rand(0, count($bgfiles) - 1);
    return $_params['pageinfo']->cssurl . '/bgs/' . $bgfiles[$filenum];
}
Example #3
0
function sadmindeleteitem($id)
{
    global $module_filepath, $Q, $DB, $module_name;
    $query = "SELECT * FROM " . $module_name . " where rid=" . $id;
    $Q->query($DB, $query);
    $count = $Q->numrows();
    $recs = "";
    for ($i = 0; $i < $count; $i++) {
        $row = $Q->getrow();
        $recs[$i] = $row[id];
    }
    for ($i = 0; $i < $count; $i++) {
        sadmindeleteitem($recs[$i]);
    }
    // ATTACHMENTS
    $ppath = $module_filepath . "/attachments/" . $id . "/";
    $mas = getfiles($ppath);
    if ($mas[0] != "") {
        for ($j = 0; $j < count($mas); $j++) {
            unlink($ppath . $mas[$j]);
        }
    }
    $query = "DELETE from " . $module_name . " WHERE id=" . $id;
    //echo $query."<br>";
    $Q->query($DB, $query);
}
Example #4
0
/**
 * 遍历获取目录下的指定类型的文件
 * @param $path
 * @param array $files
 * @return array
 */
function getfiles($path, $allowFiles, &$files = array())
{
    global $_M;
    if (!is_dir($path)) {
        return null;
    }
    if (substr($path, strlen($path) - 1) != '/') {
        $path .= '/';
    }
    $handle = opendir($path);
    while (false !== ($file = readdir($handle))) {
        if ($file != '.' && $file != '..') {
            $path2 = $path . $file;
            if (is_dir($path2)) {
                getfiles($path2, $allowFiles, $files);
            } else {
                if (preg_match("/\\.(" . $allowFiles . ")\$/i", $file)) {
                    $url = str_replace(PATH_WEB, $_M['url']['site'], $path2);
                    if (!strstr($url, 'thumb_dis/') && !strstr($url, 'thumb/') && !strstr($url, 'watermark/') && !strstr($url, 'upload/_thumbs/') && !strstr($url, 'upload/thumb_src/') && !strstr($url, 'upload/files/') && !strstr($url, 'upload/images/')) {
                        $files[] = array('url' => $url, 'mtime' => filemtime($path2));
                    }
                }
            }
        }
    }
    return $files;
}
function smarty_function_randphoto($_params, &$_smarty)
{
    $pageinfo = $_smarty->tpl_vars['pageinfo']->value;
    $bgdir = $pageinfo['cssdir'] . '/bgs/';
    $bgfiles = getfiles($bgdir);
    $filenum = rand(0, count($bgfiles) - 1);
    return $pageinfo['cssurl'] . '/bgs/' . $bgfiles[$filenum];
}
Example #6
0
function copyallfiles($dirfrom, $dirto)
{
    $filesfrom = getfiles($dirfrom);
    if (!$filesfrom) {
        return 0;
    }
    for ($i = 0; $i < count($filesfrom); $i++) {
        $file1 = $dirfrom . "/" . $filesfrom[$i];
        $file2 = $dirto . "/" . $filesfrom[$i];
        copy($file1, $file2);
        //	echo "$file1 $file2<br>";
    }
    echo "<p>";
}
Example #7
0
function getfiles($dir, &$files = array())
{
    if (!file_exists($dir) || !is_dir($dir)) {
        return;
    }
    if (substr($dir, -1) == '/') {
        $dir = substr($dir, 0, strlen($dir) - 1);
    }
    $_files = scandir($dir);
    foreach ($_files as $v) {
        if ($v != '.' && $v != '..') {
            if (is_dir($dir . '/' . $v)) {
                getfiles($dir . '/' . $v, $files);
            } else {
                $files[] = $dir . '/' . $v;
            }
        }
    }
    return $files;
}
Example #8
0
/**
 * 遍历获取目录下的指定类型的文件
 * @param  	 $path
 * @param  	 array $files
 * @return 	 array
 */
function getfiles($path, &$files = array())
{
    if (!is_dir($path)) {
        return null;
    }
    $handle = opendir($path);
    while (false !== ($file = readdir($handle))) {
        if ($file != '.' && $file != '..') {
            $path2 = $path . '/' . $file;
            if (is_dir($path2)) {
                getfiles($path2, $files);
            } else {
                if (preg_match("/\\.(gif|jpeg|jpg|png|bmp)\$/i", $file)) {
                    $files[] = $path2;
                }
            }
        }
    }
    return $files;
}
Example #9
0
/**
 * 遍历获取目录下的指定类型的文件
 * @param $path
 * @param array $files
 * @return array
 */
function getfiles($path, $allowFiles, $APPCONFIG, &$files = array())
{
    if (!is_dir($path)) {
        return null;
    }
    if (substr($path, strlen($path) - 1) != '/') {
        $path .= '/';
    }
    $handle = opendir($path);
    while (false !== ($file = readdir($handle))) {
        if ($file != '.' && $file != '..') {
            $path2 = $path . $file;
            if (is_dir($path2)) {
                getfiles($path2, $allowFiles, $APPCONFIG, $files);
            } else {
                if (preg_match("/\\.(" . $allowFiles . ")\$/i", $file)) {
                    $files[] = array('url' => $APPCONFIG['sys_images_domain'] . substr($path2, strlen($APPCONFIG['sys_upload_path'])), 'mtime' => filemtime($path2));
                }
            }
        }
    }
    return $files;
}
Example #10
0
/**
 * 遍历获取目录下的指定类型的文件
 * @param $path
 * @param array $files
 * @return array
 */
function getfiles($path, $allowFiles, &$files = array())
{
    if (!is_dir($path)) {
        return null;
    }
    if (substr($path, strlen($path) - 1) != '/') {
        $path .= '/';
    }
    $handle = opendir($path);
    while (false !== ($file = readdir($handle))) {
        if ($file != '.' && $file != '..') {
            $path2 = $path . $file;
            if (is_dir($path2)) {
                getfiles($path2, $allowFiles, $files);
            } else {
                if (preg_match("/\\.(" . $allowFiles . ")\$/i", $file)) {
                    $files[] = array('url' => substr($path2, strlen($_SERVER['DOCUMENT_ROOT'])), 'mtime' => filemtime($path2));
                }
            }
        }
    }
    return $files;
}
Example #11
0
$pic = "images/pic.jpg";
if (file_exists("attachments/" . $_GET[id] . "/big.jpg")) {
    $pic = "attachments/" . $_GET[id] . "/big.jpg";
}
if (file_exists("attachments/" . $_GET[id] . "/1.jpg")) {
    $pic = "attachments/" . $_GET[id] . "/1.jpg";
}
$small_pics = "";
$pics = getfiles_pictures("attachments/" . $_GET[id] . "/");
for ($i = 0; $i < count($pics); $i++) {
    if (!ereg("big\\.jpg", $pics[$i]) && ereg("[0-9]+", $pics[$i]) && $pics[$i] != "1.jpg") {
        $small_pics .= "\n\t\t<tr valign='top'>\n\t\t\t<td class='vtable'><a href='/attachments/" . $_GET[id] . "/" . $pics[$i] . "' alt='" . $product[name] . "' title='" . $product[name] . "' rel='lightbox[images]'><img src='shortimage.php?path=attachments--" . $_GET[id] . "--" . $pics[$i] . "&x=41&y=41' border='0'/></a></td>\n\t\t</tr>\n\t\t";
    }
}
$instruction = "";
$files = getfiles("attachments/" . $_GET[id] . "/");
for ($i = 0; $i < count($files); $i++) {
    $ext = split("\\.", $files[$i]);
    $ext = $ext[count($ext) - 1];
    if ($ext == "pdf") {
        $instruction = "/attachments/" . $_GET[id] . "/" . $files[$i];
    }
}
?>
<td valign="top">
 	  <table id="Table2" width="100%"  border="0" cellpadding="0"  cellspacing="0"><tr height="1px" valign="top"><td  align="left" style="padding-left:20px;padding-top:10px; padding-right:25px;">
		<table id="Table" width="100%"  border="0" cellpadding="0"  cellspacing="0">
			<tr height="1px" valign="middle">
			<td style="padding-top:5px;"><p style="margin:0px;padding-top:10px;"></p><h1 class="nobottomed"><?php 
echo $product[name];
?>
<?php

// version 1.03, 12/03/2012;
// example usage: gallery.php?start=14&len=12
require 'common.php';
getparams();
$status = getdirs();
if ($status == 0) {
    print "directory \"{$archive_dir}\" not found<br>";
    exit;
}
getfiles();
header('content-type: text/html; charset=utf-8');
echo "<html><head><title>" . date("Y M d H:i:s", ftime($working_dir . "/" . $files[$start])) . "</title></head><body>";
navigation_top();
navigation_bottom();
// Gallery
echo "<p>";
if ($start > sizeof($files)) {
    $start = sizeof($files) - 1;
}
$last = $start + $len;
if ($last >= sizeof($files)) {
    $last = sizeof($files) - 1;
}
for ($count = $start; $count <= $last; $count++) {
    $filename = $files[$count];
    $smallname = $thumbdir . "/" . $filename;
    $smallname_abs = $root_dir . "/" . $smallname;
    if (file_exists($smallname_abs)) {
        echo "<a href='image.php?cam={$cam}&img={$filename}&dir={$dir}&i={$count}'><img src='" . $smallname . "' title='" . date("H:i:s", ftime($working_dir . "/" . $filename)) . "'></a> ";
Example #13
0
    $wp = $_GET["whatpage"];
    $wp = preg_replace("/..\\//i", "", $wp);
    $myFile = ENGINE . 'news/' . $wp;
}
#$myFile=ENGINE.'newsdb.php';
$commentFile = ENGINE . 'commentsdb.php';
$newsperpage = 30;
//Список файлов в каталоге
function getfiles($inpath)
{
    if (sizeof($dir = scandir($inpath, 1)) > 1) {
        array_splice($dir, -2, 2);
    }
    return $dir;
}
$filesnews = getfiles(ENGINE . 'news/');
foreach ($filesnews as $file) {
    $file = basename($file, 'php');
    $all_files .= "|&nbsp;&nbsp;<a href=\"?whatpage={$file}\"> {$file}</a>&nbsp;&nbsp;|";
}
if (file_exists($myFile)) {
    //Запись
    if (!empty($_REQUEST['action'])) {
        $news = file($myFile);
        $countallnews = count($news);
        if ($edit > 0) {
            $new = unserialize($news[$edit - 1]);
            @($adminemail = $new['admmail']);
            @($idmess = $new['id']);
            @($time = $new['pubtime']);
            $head = filtermessage($_REQUEST['header']);
Example #14
0
fileIds=new Array();
<?php 
if (isset($id) && $id != "undefined") {
    $e = "";
    $filelink = "";
    $query = "select * from " . $module_name . " where lang='{$lang}' and aname='material'";
    $Q->query($DB, $query);
    $count = $Q->numrows();
    $ids[0] = $id;
    for ($i = 1; $i <= $count; $i++) {
        $row = $Q->getrow();
        $ids[$i] = $row[id];
    }
    for ($uy = 0; $uy <= $count; $uy++) {
        echo "fileIds[" . $ids[$uy] . "]=" . $uy . ";\n";
        $mas = getfiles($module_filepath . "/attachments/" . $ids[$uy] . "/");
        if ($mas[0] != "") {
            for ($i = 0; $i < count($mas); $i++) {
                $ppath[$i] = $module_filepath . "/attachments/" . $ids[$uy] . "/";
                $ppath[$i] = $ppath[$i] . $mas[$i];
            }
            //	$e[0]='<p><a class=\"filelink\"  id=\"ff0\" style=\"height:22px; margin:0px 0px 0px 0px;\" href=\"#\" onClick=\"javascript:highlight(\\\'ff0\\\');fileLink(\\\'..\\\');\" title=\"URL: #\"><img src=\"../../images/spacer.gif\" width=1 height=22 alt=\"\" border=\"0\" align=\"absmiddle\">..</a></p>';
            for ($i = 0; $i < count($mas); $i++) {
                $filesize = ceil(filesize($ppath[$i]) / 1000);
                $ext = split("\\.", mystrtohigher($mas[$i]));
                $ext = $ext[count($ext) - 1];
                $ext1 = strtolower($ext);
                $ext1 = ereg_replace("jpeg", "jpg", $ext1);
                $emp = "";
                if ($filesize > 0) {
                    if ($ext == "JPG" || $ext == "JPEG" || $ext == "GIF") {
Example #15
0
    $f = fopen($file, "r");
    $ln = 0;
    while (!feof($f)) {
        $line = fgets($f);
        ++$ln;
        //        echo $ln."\r\n";
        if ($line === FALSE) {
            print "FALSE\n";
        } elseif (contains($line, "scenarios (")) {
            $text = $line;
        }
    }
    fclose($f);
    return $text;
}
getfiles($dir);
//echo $body;
for ($i = 0; $i < count($result); $i++) {
    $temp = preg_replace("/.html/", "", $result[$i]);
    $temp = @split("_", $temp);
    $date[$i] = $temp[0];
    $app[$i] = $temp[1];
    $pt[$i] = $temp[2];
    $v[$i] = $temp[3];
}
for ($i = 0; $i < count($fullpath); $i++) {
    $text = Readlog($fullpath[$i]);
    $temp = @split("=", $text);
    //var_dump($temp);
    $find = "scenarios";
    $findLen = strlen($find);
Example #16
0
}
?>
</div>
<?php 
echo '<table class="table table-bordered table-striped">';
echo '<thead><tr><th colspan="2">Checking for files need to be renamed</th></tr></thead>';
echo '<tbody>';
// Start Language Check
$rename = " must be renamed to ";
$language_file_count = 0;
foreach (glob("../languages/*.conf") as $filename) {
    $language_file_count = $language_file_count + 1;
}
if (!glob("../languages/*.conf")) {
    echo '<tr><td style="width:20px;" class="bad"><i class="fa fa-times"></i></td><td>No Language file has been detected! You will need to remove the .default extension from one of these language files:<ul style="margin:0px 0 5px 15px;padding:0;">';
    getfiles("../languages");
    // List language files
    echo '</ul></td></tr>';
} else {
    echo "<tr><td style='width:20px;' class='good'><i class='fa fa-check'></i></td><td>You have renamed ";
    echo '<a id="langfiles" data-trigger="hover" data-html="true" data-content="<ul>';
    foreach (glob("../languages/*.conf") as $filename) {
        echo "<li>{$filename}</li>";
    }
    echo '</ul>" rel="popover" href="#" data-original-title="Renamed Language Files">' . $language_file_count . ' language file(s)</a>, which are ready to be used</td></tr>' . "\n";
}
$settings = '../settings.php';
$settingsdefault = '../settings.php.default';
if (file_exists($settings)) {
    echo '<tr><td ckass="good"><i class="fa fa-check" ></i></td><td>' . $settings . '</td></tr>';
} else {
Example #17
0
    if ($file != '.' && $file != '..') {
        $path2 = $path . '/' . $file;
        if (is_dir($path2)) {
            getfiles($path2);
        } else {
            if (preg_match("/\\.(gif|jpeg|jpg|png|bmp)\$/i", $file)) {
                $files[] = $path . '/' . $file;
            }
        }
    }
}
$files1 = array();
if (!is_dir($path1)) {
    echo "not a dir";
}
$handle = opendir($path1);
while (false !== ($file = readdir($handle))) {
    if ($file != '.' && $file != '..') {
        $path2 = $path . '/' . $file;
        if (is_dir($path2)) {
            getfiles($path2);
        } else {
            if (preg_match("/\\.(gif|jpeg|jpg|png|bmp)\$/i", $file)) {
                $files1[] = $path1 . '/' . $file;
            }
        }
    }
}
?>

Example #18
0
 </form>

</div>

<div id='selectFileDB'>

 <form id="fileVisList" action=""  method="post">
 <label for = "file" >Choose a file to Visualize</label>
 <br>

 <select id="file_list" size="6" name="filename" multiple="multiple">
 </select>

  <script>
  data_files = <?php 
getfiles($db, $files_array);
?>
 
  //console.log(data_files);

  for ( var i = 0; i < data_files.length; i++ ){
             $('#file_list').append($("<option/>", {
              value:data_files[i].file_id + "|" + data_files[i].filename + "|" + data_files[i].desc,
              text: data_files[i].file_id + "|" + data_files[i].filename + "|" + data_files[i].desc
             }));
     }

  </script>


<select name="vis"> 
Example #19
0
<?php

/*
 
 Написать функцию, которая выводит список файлов в заданной директории. 
 Директория задается как параметр функции.
*/
function getfiles($dir)
{
    $files = scandir($dir);
    foreach ($files as $file) {
        echo $file . '<br>';
    }
}
getfiles('dir/');
Example #20
0
function get_image($path)
{
    $img = "";
    $files = getfiles($path);
    for ($i = 0; $i < count($files); $i++) {
        if (stripos($files[$i], "jpg") || stripos($files[$i], "gif") || stripos($files[$i], "png")) {
            $img = $files[$i];
        }
    }
    return "/" . $path . $img;
}
Example #21
0
    $f = fopen($file, "r");
    $ln = 0;
    while (!feof($f)) {
        $line = fgets($f);
        ++$ln;
        //        echo $ln."\r\n";
        if ($line === FALSE) {
            print "FALSE\n";
        } elseif (contains($line, "scenarios (")) {
            $text = $line;
        }
    }
    fclose($f);
    return $text;
}
getfiles($dir, $today);
//echo $body;
for ($i = 0; $i < count($result); $i++) {
    $j = 0;
    $temp = preg_replace("/.html/", "", $result[$i]);
    $temp = @split("_", $temp);
    $tempdate = substr($temp[0], 0, 8);
    //取今天的Report
    if ($tempdate[$i] == $today) {
        $date[$j] = $tempdate;
        //$date[$i] = $temp[0];
        $app[$j] = $temp[1];
        $pt[$j] = $temp[2];
        $v[$j] = $temp[3];
        $j = $j + 1;
    }
Example #22
0
        echo '<br><br>当前队列:<br>';
        $farray = file("tmp" . DIRECTORY_SEPARATOR . "queue.queue");
        foreach ($farray as $key => $value) {
            # code...
            if ($key < 1) {
                if (count($farray) == 0) {
                    echo '<a style="font-size:13px;">' . trim($value) . '&nbsp;载入中</a><br>';
                } else {
                    echo '<a style="font-size:13px;">' . trim($value) . '&nbsp;' . trim(file("tmp" . DIRECTORY_SEPARATOR . "" . (int) $value . ".serverTmpARR")[0]) . '</a><br>';
                }
            } else {
                echo '<a style="font-size:13px;">' . trim($value) . '&nbsp;排队中</a><br>';
            }
        }
    }
    getfiles('./tmp');
    echo '<br><br>版本历史:<br>
<a style="font-size:13px;">1.1 增加队列功能,大幅度减少当前任务抓取时间</a>
	';
    exit;
}
if (isset($_GET['opt']) && $_GET['opt'] == 'd') {
    if (isset($_GET['key']) && @$_GET['key'] == $secretKey) {
        @unlink("tmp" . DIRECTORY_SEPARATOR . "" . $id . ".kgl");
        header('location:index.php?key=' . $secretKey . '');
    }
    header('location:index.php');
    exit;
}
if (file_exists("tmp" . DIRECTORY_SEPARATOR . "" . $id . ".serverTmpARR")) {
    // $tmp = fread(, "r");
Example #23
0
</a></td>
<td align=center><a href=# onclick="JavaScript:window.close();" class=menu100><?php 
echo $lt[51];
?>
</a></td>
</tr>
</table>
<?php 
$query = "select * from " . $module_name . " where id={$id} and lang='" . $adminlanguage . "'";
$Q->query($DB, $query);
$row = $Q->getrow();
$text = ereg_replace("&quot;", "\"", $row[text]);
$subject = $row[name];
$subject = convert_cyr_string($subject, "w", "k");
$text = convert_cyr_string($text, "w", "k");
$at = getfiles($module_filepath . "/attachments/" . $row[id] . "/");
$p = "http://" . $admin_settings['site_url'] . "/attachments/" . $row[id] . "/";
$att = array();
if ($at[0]) {
    for ($i = 0; $i < count($at); $i++) {
        $att[] = $p . $at[$i];
    }
}
if ($att[0]) {
    $att = join(";", $att);
} else {
    $att = "";
}
$query = "select * from " . $module_name . " where aname='{$where}' and lang='" . $adminlanguage . "'";
$Q->query($DB, $query);
$count = $Q->numrows();
function getfiles($jdupath, $xdupath = '', &$files = array())
{
    if (!is_dir($jdupath)) {
        return null;
    }
    $handle = opendir($jdupath);
    while (false !== ($file = readdir($handle))) {
        if ($file != '.' && $file != '..') {
            $jdupath2 = $jdupath . DIRS . $file;
            $xdupath2 = $xdupath ? $xdupath . '/' . $file : $file;
            if (is_dir($jdupath2)) {
                getfiles($jdupath2, $xdupath2, $files);
            } elseif (strpos($jdupath2, '.html') === false) {
                $files[] = $xdupath2;
            }
        }
    }
    return $files;
}
Example #25
0
<?php

/*
 
 Написать функцию, которая выводит список файлов в заданной директории, 
 которые содержат искомое слово. 
 Директория и искомое слово задаются как параметры функции.
*/
function getfiles($dir, $word)
{
    foreach (glob("{$dir}/{$word}*.txt") as $filename) {
        echo "{$filename} <br>";
    }
}
getfiles('dir', 'den');
Example #26
0
function getfiles($path, &$files = array())
{
    if (!is_dir($path)) {
        return;
    }
    $handle = opendir($path);
    while (false !== ($file = readdir($handle))) {
        if ($file != '.' && $file != '..') {
            $path2 = $path . '/' . $file;
            if (is_dir($path2)) {
                getfiles($path2, $files);
            } else {
                if (is_image($file)) {
                    $files[] = $path . '/' . $file;
                }
            }
        }
    }
    return $files;
}
Example #27
0
    $versions = preg_grep("/^[0-9]+\\.[0-9]+\\.[0-9]+[a-z]?\$/", $versions);
    // split string into array at '.' and prepend original string
    foreach ($versions as $version) {
        $tmp = explode(".", $version);
        $out[] = array_merge((array) $version, $tmp);
    }
    // remove identical versions
    $out = array_filter_unique($out, "versioncmp");
    // create result array containing original strings
    for ($x = 0; $x < count($out); $x++) {
        $out2[] = $out[$x][0];
    }
    // finally, return array in reverse order (most recent version first)
    return array_reverse($out2);
}
$files = getfiles();
$avail_versions = getversions($files);
if ($version == "") {
    $version = $avail_versions[0];
}
$version_ = strtr($version, ".", "_");
$notes = "http://apcupsd.cvs.sourceforge.net/viewvc/*checkout*/apcupsd/apcupsd/ReleaseNotes?pathrev=Release-{$version_}";
$chglog = "http://apcupsd.cvs.sourceforge.net/viewvc/*checkout*/apcupsd/apcupsd/ChangeLog?pathrev=Release-{$version_}";
$pubkey = "https://sourceforge.net/projects/apcupsd/files/apcupsd%20Public%20Key/Current%20Public%20Key/apcupsd.pub/download";
$rpmkey = "https://sourceforge.net/projects/apcupsd/files/apcupsd%20Public%20Key/Current%20Public%20Key/rpmkey-apcupsd-0.1-3.noarch.rpm/download";
echo "<html>\n";
echo "<title>Downloads for apcupsd {$version}</title>\n";
echo "<body>\n";
echo "<h1>Downloads for apcupsd {$version}</h1>\n";
echo "<form method=\"get\" action=\"dl.php\">\n";
echo "Other Versions:\n";
Example #28
0
    if ($video_level[rid] > 127) {
        if ($_GET[video]) {
            $video_files = getfiles("attachments/" . $_GET[video] . "/");
            $video_file = "";
            for ($i = 0; $i < count($video_files); $i++) {
                if (ereg("flv", $video_files[$i])) {
                    $video_file = "attachments/" . $_GET[video] . "/" . $video_files[$i];
                }
            }
            $video_name = block("id='" . $_GET[video] . "'", "name");
            $text_id = $_GET[video];
        } else {
            $SQL = "SELECT * FROM " . $module_name . " WHERE rid = '" . $_GET[id] . "' ORDER BY date DESC LIMIT 0,1";
            $result = $Q->query($DB, $SQL);
            $video = mysql_fetch_assoc($result);
            $video_files = getfiles("attachments/" . $video[id] . "/");
            $video_file = "";
            for ($i = 0; $i < count($video_files); $i++) {
                if (ereg("flv", $video_files[$i])) {
                    $video_file = "attachments/" . $video[id] . "/" . $video_files[$i];
                }
            }
            $video_name = $video[name];
            $text_id = $video[id];
        }
        echo '
					<center>
					<object type="application/x-shockwave-flash" data="/uflvplayer.swf" height="388" width="500">
						<param name="bgcolor" value="#EEEEEE" />
						<param name="allowFullScreen" value="true" />
						<param name="allowScriptAccess" value="always" />
 function lists()
 {
     /* 判断类型 */
     switch ($_GET['action']) {
         /* 列出文件 */
         case 'listfile':
             $allowFiles = $this->CONFIG['fileManagerAllowFiles'];
             $listSize = $this->CONFIG['fileManagerListSize'];
             $path = $this->path . 'files/';
             break;
             /* 列出图片 */
         /* 列出图片 */
         case 'listimage':
         default:
             $allowFiles = $this->CONFIG['imageManagerAllowFiles'];
             $listSize = $this->CONFIG['imageManagerListSize'];
             $path = $this->path . 'images/';
     }
     $allowFiles = substr(str_replace(".", "|", join("", $allowFiles)), 1);
     /* 获取参数 */
     $size = isset($_GET['size']) ? $_GET['size'] : $listSize;
     $start = isset($_GET['start']) ? $_GET['start'] : 0;
     $end = $start + $size;
     /* 获取文件列表 */
     $path = $_SERVER['DOCUMENT_ROOT'] . (substr($path, 0, 1) == "/" ? "" : "/") . $path;
     $files = getfiles($path, $allowFiles);
     if (!count($files)) {
         return json_encode(array("state" => "no match file", "list" => array(), "start" => $start, "total" => count($files)));
     }
     /* 获取指定范围的列表 */
     $len = count($files);
     for ($i = min($end, $len) - 1, $list = array(); $i < $len && $i >= 0 && $i >= $start; $i--) {
         $list[] = $files[$i];
     }
     //倒序
     //for ($i = $end, $list = array(); $i < $len && $i < $end; $i++){
     //    $list[] = $files[$i];
     //}
     /* 返回数据 */
     $result = json_encode(array("state" => "SUCCESS", "list" => $list, "start" => $start, "total" => count($files)));
     return $result;
 }
Example #30
0
function getdfiles($path, $exclude = array())
{
    $files = getfiles($path, $exclude);
    $dfiles = array();
    foreach ($files as $file) {
        $dfiles[] = fileinfo($path . $file);
    }
    return $dfiles;
}