Пример #1
0
 function load_menu($selected = null)
 {
     $menu = dir_list(CONTROLLERS_DIR);
     foreach ($menu as $voice) {
         $menu_list[] = array('name' => $voice, 'link' => basename($_SERVER['SCRIPT_NAME']) . '/' . $voice . '/', 'selected' => $selected == $voice);
     }
     return $menu_list;
 }
Пример #2
0
function dir_list($path)
{
    foreach (scandir($path) as $file) {
        if ($file != '.' && $file != '..') {
            if (is_dir($path . $file)) {
                dir_list($path . $file . '/');
            } else {
                echo '<div class="avatar" onclick="select(\'' . addslashes($path . $file) . '\')"><img title="' . $path . $file . '" src="' . $path . $file . '"></div>' . "\n";
            }
        }
    }
}
Пример #3
0
function dir_list($path, $display = 'block')
{
    if (!($dir = opendir($path))) {
        echo $path . ' introuvable';
    } else {
        ?>
<ul style="line-height:1.3em; list-style:none;display:<?php 
        echo $display;
        ?>
" id="ul_<?php 
        echo $GLOBALS['i'];
        ?>
"><?php 
        while (($item = readdir($dir)) !== false) {
            if (in_array($item, array('.', '..'))) {
                continue;
            }
            ?>
<li><?php 
            echo $item;
            $full_path = $path . $item;
            switch (true) {
                case is_dir($full_path):
                    echo " <a id='cross_" . ($GLOBALS['i'] + 1) . "' href='javascript:void(0);' onclick=\"toggleBloc('" . ($GLOBALS['i'] + 1) . "');\">+</a>";
                    $GLOBALS['i']++;
                    dir_list($full_path . '/', 'none');
                    break;
                case is_link($full_path):
                    ?>
 (raccourci)<?php 
                    break;
                case is_file($full_path):
                    ?>
 (fichier<?php 
                    echo @filesize($full_path) === false ? null : ', ' . filesize($full_path) . ' octets';
                    ?>
)<?php 
                    break;
                default:
                    ?>
 (???)<?php 
            }
            ?>
</li><?php 
        }
        ?>
</ul><?php 
    }
    closedir($dir);
}
Пример #4
0
function dir_list($path, $exts = '', $list = array())
{
    $path = dir_path($path);
    $files = glob($path . '*');
    foreach ($files as $v) {
        if (!$exts || preg_match("/\\.({$exts})/i", $v)) {
            $list[] = retrieve($v);
            if (is_dir($v)) {
                $list = dir_list($v, $exts, $list);
            }
        }
    }
    return $list;
}
Пример #5
0
 public function getJs()
 {
     //合并分开的app.js
     pc_base::load_sys_func('dir');
     $filelist = dir_list(PHPCMS_PATH . 'statics/js/app/build/', 'js');
     $models_js = '';
     foreach ($filelist as $k => $v) {
         $value = file_get_contents($v);
         $models_js .= "\r" . $value;
     }
     $app_path = "http://" . $_SERVER['HTTP_HOST'] . "/";
     //dump($filelist);
     //echo template('content','js');
     include template('content', 'js');
 }
Пример #6
0
 public function index()
 {
     $exts = array('html', 'css', 'js');
     $type = $_GET['type'] ? $_GET['type'] : 'html';
     if ($type == 'html') {
         $path = $this->filepath;
     } else {
         $path = $this->publicpath . $type . '/';
     }
     $files = dir_list($path, $type);
     foreach ($files as $key => $file) {
         $filename = basename($file);
         $templates[$key]['value'] = substr($filename, 0, strrpos($filename, '.'));
         $templates[$key]['filename'] = $filename;
         $templates[$key]['filepath'] = $file;
         $templates[$key]['filesize'] = byte_format(filesize($file));
         $templates[$key]['filemtime'] = filemtime($file);
         $templates[$key]['ext'] = strtolower(substr($filename, strrpos($filename, '.') - strlen($filename)));
     }
     $this->assign('templates', $templates);
     $this->display();
 }
Пример #7
0
 function index()
 {
     $tempfiles = dir_list($this->path, 'php');
     $list = $this->dao->Field('id,pay_code,status,listorder,pay_name')->select();
     foreach ((array) $list as $key => $r) {
         $installed[$r['pay_code']] = $r;
     }
     foreach ($tempfiles as $r) {
         $filename = basename($r);
         $pay_code = str_replace('.class.php', '', $filename);
         import("@.Pay." . $pay_code);
         $pay = new $pay_code();
         $paylist[$pay_code] = $pay->setup();
         if ($installed[$pay_code]) {
             $paylist[$pay_code]['id'] = $installed[$pay_code]['id'];
             $paylist[$pay_code]['status'] = $installed[$pay_code]['status'];
             $paylist[$pay_code]['listorder'] = $installed[$pay_code]['listorder'];
             $paylist[$pay_code]['pay_name'] = $installed[$pay_code]['pay_name'];
         }
     }
     $this->assign('list', $paylist);
     $this->display();
 }
Пример #8
0
?>
</div> 

<hr class="chubby"> 

<div class="table_actions clearfix"> 
		
		<?php 
if ($cms_user['media']) {
    ?>
		<ul id="status_actions"> 
			<li id="status_action_delete"><a href="">Delete</a></li>
			<?php 
    // Display batch upload button if there are files in the batch folder
    if (file_exists('media/batch/')) {
        $batch_media = dir_list('media/batch/');
        if (count($batch_media) > 0) {
            ?>
					<li id="media_batch_upload"><a href="">Batch upload <span id="media_batch_total"><?php 
            echo count($batch_media);
            ?>
</span> items<span id="media_batch_percent"></span></a></li>
					<?php 
        }
    }
    ?>
		</ul> 
		<?php 
}
?>
	
Пример #9
0
// admin
if ($smartysh->config["frontpage_site"] === false) {
    if ($smartysh->runtime["site_dir"] == "") {
        if (isset($_GET["action"])) {
            if ($_GET["action"] == "new_project") {
                if (isset($_GET["name"])) {
                    echo "todo new ";
                } else {
                    die("name attribute needed");
                }
            }
        }
        $smarty->template_dir = $smartysh->config["code_path"] . "/admin/templates";
        $smarty->assign("access_log", get_access_log(array("limit" => 10)));
        $smarty->assign("access_log_site", get_site_access_log(array("limit" => 10)));
        $files = dir_list($smartysh->config["basepath"]);
        foreach ($files as &$ma) {
            $tmp[] =& $ma["timestamp"];
        }
        array_multisort($tmp, SORT_DESC, $files, SORT_DESC);
        $smarty->assign("files", $files);
        $smarty->display("index.tpl");
        die;
    }
}
// load custom site functions
if (file_exists($smartysh->config["basepath"] . "/" . $smartysh->runtime["site_dir"] . "/functions.php")) {
    require_once $smartysh->config["basepath"] . "/" . $smartysh->runtime["site_dir"] . "/functions.php";
}
// build all templates
// todo build also logged templates
Пример #10
0
<?php

session_start();
require_once "../../../includes/db_functions.inc.php";
require_once "../../../includes/config.inc.php";
require_once "../../../includes/filelist.inc.php";
$dir = $setting['sitepath'] . '/avatars';
$files = dir_list($dir);
$os = array("gif", "jpg", "jpeg", "png", "GIF", "JPG", "JPEG", "PNG");
$n = 0;
$num = 0;
$count = count($files);
if ($count == 0) {
    echo '<p>No free avatars available.</p>';
    exit;
}
$avquery = yasDB_select("SELECT avatar FROM avatars WHERE userid = {$_SESSION['userid']}");
if ($avquery->num_rows != 0) {
    while ($avfile = $avquery->fetch_array(MYSQL_ASSOC)) {
        echo '
		<div class="avatarpics">
		<ul>
		<li class="even"><input type="image" class="useravatars" src="' . $setting['siteurl'] . 'avatars/' . $avfile['avatar'] . '" onclick="switchAvatar(\'' . $avfile['avatar'] . '\');return false">
		<center><input type="image" src="' . $setting['siteurl'] . 'templates/' . $setting['theme'] . '/skins/' . $setting['skin'] . '/images/close.png" height="15" width="15" name="avatar" value="Remove" onclick="deleteAvatar(\'' . addslashes($avfile['avatar']) . '\');return false"/></center></li>
		</ul>
		</div>';
    }
}
$avquery->close();
while ($num < $count) {
    $file = $files[$num]['name'];
Пример #11
0
// admin
if ($htmlwarrior->config['frontpage_site'] === false) {
    if ($htmlwarrior->runtime['site_dir'] == '') {
        if (isset($_GET['action'])) {
            if ($_GET['action'] == 'new_project') {
                if (isset($_GET['name'])) {
                    echo 'todo new ';
                } else {
                    die('name attribute needed');
                }
            }
        }
        $smarty->setTemplateDir($htmlwarrior->config['code_path'] . '/admin/templates');
        $smarty->assign('access_log', get_access_log(array('limit' => 10)));
        $smarty->assign('access_log_site', get_site_access_log(array('limit' => 10)));
        $files = dir_list($htmlwarrior->config['basepath']);
        foreach ($files as &$ma) {
            $tmp[] =& $ma['timestamp'];
        }
        array_multisort($tmp, SORT_DESC, $files, SORT_DESC);
        $smarty->assign('files', $files);
        $smarty->display('index.tpl');
        die;
    }
}
// load custom site functions
if (file_exists($htmlwarrior->config['basepath'] . '/' . $htmlwarrior->runtime['site_dir'] . '/functions.php')) {
    require_once $htmlwarrior->config['basepath'] . '/' . $htmlwarrior->runtime['site_dir'] . '/functions.php';
}
// load custom site configs
if (file_exists($htmlwarrior->config['basepath'] . '/' . $htmlwarrior->runtime['site_dir'] . '/cfg/config.php')) {
Пример #12
0
<?php

/**
 * Spic <https://github.com/ricain/spic>
 * @author Jean Mercadier <jmercadier.fr>
 * @license The MIT License
 */
require_once __DIR__ . "/../private/lib/secu.lib.php";
require_once __DIR__ . "/../private/lib/dir.lib.php";
require_once __DIR__ . "/../private/lib/ajax.lib.php";
require_once __DIR__ . "/../private/lib/util.lib.php";
util_define_timezone();
$resp = array();
if (isset($_POST["resend"])) {
    $resp["resend"] = $_POST["resend"];
}
if (!secu_isloged() && (!isset($_POST["pass"]) || !secu_login($_POST["pass"]))) {
    echo ajax_format($resp, "wrong password.");
    exit;
}
$resp["list"] = dir_list();
echo ajax_format($resp);
Пример #13
0
 if (!$cms_user['media']) {
     $error[] = "Media management is disabled for your account";
 } else {
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // Push the limits...
     ini_set("memory_limit", "104857600");
     ini_set("max_execution_time", "3600");
     ini_set("max_input_time", "3600");
     ini_set("post_max_size", "105857600");
     ini_set("upload_max_filesize", "104857600");
     ini_set("output_buffering", "on");
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // Batch upload from folder
     if (isset($_GET['batch'])) {
         if (file_exists('../media/batch/')) {
             $batch_media = dir_list('../media/batch/', false, true);
             if (count($batch_media) > 0) {
                 // No need to use this GET-ID since we are deleting them as we go
                 $_POST['url_media'] = $batch_media[0];
             }
         }
     }
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // Allow for multiple files (Chrome, FireFox and Safari)
     $files_uploaded = count($_FILES['upload_media']['name']);
     $files_to_add = $files_uploaded ? $files_uploaded : 1;
     for ($file_indice = 0; $file_indice < $files_to_add; $file_indice++) {
         //////////////////////////////////////////////////////////////////////////////
         // If there are uploaded files let's set the info
         if ($files_uploaded > 0) {
             $file_upload = array();
Пример #14
0
function copy_move_items($dir)
{
    // copy and move are only allowed if the user may read and change files
    if ($GLOBALS["action"] == "copy" && !permissions_grant_all($dir, NULL, array("read", "create"))) {
        show_error($GLOBALS["error_msg"]["accessfunc"]);
    }
    if ($GLOBALS["action"] == "move" && !permissions_grant($dir, NULL, "change")) {
        show_error($GLOBALS["error_msg"]["accessfunc"]);
    }
    // Vars
    $first = $GLOBALS['__POST']["first"];
    if ($first == "y") {
        $new_dir = $dir;
    } else {
        $new_dir = $GLOBALS['__POST']["new_dir"];
    }
    if ($new_dir == ".") {
        $new_dir = "";
    }
    $cnt = count($GLOBALS['__POST']["selitems"]);
    // Copy or Move?
    if ($GLOBALS["action"] != "move") {
        $_img = "_img/__copy.gif";
    } else {
        $_img = "_img/__cut.gif";
    }
    // Get New Location & Names
    if (!isset($GLOBALS['__POST']["confirm"]) || $GLOBALS['__POST']["confirm"] != "true") {
        $msg = $GLOBALS["action"] != "move" ? $GLOBALS["messages"]["actcopyitems"] : $GLOBALS["messages"]["actmoveitems"];
        show_header($msg);
        // JavaScript for Form:
        // Select new target directory / execute action
        ?>
<script language="JavaScript1.2" type="text/javascript">
<!--
    function NewDir(newdir) {
        document.selform.new_dir.value = newdir;
        document.selform.submit();
    }

    function Execute() {
        document.selform.confirm.value = "true";
    }
//-->
</script>
<?php 
        // "Copy / Move from .. to .."
        $s_dir = $dir;
        if (strlen($s_dir) > 40) {
            $s_dir = "..." . substr($s_dir, -37);
        }
        $s_ndir = $new_dir;
        if (strlen($s_ndir) > 40) {
            $s_ndir = "..." . substr($s_ndir, -37);
        }
        echo "<BR><IMG SRC=\"" . $_img . "\" align=\"ABSMIDDLE\" ALT=\"\">&nbsp;";
        echo htmlspecialchars(sprintf($GLOBALS["action"] != "move" ? $GLOBALS["messages"]["actcopyfrom"] : $GLOBALS["messages"]["actmovefrom"], $s_dir, $s_ndir));
        echo "<IMG SRC=\"_img/__paste.gif\" align=\"ABSMIDDLE\" ALT=\"\">\n";
        // Form for Target Directory & New Names
        echo "<BR><BR><FORM name=\"selform\" method=\"post\" action=\"";
        echo make_link("post", $dir, NULL) . "\"><TABLE>\n";
        echo "<INPUT type=\"hidden\" name=\"do_action\" value=\"" . $GLOBALS["action"] . "\">\n";
        echo "<INPUT type=\"hidden\" name=\"confirm\" value=\"false\">\n";
        echo "<INPUT type=\"hidden\" name=\"first\" value=\"n\">\n";
        echo "<INPUT type=\"hidden\" name=\"new_dir\" value=\"" . htmlspecialchars($new_dir) . "\">\n";
        // List Directories to select Target
        dir_print(dir_list($new_dir), $new_dir);
        echo "</TABLE><BR><TABLE>\n";
        // Print Text Inputs to change Names
        for ($i = 0; $i < $cnt; ++$i) {
            $selitem = $GLOBALS['__POST']["selitems"][$i];
            if (isset($GLOBALS['__POST']["newitems"][$i])) {
                $newitem = $GLOBALS['__POST']["newitems"][$i];
                if ($first == "y") {
                    $newitem = $selitem;
                }
            } else {
                $newitem = $selitem;
            }
            $s_item = $selitem;
            if (strlen($s_item) > 50) {
                $s_item = substr($s_item, 0, 47) . "...";
            }
            echo "<TR><TD><IMG SRC=\"_img/_info.gif\" align=\"ABSMIDDLE\" ALT=\"\">";
            // Old Name
            echo "<INPUT type=\"hidden\" name=\"selitems[]\" value=\"";
            echo htmlspecialchars($selitem) . "\">&nbsp;" . htmlspecialchars($s_item) . "&nbsp;";
            // New Name
            echo "</TD><TD><INPUT type=\"text\" size=\"25\" name=\"newitems[]\" value=\"";
            echo htmlspecialchars($newitem) . "\"></TD></TR>\n";
        }
        // Submit & Cancel
        echo "</TABLE><BR><TABLE><TR>\n<TD>";
        echo "<INPUT type=\"submit\" value=\"";
        echo $GLOBALS["action"] != "move" ? $GLOBALS["messages"]["btncopy"] : $GLOBALS["messages"]["btnmove"];
        echo "\" onclick=\"javascript:Execute();\"></TD>\n<TD>";
        echo "<input type=\"button\" value=\"" . $GLOBALS["messages"]["btncancel"];
        echo "\" onClick=\"javascript:location='" . make_link("list", $dir, NULL);
        echo "';\"></TD>\n</TR></FORM></TABLE><BR>\n";
        return;
    }
    // DO COPY/MOVE
    // ALL OK?
    if (!@file_exists(get_abs_dir($new_dir))) {
        show_error($new_dir . ": " . $GLOBALS["error_msg"]["targetexist"]);
    }
    if (!get_show_item($new_dir, "")) {
        show_error($new_dir . ": " . $GLOBALS["error_msg"]["accesstarget"]);
    }
    if (!down_home(get_abs_dir($new_dir))) {
        show_error($new_dir . ": " . $GLOBALS["error_msg"]["targetabovehome"]);
    }
    // copy / move files
    $err = false;
    for ($i = 0; $i < $cnt; ++$i) {
        $tmp = $GLOBALS['__POST']["selitems"][$i];
        $new = basename($GLOBALS['__POST']["newitems"][$i]);
        $abs_item = get_abs_item($dir, $tmp);
        $abs_new_item = get_abs_item($new_dir, $new);
        $items[$i] = $tmp;
        // Check
        if ($new == "") {
            $error[$i] = $GLOBALS["error_msg"]["miscnoname"];
            $err = true;
            continue;
        }
        if (!@file_exists($abs_item)) {
            $error[$i] = $GLOBALS["error_msg"]["itemexist"];
            $err = true;
            continue;
        }
        if (!get_show_item($dir, $tmp)) {
            $error[$i] = $GLOBALS["error_msg"]["accessitem"];
            $err = true;
            continue;
        }
        if (@file_exists($abs_new_item)) {
            $error[$i] = $GLOBALS["error_msg"]["targetdoesexist"];
            $err = true;
            continue;
        }
        // Copy / Move
        if ($GLOBALS["action"] == "copy") {
            if (@is_link($abs_item) || @is_file($abs_item)) {
                // check file-exists to avoid error with 0-size files (PHP 4.3.0)
                $ok = @copy($abs_item, $abs_new_item);
                //||@file_exists($abs_new_item);
            } elseif (@is_dir($abs_item)) {
                $ok = copy_dir($abs_item, $abs_new_item);
            }
        } else {
            $ok = @rename($abs_item, $abs_new_item);
        }
        if ($ok === false) {
            $error[$i] = $GLOBALS["action"] == "copy" ? $GLOBALS["error_msg"]["copyitem"] : $GLOBALS["error_msg"]["moveitem"];
            $err = true;
            continue;
        }
        $error[$i] = NULL;
    }
    if ($err) {
        // there were errors
        $err_msg = "";
        for ($i = 0; $i < $cnt; ++$i) {
            if ($error[$i] == NULL) {
                continue;
            }
            $err_msg .= $items[$i] . " : " . $error[$i] . "<BR>\n";
        }
        show_error($err_msg);
    }
    header("Location: " . make_link("list", $dir, NULL));
}
Пример #15
0
 /**
  * 转换目录下面的所有文件编码格式
  * 
  * @param	string	$in_charset		原字符集
  * @param	string	$out_charset	目标字符集
  * @param	string	$dir			目录地址
  * @param	string	$fileexts		转换的文件格式
  * @return	string	如果原字符集和目标字符集相同则返回false,否则为true
  */
 static function dir_iconv($in_charset, $out_charset, $dir, $fileexts = 'php|html|htm|shtml|shtm|js|txt|xml')
 {
     if ($in_charset == $out_charset) {
         return false;
     }
     $list = dir_list($dir);
     foreach ($list as $v) {
         if (pathinfo($v, PATHINFO_EXTENSION) == $fileexts && is_file($v)) {
             file_put_contents($v, iconv($in_charset, $out_charset, file_get_contents($v)));
         }
     }
     return true;
 }
Пример #16
0
 /**
  * 系统图片库
  */
 function showPics()
 {
     $files = dir_list(ROOT_PATH . 'data/uploads/');
     require dirname(__FILE__) . '/../view/showPics.php';
 }
Пример #17
0
        break;
    case 'chmod':
        fm_chmod($_REQUEST['source'], $_REQUEST['mode']);
        break;
    case 'chown':
        fm_chown($_REQUEST['source'], $_REQUEST['uid'], $_REQUEST['gid']);
        break;
    case 'create_file':
        fm_create_file($_REQUEST['source'], $_REQUEST['mode'] || FALSE);
        break;
    case 'create_dir':
        fm_create_dir($_REQUEST['source'], $_REQUEST['mode'] || FALSE);
        break;
    default:
        $pwd = $_REQUEST['path'] ? $_REQUEST['path'] : __DIR__;
        $listing = dir_list($pwd, $_REQUEST['sort_field']);
        $writable = is_writable($pwd);
        $pwd = array_merge(array('/'), explode('/', trim($pwd, '/')));
        include 'templates/filemanager.php';
        break;
}
//echo $_GET['sort_field'];
//    if(in_array($_GET['sort_field'], $available_sort_fields)){
//	echo '1';
//    }
/*
  upload_file

+  list_dir
+-  copy file / dir [ recursive ]
+-  rename(move) file / dir
Пример #18
0
function dir_list($path)
{
    $hand = opendir(CMS_PATH . $path);
    readdir($hand);
    readdir($hand);
    while ($file = readdir($hand)) {
        if (is_dir(CMS_PATH . $path . '/' . $file)) {
            dir_list($path . '/' . $file);
            echo "<option value=\"{$path}/{$file}\">{$path}/{$file}</option>";
            continue;
        }
    }
    closedir($hand);
}
Пример #19
0
                if (unlink($delname)) {
                    $err_remove = "";
                } else {
                    $err_remove = "failed";
                }
            } else {
                if (is_dir($delname)) {
                    if (delTree($delname)) {
                        $err_remove = "";
                    } else {
                        $err_remove = "failed";
                    }
                } else {
                }
            }
        }
        echo json_encode(array($objData->rq => array("error" => $err_remove)));
        break;
    case 'list':
        $dst_dir = $disk_config->dirs[$objData->bm]["path"] . "/" . $objData->dir;
        $dir_list = dir_list($dst_dir);
        $dir_list[] = array('id' => 0, 'name' => '..', 'size' => '-', 'hsize' => '-', 'perm' => '-', 'type' => 'dir', 'type_name' => 'dir_..', 'time' => '-');
        echo json_encode(array($objData->rq => array("files" => $dir_list, "space" => getSpace($disk_config->dirs[$objData->bm]["path"]))));
        break;
    case 'all':
        echo json_encode(array($objData->rq => array("allfiles" => dir_list($disk_config->dirs[$objData->bm]["path"]), "space" => getSpace($disk_config->dirs[$objData->bm]["path"]))));
        break;
    default:
        echo json_encode(array($objData->rq => "N/A"));
        break;
}
Пример #20
0
function unzip_item($dir)
{
    _debug("unzip_item({$dir})");
    global $home_dir;
    // copy and move are only allowed if the user may read and change files
    if (!permissions_grant_all($dir, NULL, array("read", "create"))) {
        show_error($GLOBALS["error_msg"]["accessfunc"]);
    }
    // Vars
    $new_dir = isset($GLOBALS['__POST']["new_dir"]) ? stripslashes($GLOBALS['__POST']["new_dir"]) : $dir;
    $_img = $GLOBALS["baricons"]["unzip"];
    // Get Selected Item
    if (!isset($GLOBALS['__POST']["item"]) && isset($GLOBALS['__GET']["item"])) {
        $s_item = $GLOBALS['__GET']["item"];
    } elseif (isset($GLOBALS['__POST']["item"])) {
        $s_item = $GLOBALS['__POST']["item"];
    }
    $dir_extract = "{$home_dir}/{$new_dir}";
    if ($new_dir != "") {
        $dir_extract .= "/";
    }
    $zip_name = "{$home_dir}/{$dir}/{$s_item}";
    // Get New Location & Names
    if (!isset($GLOBALS['__POST']["confirm"]) || $GLOBALS['__POST']["confirm"] != "true") {
        show_header($GLOBALS["messages"]["actunzipitem"]);
        // JavaScript for Form:
        // Select new target directory / execute action
        ?>
<script language="JavaScript1.2" type="text/javascript">
<!--
	function NewDir(newdir) {
		document.selform.new_dir.value = newdir;
		document.selform.submit();
	}
	
	function Execute() {
		document.selform.confirm.value = "true";
	}
//-->
</script><?php 
        // "Copy / Move from .. to .."
        $s_dir = $dir;
        if (strlen($s_dir) > 40) {
            $s_dir = "..." . substr($s_dir, -37);
        }
        $s_ndir = $new_dir;
        if (strlen($s_ndir) > 40) {
            $s_ndir = "..." . substr($s_ndir, -37);
        }
        echo "<!-- dirextr = " . $dir_extract . " -->\n";
        echo "<!-- zipname = " . $zip_name . " -->\n";
        echo "<CENTER><BR><BR><IMG SRC=\"" . $_img . "\" align=\"ABSMIDDLE\" ALT=\"\">&nbsp;";
        echo "<IMG SRC=\"" . $GLOBALS["baricons"]["unzipto"] . "\" align=\"ABSMIDDLE\" ALT=\"\">\n";
        // Form for Target Directory & New Names
        echo "<BR><BR><FORM name=\"selform\" method=\"post\" action=\"";
        echo make_link("post", $dir, NULL) . "\"><TABLE>\n";
        echo "<INPUT type=\"hidden\" name=\"do_action\" value=\"" . $GLOBALS["action"] . "\">\n";
        echo "<INPUT type=\"hidden\" name=\"confirm\" value=\"false\">\n";
        //echo "<INPUT type=\"hidden\" name=\"dir\" value=\"n\">\n";
        echo "<INPUT type=\"hidden\" name=\"new_dir\" value=\"" . $new_dir . "\">\n";
        // List Directories to select Target
        dir_print(dir_list($new_dir), $new_dir);
        echo "</TABLE><BR><TABLE>\n";
        // Print Text Inputs to change Names
        echo "<TR><TD><IMG SRC=\"" . $GLOBALS["baricons"]["zip"] . "\" align=\"ABSMIDDLE\" ALT=\"\">";
        echo "<INPUT type=\"hidden\" name=\"item\" value=\"" . $s_item . "\">&nbsp;" . $s_item . "&nbsp;";
        // Submit & Cancel
        echo "</TABLE><BR><TABLE><TR>\n<TD>";
        echo "<INPUT type=\"submit\" value=\"";
        echo $GLOBALS["messages"]["btnunzip"];
        echo "\" onclick=\"javascript:Execute();\"></TD>\n<TD>";
        echo "<input type=\"button\" value=\"" . $GLOBALS["messages"]["btncancel"];
        echo "\" onClick=\"javascript:location='" . make_link("list", $dir, NULL);
        echo "';\"></TD>\n</TR></FORM></TABLE><BR><BR><BR>\n";
        return;
    }
    // DO COPY/MOVE
    // ALL OK?
    if (!@file_exists(get_abs_dir($new_dir))) {
        show_error($new_dir . ": " . $GLOBALS["error_msg"]["targetexist"]);
    }
    if (!get_show_item($new_dir, "")) {
        show_error($new_dir . ": " . $GLOBALS["error_msg"]["accesstarget"]);
    }
    if (!down_home(get_abs_dir($new_dir))) {
        show_error($new_dir . ": " . $GLOBALS["error_msg"]["targetabovehome"]);
    }
    // copy / move files
    $err = false;
    /*for($i=0;$i<$cnt;++$i) {
    		$tmp = stripslashes($GLOBALS['__POST']["selitems"][$i]);
    		$new = basename(stripslashes($GLOBALS['__POST']["newitems"][$i]));
    		$abs_item = get_abs_item($dir,$tmp);
    		$abs_new_item = get_abs_item($new_dir,$new);
    		$items[$i] = $tmp;
    	
    		// Check
    		if($new=="") {
    			$error[$i]= $GLOBALS["error_msg"]["miscnoname"];
    			$err=true;	continue;
    		}
    		if(!@file_exists($abs_item)) {
    			$error[$i]= $GLOBALS["error_msg"]["itemexist"];
    			$err=true;	continue;
    		}
    		if(!get_show_item($dir, $tmp)) {
    			$error[$i]= $GLOBALS["error_msg"]["accessitem"];
    			$err=true;	continue;
    		}
    		if(@file_exists($abs_new_item)) {
    			$error[$i]= $GLOBALS["error_msg"]["targetdoesexist"];
    			$err=true;	continue;
    		}
    	*/
    // Copy / Move
    //if($GLOBALS["action"]=="copy") {
    //if($GLOBALS["action"]=="unzip") {
    /*
    	if(@is_link($abs_item) || @is_file($abs_item)) {
    		// check file-exists to avoid error with 0-size files (PHP 4.3.0)
    		$ok=@copy($abs_item,$abs_new_item);	//||@file_exists($abs_new_item);
    	} elseif(@is_dir($abs_item)) {
    		$ok=copy_dir($abs_item,$abs_new_item);
    	}
    */
    //----------------------------------          print_r($GLOBALS);
    _debug("unzip_item(): Extracting {$zip_name} to {$dir_extract}");
    //$dir_extract[0]='/';
    //$dir_extract = '.'. $dir_extract;
    //------------------------------------------------------echo $zip_name.' aa'.$dir_extract.'aa';
    $exx = pathinfo($zip_name, PATHINFO_EXTENSION);
    if ($exx == 'zip') {
        $zip = new ZipArchive();
        $res = $zip->open($zip_name);
        if ($res === TRUE) {
            $zip->extractTo($dir_extract);
            $zip->close();
        } else {
        }
    } else {
        // gz, tar, bz2, ....
        include_once './_lib/archive.php';
        extArchive::extract($zip_name, $dir_extract);
    }
    // FIXME $i is not set anymore.. remove code?
    if (!isset($i)) {
        $i = 0;
    }
    if ($res == false) {
        $error[$i] = $GLOBALS["error_msg"]["unzip"];
        $err = true;
        continue;
    }
    $error[$i] = NULL;
    if ($err) {
        // there were errors
        $err_msg = "";
        for ($i = 0; $i < $cnt; ++$i) {
            if ($error[$i] == NULL) {
                continue;
            }
            $err_msg .= $items[$i] . " : " . $error[$i] . "<BR>\n";
        }
        show_error($err_msg);
    }
    header("Location: " . make_link("list", $dir, NULL));
}
Пример #21
0
 public function recover()
 {
     if ($_GET['do'] == 'delete') {
         foreach ((array) $_POST['files'] as $r) {
             unlink($r);
         }
         $this->success(L('do_ok'));
     } elseif ($_GET['do'] == 'import') {
         header('Content-Type: text/html; charset=UTF-8');
         $filename = $_GET['filename'];
         $filelist = dir_list($this->datadir);
         foreach ((array) $filelist as $r) {
             $file = explode('-', basename($r));
             if ($file[0] == $filename) {
                 $files[] = $r;
             }
         }
         foreach ((array) $files as $file) {
             //读取数据文件
             $sqldata = file_get_contents($file);
             $sqlFormat = sql_split($sqldata, C('DB_PREFIX'));
             foreach ((array) $sqlFormat as $sql) {
                 $sql = trim($sql);
                 if (strstr($sql, 'CREATE TABLE')) {
                     preg_match('/CREATE TABLE `([^ ]*)`/', $sql, $matches);
                     $ret = $this->excuteQuery($sql);
                     //if($ret){echo   L('CREATE_TABLE_OK').$matches[0].' <br />';}else{echo 'Error sql:'.$sql;}exit;
                 } else {
                     $ret = $this->excuteQuery($sql);
                 }
             }
             echo L('CREATE_TABLE_OK') . basename($file) . '<br>';
         }
     } else {
         $filelist = dir_list($this->datadir);
         foreach ((array) $filelist as $r) {
             $filename = explode('-', basename($r));
             $files[] = array('path' => $r, 'file' => basename($r), 'name' => $filename[0], 'size' => filesize($r), 'time' => filemtime($r));
         }
         $this->assign('files', $files);
         $this->display();
     }
 }
Пример #22
0
function unzip_item($dir)
{
    // copy and move are only allowed if the user may read and change files
    /*if ($GLOBALS["action"] == "copy"
    	&& !permissions_grant_all($dir, NULL, array("read", "create")))
    		show_error($GLOBALS["error_msg"]["accessfunc"]);
    	if ($GLOBALS["action"] == "move"
    	&& !permissions_grant($dir, NULL, "change"))
    		show_error($GLOBALS["error_msg"]["accessfunc"]);
    	*/
    if (!permissions_grant_all($dir, NULL, array("read", "create"))) {
        show_error($GLOBALS["error_msg"]["accessfunc"]);
    }
    // Vars
    /*
    $first = $GLOBALS['__POST']["first"];
    if($first=="y") 
    $new_dir=$dir;
    else $new_dir = stripslashes($GLOBALS['__POST']["new_dir"]);
    */
    $new_dir = stripslashes($GLOBALS['__POST']["new_dir"]);
    //if($new_dir==".") $new_dir="";
    //$cnt=count($GLOBALS['__POST']["selitems"]);
    // Copy or Move?
    /*
    if($GLOBALS["action"]!="move") {
    	$_img="_img/__copy.gif";
    } else {
    	$_img="_img/__cut.gif";
    }
    */
    $_img = $GLOBALS["baricons"]["unzip"];
    // Get Selected Item
    if (!isset($GLOBALS['__POST']["item"]) && isset($GLOBALS['__GET']["item"])) {
        $s_item = $GLOBALS['__GET']["item"];
    } elseif (isset($GLOBALS['__POST']["item"])) {
        $s_item = $GLOBALS['__POST']["item"];
    }
    $dir_extract = $GLOBALS["home_dir"] . $new_dir;
    if ($new_dir != "") {
        $dir_extract .= "/";
    }
    $zip_name = $GLOBALS["home_dir"] . $GLOBALS["dir"] . "/" . $s_item;
    // Get New Location & Names
    if (!isset($GLOBALS['__POST']["confirm"]) || $GLOBALS['__POST']["confirm"] != "true") {
        show_header($GLOBALS["messages"]["actunzipitem"]);
        // JavaScript for Form:
        // Select new target directory / execute action
        ?>
    <script language="JavaScript1.2" type="text/javascript">
      <!--
      function NewDir(newdir) {
        document.selform.new_dir.value = newdir;
        document.selform.submit();
      }

      function Execute() {
        document.selform.confirm.value = "true";
      }
      //-->
    </script><?php 
        // "Copy / Move from .. to .."
        $s_dir = $dir;
        if (strlen($s_dir) > 40) {
            $s_dir = "..." . substr($s_dir, -37);
        }
        $s_ndir = $new_dir;
        if (strlen($s_ndir) > 40) {
            $s_ndir = "..." . substr($s_ndir, -37);
        }
        echo "<!-- dirextr = " . $dir_extract . " -->\n";
        echo "<!-- zipname = " . $zip_name . " -->\n";
        //echo "<BR><IMG SRC=\"" . $_img . "\" align=\"ABSMIDDLE\" ALT=\"\">&nbsp;";
        //echo sprintf(($GLOBALS["action"]!="move"?$GLOBALS["messages"]["actcopyfrom"]:
        //	$GLOBALS["messages"]["actmovefrom"]),$s_dir, $s_ndir);
        echo sprintf($GLOBALS["messages"]["actunzipto"], $s_ndir);
        //echo "<IMG SRC=\"" . $GLOBALS["baricons"]["unzipto"] . "\" align=\"ABSMIDDLE\" ALT=\"\">\n";
        // Form for Target Directory & New Names
        echo "<BR><BR><FORM name=\"selform\" method=\"post\" action=\"";
        echo make_link("post", $dir, NULL) . "\"><TABLE>\n";
        echo "<INPUT type=\"hidden\" name=\"do_action\" value=\"" . $GLOBALS["action"] . "\">\n";
        echo "<INPUT type=\"hidden\" name=\"confirm\" value=\"false\">\n";
        //echo "<INPUT type=\"hidden\" name=\"dir\" value=\"n\">\n";
        echo "<INPUT type=\"hidden\" name=\"new_dir\" value=\"" . $new_dir . "\">\n";
        // List Directories to select Target
        dir_print(dir_list($new_dir), $new_dir);
        echo "</TABLE><BR><TABLE>\n";
        // Print Text Inputs to change Names
        /*for($i=0;$i<$cnt;++$i) {
            $selitem=stripslashes($GLOBALS['__POST']["selitems"][$i]);
            if(isset($GLOBALS['__POST']["newitems"][$i])) {
              $newitem=stripslashes($GLOBALS['__POST']["newitems"][$i]);
              if($first=="y") $newitem=$selitem;
            } else {$newitem=$selitem;}
            $s_item=$selitem;	if(strlen($s_item)>50) $s_item=substr($s_item,0,47)."...";
            echo "<TR><TD><IMG SRC=\"".$GLOBALS["baricons"]["info"]."\" align=\"ABSMIDDLE\" ALT=\"\">";
            // Old Name
            echo "<INPUT type=\"hidden\" name=\"selitems[]\" value=\"";
            echo $selitem."\">&nbsp;".$s_item."&nbsp;";
            // New Name
            echo "</TD><TD><INPUT type=\"text\" size=\"25\" name=\"newitems[]\" value=\"";
            echo $newitem."\"></TD></TR>\n";
          }*/
        echo "<TR><TD>";
        //<IMG SRC=\"" . $GLOBALS["baricons"]["zip"] . "\" align=\"ABSMIDDLE\" ALT=\"\">";
        echo "<INPUT type=\"hidden\" name=\"item\" value=\"" . $s_item . "\">&nbsp;" . $s_item . "&nbsp;";
        // Submit & Cancel
        echo "</TABLE><BR><TABLE><TR>\n<TD>";
        if ($new_dir == 'hn') {
            echo "<INPUT type=\"submit\" value=\"Rozbaliť archív\" onclick=\"javascript:Execute();\" style=\"color:#fff;background:#337ab7;display:inline-block;padding:6px 12px;font-size:16px;text-decoration:none;font-weight:400;line-height:1.4;text-align:center;white-space:nowrap;vertical-align:middle;border:1px solid #2e6da4;border-radius:4px;\">";
        }
        echo "</TD>\n<TD>Rovnako bude pomenovaný slug pre vydanie Horezza News. Pre zmenu názvu, je potrebné zmeniť názov ZIP súboru, pred nahraním.<br>";
        echo "<input type=\"button\" value=\"Zrušiť\" onClick=\"javascript:location='" . make_link("list", $dir, NULL);
        echo "';\" style=\"color:#333;background:#fff;display:inline-block;padding:6px 12px;font-size:16px;text-decoration:none;font-weight:400;line-height:1.4;text-align:center;white-space:nowrap;vertical-align:middle;border:1px solid #ccc;border-radius:4px;\"></TD>\n</TR></FORM></TABLE><BR>\n";
        return;
    }
    // DO COPY/MOVE
    // ALL OK?
    if (!@file_exists(get_abs_dir($new_dir))) {
        show_error($new_dir . ": " . $GLOBALS["error_msg"]["targetexist"]);
    }
    if (!get_show_item($new_dir, "")) {
        show_error($new_dir . ": " . $GLOBALS["error_msg"]["accesstarget"]);
    }
    if (!down_home(get_abs_dir($new_dir))) {
        show_error($new_dir . ": " . $GLOBALS["error_msg"]["targetabovehome"]);
    }
    // copy / move files
    $err = false;
    /*for($i=0;$i<$cnt;++$i) {
    		$tmp = stripslashes($GLOBALS['__POST']["selitems"][$i]);
    		$new = basename(stripslashes($GLOBALS['__POST']["newitems"][$i]));
    		$abs_item = get_abs_item($dir,$tmp);
    		$abs_new_item = get_abs_item($new_dir,$new);
    		$items[$i] = $tmp;
    	
    		// Check
    		if($new=="") {
    			$error[$i]= $GLOBALS["error_msg"]["miscnoname"];
    			$err=true;	continue;
    		}
    		if(!@file_exists($abs_item)) {
    			$error[$i]= $GLOBALS["error_msg"]["itemexist"];
    			$err=true;	continue;
    		}
    		if(!get_show_item($dir, $tmp)) {
    			$error[$i]= $GLOBALS["error_msg"]["accessitem"];
    			$err=true;	continue;
    		}
    		if(@file_exists($abs_new_item)) {
    			$error[$i]= $GLOBALS["error_msg"]["targetdoesexist"];
    			$err=true;	continue;
    		}
    	*/
    // Copy / Move
    //if($GLOBALS["action"]=="copy") {
    //if($GLOBALS["action"]=="unzip") {
    /*
    	if(@is_link($abs_item) || @is_file($abs_item)) {
    		// check file-exists to avoid error with 0-size files (PHP 4.3.0)
    		$ok=@copy($abs_item,$abs_new_item);	//||@file_exists($abs_new_item);
    	} elseif(@is_dir($abs_item)) {
    		$ok=copy_dir($abs_item,$abs_new_item);
    	}
    */
    $zip = new ZipArchive();
    //			$zip_name = "../../".$GLOBALS["dir"].$s_item;
    //			$dir_extract = "../../".$new_dir."/";
    $res = $zip->open($zip_name);
    if ($res === TRUE) {
        $zip->extractTo($dir_extract);
        $zip->close();
        //echo �ok�;
    } else {
        // echo �failed�;
    }
    //} //else {
    //	$ok=@rename($abs_item,$abs_new_item);
    //}
    if ($ok === false || $res == false) {
        //$error[$i]=($GLOBALS["action"]=="copy"?
        //	$GLOBALS["error_msg"]["copyitem"]:
        //	$GLOBALS["error_msg"]["moveitem"]
        //);
        $error[$i] = $GLOBALS["error_msg"]["unzip"];
        $err = true;
        continue;
    }
    $error[$i] = NULL;
    //}
    if ($err) {
        // there were errors
        $err_msg = "";
        for ($i = 0; $i < $cnt; ++$i) {
            if ($error[$i] == NULL) {
                continue;
            }
            $err_msg .= $items[$i] . " : " . $error[$i] . "<BR>\n";
        }
        show_error($err_msg);
    }
    miwoftp_redirect(make_link("list", $dir, NULL));
}
Пример #23
0
    $sth = $dbh->query($query);
    // Reminder: This is how to debug MySQL with PDO
    if ($sth === false) {
        print_r($dbh->errorInfo());
    }
    $activity_array = $sth->fetchAll();
    get_activity($activity_array);
    die;
} else {
    $query = "SELECT * FROM directus_activity {$view_errors} ORDER BY `datetime` DESC LIMIT 0, 100 ";
    $sth = $dbh->query($query);
    $activity_array = $sth->fetchAll();
}
//////////////////////////////////////////////////////////////////////////////
// Get Backups
$backups = dir_list('inc/backups/');
rsort($backups, SORT_STRING);
//////////////////////////////////////////////////////////////////////////////
$cms_html_title = "Dashboard";
require_once "inc/header.php";
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
?>

<h2>Dashboard</h2>

<hr class="chubby">

<div class="clearfix" style="position:relative;">	
	<div id="dashboard_modules">
		
		<!--
Пример #24
0
<ul>
<?php 
include "../inc/function.php";
include "../inc/config.php";
session_start();
setcookie(session_name(), session_id(), time() + $sessionTime, "/");
if (isset($_SESSION["role"]) && ($_SESSION["role"] == ADMIN || $_SESSION["role"] == TEACHER)) {
    $father = @isutf8($_GET["dir"]) ? iconv("UTF-8", "gb2312", $_GET["dir"]) : $_GET["dir"];
    $fileArr = dir_list($father);
    foreach ($fileArr as $file) {
        $filename = str_replace($father . "/", "", $file);
        if (is_dir($file)) {
            $file = iconv("gb2312", "UTF-8", $file);
            $filename = iconv("gb2312", "UTF-8", $filename);
            echo "<li><img src='../img/no-expanded.gif' dir='{$file}' onclick='showChildrenDir(\"{$file}\",this)'>" . $filename . "</li>";
        } else {
            $file = iconv("gb2312", "UTF-8", $file);
            $filename = iconv("gb2312", "UTF-8", $filename);
            echo "<li><label><input type='radio' name='indexfile' value='{$file}'>" . $filename . "</label></li>";
        }
    }
} else {
    die("What are you doing?");
}
?>
</ul>
Пример #25
0
function copy_move_items($dir)
{
    // copy/move file/dir
    if (($GLOBALS["permissions"] & 01) != 01) {
        show_error($GLOBALS["error_msg"]["accessfunc"]);
    }
    $action = stripslashes(JRequest::getCmd('action'));
    if ($action == "post") {
        $action = JRequest::getCmd("do_action");
    } elseif (empty($action)) {
        $action = "list";
    }
    // Vars
    $first = $GLOBALS['__POST']["first"];
    if ($first == "y") {
        $new_dir = $dir;
    } else {
        $new_dir = stripslashes($GLOBALS['__POST']["new_dir"]);
    }
    if ($new_dir == ".") {
        $new_dir = "";
    }
    $cnt = count($GLOBALS['__POST']["selitems"]);
    // Copy or Move?
    if ($action != "move") {
        $images = "images/__copy.gif";
    } else {
        $images = "images/__cut.gif";
    }
    // Get New Location & Names
    if (!isset($GLOBALS['__POST']["confirm"]) || $GLOBALS['__POST']["confirm"] != "true") {
        show_header($action != "move" ? $GLOBALS["messages"]["actcopyitems"] : $GLOBALS["messages"]["actmoveitems"]);
        // JavaScript for Form:
        // Select new target directory / execute action
        ?>
<script language="JavaScript1.2" type="text/javascript">
<!--
	function NewDir(newdir) {
		document.selform.new_dir.value = newdir;
		document.selform.submit();
	}

	function Execute() {
		document.selform.confirm.value = "true";
	}
//-->
</script><?php 
        // "Copy / Move from .. to .."
        $s_dir = $dir;
        if (strlen($s_dir) > 40) {
            $s_dir = "..." . substr($s_dir, -37);
        }
        $s_ndir = $new_dir;
        if (strlen($s_ndir) > 40) {
            $s_ndir = "..." . substr($s_ndir, -37);
        }
        echo "<br /><img src=\"" . _QUIXPLORER_URL . '/images/' . $images . "\" align=\"absmiddle\" alt=\"\" />&nbsp;<strong>";
        echo sprintf($action != "move" ? $GLOBALS["messages"]["actcopyfrom"] : $GLOBALS["messages"]["actmovefrom"], $s_dir, $s_ndir);
        echo "</strong><img src=\"" . _QUIXPLORER_URL . "/images/__paste.gif\" align=\"absmiddle\" alt=\"\">\n";
        // Form for Target Directory & New Names
        echo "<br /><br /><form name=\"selform\" method=\"post\" action=\"";
        echo make_link("post", $dir, NULL) . "\"><table style=\"width:500px;\" class=\"adminform\">\n";
        echo "<input type=\"hidden\" name=\"do_action\" value=\"" . $action . "\">\n";
        echo "<input type=\"hidden\" name=\"confirm\" value=\"false\">\n";
        echo "<input type=\"hidden\" name=\"first\" value=\"n\">\n";
        echo "<input type=\"hidden\" name=\"new_dir\" value=\"" . $new_dir . "\">\n";
        // List Directories to select Target
        dir_print(dir_list($new_dir), $new_dir);
        echo "</table><br />\n\t\t<table style=\"width:500px;\" class=\"adminform\">\n";
        // Print Text Inputs to change Names
        for ($i = 0; $i < $cnt; ++$i) {
            $selitem = stripslashes($GLOBALS['__POST']["selitems"][$i]);
            if (isset($GLOBALS['__POST']["newitems"][$i])) {
                $newitem = stripslashes($GLOBALS['__POST']["newitems"][$i]);
                if ($first == "y") {
                    $newitem = $selitem;
                }
            } else {
                $newitem = $selitem;
            }
            $s_item = $selitem;
            if (strlen($s_item) > 50) {
                $s_item = substr($s_item, 0, 47) . "...";
            }
            echo "<tr><td><img src=\"" . _QUIXPLORER_URL . "/images/information.png\" align=\"absmiddle\" alt=\"\">";
            // old name
            echo "<input type=\"hidden\" name=\"selitems[]\" value=\"";
            echo $selitem . "\">&nbsp;" . $s_item . "&nbsp;";
            // New Name
            echo "</td><td><input type=\"text\" size=\"25\" name=\"newitems[]\" value=\"";
            echo $newitem . "\"></td></tr>\n";
        }
        // Submit & Cancel
        echo "</table><br /><table><tr>\n<td>";
        echo "<input type=\"submit\" value=\"";
        echo $action != "move" ? $GLOBALS["messages"]["btncopy"] : $GLOBALS["messages"]["btnmove"];
        echo "\" onclick=\"javascript:Execute();\"></td>\n<td>";
        echo "<input type=\"button\" value=\"" . $GLOBALS["messages"]["btncancel"];
        echo "\" onclick=\"javascript:location='" . make_link("list", $dir, NULL);
        echo "';\"></td>\n</tr></table><br /></form>\n";
        return;
    }
    // DO COPY/MOVE
    // ALL OK?
    if (!@$GLOBALS['nx_File']->file_exists(get_abs_dir($new_dir))) {
        show_error(get_abs_dir($new_dir) . ": " . $GLOBALS["error_msg"]["targetexist"]);
    }
    if (!get_show_item($new_dir, "")) {
        show_error($new_dir . ": " . $GLOBALS["error_msg"]["accesstarget"]);
    }
    if (!down_home(get_abs_dir($new_dir))) {
        show_error($new_dir . ": " . $GLOBALS["error_msg"]["targetabovehome"]);
    }
    // copy / move files
    $err = false;
    for ($i = 0; $i < $cnt; ++$i) {
        $tmp = stripslashes($GLOBALS['__POST']["selitems"][$i]);
        $new = basename(stripslashes($GLOBALS['__POST']["newitems"][$i]));
        if (nx_isFTPMode()) {
            $abs_item = get_item_info($dir, $tmp);
            $abs_new_item = get_item_info('/' . $new_dir, $new);
        } else {
            $abs_item = get_abs_item($dir, $tmp);
            $abs_new_item = get_abs_item($new_dir, $new);
        }
        $items[$i] = $tmp;
        // Check
        if ($new == "") {
            $error[$i] = $GLOBALS["error_msg"]["miscnoname"];
            $err = true;
            continue;
        }
        if (!@$GLOBALS['nx_File']->file_exists($abs_item)) {
            $error[$i] = $GLOBALS["error_msg"]["itemexist"];
            $err = true;
            continue;
        }
        if (!get_show_item($dir, $tmp)) {
            $error[$i] = $GLOBALS["error_msg"]["accessitem"];
            $err = true;
            continue;
        }
        if (@$GLOBALS['nx_File']->file_exists($abs_new_item)) {
            $error[$i] = $GLOBALS["error_msg"]["targetdoesexist"];
            $err = true;
            continue;
        }
        // Copy / Move
        if ($action == "copy") {
            if (@is_link($abs_item) || get_is_file($abs_item)) {
                // check file-exists to avoid error with 0-size files (PHP 4.3.0)
                if (nx_isFTPMode()) {
                    $abs_item = '/' . $dir . '/' . $abs_item['name'];
                }
                $ok = @$GLOBALS['nx_File']->copy($abs_item, $abs_new_item);
                //||@file_exists($abs_new_item);
            } elseif (@get_is_dir($abs_item)) {
                $dir = nx_isFTPMode() ? '/' . $dir . '/' . $abs_item['name'] . '/' : $abs_item;
                if (nx_isFTPMode()) {
                    $abs_new_item .= '/';
                }
                $ok = $GLOBALS['nx_File']->copy_dir($dir, $abs_new_item);
            }
        } else {
            $ok = $GLOBALS['nx_File']->rename($abs_item, $abs_new_item);
        }
        if ($ok === false || PEAR::isError($ok)) {
            $error[$i] = $action == "copy" ? $GLOBALS["error_msg"]["copyitem"] : $GLOBALS["error_msg"]["moveitem"];
            if (PEAR::isError($ok)) {
                $error[$i] .= ' [' . $ok->getMessage() . ']';
            }
            $err = true;
            continue;
        }
        $error[$i] = NULL;
    }
    if ($err) {
        // there were errors
        $err_msg = "";
        for ($i = 0; $i < $cnt; ++$i) {
            if ($error[$i] == NULL) {
                continue;
            }
            $err_msg .= $items[$i] . " : " . $error[$i] . "<br />\n";
        }
        show_error($err_msg);
    }
    header("Location: " . make_link("list", $dir, NULL));
}
 public function index()
 {
     $v = explode(' ', VERSION);
     $menuid = intval($_REQUEST['menuid']);
     $var = $v[0];
     $upgrade_path = $this->_url . $var . '/patch/';
     $upgrade_path_str = @file_get_contents($upgrade_path);
     $allpatch = json_decode($upgrade_path_str);
     $patchlist = $patchlists = array();
     $key = -1;
     foreach ($allpatch as $k => $v) {
         if (strstr($v, 'patch_' . UPDATETIME)) {
             $key = $k;
             break;
         }
     }
     $key = $key < 0 ? '999' : $key;
     foreach ($allpatch as $k => $v) {
         if ($k >= $key) {
             $patchlist[$k]['file'] = $v;
             $time = explode('_', $v);
             $patchlist[$k]['oldtime'] = $time[1];
             $time = explode('.', $time[2]);
             $patchlist[$k]['filemtime'] = $time[0];
         }
     }
     if (!empty($_GET['do'])) {
         $cover = intval($_REQUEST['cover']);
         import("@.ORG.Http");
         import("@.ORG.Phpzip");
         foreach ($patchlist as $k => $v) {
             //远程压缩包地址
             $upgradezip_url = $upgrade_path . $v['file'];
             //保存到临时文件夹
             $upgradezip_file = TEMP_PATH . $v['file'];
             //解压路径
             $upgradezip_source_path = TEMP_PATH . basename($v['file'], ".zip");
             //备份路径
             $backupdir = TEMP_PATH . 'bakup_' . $v['oldtime'];
             dir_create($backupdir);
             //开始下载并解压
             Http::curldownload($upgradezip_url, $upgradezip_file);
             Phpzip::unZip($upgradezip_file, $upgradezip_source_path);
             //先做备份
             $backupfilelist = dir_list($upgradezip_source_path);
             foreach ((array) $backupfilelist as $k => $file) {
                 $fromfile = str_replace($upgradezip_source_path, './', $file);
                 $tofile = $backupdir . str_replace($upgradezip_source_path, '', $file);
                 if (is_dir($fromfile)) {
                     mkdir($tofile);
                 } elseif (is_file($fromfile)) {
                     copy($fromfile, $tofile);
                 }
             }
             $this->copyfileerror = 0;
             //复制并加判断是否成功
             $this->copydir($upgradezip_source_path, './', $cover);
             //如果失败,恢复当前版本
             if ($this->copyfileerror) {
                 $this->copydir($backupdir, './', $cover);
                 die(L('upgrade_error'));
             } else {
                 if (file_exists($upgradezip_source_path . '/yourphp.sql')) {
                     $sqldata = file_get_contents($upgradezip_source_path . '/yourphp.sql');
                     $sqlFormat = sql_split($sqldata, C('DB_PREFIX'));
                     foreach ((array) $sqlFormat as $sql) {
                         $sql = trim($sql);
                         if (strstr($sql, 'CREATE TABLE')) {
                             preg_match('/CREATE TABLE `([^ ]*)`/', $sql, $matches);
                             $ret = $this->excuteQuery($sql);
                             //if($ret){echo   L('CREATE_TABLE_OK').$matches[0].' <br />';}else{echo 'Error sql:'.$sql;}exit;
                         } else {
                             $ret = $this->excuteQuery($sql);
                         }
                     }
                 }
                 if (file_exists($upgradezip_source_path . '/upgrade.php')) {
                     include $upgradezip_source_path . '/upgrade.php';
                 }
                 dir_delete($upgradezip_source_path);
                 @unlink('./upgrade.php');
                 @unlink('./yourphp.sql');
                 @unlink($upgradezip_file);
             }
         }
         $this->assign('jumpUrl', U(MODULE_NAME . '/checkfile?menuid=' . $menuid));
         $this->success(L('upgrade_ok'));
         exit;
     }
     $this->assign('menuid', $menuid);
     $this->assign('var', $var);
     $this->assign('patchlist', $patchlist);
     $this->display();
 }
Пример #27
0
                     

 <?php 
    while (list($key, $value) = each($files)) {
        $f++;
        echo "<tbody><tr>\n    \n    <td><strong>{$value}</strong></td>\n    \n    <td><a href=\"{$directory}{$value}\">Download csv<img src='immagini/icone/download.png' width='20'></a></td>\n    \n    </tr></tbody>";
    }
    if (!$d) {
        $d = "0";
    }
    if (!$f) {
        $f = "0";
    }
    echo "<br><div class='alert alert-info' role='alert'>Sono presenti <strong>{$f}</strong> Report di analisi.</strong></div><br>";
}
dir_list("report/");
?>


</table>

  </div>                    
                        
 </div>

                </div>

                <div class="row">

                  
                </div>
Пример #28
0
 function dir_list($path, $exts = '', $list = array())
 {
     $path = dir_path($path);
     $files = glob($path . '*');
     foreach ($files as $v) {
         if (!$exts || pathinfo($v, PATHINFO_EXTENSION) == $exts) {
             $list[] = $v;
             if (is_dir($v)) {
                 $list = dir_list($v, $exts, $list);
             }
         }
     }
     return $list;
 }
Пример #29
0
<?php

/**
 * Spic <https://github.com/ricain/spic>
 * @author Jean Mercadier <jmercadier.fr>
 * @license The MIT License
 */
require_once __DIR__ . "/../lib/dir.lib.php";
require_once __DIR__ . "/../lib/conf.lib.php";
require_once __DIR__ . "/../lib/util.lib.php";
util_define_timezone();
$pics = dir_list();
$url = conf_read("url");
$prefix = conf_read("prefix");
$suffix = conf_read("suffix");
$space = conf_read("allowspace") ? "true" : "false";
$name = conf_read("brandname");
$name = util_empty($name) ? "Spic" : $name;
?>
<!--
- Spic <https://github.com/ricain/spic>
- @author Jean Mercadier <jmercadier.fr>
- @license The MIT License
-->
<!DOCTYPE html>
<html>
<head>
	<title><?php 
echo $name;
?>
</title>
Пример #30
0
			<form action="uploadSingleFile.php" method="post" enctype="multipart/form-data" onsubmit="return checkFile()">
				请选择文件:<input type="file" name="file" id="file" onchange="checkZip()">
				<button type="submit">上传</button>
				<input type="hidden" name="dir" value="<?php 
echo $dir;
?>
">		
			</form>
			<button style="float:right;margin-top:-30px;" onclick="createDir('<?php 
echo $dir;
?>
');">创建文件夹</button>
			<div class="wrap">
				<ul>
				<?php 
$dirArr = dir_list($dir);
echo "<li><a href='?dir=" . substr($dir, 0, strrpos(substr($dir, 0, -1), "/")) . "'><img src='../img/back.gif'>父级目录</a></li>";
for ($i = 0; $i < count($dirArr); $i++) {
    if (is_dir($dirArr[$i])) {
        echo "<li><a href='?dir=" . iconv("gb2312", "utf-8", $dirArr[$i]) . "/'><img src='../img/folder.gif'>" . iconv("gb2312", "utf-8", str_replace($dir . "/", "", $dirArr[$i])) . "</a></li>";
    } else {
        echo "<li><img src='../img/text.gif'>" . iconv("gb2312", "utf-8", str_replace($dir . "/", "", $dirArr[$i])) . "</li>";
    }
}
?>
				</ul>
			</div>
		</div>
	</div>
</div> <div class="clear">&nbsp;</div> <!-- 'clearing' div to make sure that footer stays below the main and right column sections -->
</div> <!-- end of #main" started at the end of banner.inc.php -->