Esempio n. 1
0
function dirlist_list($config)
{
    $images = get_file_list($config);
    $files = get_file_list($config, false);
    $next_file = $prev_file = '';
    // Remove duplicates
    $dupes = array_intersect($images, $files);
    foreach ($dupes as $dupe) {
        unset($files[array_search($dupe, $files)]);
    }
    $file = false;
    if (isset($_GET['f']) && (in_array($_GET['f'], $images) || in_array($_GET['f'], $files))) {
        $file = $_GET['f'];
    } else {
        $file = $images[0];
    }
    $idx = array_search($file, $images);
    if ($idx !== false) {
        if ($idx > 0) {
            $prev_file = $images[$idx - 1];
        }
        if ($idx < count($images)) {
            $next_file = $images[$idx + 1];
        }
    }
    include $config['template_file'];
}
Esempio n. 2
0
 /**
  * A method to return the HTML code needed to display a tree-based
  * menu of all the simulations.
  *
  * @return string A string containing the HTML code needed to display
  *                the tests in a tree-based menu.
  */
 function buildTree()
 {
     $icon_pkg = "package.png";
     // Create the root of the test suite
     $menu = new HTML_TreeMenu();
     $rootNode = new HTML_TreeNode(array('text' => 'Test Datasets', 'icon' => $icon_pkg, 'link' => 'home.php', 'linkTarget' => 'right'));
     // Create the top-level test groups
     $aTypes = array('datasets' => 'menu.php');
     foreach ($aTypes as $type => $link) {
         $nodeName = $type . 'RootNode';
         ${$nodeName} = new HTML_TreeNode(array('text' => ucwords($type), 'icon' => $icon_pkg, 'link' => $link, 'linkTarget' => "left"));
         $list = get_file_list(TD_DATAPATH, '.xml', true);
         foreach ($list as $index => $file) {
             ${$nodeName}->addItem(new HTML_TreeNode(array('text' => $file, 'icon' => $icon_pkg, 'link' => "action.php?&datasetfile={$file}", 'linkTarget' => 'right')));
         }
         $rootNode->addItem(${$nodeName});
     }
     $menu->addItem($rootNode);
     $tree = new HTML_TreeMenu_DHTML($menu);
     $code = file_get_contents(MAX_PATH . '/tests/testClasses/menu.css');
     $code .= "\n<script>\n";
     $code .= file_get_contents(MAX_PATH . '/tests/testClasses/TreeMenu.js');
     $code .= "\n</script>";
     $code .= $tree->toHTML();
     return $code;
 }
Esempio n. 3
0
function module_files_list()
{
    global $smarty;
    $list = get_file_list('resource');
    $smarty->assign('list', $list);
    $smarty->assign('host', $_SERVER['HTTP_HOST']);
}
Esempio n. 4
0
function module_pic_list()
{
    global $global, $smarty;
    $dir_path = url_decode($global['path']);
    $list = get_file_list($dir_path);
    $smarty->assign('list', $list);
    $smarty->assign('dir_path', $dir_path);
    $smarty->assign('host', $_SERVER['HTTP_HOST']);
}
Esempio n. 5
0
/**
* 模板隐藏安全检测
只是匹配一些敏感函数
*/
function m__safe_check()
{
    global $page, $words;
    $template = $_GET['file'];
    $dir = dirname(__FILE__) . '/../templates/' . $template;
    $files = get_file_list($dir);
    $saferes = '';
    // 遍历所有模板页
    foreach ($files as $f) {
        $filecont = strtolower(helper::get_contents($dir . "/" . $f['name']));
        /**
         * 判断模板文件中是否有敏感变量或方法名
         */
        foreach ($words as $sa) {
            if (preg_match('~(<\\?|<%)[\\w\\W]*?' . strtolower($sa) . '[\\w\\W]*?(%|\\?>)~', $filecont)) {
                $saferes .= '模板文件 ' . $f['name'] . " 代码中有敏感字符 " . $sa . ",可能存在安全隐患\\r\\n";
            }
        }
        if (!empty($saferes)) {
            die('{"code":"100","msg":"' . $saferes . '请仔细检查模板中存在该字符的代码,本提示不保证绝对准确!"}');
        }
        if (is_file($f['name'])) {
            /**
             * 判断是否包含其他文件
             */
            if (preg_match_all('~(require_once|include_once|require|include)(.*?)(;|\\?>)~', $filecont, $arr)) {
                $arrs = $arr[2];
                foreach ($arrs as $fileurl) {
                    $count1 = substr_count($fileurl, '"');
                    $count2 = substr_count($fileurl, "'");
                    if ($count1 > 2 || $count2 > 2) {
                        die('{"code":"100","msg":"模板 ' . $f['name'] . ' 的包含了其他目录的文件 ' . $fileurl . ',可能存在安全隐患"}');
                    }
                    if (count(explode('/', $fileurl)) > 1) {
                        die('{"code":"100","msg":"模板 ' . $f['name'] . ' 的包含了其他目录的文件 ' . $fileurl . ',可能存在安全隐患"}');
                    }
                }
            }
            /**
             * 判断是否又实例化对象(模板是不需要实例化任何东西的)
             */
            if (preg_match('~<\\?[\\w\\W]*?new [\\w\\W]*?\\?>~', $filecont)) {
                die('{"code":"100","msg":"模板文件 ' . $f['name'] . ' 实例化了一个对象,可能存在安全隐患"}');
            }
        }
        // echo $f['name'].'<br>';
    }
    die('{"code":"0","msg":"我们不保证文件绝对安全"}');
}
Esempio n. 6
0
 public function get_file_list($path, $arr = array())
 {
     $dir = opendir($path);
     while ($file = readdir($dir)) {
         if ($file == '.' || $file == '..') {
             continue;
         } else {
             if (is_dir($path . '\\' . $file)) {
                 $arr = get_file_list($path . '\\' . $file, $arr);
             } else {
                 $arr[] = $file;
             }
         }
     }
     closedir($dir);
     return $arr;
 }
function get_file_list(&$file_list_array, $path, $extension)
{
    $extension_preg = preg_quote($extension, '/');
    if (!is_array($file_list_array)) {
        $file_list_array = array();
    }
    if ($dir_handle = opendir($path)) {
        while (($file_name = readdir($dir_handle)) !== false) {
            if ($file_name != "." && $file_name != "..") {
                if (@is_dir("{$path}/{$file_name}") && !in_array("{$path}/{$file_name}", $GLOBALS['exclude_dirs_array'])) {
                    get_file_list($file_list_array, "{$path}/{$file_name}", $extension);
                } else {
                    if (preg_match("/{$extension_preg}\$/iu", $file_name) > 0) {
                        $file_list_array[] = "{$path}/{$file_name}";
                    }
                }
            }
        }
    }
}
Esempio n. 8
0
 /**
  * A method to return the HTML code needed to display a tree-based
  * menu of all the simulations.
  *
  * @return string A string containing the HTML code needed to display
  *                the tests in a tree-based menu.
  */
 function buildTree()
 {
     $icon_pkg = "package.png";
     // Create the root of the test suite
     $menu = new HTML_TreeMenu();
     $rootNode = new HTML_TreeNode(array('text' => 'Simulation Scenarios', 'icon' => $icon_pkg, 'link' => 'home.php', 'linkTarget' => 'right'));
     // Create the top-level test groups
     $aTypes = array(SCENARIOS => 'menu.php');
     foreach ($aTypes as $type => $link) {
         $nodeName = $type . 'RootNode';
         ${$nodeName} = new HTML_TreeNode(array('text' => ucwords($type), 'icon' => $icon_pkg, 'link' => $link, 'linkTarget' => "left"));
         $scenarios = get_file_list($type, '.php');
         foreach ($scenarios as $index => $scenario) {
             ${$nodeName}->addItem(new HTML_TreeNode(array('text' => $scenario, 'icon' => $icon_pkg, 'link' => "action.php?dir={$type}&scenario={$scenario}", 'linkTarget' => 'right')));
         }
         $rootNode->addItem(${$nodeName});
     }
     $aParams = array('text' => 'Actions', 'icon' => $icon_pkg, 'link' => "", 'linkTarget' => "right");
     // create the Actions node
     $nodeName = 'ActionsRootNode';
     ${$nodeName} = new HTML_TreeNode($aParams);
     $rootNode->addItem(${$nodeName});
     $aParams['text'] = 'Save Current Scenario';
     $aParams['link'] = 'action.php?act=save';
     ${$nodeName}->addItem(new HTML_TreeNode($aParams));
     $aParams['text'] = 'Download Scenario/s';
     $aParams['link'] = 'action.php?act=download';
     ${$nodeName}->addItem(new HTML_TreeNode($aParams));
     $aParams['text'] = 'Upload Scenario/s';
     $aParams['link'] = 'action.php?act=upload';
     ${$nodeName}->addItem(new HTML_TreeNode($aParams));
     // Add the root node to the menu, and return the HTML code
     $menu->addItem($rootNode);
     $tree = new HTML_TreeMenu_DHTML($menu);
     $code = file_get_contents(MAX_PATH . '/tests/testClasses/menu.css');
     $code .= "\n<script>\n";
     $code .= file_get_contents(MAX_PATH . '/tests/testClasses/TreeMenu.js');
     $code .= "\n</script>";
     $code .= $tree->toHTML();
     return $code;
 }
Esempio n. 9
0
function display_patch_list($title, $patchdir)
{
    global $ADMIN_TYPE;
    echo "<h3>" . $title . "</h3>";
    $filelist = get_file_list('./admin/patch_facility/sql/' . $patchdir, 'sql');
    $sqllist = NULL;
    if (is_not_empty_array($filelist)) {
        for ($i = 0; $i < count($filelist); $i++) {
            $parsedfile_r = parse_file($filelist[$i]);
            $sqllist[] = array('sqlfile' => $filelist[$i], 'name' => initcap(str_replace('_', ' ', $parsedfile_r['name'])));
        }
        if (is_not_empty_array($sqllist)) {
            echo "<table>";
            echo "<tr class=\"navbar\">" . "<th>Patch</th>" . "<th>SQL File</th>" . "<th></th>" . "<th></th>" . "</tr>";
            for ($i = 0; $i < count($sqllist); $i++) {
                echo "<tr class=\"oddRow\">" . "<td>" . $sqllist[$i]['name'] . "</td>" . "<td>" . $sqllist[$i]['sqlfile'] . "</td>" . "<td><a href=\"admin.php?type={$ADMIN_TYPE}&op=previewsql&mode=job&title=" . urlencode($sqllist[$i]['sqlfile']) . "&patchdir={$patchdir}&sqlfile=" . $sqllist[$i]['sqlfile'] . "&preview=true\" target=\"_new\">Preview</a></td>" . "<td><a href=\"admin.php?type={$ADMIN_TYPE}&op=installsql&patchdir={$patchdir}&sqlfile=" . $sqllist[$i]['sqlfile'] . "\">Install</a></td>" . "</tr>";
            }
            echo "</table>";
        }
    }
}
Esempio n. 10
0
function module_pic_lists()
{
    global $smarty;
    $list_public = get_file_list('images');
    $smarty->assign('list_public', $list_public);
    $list_editor = get_folder_list('images/editor');
    $smarty->assign('list_editor', $list_editor);
    $k = 0;
    $lists = array();
    $obj = new channel();
    $list = $obj->get_list();
    for ($i = 0; $i < count($list); $i++) {
        $arr = get_folder_list('images/' . $list[$i]['cha_code']);
        if (count($arr)) {
            $k++;
            $lists[$k]['channel'] = $list[$i]['cha_code'];
            $lists[$k]['name'] = $list[$i]['cha_name'];
            $lists[$k]['folder'] = $arr;
        }
    }
    $smarty->assign('lists', $lists);
    $smarty->assign('host', $_SERVER['HTTP_HOST']);
}
Esempio n. 11
0
 function get_file_list($a)
 {
     // reads all files into an array
     if ($a[strlen($a) - 1] != "/") {
         $a .= "/";
     }
     $result_array = array();
     chdir($a);
     $file_handle = @opendir($a);
     if (isset($file_handle)) {
         while ($file = readdir($file_handle)) {
             if ($file == '.' || $file == '..') {
                 continue;
             }
             if (is_dir($a . $file)) {
                 $result_array[str_replace($_SERVER['DOCUMENT_ROOT'], "", $a . $file)] = get_file_list($a . $file);
             } else {
                 $result_array[] = $a . $file;
             }
         }
         closedir($file_handle);
     }
     return $result_array;
 }
Esempio n. 12
0
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">     
    <style type=text/css>
        .fv table{
        	border-collapse:collapse;   
        }
        .fv td{
        	background:#ffc;
        	border:solid 1px #f90;
        	height:22px;
        }
        </style>
</head>
<body>
<?php 
require "config.php";
$ret = get_file_list(DATA);
sort_by_key($ret, 'filetime');
if ($_GET['p'] && is_numeric($_GET['p'])) {
    $p = intval($_GET['p']);
    $offset = $p * LIMIT;
    $length = LIMIT;
    $items = array_slice($ret, $offset, $length);
} else {
    $p = 1;
    if (count($ret) > LIMIT) {
        $items = array_slice($ret, 0, LIMIT);
    } else {
        $items = $ret;
    }
}
echo "<b>" . count($ret) . "</b> in total~ &nbsp;<a href=?action=clear&p=all><b>delete all</b></a>&nbsp;&nbsp;<a href=?action=clear&p={$p}><b>delete page {$p}</b></a>";
Esempio n. 13
0
/**
	$page should be a basename of $PHP_SELF with .php replaced with .html

	This function will determine whether a page can be found, or else a
	derivative of a page, based on a mapping algorithm.   The initial
	mapping algorithm will match borow.html against any pages that
	end in _borrow.html too
*/
function get_opendb_lang_help_page($language, $help_page)
{
    $language = strtolower($language);
    $filelist_r = get_file_list('./help/' . $language, 'html');
    if (is_array($filelist_r)) {
        for ($i = 0; $i < count($filelist_r); $i++) {
            if ($help_page == $filelist_r[$i]) {
                return $language . '/' . $filelist_r[$i];
            }
        }
        for ($i = 0; $i < count($filelist_r); $i++) {
            // borrow.html will be returned for item_borrow.html too
            if (ends_with($help_page, "_" . $filelist_r[$i])) {
                return $language . '/' . $filelist_r[$i];
            }
        }
    }
    return NULL;
}
Esempio n. 14
0
        echo "<p><input type='submit' name='setdir'  value='Set directory' disabled=1>&nbsp;<i>Torrent must be stopped before changing directory.</i></p>\n";
    } else {
        echo "<input type='hidden' name='hash' value='" . $thistorrent['hash'] . "'>\n";
        echo "<input type='hidden' name='newdir' value=''>\n";
        echo "<input type='submit' name='setdir'  value='Set directory'>\n";
    }
    echo "</fieldset>\n";
    echo "</form>\n";
    echo "<iframe frameborder=0 src='dirbrowser.php?dir=" . urlencode($seldir) . "&amp;hilitedir=" . urlencode($torrentdir) . "' width=100% height=300px>iFrame</iframe>";
    echo "<br>&nbsp;</div>";
    // end container div
    echo "<div class='bottomthin' style='width:552px;'> </div>\n";
}
// Debug info
if ($r_select == "debug") {
    echo "<pre class='medtext'>";
    echo "<h2>Torrent</h2>";
    echo nl2br(print_r($thistorrent));
    echo "<h2>Files</h2>";
    echo nl2br(print_r(get_file_list($r_hash)));
    echo "<h2>Peers</h2>";
    echo nl2br(print_r(get_peer_list($r_hash)));
    echo "<h2>Tracker</h2>";
    echo nl2br(print_r(get_tracker_list($r_hash)));
    echo "</pre>";
}
?>
</div>
</body>
</html>
Esempio n. 15
0
#!/usr/bin/php -q
<?php 
require_once 'require.php';
$files = get_file_list();
//backup_files($files);
$hdr = file_get_contents('../header.txt');
$ftr = file_get_contents('../footer.txt');
foreach ($files as $file) {
    //skip the index file
    if ($file === 'index.html') {
        echo "==> Skipping {$file} <==\n";
        continue;
    }
    //dump file into array
    $strings = file($file);
    $body = '';
    //process individual lines
    foreach ($strings as $line) {
        $line = strip($line);
        $body .= "{$line}\n";
    }
    $newfile = $hdr . $body . $ftr;
    file_put_contents($file, $newfile);
}
Esempio n. 16
0
function upload_file($name)
{
    global $image_dir_path;
    if (isset($_FILES[$name])) {
        $filename = $_FILES[$name]['name'];
        if (empty($filename)) {
            return;
        }
        $source = $_FILES[$name]['tmp_name'];
        $target = $image_dir_path . DIRECTORY_SEPARATOR . $filename;
        move_uploaded_file($source, $target);
        // create the '400', '250', and '100' versions of the image
        process_image($image_dir_path, $filename);
    }
}
switch ($action) {
    case 'upload':
        upload_file('file1');
        upload_file('file2');
        upload_file('file3');
        break;
    case 'delete':
        $filename = filter_input(INPUT_GET, 'filename', FILTER_SANITIZE_STRING);
        $target = $image_dir_path . DIRECTORY_SEPARATOR . $filename;
        if (file_exists($target)) {
            unlink($target);
        }
        break;
}
$files = get_file_list($image_dir_path);
include 'uploadform.php';
Esempio n. 17
0
/**
 * @param unknown_type $ADMIN_TYPE
 * @param unknown_type $typeName
 * @param unknown_type $sqlRegexp - if provided, assumes that the first group is the type
 * and the second is a description.  Will display both hypen separated.
 * @param unknown_type $is_not_exists_function
 */
function generate_sql_list($ADMIN_TYPE, $typeName, $sqlRegexp, $is_not_exists_function)
{
    $filelist = get_file_list('./admin/' . $ADMIN_TYPE . '/sql/', 'sql');
    $sitelist = NULL;
    if (is_not_empty_array($filelist)) {
        for ($i = 0; $i < count($filelist); $i++) {
            $parsedfile_r = parse_file($filelist[$i]);
            $type = NULL;
            $description = NULL;
            if (strlen($sqlRegexp) > 0) {
                if (preg_match($sqlRegexp, $parsedfile_r['name'], $matches)) {
                    $type = strtoupper($matches[1]);
                    $description = str_replace('_', ' ', $matches[2]);
                }
            } else {
                $type = strtoupper($parsedfile_r['name']);
            }
            if ($is_not_exists_function($type)) {
                $sqllist[] = array('sqlfile' => $filelist[$i], 'type' => $type, description => $description);
            }
        }
        if (is_not_empty_array($sqllist)) {
            echo "<table class=\"sqlList\">";
            echo "<tr class=\"navbar\">" . "<th>" . $typeName . "</th>" . "<th>SQL File</th>" . "<th>&nbsp;</th>" . "</tr>";
            for ($i = 0; $i < count($sqllist); $i++) {
                echo "<tr class=\"oddRow\">" . "<td>" . $sqllist[$i]['type'] . (strlen($sqllist[$i]['description']) > 0 ? " - " . $sqllist[$i]['description'] : "") . "</td>" . "<td>" . $sqllist[$i]['sqlfile'] . "</td>" . "<td><a href=\"admin.php?type={$ADMIN_TYPE}&op=installsql&sqlfile=" . $sqllist[$i]['sqlfile'] . "\">Install</a></td>" . "</tr>";
            }
            echo "</table>";
        }
    }
}
Esempio n. 18
0
 $installPlugin = new $classname();
 $recordCount = $installPlugin->getRecordCount();
 if (is_numeric($recordCount)) {
     echo "\n<p>Record Count: " . $recordCount . "</p>";
 }
 $lastUpdated = $installPlugin->getLastUpdated();
 if ($lastUpdated !== FALSE) {
     $lastUpdatedString = get_localised_timestamp($cfg_date_mask, $lastUpdated);
 }
 if (strlen($lastUpdated) > 0) {
     echo "\n<p>Last updated: " . $lastUpdatedString . "</p>";
 }
 echo "\n<h4>Listing <code>./admin/s_site_plugin/upload/</code> directory</h4>";
 echo "\n<table>";
 echo "\n<tr class=\"navbar\">" . "<th>CSV File</th>" . "<th>Action</th>" . "\n</tr>";
 $file_list_r = get_file_list('./admin/s_site_plugin/upload/', 'csv');
 if (is_not_empty_array($file_list_r)) {
     $toggle = TRUE;
     reset($file_list_r);
     while (list(, $file) = each($file_list_r)) {
         $color = $toggle ? "oddRow" : "evenRow";
         $toggle = !$toggle;
         echo "\n<form name=\"import_file\" action=\"{$PHP_SELF}\" method=\"GET\">" . "\n<input type=\"hidden\" name=\"type\" value=\"" . $ADMIN_TYPE . "\">" . "\n<input type=\"hidden\" name=\"site_type\" value=\"" . $HTTP_VARS['site_type'] . "\">" . "\n<input type=\"hidden\" name=\"op\" value=\"" . $HTTP_VARS['op'] . "\">" . "\n<input type=\"hidden\" name=\"import_file\" value=\"" . $file . "\">";
         echo "\n<tr>";
         echo "\n<td class=\"{$color}\">" . $file . "</td>";
         echo "<td class=\"{$color}\"><input type=\"submit\" class=\"submit\" value=\"Import\"></td></tr>";
         echo "\n</form>";
         echo "</table>";
     }
 } else {
     echo "</table>";
Esempio n. 19
0
    			if (!@is_dir($e)) continue;
    			$theme_list[$e] = $e;
    			flush();
    		}
    		closedir($d);
    	chdir(".."); */
    $theme_list = get_theme_list();
    foreach ($theme_list as $theme) {
        echo '<OPTION VALUE="' . $theme . '">';
        echo $theme;
    }
    echo '</SELECT>
	<input name="change_theme" value="Активировать" type="submit" class="unit_button" /> 
	</form>';
    ##### Редактор ->
    $file_list = get_file_list($t);
    if (@$_REQUEST['act'] == "edit") {
        if (isset($file_list[$_REQUEST['file']])) {
            $file = htmlspecialchars(file_get_contents(TE_DIR . '/themes/' . $t . '/' . $_REQUEST['file']));
            $thFchmod = '<span class="mes"> Права доступа: ' . decoct(0777 & fileperms(TE_DIR . '/themes/' . $t . '/' . $file_list[$_REQUEST['file']])) . '</span> 
		<a target="_blank" href="' . $help['chmod'] . '">[Что это?]</a>';
        }
    }
    //echo '<pre>'; print_r($file_list); echo '</pre>';
    echo '	
<form method="post">
		<INPUT TYPE="hidden" NAME="action" VALUE="theme_list">
		<INPUT TYPE="hidden" NAME="file" VALUE="' . $_REQUEST['file'] . '">
		<INPUT TYPE="hidden" NAME="act" VALUE="edit">';
    echo '<table border="0">
	<tr>
Esempio n. 20
0
function get_parts_skin_file_uri()
{
    //define( 'FS_METHOD', 'direct' );
    define('MERGED_CSS', '_merged_.css');
    $skin_file = get_pearts_base_skin();
    if (!$skin_file) {
        return;
    }
    //パーツスキンじゃないときは
    $skin_arr = explode('/', $skin_file);
    array_pop($skin_arr);
    //CSSファイル名の除去
    $skin_dir = implode('/', $skin_arr);
    //var_dump(get_theme_local_dir());
    //スキンファイルをローカルパスに変換
    $skin_local_file = str_replace(get_theme_dir(), get_theme_local_dir(), $skin_file);
    //URLをローカルパスに変換
    $skin_local_dir = str_replace(get_theme_dir(), get_theme_local_dir(), $skin_dir);
    //ディレクトリ内の全てのCSSファイルを取得
    //var_dump($skin_local_dir);
    $all_files = get_file_list($skin_local_dir . '/');
    //var_dump($all_files);
    //利用するパーツスキンファイルを取得
    $skin_pearts_local_files = array();
    foreach ($all_files as $pathname) {
        $pathname = str_replace('\\', '/', $pathname);
        if (preg_match('/\\.css$/i', $pathname, $matches)) {
            //フォルダ名の正規表現が[a-zA-Z\-_]+のとき
            //結合ファイルの時は読み込まない
            if (preg_match('/\\/_merged_\\.css$/i', $pathname, $m)) {
                continue;
            }
            //スキンのstyle.cssは先頭にするため読み込まない
            if (!preg_match('/\\/style\\.css$/i', $pathname, $m)) {
                $skin_pearts_local_files[] = $pathname;
            }
        }
    }
    //文字列順に並び替え
    sort($skin_pearts_local_files, SORT_STRING);
    //先頭にstyle.cssを追加
    $skin_pearts_local_files = array_merge(array($skin_local_file), $skin_pearts_local_files);
    //var_dump($skin_pearts_local_files);
    //パーツスキンファイルを開いて全てまとめる
    $merged_css_text = '';
    foreach ($skin_pearts_local_files as $pathname) {
        if (WP_Filesystem()) {
            //WP_Filesystemの初期化
            global $wp_filesystem;
            //$wp_filesystemオブジェクトの呼び出し
            //コメントで位置を表示するためのファイル名取得
            $comment_file_name = str_replace($skin_local_dir . '/', '', $pathname);
            $css = $wp_filesystem->get_contents($pathname);
            //ファイルの読み込み
            $merged_css_text .= "/****************************\r\n" . "** File:" . $comment_file_name . "\r\n" . "****************************/\r\n" . $css . "\r\n";
            //CSSの結合
        }
    }
    //var_dump($merged_css_text);
    $merged_css_file = $skin_local_dir . '/' . MERGED_CSS;
    if (WP_Filesystem()) {
        //WP_Filesystemの初期化
        global $wp_filesystem;
        //$wp_filesystemオブジェクトの呼び出し
        $wp_filesystem->put_contents($merged_css_file, $merged_css_text, 0644);
    }
    if (!file_exists($merged_css_file)) {
        return;
    }
    //ファイルが存在しないときnull
    return str_replace(get_theme_local_dir(), get_theme_dir(), $merged_css_file);
    //成功した時はファイルパスを渡す
}
Esempio n. 21
0
function get_file_list($dir)
{
    $files = array();
    if (is_dir($dir)) {
        if ($dh = opendir($dir)) {
            while (($file = readdir($dh)) !== false) {
                if ($file != '.' && $file != '..' && $file != '.svn') {
                    if (is_dir($dir . $file . '/')) {
                        $files = array_merge($files, get_file_list($dir . $file . '/'));
                    } else {
                        $files[$dir . $file] = $file;
                    }
                }
            }
            closedir($dh);
        }
    }
    return $files;
}
Esempio n. 22
0
File: view.php Progetto: nylen/rtgui
HTML;
    }
    // ------------------------------------------------
    // --- Debug tab
    // ------------------------------------------------
    if ($debug_mode && $r_select == 'debug') {
        ?>
    <pre class="medtext">
      <h2>Torrent</h2>
<?php 
        print_r($this_torrent);
        ?>

      <h2>Files</h2>
<?php 
        print_r(get_file_list($r_hash));
        ?>

      <h2>Peers</h2>
<?php 
        print_r(get_peer_list($r_hash));
        ?>

      <h2>Tracker</h2>
<?php 
        print_r(get_tracker_list($r_hash));
        ?>

    </pre>
<?php 
    }
Esempio n. 23
0
            }
        }
        closedir($handle);
        return $files;
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>解压文件</title>
</head>
<form action="?m=do_unzip" method="get" enctype="multipart/form-data">
<?php 
$zips = get_file_list(dirname(__FILE__));
if (empty($zips)) {
    echo "当前目录下面没有可以解压的zip文件";
} else {
    ?>
    <span>请选择要解压的文件</span><br><br><select name="from">
    <?php 
    foreach ($zips as $zip) {
        echo '<option  value="' . $zip['name'] . '" >' . $zip['name'] . "</option>";
    }
    ?>
    </select><br><br>
    <span>请填写要解压到的目录名称(<font color="red">相对于当前目录,为空表示解压到当前目录下,不能用“/”开头</font>)</span><br><br><input type="text" name="to" value=""/><br/><br>
    <input type="hidden" name="m" value="do_unzip" />
    <input type="submit" value="解压"/>
    <?php 
Esempio n. 24
0
    $hash = $row["ihash"];
    $parent_key = $row["ikey"];
    file_put_contents($my_data_dir . "/paypal_ds.log", date(DATE_ATOM) . "already registered. client [{$company_name}] {$contact_name} l: {$sftplog} \n", FILE_APPEND);
    //die("this client already registered, please contact user $eml for shared datasource");
}
// send progress bar to client
file_put_contents($my_data_dir . "/" . $hash . ".prc", "10");
$waiter = file_get_contents($wwwrealpath . "/paypal-wait.html");
$waiter = str_replace("thekey", $hash, $waiter);
echo $waiter;
// send page to user
flush();
ob_flush();
flush();
if (!$testrun) {
    $ret = get_file_list($paypal_sftp_login, $paypal_sftp_password);
    //$result=exec("./getpaypal-list-files.sh $paypal_sftp_login"."@reports.paypal.com $paypal_sftp_password 2>&1", $ret);
    //$ftp_response=$result;
    $stime2 = get_timer();
    $list_time = $stime2 - $stime1;
    $some_data_found = 0;
    foreach ($ret as $fname) {
        if (FALSE === strpos($fname, "TRR-")) {
            continue;
        }
        $some_data_found = 1;
    }
    if ($ret[3] == $ret[2] && FALSE !== strpos("Password Authentication", $ret[2])) {
        //    [2] => Password Authentication
        //    [3] => Password Authentication
        $resp = "<b>unable to login into paypal transactions report sftp server (reports.paypal.com), <br>please check credentials and try again</b><br>If credentials valid, and you still get this message - please contact support.";
Esempio n. 25
0
function get_file_list($directory)
{
    $all = "";
    if ($handle = opendir($directory)) {
        while (false !== ($file = readdir($handle))) {
            if (is_file($directory . $file)) {
                $all .= $directory . $file;
            } elseif ($file != '.' and $file != '..' and is_dir($directory . $file)) {
                $all .= $directory . $file;
                $all .= get_file_list($directory . $file . '/');
            }
        }
    }
    closedir($handle);
    return $all;
}
Esempio n. 26
0
function get_file_list($dir)
{
    $ret = array();
    $list = glob($dir . '*');
    foreach ($list as $file) {
        $ext = substr($file, -4);
        if (in_array($ext, array('.svn', '.php', '.apk', '.ipa', '.zip', '.rar'))) {
            //过滤svn文件夹和php等文件。
            continue;
        }
        if (is_dir($file)) {
            $ret = array_merge($ret, get_file_list($file . '/'));
        } else {
            $ret[$file] = substr($file, strlen(__ROOT__));
        }
    }
    return $ret;
}
Esempio n. 27
0
echo "<hr size=1>";
// Select view...
echo "<table cellspacing=0 cellpadding=3>\n";
echo "<tr><td>&nbsp;</td>\n";
echo "<td class='" . ($r_select == "files" ? "viewselon" : "viewseloff") . "'><a href='?select=files&hash={$r_hash}'>Files</a></td>\n";
echo "<td>&nbsp</td>\n";
echo "<td class='" . ($r_select == "tracker" ? "viewselon" : "viewseloff") . "'><a href='?select=tracker&hash={$r_hash}'>Tracker</a></td>\n";
echo "<td>&nbsp</td>\n";
echo "<td class='" . ($r_select == "torrent" ? "viewselon" : "viewseloff") . "'><a href='?select=torrent&hash={$r_hash}'>Torrent</a></td>\n";
echo "</tr></table>\n";
// Main outer table...
echo "<table class='maintable' width='100%'>\n";
echo "<tr><td>\n";
// Display file info...
if ($r_select == "files") {
    $data = get_file_list($r_hash);
    echo "<form action='control.php' action=post>";
    echo "<table border=0 cellspacing=0 cellpadding=5 class='maintable' width='100%'>";
    echo "<tr class='tablehead'>";
    echo "<td>Filename</td>";
    echo "<td align=center>Size</td>";
    echo "<td align=center>Done</td>";
    echo "<td align=center>Chunks</td>";
    echo "<td align=center>Priority</td>";
    echo "</tr>\n";
    $thisrow = "row1";
    $index = 0;
    foreach ($data as $item) {
        echo "<tr class='{$thisrow}'>";
        echo "<td colspan=5>" . wordwrap($item['get_path'], 90, "<br>\n", TRUE) . "</td>";
        echo "</tr><tr class='{$thisrow}'>\n";