Added data/basic add functionality

This commit is contained in:
Timothy Warren 2012-08-31 20:18:23 +00:00
parent 844d37ad58
commit e91625300f
27 changed files with 693 additions and 212 deletions

View File

@ -30,14 +30,35 @@ abstract class Controller extends \miniMVC\Controller {
parent::__construct(); parent::__construct();
$this->load_model('meta\model'); $this->load_model('meta\model');
$this->load_model('meta\user_model'); $this->load_model('meta\user_model');
$this->session =& \miniMVC\Session::get_instance();
// Check if user is logged in
$this->check_login_status();
$this->page->build_header(); $this->page->build_header();
} }
/**
* Require user login for access
*/
private function check_login_status()
{
if ( ! isset($this->session->uid))
{
// Redirect to login
}
return;
}
/** /**
* Destruct controller and build page footer * Destruct controller and build page footer
*/ */
public function __destruct() public function __destruct()
{ {
$this->page->set_foot_js_group('js');
$this->page->build_footer(); $this->page->build_footer();
} }

View File

@ -134,4 +134,14 @@ define('DEFAULT_JS_GROUP', "js");
*/ */
define('SHOW_DEBUG_BACKTRACE', TRUE); define('SHOW_DEBUG_BACKTRACE', TRUE);
/*
|--------------------------------------------------------------------------
| Gzip compress
|--------------------------------------------------------------------------
|
| Whether or not use gzip compression on page output
|
*/
define('GZ_COMPRESS', FALSE);
// End of config.php // End of config.php

View File

@ -31,17 +31,18 @@
return array( return array(
// Default Paths // Default Paths
'default_controller' => 'welcome', 'default_controller' => 'welcome',
'default_module' => 'meta', 'default_module' => 'meta',
'genre' => 'meta/genre/index', 'genre' => 'meta/genre/index',
'genre/add' => 'meta/genre/add', 'genre/add' => 'meta/genre/add',
'category' => 'meta/category/index', 'category' => 'meta/category/index',
'category/add' => 'meta/category/add', 'category/add' => 'meta/category/add',
'category/detail' => 'meta/category/detail', 'category/detail' => 'meta/category/detail',
'section' => 'meta/section/index', 'section' => 'meta/section/index',
'section/add' => 'meta/section/add', 'section/add' => 'meta/section/add',
'section/detail' => 'meta/section/detail', 'data/add' => 'meta/data/add',
'404_route' => '', 'data/update' => 'meta/data/update',
'404_route' => '',
); );
// End of routes.php // End of routes.php

View File

@ -58,7 +58,7 @@ class category extends meta\controller {
} }
// Render the basic page // Render the basic page
$this->detail(-1); $this->detail($this->model->get_last_id('category'));
} }
/** /**
@ -78,7 +78,8 @@ class category extends meta\controller {
$data = array( $data = array(
'category' => $this->model->get_category_by_id($id), 'category' => $this->model->get_category_by_id($id),
'sections' => $this->model->get_sections($id), 'sections' => $this->model->get_category_outline_data($id),
'genre' => $this->model->get_genre_by_category($id),
'category_id' => $id 'category_id' => $id
); );

View File

@ -0,0 +1,66 @@
<?php
/**
* meta
*
* Hierarchial data tool
*
* @package meta
* @author Timothy J. Warren
* @copyright Copyright (c) 2012
* @link https://github.com/aviat4ion/meta
* @license http://philsturgeon.co.uk/code/dbad-license
*/
// --------------------------------------------------------------------------
/**
* Data Controller
*
* @package meta
*/
class data extends meta\controller {
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
}
/**
* View section data
*/
public function index()
{
}
/**
* Add data
*/
public function add()
{
$section_id = (int) $_POST['section_id'];
//$old_data = $this->model->get_data($section_id);
$keys = filter_var_array($_POST['name'], FILTER_SANITIZE_STRING);
$vals = filter_var_array($_POST['val'], FILTER_SANITIZE_STRING);
//echo miniMVC\to_string($_POST);
$data = array_combine($keys, $vals);
$res = /*(empty($old_data))
?*/ $this->model->add_data($section_id, $data);
//: FALSE;
($res)
? $this->page->set_message('success', 'Added data')
: $this->page->set_message('error', 'Data already exists');
}
}
// End of data.php

View File

@ -31,9 +31,26 @@ class section extends meta\controller {
/** /**
* Default controller method * Default controller method
*/ */
public function index() public function index($id=0)
{ {
$this->detail(); if ($id === 0)
{
$id = (int) miniMVC\get_last_segment();
}
if ($id === 0)
{
miniMVC\show_404();
}
$data = array(
'section' => $this->model->get_section_by_id($id),
'sdata' => $this->model->get_data($id),
'p' => $this->model->get_path_by_section($id),
'section_id' => $id
);
$this->load_view('section_detail', $data);
} }
/** /**
@ -58,33 +75,8 @@ class section extends meta\controller {
} }
// Render the basic page // Render the basic page
$this->detail(-1); $this->index($this->model->get_last_id('section'));
} }
/**
* Returns the sections / editing options for a category
*/
public function detail($id = 0)
{
if ($id === 0)
{
$id = (int) miniMVC\get_last_segment();
}
if ($id === 0)
{
miniMVC\show_404();
}
$data = array(
'section' => $this->model->get_section_by_id($id),
'data' => $this->model->get_data($id),
'section_id' => $id
);
$this->load_view('section_detail', $data);
}
} }
// End of section.php // End of section.php

View File

@ -54,9 +54,19 @@ class welcome extends \meta\controller {
{ {
$this->page->render('login'); $this->page->render('login');
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/**
* Logout
*/
public function logout()
{
}
// --------------------------------------------------------------------------
/** /**
* Display an outline of the data for a table of contents * Display an outline of the data for a table of contents
*/ */

View File

@ -47,6 +47,8 @@ class model extends \miniMVC\Model {
$this->db =& \miniMVC\db::get_instance(); $this->db =& \miniMVC\db::get_instance();
} }
// --------------------------------------------------------------------------
// ! Data Manipulation
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/** /**
@ -104,7 +106,7 @@ class model extends \miniMVC\Model {
// for databases that do not support // for databases that do not support
// grabbing result counts (SQLite / Firebird) // grabbing result counts (SQLite / Firebird)
$array = $query->fetchAll(); $array = $query->fetchAll();
if (count($array) === 0) if (count($array)< 1)
{ {
$this->db->set('genre', $genre) $this->db->set('genre', $genre)
->insert('genre'); ->insert('genre');
@ -118,21 +120,6 @@ class model extends \miniMVC\Model {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/**
* Rename a genre
*
* @param int
* @param string
*/
public function update_genre($genre_id, $genre)
{
$this->db->set('genre', $genre)
->where('id', $genre_id)
->update('genre');
}
// --------------------------------------------------------------------------
/** /**
* Add category to genre * Add category to genre
* *
@ -146,13 +133,14 @@ class model extends \miniMVC\Model {
$query = $this->db->from('category') $query = $this->db->from('category')
->where('genre_id', $genre_id) ->where('genre_id', $genre_id)
->where('category', $cat) ->where('category', $cat)
->limit(1)
->get(); ->get();
// Fetch the data as a workaround // Fetch the data as a workaround
// for databases that do not support // for databases that do not support
// grabbing result counts (SQLite / Firebird) // grabbing result counts (SQLite / Firebird)
$array = $query->fetchAll(); $array = $query->fetchAll();
if (count($array) === 0) if (count($array)< 1)
{ {
$this->db->set('category', $cat) $this->db->set('category', $cat)
->set('genre_id', $genre_id) ->set('genre_id', $genre_id)
@ -166,21 +154,6 @@ class model extends \miniMVC\Model {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/**
* Rename a category
*
* @param int
* @param string
*/
public function update_category($cat_id, $category)
{
$this->db->set('category', $category)
->where('id', (int) $cat_id)
->update('category');
}
// --------------------------------------------------------------------------
/** /**
* Add a section to a category * Add a section to a category
* *
@ -189,24 +162,27 @@ class model extends \miniMVC\Model {
*/ */
public function add_section($section, $category_id) public function add_section($section, $category_id)
{ {
$this->db->set('section', $section) // Check if the section exists
->set('category_id', (int) $category_id) $q = $this->db->from('section')
->insert('section'); ->where('category_id', $category_id)
} ->where('section', $section)
->limit(1)
->get();
// -------------------------------------------------------------------------- // Fetch the data as a workaround
// for databases that do not support
// grabbing result counts (SQLite / Firebird)
$array = $q->fetchAll();
if (count($array) < 1)
{
$this->db->set('section', $section)
->set('category_id', (int) $category_id)
->insert('section');
/** return TRUE;
* Rename a section }
*
* @param int return FALSE;
* @param string
*/
public function update_section($section_id, $section)
{
$this->db->set('section', $section)
->where('id', (int) $section_id)
->update('section');
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@ -219,13 +195,40 @@ class model extends \miniMVC\Model {
*/ */
public function add_data($section_id, $data) public function add_data($section_id, $data)
{ {
// Convert the data to json for storage foreach($data as $key => $val)
$data_str = json_encode($data); {
// See if the data exists
$q = $this->db->from('data')
->where('section_id', $section_id)
->where('key', $key)
->get();
// Save the data if ($this->db->num_rows() > 0) return FALSE;
$this->db->set('data', $data_str)
->set('section_id', (int) $section_id) // Save the data
->insert('data'); $this->db->set('key', $key)
->set('value', $val)
->set('section_id', (int) $section_id)
->insert('data');
}
return TRUE;
}
// --------------------------------------------------------------------------
/**
* Rename a genre/category/section
*
* @param string
* @param int
* @param string
*/
public function update($type, $id, $name)
{
$this->db->set($type, $name)
->where('id', (int) $id)
->update('genre');
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@ -248,6 +251,49 @@ class model extends \miniMVC\Model {
} }
// --------------------------------------------------------------------------
// ! Data Retrieval
// --------------------------------------------------------------------------
/**
* Get the id of the last item of the type
*
* @param string $type
* @return int
*/
public function get_last_id($type)
{
$query = $this->db->select('id')
->from($type)
->order_by('id', 'DESC')
->limit(1)
->get();
$r = $query->fetch(\PDO::FETCH_ASSOC);
return $r['id'];
}
// --------------------------------------------------------------------------
/**
* Get breadcrumb data for section
*
* @param section_id
* @return array
*/
public function get_path_by_section($section_id)
{
$query = $this->db->select('genre, genre_id, category, category_id')
->from('section s')
->join('category c', 'c.id=s.category_id')
->join('genre g', 'g.id=c.genre_id')
->where('s.id', $section_id)
->get();
return $query->fetch(\PDO::FETCH_ASSOC);
}
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/** /**
@ -313,6 +359,27 @@ class model extends \miniMVC\Model {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/**
* Get the genre name by category id
*
* @param int
* @return array
*/
public function get_genre_by_category($cat_id)
{
$query = $this->db->select('g.id, genre')
->from('genre g')
->join('category c', 'c.genre_id=g.id', 'inner')
->where('c.id', (int)$cat_id)
->get();
$row = $query->fetch(\PDO::FETCH_ASSOC);
return $row;
}
// --------------------------------------------------------------------------
/** /**
* Gets the name of the section from its id * Gets the name of the section from its id
* *
@ -393,21 +460,71 @@ class model extends \miniMVC\Model {
{ {
$data = array(); $data = array();
$query = $this->db->select('id, data') $query = $this->db->select('id, key, value')
->from('data') ->from('data')
->where('section_id', (int) $section_id) ->where('section_id', (int) $section_id)
->get(); ->get();
while($row = $query->fetch(\PDO::FETCH_ASSOC)) while($row = $query->fetch(\PDO::FETCH_ASSOC))
{ {
$data[$row['id']] = json_decode($row['data'], TRUE); $data[$row['id']] = array($row['key'] => str_replace("\n", "<br />", $row['value']));
} }
return $data; return $data;
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/**
* Get sections and data for a general data outline
*
* @param int $category_id
* @return array
*/
public function get_category_outline_data($category_id)
{
// Get the sections
$s_query = $this->db->from('section')
->where('category_id', (int) $category_id)
->get();
$sections = array();
while($row = $s_query->fetch(\PDO::FETCH_ASSOC))
{
$sections[$row['id']] = $row['section'];
}
// Get the data for the sections
$d_array = array();
if ( ! empty($sections))
{
$d_query = $this->db->from('data')
->where_in('section_id', array_keys($sections))
->get();
while($row = $d_query->fetch(\PDO::FETCH_ASSOC))
{
$d_array[$row['section_id']][$row['key']] = str_replace("\n", "<br />", $row['value']);
}
}
// Reorganize the data
$data = array();
foreach($sections as $section_id => $section)
{
$data[$section_id] = (isset($d_array[$section_id]))
? array($section, $d_array[$section_id])
: $section;
}
return $data;
}
// --------------------------------------------------------------------------
/** /**
* Get data for a full outline * Get data for a full outline
* *
@ -418,53 +535,53 @@ class model extends \miniMVC\Model {
// Get the genres // Get the genres
$g_query = $this->db->from('genre') $g_query = $this->db->from('genre')
->get(); ->get();
$genres = array(); $genres = array();
while ($row = $g_query->fetch(\PDO::FETCH_ASSOC)) while ($row = $g_query->fetch(\PDO::FETCH_ASSOC))
{ {
$genres[$row['id']] = $row['genre']; $genres[$row['id']] = $row['genre'];
} }
// Get the categories // Get the categories
$c_query = $this->db->from('category') $c_query = $this->db->from('category')
->get(); ->get();
$categories = array(); $categories = array();
while($row = $c_query->fetch(\PDO::FETCH_ASSOC)) while($row = $c_query->fetch(\PDO::FETCH_ASSOC))
{ {
$categories[$row['genre_id']][$row['id']] = $row['category']; $categories[$row['genre_id']][$row['id']] = $row['category'];
} }
// Get the sections // Get the sections
$s_query = $this->db->from('section') $s_query = $this->db->from('section')
->get(); ->get();
$sections = array(); $sections = array();
while($row = $s_query->fetch(\PDO::FETCH_ASSOC)) while($row = $s_query->fetch(\PDO::FETCH_ASSOC))
{ {
$sections[$row['category_id']][$row['id']] = $row['section']; $sections[$row['category_id']][$row['id']] = $row['section'];
} }
// Organize into a nested array // Organize into a nested array
foreach($genres as $genre_id => $genre) foreach($genres as $genre_id => $genre)
{ {
$return[$genre_id][$genre] = array(); $return[$genre_id][$genre] = array();
$g =& $return[$genre_id][$genre]; $g =& $return[$genre_id][$genre];
// Categories for this genre // Categories for this genre
if (isset($categories[$genre_id])) if (isset($categories[$genre_id]))
{ {
$g = $categories[$genre_id]; $g = $categories[$genre_id];
foreach($categories[$genre_id] as $category_id => $category) foreach($categories[$genre_id] as $category_id => $category)
{ {
$g[$category_id] = array($category => array()); $g[$category_id] = array($category => array());
$c =& $g[$category_id][$category]; $c =& $g[$category_id][$category];
// Sections for this category // Sections for this category
if (isset($sections[$category_id])) if (isset($sections[$category_id]))
{ {
@ -473,7 +590,7 @@ class model extends \miniMVC\Model {
} }
} }
} }
return $return; return $return;
} }

View File

@ -35,7 +35,7 @@ class user_model extends \miniMVC\Model {
* @var Bcrypt * @var Bcrypt
*/ */
protected $bcrypt; protected $bcrypt;
/** /**
* Reference to session * Reference to session
* *
@ -56,7 +56,7 @@ class user_model extends \miniMVC\Model {
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/** /**
* Add a user for access * Add a user for access
* *
@ -66,9 +66,29 @@ class user_model extends \miniMVC\Model {
*/ */
public function add_user($username, $pass1, $pass2) public function add_user($username, $pass1, $pass2)
{ {
// Check for the existing username
$query = $this->db->select('username')
->from('user')
->where('username', $username)
->get();
$res = $query->fetch(\PDO::FETCH_ASSOC);
if (empty($res)) return FALSE;
// Verify that passwords match
if ($pass1 !== $pass2) return FALSE;
// Add user
$hashed = $this->bcrypt->hash($pass1);
$this->db->set('username', $username)
->set('hash', $hashed)
->insert('user');
return TRUE;
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/** /**

View File

@ -1,15 +1,12 @@
<h3><?= $category ?></h3> <h2><?= $category ?></h2>
<h4>Category Sections</h4> <p class="breadcrumbs">
<ul class="list"> <a href="<?= miniMVC\site_url('') ?>">Genres</a> > <a href="<?= miniMVC\site_url('genres/detail/'.$genre['id']) ?>"><?= $genre['genre'] ?></a> > <?= $category ?>
<?php foreach($sections as $id => $section): ?> </p>
<li><a href="<?= miniMVC\site_url("section/detail/{$id}") ?>"><?= $section ?></a></li>
<?php endforeach ?>
</ul>
<form action="<?= miniMVC\site_url("section/add") ?>" method="post"> <form action="<?= miniMVC\site_url("section/add") ?>" method="post">
<fieldset> <fieldset>
<lengend>Add Section</lengend> <legend>Add Section</legend>
<dl> <dl>
<!-- Weird tag wrapping is intentional for display: inline-block --> <!-- Weird tag wrapping is intentional for display: inline-block -->
<dt><label for="section">Section name:</label></dt><dd> <dt><label for="section">Section name:</label></dt><dd>
@ -19,4 +16,30 @@
<button type="submit">Add Section</button></dd> <button type="submit">Add Section</button></dd>
</dl> </dl>
</fieldset> </fieldset>
</form> </form>
<ul class="list">
<?php foreach($sections as $id => $section): ?>
<?php if (is_array($section)) list($section, $d) = $section ?>
<li>
<h4><a href="<?= miniMVC\site_url("section/detail/{$id}") ?>"><?= $section ?></a></h4>
<?php if ( ! empty($d)): ?>
<?php foreach($d as $k => $v): ?>
<?php $class = (strpos($v, "<br />") !== FALSE) ? 'multiline' : 'pair' ?>
<dl class="<?= $class ?>">
<dt><?= $k ?></dt>
<dd><?= $v ?></dd>
</dl>
<?php endforeach ?>
<?php endif ?>
<?php $d = array(); // Don't let data linger ?>
</li>
<?php endforeach ?>
</ul>

View File

@ -0,0 +1,19 @@
<form method="post" action="<?= $action ?>">
<fieldset>
<legend>Edit <?= ucfirst($type) ?></legend>
<dl>
<?php if ($type != 'data'): ?>
<dt><label for="<?= $field_name ?>"><?= $type ?></label></dt>
<dd><input type="text" value="<?= $field_val ?>" name="<?= $field_name ?>" id="<?= $field_name ?>" /></dd>
<?php else: ?>
<dt><label for="key">Name:</label></dt>
<dd><input type="text" value="<?= $name ?>" id="name" name="name" /></dd>
<dt><label for="val">Value:</label></dt>
<dd><textarea name="val" rows="5" cols="40"><?= $val ?></textarea></dd>
<?php endif ?>
<dt><input type="hidden" name="<?= $type ?>_id" value="<?= $field_id ?>" /></dt>
<dd><button type="submit">Save Changes</button></dd>
</dl>
</fieldset>
</form>

View File

@ -1,15 +1,12 @@
<h3><?= $genre ?></h3> <h2><?= $genre ?></h2>
<h4>Genre Categories</h4> <p class="breadcrumbs">
<ul class="list"> <a href="<?= miniMVC\site_url('') ?>">Genres</a> > <?= $genre ?>
<?php foreach($categories as $id => $cat): ?> </p>
<li><a href="<?= miniMVC\site_url("category/detail/{$id}") ?>"><?= $cat ?></a></li>
<?php endforeach ?>
</ul>
<form action="<?= miniMVC\site_url("category/add") ?>" method="post"> <form action="<?= miniMVC\site_url("category/add") ?>" method="post">
<fieldset> <fieldset>
<lengend>Add Category</lengend> <legend>Add Category</legend>
<dl> <dl>
<!-- Weird tag wrapping is intentional for display: inline-block --> <!-- Weird tag wrapping is intentional for display: inline-block -->
<dt><label for="category">Category name:</label></dt><dd> <dt><label for="category">Category name:</label></dt><dd>
@ -19,4 +16,11 @@
<button type="submit">Add Category</button></dd> <button type="submit">Add Category</button></dd>
</dl> </dl>
</fieldset> </fieldset>
</form> </form>
<ul>
<?php foreach($categories as $id => $cat): ?>
<li><a href="<?= miniMVC\site_url("category/detail/{$id}") ?>"><?= $cat ?></a></li>
<?php endforeach ?>
</ul>

View File

@ -1,14 +1,8 @@
<h3>Genres</h3> <h2>Genres</h2>
<ul class="list">
<?php foreach($genres as $id => $name): ?>
<li><a href="<?= miniMVC\site_url("genre/{$id}") ?>"><?= $name ?></a></li>
<?php endforeach ?>
</ul>
<form action="<?= miniMVC\site_url("genre/add") ?>" method="post"> <form action="<?= miniMVC\site_url("genre/add") ?>" method="post">
<fieldset> <fieldset>
<lengend>Add Genre</lengend> <legend>Add Genre</legend>
<dl> <dl>
<!-- Weird tag wrapping is intentional for display: inline-block --> <!-- Weird tag wrapping is intentional for display: inline-block -->
<dt><label for="genre">Genre name:</label></dt><dd> <dt><label for="genre">Genre name:</label></dt><dd>
@ -18,4 +12,10 @@
<button type="submit">Add Genre</button></dd> <button type="submit">Add Genre</button></dd>
</dl> </dl>
</fieldset> </fieldset>
</form> </form>
<ul>
<?php foreach($genres as $id => $name): ?>
<li><a href="<?= miniMVC\site_url("genre/{$id}") ?>"><?= $name ?></a></li>
<?php endforeach ?>
</ul>

View File

@ -1,39 +1,47 @@
<h3>Data Outline</h3> <h2>Outline</h2>
<ul class="outline"> <dl class="outline">
<?php if (isset($outline)): ?> <?php if (isset($outline)): ?>
<?php foreach($outline as $genre_id => $genre_array): ?>
<?php foreach($outline as $genre_id => $genre_array): ?>
<?php foreach($genre_array as $genre => $cat_array): ?> <!-- Genres -->
<li> <?php foreach($genre_array as $genre => $cat_array): ?>
<a href="<?= \miniMVC\site_url("genre/{$genre_id}") ?>"><?= $genre ?></a> <dt>
<a href="<?= \miniMVC\site_url("genre/{$genre_id}") ?>"><?= $genre ?></a>
<?php foreach($cat_array as $cat_id => $cname_array): ?> </dt>
<ul> <dd>
<?php foreach($cname_array as $category => $sect_array): ?>
<li> <?php foreach($cat_array as $cat_id => $cname_array): ?>
<a href="<?= \miniMVC\site_url("category/{$cat_id}") ?>"><?= $category ?></a> <ul>
<!-- Categories -->
<?php if ( ! empty($sect_array)): ?> <?php foreach($cname_array as $category => $sect_array): ?>
<ul> <li>
<?php foreach($sect_array as $section_id => $section): ?> <a href="<?= \miniMVC\site_url("category/{$cat_id}") ?>"><?= $category ?></a>
<li>
<a href="<?= \miniMVC\site_url("section/{$section_id}") ?>"> <?php if ( ! empty($sect_array)): ?>
<?= $section ?> <ul>
</a> <!-- Sections -->
</li> <?php foreach($sect_array as $section_id => $section): ?>
<?php endforeach ?> <li>
</ul> <a href="<?= \miniMVC\site_url("section/{$section_id}") ?>">
<?php endif ?> <?= $section ?>
</a>
</li> </li>
<?php endforeach ?> <?php endforeach ?>
</ul> <!-- / Sections -->
<?php endforeach; ?> </ul>
<?php endif ?>
</li>
<?php endforeach ?> </li>
<?php endforeach ?>
<!-- / Categories -->
</ul>
<?php endforeach; ?>
</dd>
<?php endforeach ?> <?php endforeach ?>
<!-- / Genres -->
<?php endforeach ?>
<?php endif ?> <?php endif ?>
</ul> </dl>

View File

@ -1,8 +1,41 @@
<h3><?= $section ?></h3> <h2><?= $section ?></h2>
<h4>Section Data</h4> <p class="breadcrumbs">
<?php /*<ul class="list"> <a href="<?= miniMVC\site_url('') ?>">Genres</a> >
<?php foreach($data as $id => $d): ?> <a href="<?= miniMVC\site_url('genres/detail/'.$p['genre_id']) ?>"><?= $p['genre'] ?></a> >
<li><a href="<?= miniMVC\site_url("section/detail/{$id}") ?>"><?= $section ?></a></li> <a href="<?= miniMVC\site_url('category/detail/'.$p['category_id']) ?>"><?= $p['category'] ?></a> >
<?php endforeach ?> <?= $section ?>
</ul> */ ?> </p>
<form action="<?= miniMVC\site_url("data/add") ?>" method="post">
<fieldset>
<legend>Add Data</legend>
<dl>
<!-- Weird tag wrapping is intentional for display: inline-block -->
<dt><label for="name">Name:</label></dt><dd>
<input type="text" name="name[]" id="section" /></dd>
<dt><label for="val">Value:</label></dt><dd>
<textarea name="val[]" rows="5" cols="40"></textarea></dd>
<dt><input type="hidden" name="section_id" value="<?= $section_id ?>" /></dt><dd>
<button type="submit">Save Data</button></dd>
</dl>
</fieldset>
</form>
<?php if ( ! empty($sdata)): ?>
<?php foreach($sdata as $d): ?>
<?php foreach($d as $k => $v): ?>
<?php $class = (strpos($v, "<br />") !== FALSE) ? 'multiline' : 'pair' ?>
<dl class="<?= $class ?>">
<dt><?= $k ?></dt>
<dd><?= $v ?></dd>
</dl>
<?php endforeach ?>
<?php endforeach ?>
<?php endif ?>

View File

@ -0,0 +1,33 @@
<?php
/**
* meta
*
* Hierarchial data tool
*
* @package meta
* @author Timothy J. Warren
* @copyright Copyright (c) 2012
* @link https://github.com/aviat4ion/meta
* @license http://philsturgeon.co.uk/code/dbad-license
*/
// --------------------------------------------------------------------------
/**
* Setup Controller
*
* @package meta
*/
class setup extends \meta\controller {
/**
* Constuctor
*/
public function __construct()
{
}
}
// End of setup.php

View File

@ -9,4 +9,4 @@
<?= $head_js ?> <?= $head_js ?>
</head> </head>
<body<?= (!empty($body_class)) ? "class=\"" . $body_class . "\"" : ""; ?><?= (!empty($body_id)) ? " id=\"" . $body_id . "\"" : ""; ?>> <body<?= (!empty($body_class)) ? "class=\"" . $body_class . "\"" : ""; ?><?= (!empty($body_id)) ? " id=\"" . $body_id . "\"" : ""; ?>>
<h1>Meta</h1> <h1><a href="<?= miniMVC\site_url('') ?>">Meta</a></h1>

View File

@ -73,4 +73,4 @@ $path_to = '';
| The folder where javascript files exist, in relation to the document root | The folder where javascript files exist, in relation to the document root
| |
*/ */
$js_root = $document_root. '/js/'; $js_root = $document_root. 'js/';

View File

@ -16,8 +16,8 @@
/** /**
* This is the config array for javascript files to concatenate and minify * This is the config array for javascript files to concatenate and minify
*/ */
return [ return array(
/* /*=
For each group create an array like so For each group create an array like so
'my_group' => array( 'my_group' => array(
@ -25,4 +25,9 @@ return [
'path/to/css/file2.css' 'path/to/css/file2.css'
), ),
*/ */
];
'js' => array(
'kis-lite-dom-min.js',
'meta.js'
),
);

View File

@ -6,6 +6,11 @@ html, body {
font-weight:200; font-weight:200;
max-width:800px; max-width:800px;
margin: 0 auto; margin: 0 auto;
color:#312;
}
button {
color:#312;
} }
a { a {
@ -16,6 +21,26 @@ a:hover {
text-decoration:underline; text-decoration:underline;
} }
legend {
display:block;
}
legend:hover {
cursor:pointer;
}
h1,h2 {
display:-moz-inline-box;
display:inline-block;
vertical-align:middle;
width:25%;
}
/* Hide forms by default */
fieldset dl {
display:none;
}
/* form styles */ /* form styles */
form dt, form dd { form dt, form dd {
display:-moz-inline-box; /* For older versions of Mozilla/Firefox */ display:-moz-inline-box; /* For older versions of Mozilla/Firefox */
@ -35,3 +60,52 @@ form dd {
padding-left:.25em; padding-left:.25em;
} }
/* Outline styles */
.list {
padding:0;
margin:0;
}
.list dl {
margin-left:0.5em;
}
.list li {
list-style:none;
}
/* Data listing styles */
dl.multiline, dl.pair {
border-bottom:1px dotted #312;
}
dl.multiline dt {
font-weight:bold;
line-height:1.5;
font-size:1em;
margin:0;
}
dl.multiline dd {
margin:1em;
margin-right:0;
}
dl.pair dt, dl.pair dd {
display:-moz-inline-block;
display:inline-block;
padding:0.25em 0;
}
dl.pair dt {
width:35%;
}
dl.pair dd {
width:64%;
margin-left:0;
padding-left:0;
}

View File

@ -12,6 +12,7 @@
*/ */
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
error_reporting(-1);
/** /**
* JS Minifier and Cacher * JS Minifier and Cacher
@ -45,7 +46,7 @@ function get_files()
$js = ''; $js = '';
foreach ($groups[$_GET['g']] as &$file) foreach ($groups[$_GET['g']] as $file)
{ {
$new_file = realpath($js_root.$file); $new_file = realpath($js_root.$file);
$js .= file_get_contents($new_file); $js .= file_get_contents($new_file);
@ -69,9 +70,13 @@ function google_min($new_file)
$ch = curl_init('http://closure-compiler.appspot.com/compile'); $ch = curl_init('http://closure-compiler.appspot.com/compile');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POST, 1);
//curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'output_info=compiled_code&output_format=text&compilation_level=SIMPLE_OPTIMIZATIONS&js_code=' . urlencode($new_file)); curl_setopt($ch, CURLOPT_POSTFIELDS, 'output_info=compiled_code&output_format=text&compilation_level=SIMPLE_OPTIMIZATIONS&js_code=' . urlencode($new_file));
$output = curl_exec($ch); $output = curl_exec($ch);
//die(curl_getinfo($ch, CURLINFO_HTTP_CODE));
curl_close($ch); curl_close($ch);
return $output; return $output;
} }
@ -150,7 +155,8 @@ if ($last_modified === $requested_time)
//Determine what to do: rebuild cache, send files as is, or send cache. //Determine what to do: rebuild cache, send files as is, or send cache.
if ($cache_modified < $last_modified) if ($cache_modified < $last_modified)
{ {
$js = google_min(get_files()); $js = get_files();
$js = google_min($js);
$cs = file_put_contents($cache_file, $js); $cs = file_put_contents($cache_file, $js);
//Make sure cache file gets created/updated //Make sure cache file gets created/updated
@ -174,7 +180,7 @@ else
//This GZIPs the js for transmission to the user //This GZIPs the js for transmission to the user
//making file size smaller and transfer rate quicker //making file size smaller and transfer rate quicker
ob_start("ob_gzhandler"); //ob_start("ob_gzhandler");
header("Content-Type: text/javascript; charset=utf8"); header("Content-Type: text/javascript; charset=utf8");
header("Cache-control: public, max-age=691200, must-revalidate"); header("Cache-control: public, max-age=691200, must-revalidate");
@ -183,6 +189,6 @@ header("Expires: ".gmdate('D, d M Y H:i:s', (filemtime($this_file) + 691200))."
echo $js; echo $js;
ob_end_flush(); //ob_end_flush();
//end of js.php //end of js.php

17
assets/js/cache/js vendored Normal file
View File

@ -0,0 +1,17 @@
(function(){if("undefined"!==typeof document.querySelector){var d,e,b,c;d=function(a){c="undefined"===typeof a?"undefined"!==typeof d.el?d.el:document.documentElement:"object"!==typeof a?e(a):a;d.prototype.el=c;var a=b(d),f;for(f in a)"object"===typeof a[f]&&(a[f].el=c);a.el=c;return a};e=function(a,f){var b;if("string"!=typeof a||"undefined"===typeof a)return a;b=null!=f&&1===f.nodeType?f:document;if(a.match(/^#([\w\-]+$)/))return document.getElementById(a.split("#")[1]);b=b.querySelectorAll(a);
return 1===b.length?b[0]:b};b=function(a){var f;if("undefined"!==typeof a){if("undefined"!==typeof Object.create)return Object.create(a);f=typeof a;if(!("object"!==f&&"function"!==f))return f=function(){},f.prototype=a,new f}};d.ext=function(a,f){f.el=c;d[a]=f};d.ext("each",function(a){if("undefined"!==typeof c.length&&c!==window)if("undefined"!==typeof Array.prototype.forEach)[].forEach.call(c,a);else{var f=c.length;if(0!==f)for(var b,d=0;d<f;d++)b=c.item(d)?c.item(d):c[d],a.call(b,b)}else a.call(c,
c)});d.type=function(a){return function(){return a&&a!==this}.call(a)?(typeof a).toLowerCase():{}.toString.call(a).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()};d=window.$_=window.$_||d;d.$=e}})();"undefined"===typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,"")});
"undefined"===typeof Event.preventDefault&&"undefined"!==typeof window.event&&(Event.prototype.preventDefault=function(){window.event.returnValue=!1},Event.prototype.stopPropagation=function(){window.event.cancelBubble=!0});"undefined"===typeof Array.isArray&&(Array.isArray=function(d){return"[object Array]"===Object.prototype.toString.apply(d)});
(function(){if("undefined"!==typeof window.XMLHttpRequest){var d={_do:function(d,b,c,a,f){var g=new XMLHttpRequest;"undefined"===typeof c&&(c=function(){});f=f?"POST":"GET";d+="GET"===f?"?"+this._serialize(b):"";g.open(f,d);g.onreadystatechange=function(){4===g.readyState&&(200===g.status?c.call(g.responseText,g.responseText):"undefined"!==typeof a&&a.call(g.status,g.status))};"POST"===f?(g.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),g.send(this._serialize(b))):g.send(null)},
_serialize:function(d){var b,c,a=[];for(b in d)d.hasOwnProperty(b)&&"function"!==typeof d[b]&&(c=d[b].toString(),b=encodeURIComponent(b),c=encodeURIComponent(c),a.push(b+"="+c));return a.join("&")}};$_.ext("get",function(e,b,c,a){d._do(e,b,c,a,!1)});$_.ext("post",function(e,b,c,a){d._do(e,b,c,a,!0)});$_.ext("sse",function(d,b){var c;"undefined"!==typeof EventSource&&(c=new EventSource(d),c.onmessage=function(a){b.call(a.data,a.data)})})}})();
(function(){var d,e,b,c;"undefined"!==typeof document.addEventListener?(d=function(a,b,c){"undefined"!==typeof a.addEventListener&&a.addEventListener(b,c,!1)},e=function(a,b,c){"undefined"!==typeof a.removeEventListener&&a.removeEventListener(b,c,!1)}):"undefined"!==typeof document.attachEvent&&(d=function(a,b,c){function d(a){c.apply(a)}"undefined"!==typeof a.attachEvent&&(e(b,c),a.attachEvent("on"+b,d),a=a.KIS_0_6_0=a.KIS_0_6_0||{},a.listeners=a.listeners||{},a.listeners[b]=a.listeners[b]||[],a.listeners[b].push({callback:c,
_listener:d}))},e=function(a,b,c){if("undefined"!==typeof a.detachEvent){var d=a.KIS_0_6_0;if(d&&d.listeners&&d.listeners[b])for(var e=d.listeners[b],k=e.length,i=0;i<k;i++)if(e[i].callback===c){a.detachEvent("on"+b,e[i]._listener);e.splice(i,1);0===e.length&&delete d.listeners[b];break}}});b=function(a,c,g,h){var j,k;if(typeof a==="undefined")return null;if(c.match(/^([\w\-]+)$/))h===true?d(a,c,g):e(a,c,g);else{c=c.split(" ");k=c.length;for(j=0;j<k;j++)b(a,c[j],g,h)}};c=function(a,c,d,e){b(a,d,function(b){var d,
i,g,b=b||window.event;i=$_.$(c,a);for(d in i){g=b.target||b.srcElement;if(g==i[d]){e.call(i[d],b);b.stopPropagation()}}},true)};$_.ext("event",{add:function(a,c){$_.each(function(d){b(d,a,c,true)})},remove:function(a,c){$_.each(function(d){b(d,a,c,false)})},live:function(a,b,d){c(document.documentElement,a,b,d)},delegate:function(a,b,d){$_.each(function(e){c(e,a,b,d)})}})})();
"undefined"!==typeof document&&!("classList"in document.createElement("a"))&&function(d){var d=(d.HTMLElement||d.Element).prototype,e=Object,b=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},c=Array.prototype.indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1},a=function(a,b){this.name=a;this.code=DOMException[a];this.message=b},f=function(b,d){if(""===d)throw new a("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(d))throw new a("INVALID_CHARACTER_ERR",
"String contains an invalid character");return c.call(b,d)},g=function(a){for(var c=b.call(a.className),c=c?c.split(/\s+/):[],d=0,f=c.length;d<f;d++)this.push(c[d]);this._updateClassName=function(){a.className=this.toString()}},h=g.prototype=[],j=function(){return new g(this)};a.prototype=Error.prototype;h.item=function(a){return this[a]||null};h.contains=function(a){return-1!==f(this,a+"")};h.add=function(a){a+="";-1===f(this,a)&&(this.push(a),this._updateClassName())};h.remove=function(a){a=f(this,
a+"");-1!==a&&(this.splice(a,1),this._updateClassName())};h.toggle=function(a){a+="";-1===f(this,a)?this.add(a):this.remove(a)};h.toString=function(){return this.join(" ")};if(e.defineProperty){h={get:j,enumerable:!0,configurable:!0};try{e.defineProperty(d,"classList",h)}catch(k){-2146823252===k.number&&(h.enumerable=!1,e.defineProperty(d,"classList",h))}}else e.prototype.__defineGetter__&&d.__defineGetter__("classList",j)}(self);
(function(){function d(b,c,a){var d,e;"undefined"!==typeof b.hasAttribute?(b.hasAttribute(c)&&(d=b.getAttribute(c)),e=!0):"undefined"!==typeof b[c]?(d=b[c],e=!1):"class"===c&&"undefined"!==typeof b.className&&(c="className",d=b.className,e=!1);if("undefined"===typeof d&&("undefined"===typeof a||null===a))return null;if("undefined"===typeof a)return d;"undefined"!==typeof a&&null!==a?!0===e?b.setAttribute(c,a):b[c]=a:null===a&&(!0===e?b.removeAttribute(c):delete b[c]);return"undefined"!==typeof a?
a:d}function e(b,c,a){var d,c=c.replace(/(\-[a-z])/g,function(a){return a.toUpperCase().replace("-","")});d={outerHeight:"offsetHeight",outerWidth:"offsetWidth",top:"posTop"};if("undefined"===typeof a&&"undefined"!==b.style[c])return b.style[c];if("undefined"===typeof a&&"undefined"!==b.style[d[c]])return b.style[d[c]];if("undefined"!==typeof b.style[c])return b.style[c]=a,null;if(b.style[d[c]])return b.style[d[c]]=a,null}$_.ext("dom",{addClass:function(b){$_.each(function(c){c.classList.add(b)})},
removeClass:function(b){$_.each(function(c){c.classList.remove(b)})},hide:function(){this.css("display","none")},show:function(b){"undefined"===typeof b&&(b="block");this.css("display",b)},attr:function(b,c){var a=this.el;if(1<a.length&&"undefined"===typeof c)return null;if(1<a.length&&"undefined"!==typeof c)$_.each(function(a){return d(a,b,c)});else return d(a,b,c)},text:function(b){var c,a,d;d=this.el;a="undefined"!==typeof d.textContent?"textContent":"undefined"!==typeof d.innerText?"innerText":
"innerHTML";c=d[a];return"undefined"!==typeof b?d[a]=b:c},css:function(b,c){if("undefined"===typeof c)return e(this.el,b);$_.each(function(a){e(a,b,c)})},append:function(b){"undefined"!==typeof document.insertAdjacentHTML?this.el.insertAdjacentHTML("beforeend",b):this.el.innerHTML+=b},prepend:function(b){"undefined"!==typeof document.insertAdjacentHTML?this.el.insertAdjacentHTML("afterbegin",b):this.el.innerHTML=b+this.el.innerHTML},html:function(b){"undefined"!==typeof b&&(this.el.innerHTML=b);return this.el.innerHTML}})})();
(function(){$_("fieldset dl").dom.hide();$_("fieldset legend").event.add("click",function(){var d=$_("fieldset dl").dom;"none"==d.css("display").trim()?d.show():d.hide()})})();

17
assets/js/kis-lite-dom-min.js vendored Executable file
View File

@ -0,0 +1,17 @@
(function(){if("undefined"!==typeof document.querySelector){var d,e,b,c;d=function(a){c="undefined"===typeof a?"undefined"!==typeof d.el?d.el:document.documentElement:"object"!==typeof a?e(a):a;d.prototype.el=c;var a=b(d),f;for(f in a)"object"===typeof a[f]&&(a[f].el=c);a.el=c;return a};e=function(a,f){var b;if("string"!=typeof a||"undefined"===typeof a)return a;b=null!=f&&1===f.nodeType?f:document;if(a.match(/^#([\w\-]+$)/))return document.getElementById(a.split("#")[1]);b=b.querySelectorAll(a);
return 1===b.length?b[0]:b};b=function(a){var f;if("undefined"!==typeof a){if("undefined"!==typeof Object.create)return Object.create(a);f=typeof a;if(!("object"!==f&&"function"!==f))return f=function(){},f.prototype=a,new f}};d.ext=function(a,f){f.el=c;d[a]=f};d.ext("each",function(a){if("undefined"!==typeof c.length&&c!==window)if("undefined"!==typeof Array.prototype.forEach)[].forEach.call(c,a);else{var f=c.length;if(0!==f)for(var b,h=0;h<f;h++)b=c.item(h)?c.item(h):c[h],a.call(b,b)}else a.call(c,
c)});d.type=function(a){return function(){return a&&a!==this}.call(a)?(typeof a).toLowerCase():{}.toString.call(a).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()};d=window.$_=window.$_||d;d.$=e}})();"undefined"===typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,"")});
"undefined"===typeof Event.preventDefault&&"undefined"!==typeof window.event&&(Event.prototype.preventDefault=function(){window.event.returnValue=false},Event.prototype.stopPropagation=function(){window.event.cancelBubble=true});"undefined"===typeof Array.isArray&&(Array.isArray=function(d){return Object.prototype.toString.apply(d)==="[object Array]"});
(function(){if(typeof window.XMLHttpRequest!=="undefined"){var d={_do:function(d,b,c,a,f){var g=new XMLHttpRequest;typeof c==="undefined"&&(c=function(){});f=f?"POST":"GET";d=d+(f==="GET"?"?"+this._serialize(b):"");g.open(f,d);g.onreadystatechange=function(){g.readyState===4&&(g.status===200?c.call(g.responseText,g.responseText):typeof a!=="undefined"&&a.call(g.status,g.status))};if(f==="POST"){g.setRequestHeader("Content-Type","application/x-www-form-urlencoded");g.send(this._serialize(b))}else g.send(null)},
_serialize:function(d){var b,c,a=[];for(b in d)if(d.hasOwnProperty(b)&&typeof d[b]!=="function"){c=d[b].toString();b=encodeURIComponent(b);c=encodeURIComponent(c);a.push(b+"="+c)}return a.join("&")}};$_.ext("get",function(e,b,c,a){d._do(e,b,c,a,false)});$_.ext("post",function(e,b,c,a){d._do(e,b,c,a,true)});$_.ext("sse",function(d,b){var c;if(typeof EventSource!=="undefined"){c=new EventSource(d);c.onmessage=function(a){b.call(a.data,a.data)}}})}})();
(function(){var d,e,b,c;if(typeof document.addEventListener!=="undefined"){d=function(a,b,c){typeof a.addEventListener!=="undefined"&&a.addEventListener(b,c,false)};e=function(a,b,c){typeof a.removeEventListener!=="undefined"&&a.removeEventListener(b,c,false)}}else if(typeof document.attachEvent!=="undefined"){d=function(a,b,c){function d(a){c.apply(a)}if(typeof a.attachEvent!=="undefined"){e(b,c);a.attachEvent("on"+b,d);a=a.KIS_0_6_0=a.KIS_0_6_0||{};a.listeners=a.listeners||{};a.listeners[b]=a.listeners[b]||
[];a.listeners[b].push({callback:c,_listener:d})}};e=function(a,b,c){if(typeof a.detachEvent!=="undefined"){var d=a.KIS_0_6_0;if(d&&d.listeners&&d.listeners[b])for(var e=d.listeners[b],k=e.length,i=0;i<k;i++)if(e[i].callback===c){a.detachEvent("on"+b,e[i]._listener);e.splice(i,1);e.length===0&&delete d.listeners[b];break}}}}b=function(a,c,g,h){var j,k;if(typeof a==="undefined")return null;if(c.match(/^([\w\-]+)$/))h===true?d(a,c,g):e(a,c,g);else{c=c.split(" ");k=c.length;for(j=0;j<k;j++)b(a,c[j],
g,h)}};c=function(a,c,d,e){b(a,d,function(b){var d,i,g,b=b||window.event;i=$_.$(c,a);for(d in i){g=b.target||b.srcElement;if(g==i[d]){e.call(i[d],b);b.stopPropagation()}}},true)};$_.ext("event",{add:function(a,c){$_.each(function(d){b(d,a,c,true)})},remove:function(a,c){$_.each(function(d){b(d,a,c,false)})},live:function(a,b,d){c(document.documentElement,a,b,d)},delegate:function(a,b,d){$_.each(function(e){c(e,a,b,d)})}})})();
"undefined"!==typeof document&&!("classList"in document.createElement("a"))&&function(d){var d=(d.HTMLElement||d.Element).prototype,e=Object,b=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},c=Array.prototype.indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1},a=function(a,b){this.name=a;this.code=DOMException[a];this.message=b},f=function(b,d){if(d==="")throw new a("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(d))throw new a("INVALID_CHARACTER_ERR",
"String contains an invalid character");return c.call(b,d)},g=function(a){for(var c=b.call(a.className),c=c?c.split(/\s+/):[],d=0,f=c.length;d<f;d++)this.push(c[d]);this._updateClassName=function(){a.className=this.toString()}},h=g.prototype=[],j=function(){return new g(this)};a.prototype=Error.prototype;h.item=function(a){return this[a]||null};h.contains=function(a){return f(this,a+"")!==-1};h.add=function(a){a=a+"";if(f(this,a)===-1){this.push(a);this._updateClassName()}};h.remove=function(a){a=
f(this,a+"");if(a!==-1){this.splice(a,1);this._updateClassName()}};h.toggle=function(a){a=a+"";f(this,a)===-1?this.add(a):this.remove(a)};h.toString=function(){return this.join(" ")};if(e.defineProperty){h={get:j,enumerable:true,configurable:true};try{e.defineProperty(d,"classList",h)}catch(k){if(k.number===-2146823252){h.enumerable=false;e.defineProperty(d,"classList",h)}}}else e.prototype.__defineGetter__&&d.__defineGetter__("classList",j)}(self);
(function(){function d(b,c,a){var d,e;if(typeof b.hasAttribute!=="undefined"){b.hasAttribute(c)&&(d=b.getAttribute(c));e=true}else if(typeof b[c]!=="undefined"){d=b[c];e=false}else if(c==="class"&&typeof b.className!=="undefined"){c="className";d=b.className;e=false}if(typeof d==="undefined"&&(typeof a==="undefined"||a===null))return null;if(typeof a==="undefined")return d;typeof a!=="undefined"&&a!==null?e===true?b.setAttribute(c,a):b[c]=a:a===null&&(e===true?b.removeAttribute(c):delete b[c]);return typeof a!==
"undefined"?a:d}function e(b,c,a){var d,c=c.replace(/(\-[a-z])/g,function(a){return a.toUpperCase().replace("-","")});d={outerHeight:"offsetHeight",outerWidth:"offsetWidth",top:"posTop"};if(typeof a==="undefined"&&b.style[c]!=="undefined")return b.style[c];if(typeof a==="undefined"&&b.style[d[c]]!=="undefined")return b.style[d[c]];if(typeof b.style[c]!=="undefined"){b.style[c]=a;return null}if(b.style[d[c]]){b.style[d[c]]=a;return null}}$_.ext("dom",{addClass:function(b){$_.each(function(c){c.classList.add(b)})},
removeClass:function(b){$_.each(function(c){c.classList.remove(b)})},hide:function(){this.css("display","none")},show:function(b){typeof b==="undefined"&&(b="block");this.css("display",b)},attr:function(b,c){var a=this.el;if(a.length>1&&typeof c==="undefined")return null;if(a.length>1&&typeof c!=="undefined")$_.each(function(a){return d(a,b,c)});else return d(a,b,c)},text:function(b){var c,a,d;d=this.el;a=typeof d.textContent!=="undefined"?"textContent":typeof d.innerText!=="undefined"?"innerText":
"innerHTML";c=d[a];if(typeof b!=="undefined")return d[a]=b;return c},css:function(b,c){if(typeof c==="undefined")return e(this.el,b);$_.each(function(a){e(a,b,c)})},append:function(b){typeof document.insertAdjacentHTML!=="undefined"?this.el.insertAdjacentHTML("beforeend",b):this.el.innerHTML=this.el.innerHTML+b},prepend:function(b){typeof document.insertAdjacentHTML!=="undefined"?this.el.insertAdjacentHTML("afterbegin",b):this.el.innerHTML=b+this.el.innerHTML},html:function(b){if(typeof b!=="undefined")this.el.innerHTML=
b;return this.el.innerHTML}})})();

View File

@ -1,14 +1,15 @@
var meta = (function (){ (function() {
"use strict";
var meta = window.meta || {}; "use strict";
meta.addItem = function() { // Show/hide forms based on use
$_("fieldset dl").dom.hide();
$_("fieldset legend").event.add('click', function(e){
var form = $_("fieldset dl").dom;
}; (form.css('display').trim() == 'none')
? form.show()
: form.hide();
});
}());
// Return the object to the global scope
return meta;
)());

View File

@ -156,7 +156,7 @@ class Page {
if ( ! empty($this->buffer)) if ( ! empty($this->buffer))
{ {
//ob_start('ob_gzhandler'); (GZ_COMPRESS) ? ob_start('ob_gzhandler') : ob_start();
echo $this->buffer; echo $this->buffer;

2
sys/db

@ -1 +1 @@
Subproject commit 90c676019652341836edd7bf71dfc70979341810 Subproject commit 4c546ed3e90aa371053290ed4842fd9cad7f175c

View File

@ -44,9 +44,12 @@ class Session {
{ {
session_start(); session_start();
// Create a re-generatable id using a hash of the user's ip address and user agent
$session_id = sha1($_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT']);
// Save a reference to the session for later access // Save a reference to the session for later access
$_SESSION['MM_SESSION'] = (isset($_SESSION['MM_SESSION'])) ?: array(); $_SESSION[$session_id] = (isset($_SESSION[$session_id])) ?: array();
$this->sess =& $_SESSION['MM_SESSION']; $this->sess =& $_SESSION[$session_id];
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------