Пример #1
0
function load_templates($tpl_array = null)
{
    global $replacement;
    $k = array_keys($replacement);
    $r = array_values($replacement);
    $path = THEME_PATH . '/templates/';
    if (empty($tpl_array)) {
        $tpl_array = _glob($path, $pattern = 'html');
    }
    foreach ($tpl_array as $key => $tpl) {
        $tpl = _basename($tpl);
        $tpl_name = substr($tpl, 0, strlen($tpl) - 5);
        $templates[$tpl_name] = str_replace($k, $r, file_get_contents($path . $tpl));
    }
    return $templates;
}
Пример #2
0
    # Add move dialogbox to the page
    $array = array('#LIST_FILES_SELECT' => $select_folder, '#TOKEN' => returnToken());
    echo template('move_lightbox', $array);
}
if ($mode == 'links') {
    # Add lock dialogbox to the page
    $array = array('#TOKEN' => returnToken());
    echo template('password_lightbox', $array);
}
$save = false;
if (count($liste) > 0) {
    $files = array_flip($ids);
    $folderlist = '';
    $filelist = '';
    foreach ($liste as $fichier) {
        $nom = _basename($fichier);
        $length_upload_path = strlen($_SESSION['upload_root_path'] . $_SESSION['upload_user_path']);
        $nom_racine = substr($fichier, $length_upload_path);
        if ($nom != 'index.html' && empty($files[$fichier]) && empty($files[$nom_racine])) {
            // generates the file ID if not present
            $id = uniqid(true);
            $ids[$id] = $fichier;
            $files[$fichier] = $id;
            $save = true;
        }
        if ($nom != 'index.html') {
            $taille = round(filesize($fichier) / 1024, 2);
            if (!empty($files[$fichier])) {
                $id = $files[$fichier];
            } else {
                $id = $files[$nom_racine];
Пример #3
0
//时区
date_default_timezone_set("Asia/Shanghai");
//字符处理编码
mb_internal_encoding("UTF-8");
//默认页面头标识
header('Content-Type: text/html; charset=UTF-8');
header('HTTP/1.1 200 OK');
header("status: 200 OK");
define('YYUC_VERSION', '3.0');
//define('YYUC_VPDDOM', 'OKDES');
function _basename($path)
{
    return preg_replace('/^.+[\\\\\\/]/', '', $path);
}
//对于虚拟机的情况下寻找网站根目录
define('YYUC_PUB', _basename(dirname(YYUC_LOCAL_PATH)));
//设置错误日志输出
function myErrorHandler($errno, $errstr, $errfile, $errline)
{
    if (!class_exists('Log')) {
        require YYUC_LIB . 'sys/log.php';
    }
    $err_msg = "信息:{$errno}。内容:{$errstr},发生在文件{$errfile}的{$errline}行";
    switch ($errno) {
        case E_USER_ERROR:
            Log::error($err_msg);
            if (Conf::$is_developing) {
                echo $err_msg;
            }
            exit(1);
            break;
Пример #4
0
                foreach ($tree as $branch) {
                    $id_tree[file2id($branch)] = $branch;
                }
                # burn access ?
                burned($id);
                exit(json_encode($id_tree));
            }
            # RSS format of a shared folder (but not for a locked one)
            if (isset($_GET['rss']) && !empty($tree) && strlen($id) <= 23) {
                $rss = array('infos' => '', 'items' => '');
                $rss['infos'] = array('title' => _basename($f), 'description' => e('Rss feed of ', false) . _basename($f), 'link' => htmlentities($_SESSION['home'] . '?f=' . $id . '&rss'));
                include 'core/Array2feed.php';
                $upload_path_size = strlen($_SESSION['upload_root_path']);
                foreach ($tree as $branch) {
                    $id_branch = file2id($branch);
                    $rss['items'][] = array('title' => _basename($branch), 'description' => '', 'pubDate' => makeRSSdate(date("d-m-Y H:i:s.", filemtime($branch))), 'link' => $_SESSION['home'] . '?f=' . $id_branch, 'guid' => $_SESSION['home'] . '?f=' . $id_branch);
                }
                array2feed($rss);
                # burn access ?
                burned($id);
                exit;
            }
        }
    }
} else {
    require THEME_PATH . '/header.php';
    echo '<div class="link_error">
				<br/>
				' . e('This link is no longer available, sorry.', false) . '
				<br/>
			</div>';
Пример #5
0
 }
 if ($file[0] == '/') {
     $file = substr($file, 1);
 }
 $file_with_path = $_SESSION['upload_root_path'] . $_SESSION['upload_user_path'] . $file;
 $destination = $_SESSION['upload_root_path'] . $_SESSION['upload_user_path'] . $destination;
 if (check_path($file) && check_path($destination)) {
     if (is_file($file_with_path)) {
         $file = $file_with_path;
     }
     $file = $file_with_path;
     $file = stripslashes($file);
     $destination_temp = addslash_if_needed($destination) . _basename($file);
     # if file/folder exists in destination folder, change name
     if (is_file($destination_temp) || is_dir($destination_temp)) {
         $destination_temp = addslash_if_needed($destination) . rename_item(_basename($file), $destination);
     }
     $destination = $destination_temp;
     if (!is_dir(dirname('thumbs/' . $destination))) {
         mkdir(dirname('thumbs/' . $destination), 0744, true);
     }
     @rename(get_thumbs_name($file_with_path), get_thumbs_name($destination));
     if (is_file($file_with_path)) {
         # change path in id
         $id = file2id($file_with_path);
         $ids = unstore();
         $ids[$id] = $destination;
         store($ids);
         rename($file_with_path, $destination);
         $tree = rename_branch($destination, $file_with_path, $id, $_SESSION['login'], $tree);
     } elseif (is_dir($file_with_path)) {
Пример #6
0
</li>
			<li class="btn" data-target=".result_tab" id="see"><span class="icon-eye"></span> <?php 
e('See');
?>
</li>
			<li class="btn" data-target=".help_tab"><span class="icon-help-circled"></span> <?php 
e('Help');
?>
</li>
		</ul>
		<div class="dialog"><figure><figcaption>
			
		    <div class="editor_tab">
				<input type="text" class="npt" name="editor_filename" class="npt" value="<?php 
if (isset($file)) {
    echo _basename($file);
}
?>
" required placeholder="<?php 
e('Filename');
?>
"/>
			    <textarea name="editor_content" id="raw" class="npt"><?php 
if (isset($editor_content)) {
    echo $editor_content;
}
?>
</textarea>
			    <input type="submit" class="btn" value="<?php 
e('Save');
?>
Пример #7
0
function chrono($name = 'chrono', $delete = false)
{
    if ($delete) {
        @unlink('debug.html');
    }
    global $debug_mode;
    if (!$debug_mode) {
        return false;
    }
    if (!isset($_SESSION[$name])) {
        $_SESSION[$name] = microtime(true);
    } else {
        $count = round(microtime(true) - $_SESSION[$name], 2);
        if ($count < 1) {
            $color = 'lightgreen';
            $color2 = 'black';
        }
        if ($count > 1 && $count <= 2) {
            $color = 'yellow';
            $color2 = 'maroon';
        }
        if ($count > 2 && $count <= 5) {
            $color = 'orange';
            $color2 = 'maroon';
        }
        if ($count > 5) {
            $color = 'red';
            $color2 = 'pink';
        }
        $debug = '<li> ' . date('h:i:s') . ' ' . $name . ':<em style="padding:5px;font-size:1.3em; color:' . $color2 . ';background-color:' . $color . '">' . $count . 'sec</em> <ul style="margin-left:30px;">';
        unset($_SESSION[$name]);
        $dat = debug_backtrace();
        foreach (array_reverse($dat) as $data) {
            $dir = dirname($data['file']) . '/';
            $fil = _basename($data['file']);
            $debug .= '<li><em style="color:black;font-weight:bold">' . $fil . '</em> <em style="color:red;font-weight:bold">' . $data['function'] . '()</em> l.<em style="color:blue;font-weight:bold">' . $data['line'] . '</em> </li>';
        }
        $debug .= '</ul></li>';
        debug_log($debug);
        unset($_SESSION[$name]);
    }
}
Пример #8
0
echo str_replace('#TOKEN', $lb_token, $templates['dialog_qrcode']);
echo str_replace('#TOKEN', $lb_token, $templates['dialog_share']);
if ($mode == 'links') {
    # Add lock dialogbox to the page
    $array = array('#TOKEN' => TOKEN);
    echo template('dialog_password', $array);
}
if ($mode == 'view') {
    # Add shares from others users
    $shared_with = load_folder_share();
    if (!empty($shared_with[$_SESSION['login']])) {
        $shared_folders .= '<div class="shared_folders">';
        $saveshare = false;
        foreach ($shared_with[$_SESSION['login']] as $id => $data) {
            if (is_dir($data['folder']) && !empty($ids[$id])) {
                $folder = _basename($data['folder']);
                $array = array('#CLASS' => 'shared_folder', '#ID' => $id, '#FICHIER' => $folder, '#TOKEN' => TOKEN, '#NAME' => $folder, '#FROM' => $data['from']);
                $shared_folders .= template($mode . '_shared_folder_' . $layout, $array);
            } else {
                # remove obsolete shared IDs
                unset($shared_with[$_SESSION['login']][$id]);
                $saveshare = true;
            }
        }
        $shared_folders .= '</div>';
        save_folder_share($shared_with);
    }
    # Prepare folder tree for move dialog box
    $select_folder = '<select name="destination" class="folder_list button"><option value="">' . e('Choose a folder', false) . '</option>';
    $folders_list = user_folder_tree();
    if (isset($folders_list[0])) {
Пример #9
0
    }
    array2feed($rss);
    exit;
}
# ask for json format stats
if (isset($_GET['statjson']) && !empty($_GET['key']) && hash_user($_GET['key'])) {
    $stats = load($_SESSION['stats_file']);
    exit(json_encode($stats));
}
# zip and download a folder from visitor's share page
if (!empty($_GET['zipfolder']) && $_SESSION['zip']) {
    $folder = id2file($_GET['zipfolder']);
    if (!is_dir($_SESSION['temp_folder'])) {
        mkdir($_SESSION['temp_folder']);
    }
    $zipfile = $_SESSION['temp_folder'] . return_owner($_GET['zipfolder']) . '-' . _basename($folder) . '.zip';
    zip($folder, $zipfile);
    header('location: ' . $zipfile);
    exit;
}
if (is_user_connected()) {
    # users list request
    if (isset($_GET['users_list']) && is_allowed('user page')) {
        $_GET['p'] = 'users';
        unset($_GET['users_list']);
        # To avoid useless changes in auto_restrict
    }
    # if user is connected, use auto_restrict
    require_once 'core/auto_restrict.php';
    $token = returnToken();
    # complete list files ajax request button «load more»