예제 #1
0
 function __construct()
 {
     parent::__construct();
     $this->load->model('page_attributegroup_model');
     $this->load->model('page_attributevalue_model');
     $this->MODEL = $this->page_attributegroup_model;
 }
예제 #2
0
 public function __construct()
 {
     parent::__construct();
     $this->MODULE_CONF = $this->loadConfig($this->module);
     $this->_setDiskPaths();
     $this->layout->setLayout('plain');
 }
예제 #3
0
 function __construct()
 {
     parent::__construct();
     // Add controller to wrapper title
     $this->layout->appendTitle('Util : Database');
     $this->authentication->requirePermission('mysql');
     // Set internal navigation variables
     $this->current_table = $this->uri->segment(2);
     $this->current_action = $this->uri->segment(3);
     $this->current_id = $this->uri->segment(4);
     $this->tables = $this->db->list_tables();
 }
예제 #4
0
 function __construct()
 {
     parent::__construct();
     $this->load->library('admin/xml_builder');
     $this->load->model('page_attributegroup_model');
     $this->load->model('page_attributejoin_model');
     $this->load->model('page_attributevalue_model');
     if (!empty($this->ADMIN_CONF['google_api_key'])) {
         $this->layout->asset->add('js', $this->ADMIN_CONF['google_api_js'] . $this->ADMIN_CONF['google_api_key'], 'google', false);
     }
     $this->hide_redirects = $this->session->userdata('am_' . $this->module . '_hideredicts') ? $this->session->userdata('am_' . $this->module . '_hideredicts') : $this->hide_redirects;
 }
예제 #5
0
 function __construct()
 {
     parent::__construct();
     $this->FILE_CONF = $this->loadConfig('file');
     ini_set('auto_detect_line_endings', 1);
     $this->upload_path = DOCROOT . zonepath($this->FILE_CONF['file_directory'], 'local') . '/' . $this->FILE_CONF['temp_folder'] . '/';
     // Required models
     $this->load->model('page_model');
     $this->load->model('page_attributejoin_model');
     $this->load->model('page_attributevalue_model');
     $this->load->model('template_model');
     //error_reporting(E_ALL);
 }
예제 #6
0
 public function _remap($action = null)
 {
     $this->getAccessItems();
     switch ($action) {
         case 'create':
             $this->create();
             break;
         case 'update':
             $this->update();
             break;
         case 'index':
             parent::index();
             break;
         default:
             $this->edit($action);
             break;
     }
 }
예제 #7
0
 * moderators will be restricted to only the boards which they moderate, and cannot
 * perform any actions on the "Administration:" link-line.
 *
 * @package kusaba
 */
session_set_cookie_params(60 * 60 * 24 * 100);
/* 100 Days */
session_start();
require 'config.php';
require KU_ROOTDIR . 'lib/dwoo.php';
require KU_ROOTDIR . 'inc/functions.php';
require KU_ROOTDIR . 'inc/classes/manage.class.php';
require KU_ROOTDIR . 'inc/classes/board-post.class.php';
require KU_ROOTDIR . 'inc/classes/bans.class.php';
$dwoo_data->assign('styles', explode(':', KU_MENUSTYLES));
$manage_class = new Manage();
$bans_class = new Bans();
if (isset($_GET['graph'])) {
    $manage_class->ValidateSession();
    require KU_ROOTDIR . 'lib/graph/phpgraphlib.php';
    if (isset($_GET['type'])) {
        if ($_GET['type'] == 'day' || $_GET['type'] == 'week' || $_GET['type'] == 'postnum' || $_GET['type'] == 'unique' || $_GET['type'] == 'posttime') {
            $graph = new PHPGraphLib(600, 600);
            if ($_GET['type'] == 'day') {
                $setTitle = 'Posts per board in past 24hrs';
                $graph->setTitle($setTitle);
                $results = $tc_db->GetAll("SELECT HIGH_PRIORITY * FROM `" . KU_DBPREFIX . "boards` ORDER BY `name` ASC");
                if (count($results) > 0) {
                    $data = array();
                    foreach ($results as $line) {
                        $posts = $tc_db->GetOne("SELECT HIGH_PRIORITY COUNT(*) FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $line['id'] . " AND `timestamp` > " . (time() - 86400) . "");
예제 #8
0
파일: board.php 프로젝트: stormeus/Kusaba-Z
         if ($post_reported === 'cleared') {
             echo _gettext('That post has been cleared as not requiring any deletion.') . '<br />';
         } elseif ($post_reported) {
             echo _gettext('That post is already in the report list.') . '<br />';
         } else {
             if ($post_class->Report()) {
                 echo _gettext('Post successfully reported.') . '<br />';
             } else {
                 echo _gettext('Unable to report post. Please go back and try again.') . '<br />';
             }
         }
     } else {
         echo _gettext('This board does not allow post reporting.') . '<br />';
     }
 } elseif (isset($_POST['postpassword']) || (require_once KU_ROOTDIR . 'inc/classes/manage.class.php') && Manage::CurrentUserIsModeratorOfBoard($board_class->board['name'], $_SESSION['manageusername']) && ($ismod = true)) {
 } elseif (isset($_POST['postpassword']) || isset($_POST['moddelete']) && (require_once KU_ROOTDIR . 'inc/classes/manage.class.php') && Manage::CurrentUserIsModeratorOfBoard($board_class->board['name'], $_SESSION['manageusername']) && ($ismod = true)) {
     // They clicked the Delete button
     if ($_POST['postpassword'] != '' || $ismod) {
         if (md5($_POST['postpassword']) == $post_class->post['password'] || $ismod) {
             if (isset($_POST['fileonly'])) {
                 if ($post_class->post['file'] != '' && $post_class->post['file'] != 'removed') {
                     $post_class->DeleteFile();
                     $board_class->RegeneratePages();
                     if ($post_class->post['parentid'] != 0) {
                         $board_class->RegenerateThreads($post_class->post['parentid']);
                     }
                     echo _gettext('Image successfully deleted from your post.') . '<br />';
                 } else {
                     echo _gettext('Your post already doesn\'t have an image!') . '<br />';
                 }
             } else {
예제 #9
0
 * kusaba; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 */
/**
 * Manage menu
 *
 * Loaded when a user visits manage.php
 *
 * @package kusaba
 */
session_start();
require 'config.php';
require KU_ROOTDIR . 'lib/dwoo.php';
require KU_ROOTDIR . 'inc/functions.php';
require KU_ROOTDIR . 'inc/classes/manage.class.php';
$manage_class = new Manage();
$dwoo_data->assign('styles', explode(':', KU_MENUSTYLES));
$tpl_links = '';
if (!$manage_class->ValidateSession(true)) {
    $tpl_links .= '<li><a href="' . KU_WEBFOLDER . '" target="_top">' . _gettext('Home') . '</a></li>' . "\n";
    $tpl_links .= '<li><a href="manage_page.php">' . ucfirst(_gettext('log in')) . '</a></li>';
} else {
    $manage_postpassword = md5_encrypt($_SESSION['manageusername'], KU_RANDOMSEED);
    $tpl_links .= _gettext('Welcome') . ', <strong>' . $_SESSION['manageusername'] . '</strong>';
    if ($_SESSION['manageusername'] == 'admin') {
        $salt = $tc_db->GetOne("SELECT `salt` FROM " . KU_DBPREFIX . "staff WHERE `username` = " . $tc_db->qstr($_SESSION['manageusername']));
        if ($_SESSION['managepassword'] == md5('admin' . $salt)) {
            $tpl_links .= '<br /><strong><font color="red">' . _gettext('NOTICE: You are using the default administrator account. Anyone can log in to this account, so a second administrator account needs to be created. Create another, log in to it, and delete this one.') . '</font></strong>';
        }
    }
    $tpl_links .= '<br />' . _gettext('Staff rights') . ': <strong>';
예제 #10
0
<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
/*
 * Manage Controller
 */
class Manage extends Page
{
    function __construct()
    {
        parent::__construct();
        parent::header('baseMVC - ' . $_SESSION['fullname'] . ' - Manage Your Content');
    }
    public function getArticles()
    {
        $article_list = $this->select("SELECT * FROM BlogContent WHERE authorId = {$_SESSION['uid']} ORDER BY date DESC");
        $this->view('manage_view', $article_list);
    }
}
$manage = new Manage();
$manage->getArticles();
$manage->footer();
예제 #11
0
 public function __construct()
 {
     parent::__construct();
     $this->url_admin = new URLAdmin();
 }
예제 #12
0
<?php

error_reporting(E_ALL);
ini_set("display_errors", 1);
include $_SERVER["DOCUMENT_ROOT"] . "/head_foot/header.php";
include $_SERVER["DOCUMENT_ROOT"] . "/head_foot/footer.php";
require $_SERVER["DOCUMENT_ROOT"] . '/books/GetBook.php';
require $_SERVER["DOCUMENT_ROOT"] . "/lib/Manage.php";
$books = new GetBook();
$date = new Manage();
$array = $books->getBooks();
/**
 * TODO add search by
 */
?>
<!---source; http://github.com/stidges/jquery-searchable -->
<div class="container">
    <div class="row">

    <div class="row">
        <div class="col-lg-12">
            <h3>Tous les livres</h3>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-4 col-lg-offset-4">
            <input type="search" id="search" value="" class="form-control" placeholder="Rechercher">
        </div>
    </div>
    <div class="row">
        <div class="col-lg-12">
예제 #13
0
// check the session variable, if exist, get them
if (isset($_SESSION["user_name"])) {
    $user_name = $_SESSION["user_name"];
}
if (isset($_SESSION["user_type"])) {
    $user_type = $_SESSION["user_type"];
}
if (isset($user_name)) {
    // check if it is regular user
    if ($user_type == "a") {
        echo "<table width='100%' align='center'>";
        echo "<tr>";
        echo "<td align='right' style='color: #C15BAF; font-size: 24px;'>Welcome Admin! Press here to <a href='logout.php'>logout!</a></td>";
        echo "</tr>";
        echo "</table>";
        $manage = new Manage(Hostname, DB - username, password, Database - Name);
        $manage->connect();
        $manage->show_users();
        $manage->get_user_name();
        $manage->show_user_business_plan_information();
        $manage->disconnect();
        echo "<a href='register.php'>Register a New user</a>";
    } else {
        if ($user_type == "r") {
            header("location: user.php");
        } else {
            echo "Login in error";
        }
    }
} else {
    echo "Please enter username and password to login<br />";
예제 #14
0
 function __construct()
 {
     parent::__construct();
     $this->activity_link = $this->admin_path . 'activity/';
 }
예제 #15
0
 function __construct()
 {
     parent::__construct();
     $this->load->library('site_maintenance');
 }
예제 #16
0
 function __construct()
 {
     parent::__construct();
     $this->load->model('page_attributegroup_model');
 }
예제 #17
0
 function __construct()
 {
     parent::__construct();
 }
예제 #18
0
            printf('File %s does not exist', $path);
            exit;
        }
        $cmd = $argv[1];
        if ($cmd == 'project') {
        } elseif ($cmd == 'module') {
            $module = $argv[2];
            $moduleDir = sprintf('%s/modules/%s', $this->settings['root'], $module);
            $moduleTemplatesDir = sprintf('%s/modules/%s/templates', $this->settings['root'], $module);
            $moduleControllerFile = sprintf('%s/modules/%s/controller.php', $this->settings['root'], $module);
            $moduleRoutesFile = sprintf('%s/modules/%s/routes.yml', $this->settings['root'], $module);
            $moduleModelsFile = sprintf('%s/modules/%s/models.yml', $this->settings['root'], $module);
            $controlllerContent = "<?php\n\nclass [[module]] {\n\tpublic function index(){\n\t\techo 'index :)';\n\t}\n}";
            $controlllerContent = str_replace('[[module]]', ucfirst($module), $controlllerContent);
            $routesContent = "- route: ^\$\n  controller: index";
            $modelsContent = '';
            if (!file_exists($moduleDir)) {
                mkdir($moduleDir);
                mkdir($moduleTemplatesDir);
                file_put_contents($moduleControllerFile, $controlllerContent);
                file_put_contents($moduleRoutesFile, $routesContent);
                file_put_contents($moduleModelsFile, $modelsContent);
            } else {
                echo "Module directory already exists.\n";
            }
        }
        return 0;
    }
}
$manage = new Manage();
$manage->run();
예제 #19
0
<?php

require_once "start.php";
require_once "manage_class.php";
require_once "url_class.php";
$manage = new Manage();
$url = new URL();
$func = $_REQUEST["func"];
if ($func == "add_cart") {
    $manage->addCart();
} elseif ($func == "delete_cart") {
    $manage->deleteCart();
} elseif ($func == "cart") {
    $manage->updateCart();
} elseif ($func == "order") {
    $success = $manage->addOrder();
} elseif ($func == "success_pay") {
    $success = $manage->successPay();
} elseif ($func == "fail_pay") {
    $success = $manage->failPay();
} elseif ($func == "status_pay") {
    $success = $manage->statusPay();
} else {
    exit;
}
if ($success) {
    $link = $url->message();
} else {
    $link = $_SERVER["HTTP_REFERER"] != "" ? $_SERVER["HTTP_REFERER"] : $url->index();
}
header("Location: {$link}");
예제 #20
0
 /**
  * proccess_request
  * Process the request for the public area
  */
 private function proccess_request()
 {
     global $lang;
     $this->template = 404;
     // Default template
     $this->pages = $this->get_pages();
     // get theme pages
     // Prepare te request array to use the legacy request (?v=file.ext)
     if (check_value($_GET['v']) && preg_match("/^\\w*\\.jpg|png|gif\$/", $_GET['v'])) {
         $this->base_request = '?' . $this->request_array[1];
         unset($this->request_array[1]);
     }
     @session_start();
     if (count($_SESSION['ImagesUp']) > 0) {
         $_SESSION['ImagesUp'] = array_values($_SESSION['ImagesUp']);
         self::$uploaded = true;
     }
     if (chevereto_config('maintenance')) {
         $this->base_request = 'maintenance';
     }
     // Switch according the request
     switch ($this->base_request) {
         case '':
         case 'index.php':
             @session_start();
             $_SESSION['last_upload_request'] = time();
             $this->template = 'index';
             break;
         case 'json':
             json_prepare();
             // Do a special trick for the json action=login
             if ($_REQUEST['action'] == 'login') {
                 // Check for user match...
                 $login_user = login_user($_REQUEST['password'], $_REQUEST['keep']);
                 if ($login_user !== false) {
                     $json_array = array('status_code' => 200, 'status_txt' => 'logged in');
                 } else {
                     $json_array = array('status_code' => 403, 'status_txt' => 'invalid login');
                 }
             } elseif ($_REQUEST['action'] == 'logout') {
                 do_logout();
                 $json_array = array('status_code' => 200, 'status_txt' => 'logged out');
             }
             $json_array = check_value($json_array) ? $json_array : array('status' => 403, 'status_txt' => 'unauthorized');
             session_write_close();
             die(json_output($json_array));
             break;
         case __CHV_VIRTUALFOLDER_IMAGE__:
             // View request
             $id_public = $this->request_array[1];
             $this->template = !is_upload_result() ? 'view' : 'uploaded';
             self::$is_viewer = true;
             break;
         case __CHV_VIRTUALFOLDER_UPLOADED__:
             @session_start();
             if (count($_SESSION['ImagesUp']) > 0) {
                 $this->template = 'uploaded';
                 self::$doctitle = $lang['doctitle_upload_complete'];
             } else {
                 $this->redirect(__CHV_BASE_URL__, 400);
             }
             break;
         case 'error-javascript':
             chevereto_die(array(get_lang_txt('critical_js_step_1'), get_lang_txt('critical_js_step_2')), 'JavaScript', array(get_lang_txt('critical_js')));
             break;
         case '?chevereto':
             $this->template = 'bool';
             break;
             // Legacy viewer
         // Legacy viewer
         case '?v=' . $_GET['v']:
             // View request
             $id_public = $_GET['v'];
             $this->legacy_redirect = true;
             break;
         case 'delete':
         case 'delete-confirm':
             //$delete_what = $this->request_array[1];
             $id_public = $this->request_array[2];
             $deleteHash = $this->request_array[3];
             $this->template = $this->base_request;
             self::$is_viewer = true;
             break;
         case 'maintenance':
             $this->template = 'maintenance';
             self::$doctitle = chevereto_config('doctitle');
             break;
         default:
             // Pages request
             require_once $this->path_theme . 'pages/pages_config.php';
             // We load the special pages config
             if (in_array($this->base_request . '.php', $this->pages) and $this->request_array[1] == '' and $pages_config[$this->base_request]['live']) {
                 $this->template = 'pages/' . $this->base_request;
                 self::$doctitle = $pages_config[$this->base_request]['title'];
             } else {
                 $this->template = 'shorturl';
                 $id_public = $this->base_request;
                 self::$is_viewer = true;
             }
             break;
     }
     // Ask for the login on index and pages
     if ($this->template == 'index' || $this->template == 'pages/' . $this->base_request) {
         if (conditional_config('private_mode')) {
             if (!is_logged_user()) {
                 $doctitle = get_lang_txt('txt_enter_password') . ' - ' . chevereto_config('doctitle');
                 include __CHV_PATH_SYSTEM__ . 'login.php';
                 die;
             }
         }
     }
     if ($this->template == 'uploaded') {
         self::$doctitle = get_lang_txt('doctitle_upload_complete');
         self::$image_info = $_SESSION['ImagesUp'][0];
         self::$uploaded_images = $_SESSION['ImagesUp'];
         $_SESSION['ImagesUp'] = NULL;
         unset($_SESSION['ImagesUp']);
     }
     if (preg_match('/view|shorturl|delete/', $this->template) || $this->legacy_redirect) {
         // Test connection
         if ($this->dB->dead) {
             self::$doctitle = 'dB connection error';
             $this->template = 404;
         } else {
             // get image info
             $imageID = $this->legacy_redirect ? $id_public : decodeID($id_public);
             self::$image_info = $this->dB->image_info($imageID);
             self::$id_public = $id_public;
             if (!is_array(self::$image_info)) {
                 // Record?
                 if ($this->template == 'delete-confirm') {
                     json_output(array('status_code' => 403, 'status_txt' => 'target image doesn\'t exists'));
                 } else {
                     $this->template = 404;
                 }
             } else {
                 if ($this->legacy_redirect) {
                     $this->redirect(__CHV_BASE_URL__ . __CHV_VIRTUALFOLDER_IMAGE__ . '/' . encodeID(self::$image_info['image_id']), 301);
                 }
                 $target = get_image_target(self::$image_info);
                 self::$image_target = $target['image_path'];
                 self::$image_thumb_target = $target['image_thumb_path'];
                 self::$image_url = absolute_to_url($target['image_path']);
                 self::$image_thumb_url = absolute_to_url($target['image_thumb_path']);
                 self::$image_filename = self::$image_info['image_filename'];
                 self::$image_viewer = __CHV_BASE_URL__ . __CHV_VIRTUALFOLDER_IMAGE__ . '/' . $id_public;
                 self::$delete_image_url = __CHV_BASE_URL__ . 'delete/image/' . self::$id_public . '/' . self::$image_info['image_delete_hash'];
                 $image_delete_proceed = !empty(self::$image_info['image_delete_hash']) && $deleteHash === self::$image_info['image_delete_hash'] ? true : false;
                 switch ($this->template) {
                     case 'delete':
                         if (!$image_delete_proceed) {
                             $this->redirect(__CHV_BASE_URL__ . __CHV_VIRTUALFOLDER_IMAGE__ . '/' . self::$id_public, 301);
                         }
                         self::$delete_image_confirm_url = __CHV_BASE_URL__ . 'delete-confirm/image/' . self::$id_public . '/' . self::$image_info['image_delete_hash'];
                         self::$doctitle = get_lang_txt('doctitle_delete_confirm') . ' ' . self::$image_info['image_filename'];
                         break;
                     case 'delete-confirm':
                         if (!$image_delete_proceed) {
                             json_output(array('status_code' => 403, 'status_txt' => 'invalid delete hash'));
                         } else {
                             require_once __CHV_PATH_ADMIN_CLASSES__ . 'class.manage.php';
                             $manage = new Manage(array('id' => self::$image_info['image_id'], 'action' => 'delete'));
                             if ($manage->dead) {
                                 $json_array = array('status_code' => 403, 'status_txt' => $manage->error);
                             } else {
                                 $json_array = $manage->process();
                             }
                         }
                         // Make the status_txt more readable...
                         switch ($json_array['status_code']) {
                             case 200:
                                 $json_array['status_txt'] = get_lang_txt('txt_image_deleted');
                                 break;
                             default:
                             case 403:
                                 $json_array['status_txt'] = get_lang_txt('txt_error_deleting_image');
                                 break;
                         }
                         json_output($json_array);
                         break;
                     default:
                         self::$doctitle = get_lang_txt('doctitle_viewing_image') . ' ' . self::$image_info['image_filename'];
                         break;
                 }
             }
         }
     }
     if ($this->template == 404) {
         status_header(404);
         self::$doctitle = check_value(self::$doctitle) ? self::$doctitle : get_lang_txt('txt_404_title');
     } else {
         status_header(200);
     }
     // We load the template
     if ($this->template == 'bool') {
         exit(json_encode(true));
     } else {
         $this->load_template();
     }
 }
예제 #21
0
 public function picker()
 {
     if ($this->input->get_post('parent_id')) {
         $this->picker_parent_item = $this->MODEL->first()->getById($this->input->get_post('parent_id'));
     } else {
         $this->picker_parent_item = array();
     }
     return parent::picker();
 }
예제 #22
0
<?php

include $_SERVER["DOCUMENT_ROOT"] . "/head_foot/header.php";
include $_SERVER["DOCUMENT_ROOT"] . "/head_foot/footer.php";
require $_SERVER["DOCUMENT_ROOT"] . "/lib/Manage.php";
require $_SERVER["DOCUMENT_ROOT"] . "/users/GetUser.php";
$date = new Manage();
$userData = new GetUser();
$array = $userData->getUserBySession($_SESSION['user']);
?>

<div class="container-fluid well span6">
    <div class="row-fluid">
<?php 
foreach ($array as $data) {
    ?>
        <div class="span8">
            <h3>Nom d'utilisateur: <?php 
    echo $data['user_name'];
    ?>
</h3>
            <h5>Mon Adresse: <strong><?php 
    echo $data['user_email'];
    ?>
</strong></h5>

<h5>Membre depuis: <strong><?php 
    echo $date->getNameDate($data['user_registration_datetime']);
    ?>
</strong></h5>
        </div>
예제 #23
0
 function __construct($valid_request)
 {
     global $lang, $Login, $dB;
     @session_start();
     // Redirect plain /admin/index.php access
     if (preg_match('/index\\.php/', $_SERVER['REQUEST_URI'])) {
         $this->redirect($this->base_redirection($this->root_url), 301);
     }
     $admin_request = sanitize_path(str_replace(sanitize_path(__CHV_FOLDER_ADMIN__), "", str_replace(sanitize_path(__CHV_RELATIVE_ROOT__) . '/', "", $valid_request)));
     // json?blabla instead of (folder?)/admin/json?blabla
     $this->request_array = explode('/', $admin_request);
     $request_file = str_replace('//', '/', __CHV_ROOT_DIR__ . str_replace(__CHV_RELATIVE_ROOT__ == '/' ? '' : __CHV_RELATIVE_ROOT__, '', $_SERVER['REQUEST_URI']));
     // Serve the static file or call the handler?
     if (file_exists($request_file) and !is_dir($request_file) and !preg_match('/php/', get_mime($request_file)) and trim($_SERVER['REQUEST_URI'], '/') !== trim(dirname($_SERVER['SCRIPT_NAME']), '/')) {
         error_reporting(0);
         header('Content-Type: ' . get_mime($request_file) . '; Cache-Control: no-cache; Pragma: no-cache');
         die(readfile($request_file));
     }
     // Now, deny all direct access to the other resources
     if ((file_exists($request_file) or is_dir($request_file)) and trim($_SERVER['REQUEST_URI'], '/') !== trim(dirname($_SERVER['SCRIPT_NAME']), '/') and !$Login->is_admin()) {
         status_header(403);
         die('Forbidden');
     }
     // Organize the source request
     $request_array_explode = explode('?', $this->request_array[0]);
     $request_base = $request_array_explode[0];
     // Now, lets do sub request according to the base request
     switch ($request_base) {
         case '':
             break;
             // admin main
         // admin main
         case 'json':
             json_prepare();
             // Do a special trick for the json action=login
             if ($_REQUEST['action'] !== 'login' and !is_admin()) {
                 $json_array = array('status_code' => 401, 'status_txt' => 'unauthorized');
             } elseif ($_REQUEST['action'] == 'login') {
                 // Check for admin match...
                 $login_user = login_user($_REQUEST['password'], $_REQUEST['keep']);
                 if ($login_user == 'admin') {
                     $json_array = array('status_code' => 200, 'status_txt' => 'logged in');
                 } else {
                     $json_array = array('status_code' => 403, 'status_txt' => 'invalid login');
                 }
             } elseif ($_REQUEST['action'] == 'logout') {
                 do_logout();
                 $json_array = array('status_code' => 200, 'status_txt' => 'logged out');
             } elseif ($_REQUEST['action'] == 'filelist') {
                 require_once __CHV_PATH_CLASSES__ . 'class.filelist.php';
                 $filelist = new FileList($_REQUEST['type'], $_REQUEST['sort'], $_REQUEST['limit'], $_REQUEST['keyword']);
                 $json_array = $filelist->filelist;
             } elseif ($_REQUEST['action'] == 'uploaded') {
                 // In some point there will be a stats class that will help us to output all the stats. This is just the number of uploaded files now.
                 $json_array = array('total' => total_images_uploaded());
                 // The rest of the actions are for the manage class (delete|rename|resize)
             } else {
                 require_once __CHV_PATH_ADMIN_CLASSES__ . 'class.manage.php';
                 $manage = new Manage($_REQUEST);
                 if ($manage->dead) {
                     $json_array = array('status_code' => 403, 'status_txt' => $manage->error);
                 } else {
                     $json_array = $manage->process();
                 }
             }
             $json_array = check_value($json_array) ? $json_array : array('status_code' => 403, 'status_txt' => 'empty json');
             die(json_output($json_array));
             break;
             // json
         // json
         default:
             if (is_admin()) {
                 status_header(404);
                 die('Not found');
             } else {
                 status_header(403);
                 die('Forbidden');
             }
             break;
     }
     // Send the OK status header
     status_header(200);
     if (!is_admin()) {
         $doctitle = get_lang_txt('txt_enter_password') . ' - Chevereto File Manager';
         require_once __CHV_PATH_SYSTEM__ . 'login.php';
     } else {
         require_once __CHV_PATH_ADMIN_SYSTEM__ . 'header.php';
         require_once __CHV_PATH_ADMIN_SYSTEM__ . 'filemanager.php';
     }
 }
예제 #24
0
파일: functions.php 프로젝트: kuaa59/www
<?php

require_once "start.php";
require_once "lib/manage_class.php";
$manage = new Manage();
if (isset($_POST["captcha"])) {
    echo $manage->checkCaptcha($_POST["captcha"]);
}
if (isset($_POST["data_type"]) && $_POST["data_type"] == "reserv") {
    echo $manage->reserv();
} elseif (isset($_POST["data_type"]) && $_POST["data_type"] == "send") {
    echo $manage->send();
} elseif (isset($_POST["vote"])) {
    $r = $manage->vote();
    $manage->redirect($r);
} else {
    exit;
}
예제 #25
0
 function __construct()
 {
     parent::__construct();
     if ($this->input->get("directory_path") == "" || $this->input->get("parent_id") == "") {
         exit("Please enter a directory_path and a parent_id");
     }
     $this->load->model("file_model");
     $this->load->helper("directory");
     $output = '';
     $year = $this->input->get('year');
     $path = $this->input->get("directory_path");
     $files = directory_map($path);
     foreach ($files as $key => $value) {
         $collection_xml = array();
         $collection_xml[] = '<data>';
         $collection_xml[] = '<title>' . $key . '</title>';
         $collection_xml[] = '<subtitle>' . $year . '</subtitle>';
         $collection_xml[] = '<thumbnail/>';
         $collection_xml[] = '<images>';
         //make a folder
         $fields = array();
         $fields['title'] = $key;
         $fields['type'] = "collection";
         $fields['parent_id'] = $this->input->get("parent_id");
         $upload_result = $this->file_model->update($fields);
         $folder_id = $upload_result["file_id"];
         //add files to folder
         $i = 0;
         while ($i < sizeof($value)) {
             $raw_file_name = $value[$i];
             $pretty_file_name = $key . "_" . $value[$i];
             $path = $this->input->get("directory_path") . "/" . $key . "/" . $raw_file_name;
             if (is_dir($path)) {
                 continue;
             }
             if (!strpos($raw_file_name, '.jpg')) {
                 continue;
             }
             $imagedata = getimagesize($path);
             $fields = array();
             // Add tmp_file values to fields before update
             $fields['file_name'] = $pretty_file_name;
             $fields['title'] = $pretty_file_name;
             $fields['is_image'] = 1;
             $fields['mime'] = $imagedata["mime"];
             $fields['type'] = "file";
             $fields['parent_id'] = $folder_id;
             $fields['ext'] = substr($raw_file_name, sizeof($raw_file_name) - 5);
             $fields['options'] = array('image_size_str' => "width=\"" . $imagedata[0] . "\" height=\"" . $imagedata[1] . "\"", 'image_width' => $imagedata[0], 'image_height' => $imagedata[1]);
             // UPDATE DATABASE
             $upload_result = $this->file_model->update($fields);
             $collection_xml[] = '<image file_path="" file_title="" file_id="' . $upload_result['file_id'] . '"/>';
             // Make sure the id directory exists
             $this->file_model->getIdDirectory($upload_result['server_path']);
             if (file_exists($path)) {
                 // Move file (we need the id from insert)
                 rename($path, $upload_result['server_path']);
             }
             $i++;
         }
         echo '<p>' . $key . '</p>';
         $collection_xml[] = '</images>';
         $collection_xml[] = '</data>';
         $output .= $key . chr(10) . implode(chr(10), $collection_xml) . chr(10) . chr(10);
     }
     mail('*****@*****.**', 'IMG Import', $output);
     echo 'DONE!';
 }