Beispiel #1
0
function createPage($smarty)
{
    $smarty->assign('exams', Tables::exams(true));
    $smarty->assign('planning', Tables::planning(true, 'exams'));
    $smarty->assign('schedule', Queries::article('exams'));
    return $smarty;
}
function createPage($smarty)
{
    $subjects = Queries::subjects();
    foreach ($subjects as $index => $subject) {
        $assignments = Queries::assignments(true, $subject->abbreviation);
        $exams = Queries::exams(true, $subject->abbreviation);
        $subjects[$index]->ass_line_index = -1;
        $subjects[$index]->ex_line_index = -1;
        $subjects[$index]->assignments = $assignments;
        $subjects[$index]->exams = $exams;
        foreach ($assignments as $index2 => $assigment) {
            if (strtotime($assigment->end_date . ' ' . $assigment->end_time) < strtotime('now')) {
                $subjects[$index]->ass_line_index = $index2;
            }
        }
        foreach ($exams as $index2 => $exam) {
            if (strtotime($exam->date) < strtotime('today')) {
                $subjects[$index]->ex_line_index = $index2;
            }
        }
    }
    $smarty->assign('subjects', $subjects);
    $smarty->assign('events', Tables::events(true));
    return $smarty;
}
function createPage($smarty)
{
    if (!Users::isAdmin()) {
        Redirect::error(403);
    }
    $smarty->assign('edit_headers', Queries::itemListHeaders(Input::get('table', 'get')));
    $smarty->assign('edit_table', Queries::itemList(Input::get('table', 'get')));
    return $smarty;
}
function createPage($smarty)
{
    $item = Queries::examWithId(Input::get('id', 'get'));
    if (empty($item->id)) {
        Redirect::error(404);
    }
    $smarty->assign('item', $item);
    $smarty->assign('table_parentT', 'exams');
    $smarty->assign('table_parentI', $item->id);
    $smarty->assign('planning', Tables::planning(true, 'exams', $item->id));
    return $smarty;
}
 public function postLog()
 {
     // check database connections
     $conn = $this->databaseConnection();
     if ($conn) {
         $username = trim($_POST['username']);
         $password = trim($_POST['password']);
         $queries = new Queries();
         $password = sha1($password);
         $sqlQuery = $queries->loginUser($username, $password);
         $result = mysqli_query($conn, $sqlQuery);
         if (mysqli_num_rows($result) > 0) {
             echo json_encode(array('response' => 1));
         } else {
             echo json_encode(array('response' => 0));
         }
     } else {
         $connection = false;
         echo "There was an error, please contact web administrator.";
         return false;
     }
 }
 private static function parseSubjectNav($row)
 {
     $subjects = Queries::subjects();
     foreach ($subjects as $subject) {
         $sub_names[] = $subject->name;
         $sub_urls[] = '?page=subjects&subject=' . $subject->abbreviation;
     }
     if (!isset($sub_names) || !isset($sub_urls)) {
         $sub_names[] = 'No Subjects';
         $sub_urls[] = '?page=subjects&subject=none';
     }
     $row->sub_names = implode(', ', $sub_names);
     $row->sub_urls = implode(', ', $sub_urls);
     $row->url = '';
     return $row;
 }
function createPage($smarty)
{
    if (!Users::isAdmin()) {
        Redirect::error(403);
    }
    if (Input::exists() && Input::get('action') === 'admin_item_insert') {
        Update::adminInsertItem();
    }
    if (Input::exists() && Input::get('action') === 'admin_item_update') {
        Update::adminUpdateItem();
    }
    if (Input::exists() && Input::get('action') === 'admin_item_delete') {
        Update::adminDeleteItem();
    }
    $smarty->assign('columns', Queries::editableEntry(Input::get('table', 'get'), Input::get('id', 'get')));
    return $smarty;
}
 public function match($uri)
 {
     global $conf;
     global $localUri;
     global $uri;
     global $acceptContentType;
     global $endpoints;
     global $lodspk;
     global $results;
     global $firstResults;
     require_once $conf['home'] . 'classes/MetaDb.php';
     $metaDb = new MetaDb($conf['metadata']['db']['location']);
     $pair = Queries::getMetadata($localUri, $acceptContentType, $metaDb);
     if ($pair == NULL) {
         // Original URI is not in metadata
         if (Queries::uriExist($uri, $endpoints['local'])) {
             $page = Queries::createPage($uri, $localUri, $acceptContentType, $metaDb);
             if ($page == NULL) {
                 HTTPStatus::send500("Can't write sqlite database.");
             }
             HTTPStatus::send303($page, $acceptContentType);
             exit(0);
         } else {
             return false;
         }
     }
     list($res, $page, $format) = $pair;
     $uri = $res;
     $queries = $this->getQueries();
     $e = $endpoints['local'];
     require_once $conf['home'] . 'lib/Haanga/lib/Haanga.php';
     Haanga::configure(array('cache_dir' => $conf['home'] . 'cache/', 'autoescape' => FALSE));
     $vars = compact('uri', 'lodspk', 'models', 'first');
     foreach ($queries as $l => $v) {
         $q = Utils::addPrefixes(file_get_contents($v));
         $fnc = Haanga::compile($q);
         $query = $fnc($vars, TRUE);
         $aux = $e->query($query, Utils::getResultsType($query));
         if ($aux["boolean"] === true) {
             $pair[] = $l;
             return $pair;
         }
     }
     return false;
 }
Beispiel #9
0
 public static function updateAssignment($id)
 {
     $assignment = Queries::assignmentWithId($id);
     if (Users::loggedIn() && !empty($assignment) && self::isReady()) {
         $service = self::getService();
         $eventId = Users::currentData()->student_id . 'assignment' . $assignment->id;
         $calendarId = Users::currentData()->calendar_assignments;
         $state = $assignment->completion ? '[DONE] ' : '';
         $request = new Google_Service_Calendar_Event(array('id' => $eventId, 'summary' => $state . $assignment->desc_short, 'start' => array('date' => $assignment->end_date, 'timeZone' => 'Europe/Amsterdam'), 'end' => array('date' => $assignment->end_date, 'timeZone' => 'Europe/Amsterdam')));
         try {
             $event = $service->events->get($calendarId, $eventId);
             $service->events->update($calendarId, $eventId, $request);
         } catch (Exception $e) {
             $service->events->insert($calendarId, $request);
         }
         Notifications::addSuccess('Google calendar event updated!');
     }
 }
Beispiel #10
0
 public function isLoggedIn($cookie)
 {
     if ($cookie) {
         $username = filter_input(INPUT_COOKIE, "username");
         $password = filter_input(INPUT_COOKIE, "password");
         if ($username && $password && ctype_alnum($username) && ctype_alnum($password)) {
             $rows = Queries::getRowWithValue(Database::$table_users, "username", $username);
             if ($rows) {
                 if ($rows['password'] == $password) {
                     $this->username = $username;
                     $this->password = $password;
                     $this->email = $rows['email'];
                     return true;
                 }
             }
         }
         return false;
     }
 }
Beispiel #11
0
 public function match($uri)
 {
     global $conf;
     global $localUri;
     global $uri;
     global $acceptContentType;
     global $endpoints;
     global $lodspk;
     if ($conf['disableComponents'] == true) {
         return FALSE;
     }
     require_once 'classes/MetaDb.php';
     $metaDb = new MetaDb($conf['metadata']['db']['location']);
     $pair = Queries::getMetadata($localUri, $acceptContentType, $metaDb);
     if ($pair == NULL) {
         // Original URI is not in metadata
         if (Queries::uriExist($uri, $endpoints['local'])) {
             $page = Queries::createPage($uri, $localUri, $acceptContentType, $metaDb);
             if ($page == NULL) {
                 HTTPStatus::send500("Can't write sqlite database.");
             }
             HTTPStatus::send303($page, $acceptContentType);
             exit(0);
         } else {
             return false;
         }
     }
     $extension = Utils::getExtension($pair[2]);
     $curie = Utils::uri2curie($pair[0]);
     list($modelFile, $viewFile) = $this->getModelandView($curie, $extension);
     if ($modelFile == NULL) {
         return FALSE;
     }
     $result = array('res' => $pair[0], 'page' => $pair[1], 'format' => $pair[2], 'modelFile' => $modelFile, 'viewFile' => $viewFile);
     return $result;
 }
Beispiel #12
0
    } else {
        if ($path === "../../") {
            // For alerts/PMs
            require_once '../includes/smarty/Smarty.class.php';
            require_once '../includes/sanitize.php';
            spl_autoload_register(function ($class) {
                require_once '../classes/' . $class . '.php';
            });
        }
    }
}
/* 
 *  Initialise
 */
if ($page !== 'install') {
    $queries = new Queries();
    $user = new User();
    $smarty = new Smarty();
    $c = new Cache();
}
// Error reporting?
if ($page !== 'install') {
    $error_reporting = $queries->getWhere('settings', array('name', '=', 'error_reporting'));
    $error_reporting = $error_reporting[0]->value;
    if ($error_reporting !== '0') {
        // Enabled
        ini_set('display_startup_errors', 1);
        ini_set('display_errors', 1);
        error_reporting(-1);
    } else {
        // Disabled
Beispiel #13
0
    } else {
        if ($path === "../../") {
            // For alerts/PMs
            require_once '../includes/smarty/Smarty.class.php';
            require_once '../includes/sanitize.php';
            spl_autoload_register(function ($class) {
                require_once '../classes/' . $class . '.php';
            });
        }
    }
}
/* 
 *  Initialise
 */
if ($page !== 'install') {
    $queries = new Queries();
    $user = new User();
    $smarty = new Smarty();
    $c = new Cache();
}
// Error reporting?
if ($page !== 'install') {
    $error_reporting = $queries->getWhere('settings', array('name', '=', 'error_reporting'));
    $error_reporting = $error_reporting[0]->value;
    if ($error_reporting !== '0') {
        // Enabled
        ini_set('display_startup_errors', 1);
        ini_set('display_errors', 1);
        error_reporting(-1);
    } else {
        // Disabled
Beispiel #14
0
 public static function today()
 {
     $results = Queries::today();
     return $results;
 }
<?php

include 'db.php';
include 'queries.php';
include 'classes.php';
if (isset($_POST['keyword'])) {
    $keyword = $_POST['keyword'];
    $keys = explode(' ', $keyword);
    /*create dictionary starts*/
    $t_create_start = microtime(true);
    $qobj = new Queries();
    $btree = new BTree();
    $btreeop = new BOperation();
    $content = array();
    $contentlist = array();
    $docidlist = array();
    $doclist = $qobj->retrieve_documents($conn);
    while ($row = $doclist->fetch()) {
        echo $row['doc_id'] . " => ";
        echo $row['content'];
        $content = explode(' ', $row['content']);
        array_push($docidlist, $row['doc_id']);
        array_push($contentlist, $content);
        echo "<br>";
    }
    $collection = array_combine($docidlist, $contentlist);
    $dictionary = array();
    $l = array();
    // create dictionary list
    foreach ($collection as $doc => $content) {
        foreach ($content as $i => $word) {
Beispiel #16
0
<html>
    <body>
        <ul>
            <?php 
include 'includes.php';
Tracking::track(basename(filter_input(INPUT_SERVER, 'PHP_SELF')));
$account = new User();
$get_title = filter_input(INPUT_GET, 'title');
if (!$get_title) {
    echo "Error getting title";
}
if ($account->isLoggedIn()) {
    if (ctype_alnum($get_title)) {
        $row = Queries::getRowWithValue(Database::$table_pages, 'title', $get_title);
        if ($row) {
            $owner = $row['owner'];
            $title = $row['title'];
            $description = $row['description'];
            $goal = $row['goal'];
            $amount = $row['amount'];
            $pageinfo = array($owner, $title, $description, $goal, $amount);
            for ($i = 0; $i < count($pageinfo); $i++) {
                echo "<li>{$pageinfo[$i]}</li>";
            }
        } else {
            echo "Error getting a page with that title";
        }
    } else {
        echo "Title must be alphanumeric";
    }
} else {
Beispiel #17
0
    } else {
        if ($path === "../../") {
            // For alerts/PMs
            require_once '../includes/smarty/Smarty.class.php';
            require_once '../includes/sanitize.php';
            spl_autoload_register(function ($class) {
                require_once '../classes/' . $class . '.php';
            });
        }
    }
}
/* 
 *  Initialise
 */
if ($page !== 'install') {
    $queries = new Queries();
    $user = new User();
    $smarty = new Smarty();
    $c = new Cache();
}
// Error reporting?
if ($page !== 'install') {
    $error_reporting = $queries->getWhere('settings', array('name', '=', 'error_reporting'));
    $error_reporting = $error_reporting[0]->value;
    if ($error_reporting !== '0') {
        // Enabled
        ini_set('display_startup_errors', 1);
        ini_set('display_errors', 1);
        error_reporting(-1);
    } else {
        // Disabled
 public function updateFramework()
 {
     // check database connections
     $conn = $this->databaseConnection();
     parse_str(file_get_contents("php://input"), $post_vars);
     $id = $post_vars['ID'];
     $birthDate = trim($post_vars['BirthDate']);
     $firstName = trim($post_vars['FirstName']);
     $lastName = trim($post_vars['LastName']);
     $gender = trim($post_vars['Gender']);
     $hireDate = trim($post_vars['HireDate']);
     if ($conn) {
         $queries = new Queries();
         $sqlCheck = $queries->checkFrameworkIfExistsById($id);
         $checkResult = mysqli_query($conn, $sqlCheck);
         if (mysqli_num_rows($checkResult) <= 0) {
             echo json_encode(array('error' => $id . ' does not exist.'));
         } else {
             $sqlQuery = $queries->updateFrameworkQuery($id, $birthDate, $firstName, $lastName, $gender, $hireDate);
             $result = mysqli_query($conn, $sqlQuery);
             if ($result) {
                 echo json_encode(array('success' => 'Updated ' . $id));
             } else {
                 echo json_encode(array('error' => 'Unable to Update ' . $id));
             }
         }
     } else {
         $connection = false;
         echo "There was an error, please contact web administrator.";
         return false;
     }
 }
Beispiel #19
0
 public function execute($pair)
 {
     global $conf;
     global $localUri;
     global $uri;
     global $acceptContentType;
     global $endpoints;
     global $lodspk;
     global $results;
     global $firstResults;
     list($res, $page, $format) = $pair;
     //If resource is not the page, send a 303 to the document
     if ($res == $localUri) {
         HTTPStatus::send303($page, $acceptContentType);
     }
     $uri = $res;
     if ($conf['mirror_external_uris'] != false) {
         $localUri = preg_replace("|^" . $conf['ns']['local'] . "|", $conf['basedir'], $res);
     }
     $extension = Utils::getExtension($format);
     /*Redefine Content type based on the
      * dcterms:format for this page
      */
     $acceptContentType = $format;
     //Check if files for model and view exist
     $t = Queries::getClass($uri, $endpoints['local']);
     $obj = $this->getModelandView($t, $extension);
     $modelFile = $obj['modelFile'];
     $lodspk['model'] = $conf['model']['directory'];
     $viewFile = $obj['viewFile'];
     $lodspk['view'] = $obj['view']['directory'];
     if ($viewFile == null) {
         $lodspk['transform_select_query'] = true;
     }
     $lodspk['type'] = $modelFile;
     $lodspk['home'] = $conf['basedir'];
     $lodspk['baseUrl'] = $conf['basedir'];
     $lodspk['module'] = 'type';
     $lodspk['root'] = $conf['root'];
     $lodspk['contentType'] = $acceptContentType;
     $lodspk['ns'] = $conf['ns'];
     $lodspk['endpoint'] = $conf['endpoint'];
     $lodspk['view'] = $conf['view']['directory'];
     $lodspk['add_mirrored_uris'] = true;
     $lodspk['this']['value'] = $uri;
     $lodspk['this']['curie'] = Utils::uri2curie($uri);
     $lodspk['local']['value'] = $localUri;
     $lodspk['local']['curie'] = Utils::uri2curie($localUri);
     $lodspk['this']['extension'] = $extension;
     //chdir($conf['home'].$conf['model']['directory']);
     Utils::queryFile($modelFile, $endpoints['local'], $results, $firstResults);
     if (!$lodspk['resultRdf']) {
         $results = Utils::internalize($results);
         $firstAux = Utils::getfirstResults($results);
         //chdir($conf['home']);
         if (is_array($results)) {
             $resultsObj = Convert::array_to_object($results);
             $results = $resultsObj;
         } else {
             $resultsObj = $results;
         }
         $lodspk['firstResults'] = Convert::array_to_object($firstAux);
     } else {
         $resultsObj = $results;
     }
     //chdir($conf['home'].$conf['model']['directory']);
     Utils::processDocument($viewFile, $lodspk, $resultsObj);
 }
Beispiel #20
0
 public static function ban($ip)
 {
     Queries::insertBan(Database::$table_bans, $ip);
 }
Beispiel #21
0
 *  http://minersrealm.org
 *
 *  License: MIT
 */
/*
 *  Convert WordPress to NamelessMC
 *  
 *  All ways Converts:
 *     - Users [Done]
 *     - Posts
 *  ...and if bbPress is installed additionally converts:
 *     - Forums
 *     - Topics and replies
 */
if (!isset($queries)) {
    $queries = new Queries();
}
/*
 *  First, check the database connection specified in the form submission
 */
$mysqli = new mysqli(Input::get("db_address"), Input::get("db_username"), Input::get("db_password"), Input::get("db_name"));
if ($mysqli->connect_errno) {
    header('Location: /install/?step=convert&convert=yes&from=wordpress&error=true');
    die;
}
/*
 *  Get the table prefix
 */
$prefix = '';
$inputted_prefix = Input::get('db_prefix');
if (!empty($inputted_prefix)) {
Beispiel #22
0
    if ($user == '' || $host == '' || $db == '') {
        $checkIniFile = false;
    } else {
        $checkDatabaseConnection = true;
        $dbConnection = mysql_connect($host, $user, $password) or $checkDatabaseConnection = false;
        if ($checkDatabaseConnection) {
            mysql_select_db($db) or $checkDatabaseConnection = false;
        }
    }
} else {
    $dbInfo = array('user' => '', 'password' => '', 'host' => '', 'db' => '');
}
if (isset($_REQUEST['action'])) {
    require_once 'utils.php';
    require_once 'queries.php';
    $QUERIES = new Queries();
    switch ($_REQUEST['action']) {
        case 'init':
            $useMotion = false;
            $usePeople = false;
            $useKalman = false;
            $trackingconf = file_get_contents('../script/trackingconf.conf');
            $parsed = explode("\n", $trackingconf);
            foreach ($parsed as $row) {
                $row = explode("=", $row);
                $key = trim($row[0]);
                $value = trim($row[1]);
                if (strcmp($key, "USE_MOTION") == 0) {
                    $useMotion = $value == 'True' ? true : false;
                } else {
                    if (strcmp($key, "USE_PEDESTRIAN_DETECTOR") == 0) {
Beispiel #23
0
<?php

/*
 *	Made by Samerton
 *  http://worldscapemc.co.uk
 *
 *  License: MIT
 */
// Require files
if (!isset($queries)) {
    require '../../core/config.php';
    require '../../core/classes/Config.php';
    require '../../core/classes/DB.php';
    require '../../core/classes/Queries.php';
    require '../../core/includes/arrays.php';
    $queries = new Queries();
} else {
    require 'core/includes/arrays.php';
}
if (isset($_GET["key"])) {
    $key = $queries->getWhere('settings', array('name', '=', 'unique_id'));
    if ($_GET["key"] !== $key[0]->value) {
        die('Invalid key');
    }
} else {
    die('Invalid key');
}
// Which donor store are we using?
$webstore = $queries->getWhere('donation_settings', array('name', '=', 'store_type'));
$webstore = $webstore[0]->value;
if ($webstore == 'bc') {
<p class="form-title">Listado de Lotes</p>
<?php 
if (!Forms::checkPermission(FORM_LOT_LIST)) {
    return;
}
require_once 'inc/class.item.php';
require_once 'inc/class.store.php';
require_once 'inc/class.queries.php';
$itemid = isset($_GET['item']) && is_numeric($_GET['item']) ? $_GET['item'] : "";
$storeid = isset($_GET['store']) && is_numeric($_GET['store']) ? $_GET['store'] : "";
$stores = Store::getAllActive("name");
$lots = Queries::getLotsFromItem($itemid, $storeid);
$item = new Item();
if ($itemid) {
    $item->read($itemid);
}
include 'inc/widget/error.php';
?>

<form action="index.php" method="GET">
	<input type="hidden" name="pages" value="lot_list"/>
	<input type="hidden" name="item" value="<?php 
echo $itemid;
?>
"/>
	Ver lotes por almacen:
	<select name="store">
	<option value="">- Todos -</option>
	<?php 
foreach ($stores as $store) {
    echo "<option value='{$store->id}'" . ($store->id == $storeid ? " selected='selected'" : "") . ">{$store->name}</option>";
Beispiel #25
0
<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);
#load models
include '../models/View.php';
include "../models/UserAccount.php";
include "../models/Crud.php";
include "../models/Queries.php";
#instantiate classes
$view = new View();
$user = new UserAccount();
$crud = new Crud();
$queries = new Queries();
#routes
if (!empty($_GET["action"])) {
    # =-=-=-=-=-=-= Route for Admin log in page =-=-=-=
    if ($_GET['action'] == "aDmInLoGIN") {
        $view->getView("../views/head.php");
        $view->getView("../views/nav.php");
        $view->getView("../views/loginForm.php");
    }
    # =-=-=-=-=-=-= Action to login=-=-=-=-=-=-=-=-=-=
    if ($_GET['action'] == "login") {
        $user->login();
    }
    # =-=-=-=-=-=-= Action to logout =-=-=-=-=-=-=-=-=-=
    if ($_GET["action"] == "logout") {
        $view->getView("../views/head.php");
        $view->getView("../views/footer.php");
    }
Beispiel #26
0
                 header("Location: register.php?error_message={$error_message}");
             } else {
                 if ($confirm_password != $account->password) {
                     $error_message = "Passwords do not match";
                     header("Location: register.php?error_message={$error_message}");
                 } else {
                     if ($confirm_email != $account->email) {
                         $error_message = "Emails do not match";
                         header("Location: register.php?error_message={$error_message}");
                     } else {
                         if ($error_message == "") {
                             $confirm_code = rand();
                             while (Queries::valueOccurances(Database::$table_temp, 'code', $confirm_code)) {
                                 $confirm_code = rand();
                             }
                             if (!Queries::instertValuesIntoTable(Database::$table_temp, array($confirm_code, $account->username, $account->password, $account->email))) {
                                 $error_message = "Error putting user into temporary database";
                                 header("Location: register.php?error_message={$error_message}");
                             }
                             $message = "Your confirmation link: \r\n";
                             $message .= "Click on this link to activate your account\n";
                             $message .= "http://bmetest.site40.net/confirm.php?passkey={$confirm_code}";
                             mail($account->email, 'Registration Confirmation', "{$message}");
                             header("Location: thankyou.html");
                         }
                     }
                 }
             }
         }
     }
 }
Beispiel #27
0
		  </label>
	    </div>
		<input type="hidden" name="user_avatars" value="0" />
	    <div class="checkbox">
		  <label>
		    <input type="checkbox" name="user_avatars" value="1"> Allow custom user avatars
		  </label>
            </div>
            <hr>
	    <input type="submit" class="btn btn-primary" value="Submit">
	  </form>
	  <?php 
                    } else {
                        if ($step === "account") {
                            if (!isset($queries)) {
                                $queries = new Queries();
                                // Initialise queries
                            }
                            $allow_mcnames = $queries->getWhere("settings", array("name", "=", "displaynames"));
                            $allow_mcnames = $allow_mcnames[0]->value;
                            // Can the user register with a non-Minecraft username?
                            if (Input::exists()) {
                                $validate = new Validate();
                                $data = array('email' => array('required' => true, 'min' => 2, 'max' => 64), 'password' => array('required' => true, 'min' => 6, 'max' => 64), 'password_again' => array('required' => true, 'matches' => 'password'));
                                if ($allow_mcnames === "false") {
                                    // Custom usernames are disabled
                                    $data['username'] = array('min' => 2, 'max' => 20, 'isvalid' => true);
                                } else {
                                    // Custom usernames are enabled
                                    $data['username'] = array('min' => 2, 'max' => 20);
                                    $data['mcname'] = array('min' => 2, 'max' => 20, 'isvalid' => true);
Beispiel #28
0
     $user = new User();
 }
 /*
  * If the user is logged in, update their "last IP" field for moderation purposes
  */
 if ($user->isLoggedIn()) {
     $ip = $user->getIP();
     if (filter_var($ip, FILTER_VALIDATE_IP)) {
         $user->update(array('lastip' => $ip));
     }
 }
 /*
  *  Initialise queries
  */
 if (!isset($queries)) {
     $queries = new Queries();
 }
 /*
  * Install file check 
  */
 if ($page === "admin") {
     clearstatcache();
     if (file_exists($path . "install.php")) {
         Session::flash('adm-alert', '<div class="alert alert-danger">The installation file (install.php) exists. Please remove it!</div>');
     }
 }
 /*
  * Maintenance mode 
  * TODO: Tidy up the message
  */
 if ($page === "forum") {
<?php

require_once 'inc/class.queries.php';
require_once 'inc/class.store.php';
$stores = Store::getAllActive('', '');
?>
<div style="font-size:0.9em">
	<p class="form-subtitle">Stock en almacenes</p>
	<?php 
foreach ($stores as $store) {
    echo "<table class='default' style='float:left;margin-right:0.2em'>";
    echo "<caption style='text-align:center'>{$store->name}</caption>";
    echo "<thead><tr><th>Item</th><th>Stock</td></tr></thead>";
    $itemsStock = Queries::getStock($store->id, "stock", "ASC", 10);
    foreach ($itemsStock as $row) {
        echo "<tr>";
        echo "<td>{$row['name']}</td>";
        echo "<td class='number" . ($row['stock'] < $row['stock_min'] ? " mandatory" : "") . "'>{$row['stock']}</td>";
        echo "</tr>";
    }
    echo "</table>";
}
?>
	<br style="clear:both"/>
	<p>Los items de <span class="mandatory">color</span> estan por debajo del stock m&iacute;nimo.</p>
</div>
<?php

/*
 *	Made by Samerton
 *  http://worldscapemc.co.uk
 *
 *  License: MIT
 */
if (!isset($queries)) {
    $queries = new Queries();
}
$API = $queries->getWhere("settings", array("name", "=", "buycraft_key"));
$API = $API[0]->value;
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, 'http://www.minecraftmarket.com/api/1.5/' . $API . '/gui');
$mm_gui = curl_exec($ch);
$mm_gui = json_decode(str_replace("&quot;", "\"", strip_tags($mm_gui)), true);
// Packages and categories
curl_setopt($ch, CURLOPT_URL, 'http://www.minecraftmarket.com/api/1.5/' . $API . '/recentdonor');
$mm_donors = curl_exec($ch);
$mm_donors = json_decode(str_replace("&quot;", "\"", strip_tags($mm_donors)), true);
curl_close($ch);