示例#1
0
<?php

// Master Autoindex
// ionutvmi@gmail.com
// Sep 2012
// master-land.net
include "inc/init.php";
$plugins->run_hook("usr_set_top");
$links[] = mai_img("arr.gif") . " {$lang->settings} ";
if ($_POST['items']) {
    $_SESSION['perp'] = (int) $_POST['items'];
    $form .= "<div class='green'>{$lang->saved} </div>";
}
$form .= "<form action='?' method='post'>\n\n\t{$lang->elements_per_page}: \n\t<select name='items'>";
$items = range(5, 50, 5);
foreach ($items as $item) {
    if ($_SESSION['perp'] == $item) {
        $form .= "<option value='{$item}' selected='1'>{$item}</option>";
    } else {
        $form .= "<option value='{$item}'>{$item}</option>";
    }
}
$form .= "\t</select>\n\n\n<br/>\n<input type='submit' value='{$lang->save}'>\n</form>";
include "header.php";
$tpl->grab("usr_set.tpl", "usr_set");
$tpl->assign("form", $form);
$tpl->display();
$plugins->run_hook("usr_set_end");
include "footer.php";
<?php

// Master Autoindex
// ionutvmi@gmail.com
// Last Edit: May 2013
// master-land.net
ob_start();
include "../inc/init.php";
$plugins->run_hook("plugin_manager_top");
if (!is_admin()) {
    ob_end_clean();
    header("Location: {$set->url}");
    exit;
}
$links[] = mai_img("arr.gif") . " <a href='index.php'>{$lang->admincp} </a>";
$links[] = mai_img("arr.gif") . " {$lang->plugin_manager}";
$plugins->load(true);
// we don't run plugins here
$act = $_GET['act'];
$page = (int) $_GET['page'] == 0 ? 1 : (int) $_GET['page'];
// activate
if ($act == 'activate') {
    $plug = $_GET['plugin'];
    $active_plugins = unserialize($set->sinfo->active_plugins);
    if (!is_array($active_plugins)) {
        $active_plugins = array();
    }
    $active_plugins[] = $plug;
    $db->query("UPDATE `" . MAI_PREFIX . "settings` SET `active_plugins` = '" . serialize(array_unique($active_plugins)) . "'");
    if (is_callable($plug . "_activate")) {
        call_user_func($plug . "_activate");
示例#3
0
<?php

// Master Autoindex
// ionutvmi@gmail.com
// Sep 2012
// master-land.net
include "../inc/init.php";
include "../lib/Snoopy.class.php";
$plugins->run_hook("admin_import_form_top");
if (!is_admin()) {
    header("Location: {$set->url}");
    exit;
}
$links[] = mai_img("arr.gif") . " <a href='index.php'>{$lang->admincp} </a>";
$links[] = mai_img("arr.gif") . " {$lang->import_files} ";
$message = '';
$all_folders = $db->select("SELECT `path` FROM `" . MAI_PREFIX . "files` WHERE `size` = '0'");
foreach ($all_folders as $folder) {
    $folder = substr($folder->path, 6);
    // remove /files
    $path_opt .= "<option value='{$folder}'>{$folder}</option>";
}
if ($_POST) {
    $path = "../files" . $_POST['path'];
    $i = 0;
    foreach ($_POST['f'] as $f) {
        if (trim($_POST['n'][$i]) == '') {
            $_name = preg_match("~(.*)\\.(\\w)~i", basename($f)) ? basename($f) : "file_{$i}.dat";
        } else {
            $_name = preg_match("~(.*)\\.(\\w)~i", basename($_POST['n'][$i])) ? basename($_POST['n'][$i]) : "file_{$i}.dat";
        }
示例#4
0
include "../inc/init.php";
$plugins->run_hook("tpl_editor_top");
if (!is_admin()) {
    ob_end_clean();
    header("Location: {$set->url}");
    exit;
}
$links[] = mai_img("arr.gif") . " <a href='index.php'>{$lang->admincp} </a>";
$links[] = mai_img("arr.gif") . " <a href='?'>{$lang->tpl_editor}</a>";
$act = $_GET['act'];
if ($act == 'edit') {
    $file = MAI_ROOT . "/" . MAI_TPL . "/" . $_GET['f'];
    if (!file_exists($file)) {
        die("File does not exists !");
    }
    $links[] = mai_img("arr.gif") . " <a href='?act=edit&f=" . urlencode(basename($file)) . "'>" . basename($file) . "</a>";
    if ($_POST) {
        if (file_put_contents($file, $_POST['data'])) {
            $content .= "<div class='green'>{$lang->saved}</div>";
        } else {
            $content .= "<div class='red'>{$lang->error}</div>";
        }
    }
    $content .= "<div class='content'>\n        <form action='#' method='post'>\n            <textarea name='data'>" . htmlentities(file_get_contents($file)) . "</textarea><br/>\n            <input type='submit' name='ok' value='{$lang->save}'>\n        </form>\n    </div>";
} else {
    $files = glob(MAI_ROOT . "/" . MAI_TPL . "*.tpl");
    if ($files) {
        foreach ($files as $file) {
            $content .= "<div class='content" . (++$i % 2 == 0 ? "2" : "") . "'>&#187; <a href='?act=edit&f=" . urldecode(basename($file)) . "'>" . basename($file) . "</a> " . convert(filesize($file)) . "</div>";
        }
    }
示例#5
0
// template object
$tpl = new Tpl();
// version
$set->version = '1.0.6 BETA';
// db connection
$db = new dbConn($set->db_host, $set->db_user, $set->db_pass, $set->db_name);
$set->sinfo = $db->get_row("SELECT * FROM `" . MAI_PREFIX . "settings`");
if (!$set->sinfo) {
    header("Location: install.php");
    exit;
}
// check if we have any cookie saved
if ($_COOKIE['pass'] == $set->sinfo->admin_pass) {
    $_SESSION['adminpass'] = $set->sinfo->admin_pass;
}
// get the settings for plugins
if (!is_array(unserialize($set->sinfo->active_plugins))) {
    $set->sinfo->active_plugins = serialize(array());
}
$_PS = $db->select("SELECT `name`,`value` FROM `" . MAI_PREFIX . "plugins_settings`");
if ($_PS) {
    foreach ($_PS as $__PS) {
        $set->plugins[$__PS->name] = $__PS->value;
    }
}
// plugins object
$plugins = new Plugins();
$plugins->load();
$links[] = mai_img("arr.gif") . "&nbsp;<a href='{$set->url}'>{$lang->Home}</a>";
$plugins->run_hook("init");
remove_magic_quotes();
示例#6
0
    }
    $request_new = "(" . $db->count("SELECT `id` FROM `" . MAI_PREFIX . "request` WHERE `reply`=''") . ")";
    include "../header.php";
    $tpl->grab('admin_options.tpl', 'admin_options');
    $tpl->assign('password', $lang->password);
    $tpl->assign('url', $set->url);
    $tpl->assign('import_files', $lang->import_files);
    $tpl->assign('settings', $lang->settings);
    $tpl->assign('update_av', $update_av);
    $tpl->assign('login', $lang->login);
    $tpl->assign('request', $lang->request);
    $tpl->assign('request_new', $request_new);
    $tpl->assign('file_manager', $lang->file_manager);
    $tpl->assign('plugin_manager', $lang->plugin_manager);
    $tpl->assign('tpl_editor', $lang->tpl_editor);
    $tpl->assign('plugins_market', $lang->plugins_market);
    $tpl->assign('upload_files', $lang->upload_files);
    $tpl->assign('mark', mai_img('arr.gif'));
    $tpl->assign('version', $set->version);
} else {
    $token = $_SESSION['token'] = md5(rand());
    include "../header.php";
    $tpl->grab('admin_pass.tpl', 'admin_pass');
    $tpl->assign('password', $lang->password);
    $tpl->assign('token', $token);
    $tpl->assign('login', $lang->login);
    $tpl->assign('remember', $lang->remember);
}
$tpl->display();
$plugins->run_hook("admin_end");
include "../footer.php";
示例#7
0
    }
}
if ($file->icon != '') {
    $icon = "/thumb.php?ext&w=128&src=" . urlencode($file->icon);
}
$plugins->run_hook("file_mid");
$show_icon = "<img src='{$set->url}" . $icon . "' width='128'>";
$download = "<a href='?download'><div class='download'> {$lang->download} {$ext->extension} </div></a>";
if ($ext->extension == 'jar') {
    $download .= "<a href='?download&jad'><div class='download'> {$lang->download} JAD</div></a>";
}
foreach (explode('/', substr($file->path, 7)) as $dr) {
    if (trim($dr != "")) {
        $_dr .= "/" . $dr;
        $id = $db->get_row("SELECT `id`,`name` FROM `" . MAI_PREFIX . "files` WHERE `path` = '/files" . $db->escape($_dr) . "'");
        $links[] = mai_img("arr.gif") . "&nbsp;<a href='{$set->url}/data/" . ($file->id == $id->id ? "file/" : "") . $id->id . "/" . mai_converturl($id->name) . ".html'>{$id->name}</a>";
    }
}
if (is_admin()) {
    $_admin = "<div class='content'><a href='{$set->url}/admincp/actions.php?act=edit&id={$file->id}'>{$lang->edit}</a> |\n\t\t<a href='{$set->url}/admincp/actions.php?act=delete&id={$file->id}'>{$lang->delete}</a></div>";
}
include "header.php";
$tpl->grab("file.tpl", 'file');
$tpl->assign('name', $name);
$tpl->assign('description', $description);
$tpl->assign('size', $size);
$tpl->assign('dloads', $dloads);
$tpl->assign('views', $views);
$tpl->assign('show_icon', $show_icon);
$tpl->assign('time', $time);
$tpl->assign('download', $download);
<?php

// Master Autoindex
// ionutvmi@gmail.com
// master-land.net
// for now a good old fashon grabber needs to be improved but time....
include "../inc/init.php";
$plugins->run_hook("plugin_market_top");
if (!is_admin()) {
    ob_end_clean();
    header("Location: {$set->url}");
    exit;
}
$links[] = mai_img("arr.gif") . " <a href='index.php'>{$lang->admincp} </a>";
$links[] = mai_img("arr.gif") . " <a href='?'>{$lang->plugins_market}</a>";
$act = $_GET['act'];
if ($act == 'install' && ($p_name = trim($_GET['p']))) {
    $tmp_name = "plugin" . rand() . ".zip";
    if (copy("http://master-land.net/autoindex/lib/" . $p_name, $tmp_name)) {
        $zip = new ZipArchive();
        // this algorithm should work fine but some extra testing is required
        // you can contribute on github.com/ionutvmi
        if ($zip->open($tmp_name) === true) {
            for ($i = 0; $i < $zip->numFiles; $i++) {
                // we try (and hopefully succeed) to put the files in the correct folders
                $filename = $zip->getNameIndex($i);
                $new_name = $filename;
                if (strpos($filename, "autoindex/") === 0) {
                    $new_name = str_ireplace("autoindex/", "", $filename);
                }
                if (trim($new_name) == '') {
示例#9
0
    }
}
//delete
if ($_GET['act'] == 'delete') {
    $file = $db->get_row("SELECT * FROM `" . MAI_PREFIX . "files` WHERE `id`='{$fid}'");
    if (!$file) {
        header("Location: {$set->url}");
        exit;
    }
    $plugins->run_hook("admin_actions_delete_top");
    if ($file->size > 0) {
        $links[] = mai_img("arr.gif") . " <a href='{$set->url}/data/file/{$file->id}/" . mai_converturl($file->name) . ".html'>{$file->name} </a>";
    } else {
        $links[] = mai_img("arr.gif") . " <a href='{$set->url}/data/{$file->id}/" . mai_converturl($file->name) . ".html'>{$file->name} </a>";
    }
    $links[] = mai_img("arr.gif") . " {$lang->delete} ";
    if ($_POST['yes']) {
        if (is_dir(".." . $file->path)) {
            deleteAll(".." . $file->path);
            $db->query("DELETE FROM `" . MAI_PREFIX . "files` WHERE `path` LIKE '{$file->path}%'");
            $plugins->run_hook("admin_actions_delete_a");
        } else {
            @unlink(".." . $file->path);
            $db->query("DELETE FROM `" . MAI_PREFIX . "files` WHERE `id`='{$file->id}'");
            $plugins->run_hook("admin_actions_delete_b");
        }
        $form = "<div class='green'>{$lang->data_gone}</div>";
    } else {
        $form .= "<form action='#' method='post'>\n\t\t{$lang->are_you_sure} <br/>\n\t\t\t<input type='submit' name='yes' value='{$lang->yes}'> <a href='{$set->url}'> {$lang->no} </a>\n\t\t</form>";
    }
    $plugins->run_hook("admin_actions_delete_end");
示例#10
0
<?php

// Master Autoindex
// ionutvmi@gmail.com
// Sep 2012
// master-land.net
include "inc/init.php";
$links[] = mai_img("arr.gif") . " {$lang->TOS}";
include "header.php";
echo "<div class='title'>{$lang->terms_of_service}</div><div class='content'>" . nl2br("YOU EXPRESSLY AGREE THAT USE OF THE SERVICE IS AT YOUR SOLE RISK AND THAT THE SERVICE IS PROVIDED ON AN \"AS IS\" AND \"AS AVAILABLE\" BASIS. {$set->name}, ITS AFFILIATES, AND THEIR OFFICERS, DIRECTORS, EMPLOYEES, AND AGENTS (HEREINAFTER \"{$set->name} GROUP\") DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.\n\n{$set->name} GROUP MAKES NO WARRANTIES OR REPRESENTATIONS ABOUT THE ACCURACY OR COMPLETENESS OF THE CONTENT PROVIDED ON OR VIA THE SERVICE AND {$set->name} GROUP ASSUMES NO LIABILITY OR RESPONSIBILITY FOR ANY (I) ERRORS, OMISSIONS OR INACCURACIES OF CONTENT OR SUBMISSIONS, (II) PERSONAL INJURY OR PROPERTY DAMAGE OF ANY NATURE RESULTING FROM YOUR ACCESS TO AND USE OF THE SERVICE, (III) ANY UNAUTHORIZED ACCESS TO OR USE OF OUR SECURE SERVERS AND/OR ANY AND ALL PERSONAL INFORMATION AND/OR FINANCIAL INFORMATION THAT MAY BE CONTAINED THEREIN, (IV) ANY DELETION OF DATA OR INTERRUPTION OR DISCONTINUENCE OF TRANSMISSION TO OR FROM OR THROUGH THE SERVICE, (IV) ANY BUGS, VIRUSES, TROJAN HORSES, MALICIOUS CODE OR THE LIKE WHICH MAY BE TRANSMITTED TO OR THROUGH THE SERVICE BY ANY USER OR THIRD PARTY, AND/OR (V) ANY ERRORS OR OMISSIONS IN ANY CONTENT OR FOR ANY LOSS OR DAMAGE OF ANY KIND INCURRED AS A RESULT OF THE USE OF ANY CONTENT OR SUBMISSIONS THAT MAY BE UPLOADED TO OR OTHERWISE MADE AVAILABLE THROUGH THE SERVICE.\n\n{$set->name} GROUP IS NOT RESPONSIBLE FOR ANY CONTENT OR TRANSACTIONS THAT IS CONTAINED OR MAY BE AVAILABLE OUTSIDE THE SERVICE. {$set->name} GROUP MAKES NO REPRESENTATIONS, WARRANTEES, GUARANTEES OR ANY ENDORSEMENTS AS TO THE QUALITY, SUITABILITY, FUNCTIONALITY OR LEGALITY OF ANY PRODUCTS, SERVICES OR OTHER OFFERINGS THAT MAY BE ADVERTISED OR MADE AVAILABLE BY A THIRD PARTY THROUGH THE SERVICE OR WHICH MAY BE LINKED TO THE SERVICE SUCH AS IN ADVERTISING OR A SUBMISSION. ACCORDINGLY, {$set->name} GROUP WILL NOT BE A PARTY TO OR IN ANY WAY BE RESPONSIBLE FOR ANY TRANSACTION THAT MAY OCCUR BETWEEN YOU AND SUCH THIRD PARTIES AND YOU SHOULD ALWAYS USE PRUDENT JUDGMENT AND READ THE PRIVACY POLICIES ON WEBSITES OF SUCH THIRD PARTIES.\n\n{$set->name} reserves the right to change any and all content, software and other items used or contained at {$set->name} and any services and applications offered through the {$set->name} site at any time without notice.") . "</div>";
include "footer.php";
示例#11
0
}
if (is_admin()) {
    $_admin = "<a href='{$set->url}/admincp/actions.php?act=edit&id=%1\$s'>{$lang->edit}</a> |\n\t<a href='{$set->url}/admincp/actions.php?act=delete&id=%1\$s'>{$lang->delete}</a> ";
    $_admin2 = "<div class='content'><a href='{$set->url}/admincp/actions.php?act=add&id={$dir}'>{$lang->add_folder}</a></div>";
    $plugins->run_hook("index_admin");
}
$where_text = "`indir` = '{$dir}'";
if (!empty($_GET["search"])) {
    $search_words = explode(" ", $_GET["search"]);
    foreach ($search_words as $search_word) {
        $where[] = "`name` LIKE '%{$search_word}%'";
        $where2[] = "`description` LIKE '%{$search_word}%'";
    }
    $where_text = "(" . implode(" AND ", $where) . ") OR (" . implode(" AND ", $where2) . ") AND `size` > 0";
    $search_text = htmlentities($_GET["search"], ENT_QUOTES);
    $links[] = mai_img("arr.gif") . $lang->search;
} elseif (!$dir) {
    $links = ' ';
}
$plugins->run_hook("index_search");
$total_results = $db->count("SELECT `id` FROM `" . MAI_PREFIX . "files` WHERE {$where_text}");
if ($total_results > 0) {
    // pagination
    $perpage = $_SESSION['perp'] ? (int) $_SESSION['perp'] : $set->perpage;
    $page = (int) $_GET['page'] == 0 ? 1 : (int) $_GET['page'];
    if ($page > ceil($total_results / $perpage)) {
        $page = ceil($total_results / $perpage);
    }
    $start = ($page - 1) * $perpage;
    $s_pages = new pag($total_results, $page, $perpage);
    $show_pages = $lang->pages . ": " . $s_pages->pages;
示例#12
0
<?php

// Master Autoindex
// ionutvmi@gmail.com
// Sep 2012
// master-land.net
include "inc/init.php";
include "lib/pagination.class.php";
$plugins->run_hook("request_top");
$links[] = mai_img("arr.gif") . " {$lang->request} ";
if ($_POST['rq']) {
    $request_text = $_POST['rq'];
    if ($request_text[10] && !$_COOKIE['ss']) {
        $db->query("INSERT INTO `" . MAI_PREFIX . "request` SET `text`='" . $db->escape($request_text) . "'");
        $add = "<div class='green'> {$lang->req_added} </div>";
        setcookie('ss', md5(1), time() + 3600 * 12);
        $plugins->run_hook("request_ins");
    } else {
        $add = "<div class='red'> {$lang->req_limit} </div>";
    }
}
if ($_POST['reply'] && is_admin()) {
    $plugins->run_hook("request_rpl");
    $db->query("UPDATE `" . MAI_PREFIX . "request` SET `reply` = '" . $db->escape($_POST['reply']) . "' WHERE `id`='" . (int) $_POST['req'] . "'");
    header("Location: ?page={$page}");
}
if ($_GET['delete'] && is_admin()) {
    $plugins->run_hook("request_del");
    $db->query("DELETE FROM `" . MAI_PREFIX . "request` WHERE `id`='" . (int) $_GET['req'] . "'");
    header("Location: ?page={$page}");
}