1
0

Get rid of the 3.1/obsolete dir as well as the obsolete rescue module

This commit is contained in:
Bharat Mediratta 2010-10-08 12:52:55 -07:00
parent 2c76bd7eeb
commit 3640bd60bb
167 changed files with 0 additions and 27751 deletions

View File

@ -1,74 +0,0 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2010 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class rescue_task_Core {
static function available_tasks() {
return array(Task_Definition::factory()
->callback("rescue_task::fix_internet_addresses")
->name(t("Fix internet addresses"))
->description(t("Fix internet addresses broken when upgrading to Beta 3"))
->severity(log::SUCCESS),
);
}
static function fix_internet_addresses($task) {
$start = microtime(true);
$total = $task->get("total");
if (empty($total)) {
$task->set("total", $total = db::build()->count_records("items"));
$task->set("last_id", 0);
$task->set("completed", 0);
}
$last_id = $task->get("last_id");
$completed = $task->get("completed");
foreach (ORM::factory("item")
->where("id", ">", $last_id)
->find_all(100) as $item) {
$item->slug = item::convert_filename_to_slug($item->slug);
$item->save();
$last_id = $item->id;
$completed++;
if ($completed == $total || microtime(true) - $start > 1.5) {
break;
}
}
$task->set("completed", $completed);
$task->set("last_id", $last_id);
if ($total == $completed) {
$task->done = true;
$task->state = "success";
$task->percent_complete = 100;
db::build()
->update("items")
->set("relative_path_cache", null)
->set("relative_url_cache", null)
->execute();
} else {
$task->percent_complete = round(100 * $completed / $total);
}
$task->status = t2("One row updated", "%count / %total rows updated", $completed,
array("total" => $total));
}
}

View File

@ -1,3 +0,0 @@
name = "Rescue"
description = "Fix problems in your Gallery 3 install"
version = 1

View File

@ -1,320 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed. This file is automatically ran by index.php.'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Kohana Installation</title>
<style type="text/css">
body {
width: 42em;
margin: 0 auto;
font-family: sans-serif;
font-size: 90%;
}
#tests table {
border-collapse: collapse;
width: 100%;
}
#tests table th, #tests table td {
padding: 0.2em 0.4em;
text-align: left;
vertical-align: top;
}
#tests table th {
width: 12em;
font-weight: normal;
font-size: 1.2em;
}
#tests table tr:nth-child(odd) {
background: #eee;
}
#tests table td.pass {
color: #191;
}
#tests table td.fail {
color: #911;
}
#tests #results {
color: #fff;
}
#tests #results p {
padding: 0.8em 0.4em;
}
#tests #results p.pass {
background: #191;
}
#tests #results p.fail {
background: #911;
}
</style>
</head>
<body>
<h1>Environment Tests</h1>
<p>
The following tests have been run to determine if Kohana will work in your environment. If any of the tests have failed, consult the <a href="http://docs.kohanaphp.com/installation">documentation</a>
for more information on how to correct the problem.
</p>
<div id="tests">
<?php $failed = FALSE?>
<table cellspacing="0">
<tr>
<th>PHP Version</th>
<?php if (version_compare(PHP_VERSION, '5.2', '>=')): ?>
<td class="pass">
<?php echo PHP_VERSION?>
</td>
<?php else : $failed = TRUE?>
<td class="fail">
Kohana requires PHP 5.2 or newer, this version is <?php echo PHP_VERSION?>.
</td>
<?php endif?>
</tr>
<tr>
<th>System Directory</th>
<?php if (is_dir(SYSPATH)): ?>
<td class="pass">
<?php echo SYSPATH?>
</td>
<?php else : $failed = TRUE?>
<td class="fail">
The configured
<code>
system
</code>
directory does not exist or does not contain required files.
</td>
<?php endif?>
</tr>
<tr>
<th>Application Directory</th>
<?php if (is_dir(APPPATH) AND is_file(APPPATH.'config/config'.EXT) AND is_file(APPPATH.'Bootstrap'.EXT)): ?>
<td class="pass">
<?php echo APPPATH?>
</td>
<?php else : $failed = TRUE?>
<td class="fail">
The configured
<code>
application
</code>
directory does not exist or does not contain required files.
</td>
<?php endif?>
</tr>
<tr>
<th>Modules Directory</th>
<?php if (is_dir(MODPATH)): ?>
<td class="pass">
<?php echo MODPATH?>
</td>
<?php else : $failed = TRUE?>
<td class="fail">
The configured
<code>
modules
</code>
directory does not exist or does not contain required files.
</td>
<?php endif?>
</tr>
<tr>
<th>Logs Directory</th>
<?php if (is_dir(APPPATH.'logs') AND is_writable(APPPATH.'logs')): ?>
<td class="pass">
Pass
</td>
<?php else : $failed = TRUE?>
<td class="fail">
The default
<code>
logs
</code>
directory does not exist or is not writable. Depending on your log driver and config settings, this may not be a problem.
</td>
<?php endif?>
</tr>
<tr>
<th>Cache Directory</th>
<?php if (is_dir(APPPATH.'cache') AND is_writable(APPPATH.'cache')): ?>
<td class="pass">
Pass
</td>
<?php else : $failed = TRUE?>
<td class="fail">
The default
<code>
cache
</code>
directory does not exist or is not writable. Depending on your cache driver and config settings, this may not be a problem.
</td>
<?php endif?>
</tr>
<tr>
<th>PCRE UTF-8</th>
<?php if ( ! function_exists('preg_match')): $failed = TRUE?>
<td class="fail">
<a href="http://php.net/pcre">PCRE</a>
support is missing.
</td>
<?php elseif ( ! @preg_match('/^.$/u', 'ñ')): $failed = TRUE?>
<td class="fail">
<a href="http://php.net/pcre">PCRE</a>
has not been compiled with UTF-8 support.
</td>
<?php elseif ( ! @preg_match('/^\pL$/u', 'ñ')): $failed = TRUE?>
<td class="fail">
<a href="http://php.net/pcre">PCRE</a>
has not been compiled with Unicode property support.
</td>
<?php else : ?>
<td class="pass">
Pass
</td>
<?php endif?>
</tr>
<tr>
<th>Reflection Enabled</th>
<?php if (class_exists('ReflectionClass')): ?>
<td class="pass">
Pass
</td>
<?php else : $failed = TRUE?>
<td class="fail">
PHP <a href="http://www.php.net/reflection">reflection</a>
is either not loaded or not compiled in.
</td>
<?php endif?>
</tr>
<tr>
<th>Filters Enabled</th>
<?php if (function_exists('filter_list')): ?>
<td class="pass">
Pass
</td>
<?php else : $failed = TRUE?>
<td class="fail">
The <a href="http://www.php.net/filter">filter</a>
extension is either not loaded or not compiled in.
</td>
<?php endif?>
</tr>
<tr>
<th>Iconv Extension Loaded</th>
<?php if (extension_loaded('iconv')): ?>
<td class="pass">
Pass
</td>
<?php else : $failed = TRUE?>
<td class="fail">
The <a href="http://php.net/iconv">iconv</a>
extension is not loaded.
</td>
<?php endif?>
</tr>
<tr>
<th>SPL Enabled</th>
<?php if (function_exists('spl_autoload_register')): ?>
<td class="pass">
Pass
</td>
<?php else : $failed = TRUE?>
<td class="fail">
<a href="http://php.net/spl">SPL</a>
is not enabled.
</td>
<?php endif?>
</tr>
<tr>
<th>Multibyte String Enabled</th>
<?php if (extension_loaded('mbstring')): ?>
<td class="pass">Pass</td>
<?php else: $failed = TRUE; ?>
<td class="fail">The <a href="http://php.net/mbstring">mbstring</a>
extension is not loaded.</td>
<?php endif ?>
</tr>
<?php if (extension_loaded('mbstring')): ?>
<tr>
<th>Mbstring Not Overloaded</th>
<?php if (ini_get('mbstring.func_overload') & MB_OVERLOAD_STRING): $failed = TRUE?>
<td class="fail">
The <a href="http://php.net/mbstring">mbstring</a>
extension is overloading PHP's native string functions.
</td>
<?php else : ?>
<td class="pass">
Pass
</td>
<?php endif?>
</tr>
<?php endif?>
<tr>
<th>XML support</th>
<?php if ( ! function_exists('utf8_encode')): $failed = TRUE?>
<td class="fail">
PHP is compiled without <a href="http://php.net/xml">XML</a>
support, thus lacking support for
<code>
utf8_encode()
</code>/
<code>
utf8_decode()
</code>.
</td>
<?php else : ?>
<td class="pass">
Pass
</td>
<?php endif?>
</tr>
<th>Timezone</th>
<?php try { new DateTimeZone(ini_get('date.timezone')); ?>
<td class="pass">Pass</td>
<?php } catch (Exception $e) { $failed = TRUE ?>
<td class="fail">
The current timezone, <code>'<?php echo ini_get('date.timezone') ?>'</code>, is not valid.
You must configure it in <code>php.ini</code> or <code>config/locale.php</code>.
</td>
<?php } ?>
</tr>
<tr>
<th>URI Determination</th>
<?php if (isset($_SERVER['SCRIPT_NAME']) AND (isset($_SERVER['PATH_INFO']) OR isset($_SERVER['ORIG_PATH_INFO']) OR isset($_SERVER['PHP_SELF']))): ?>
<td class="pass">
Pass
</td>
<?php else : $failed = TRUE?>
<td class="fail">
At least one of <code>$_SERVER['PATH_INFO']</code>, <code>$_SERVER['ORIG_PATH_INFO']</code>, or <code>$_SERVER['PHP_SELF']</code> must be available.
</td>
<?php endif?>
</tr>
</table>
<div id="results">
<?php if ($failed === TRUE): ?>
<p class="fail">
Kohana may not work correctly with your environment.
</p>
<?php else : ?>
<p class="pass">
Your environment passed all requirements. Remove or rename the
<code>
install<?php echo EXT?>
</code>
file now.
</p>
<?php endif?>
</div>
</div>
</body>
</html>

View File

@ -1,30 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Kohana License</title>
</head>
<body>
<h2>Kohana License Agreement</h2>
<p>This license is a legal agreement between you and the Kohana Software Foundation for the use of Kohana Framework (the "Software"). By obtaining the Software you agree to comply with the terms and conditions of this license.</p>
<p>Copyright (c) 2007-2009 Kohana Team<br/>All rights reserved.</p>
<p>Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:</p>
<ul>
<li>Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</li>
<li>Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.</li>
<li>Neither the name of the Kohana nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.</li>
</ul>
<p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p>
<p><small>NOTE: This license is modeled after the BSD software license.</small></p>
</body>
</html>

View File

@ -1,59 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Kohana process control file, loaded by the front controller.
*
* $Id: Bootstrap.php 4679 2009-11-10 01:45:52Z isaiah $
*
* @package Core
* @author Kohana Team
* @copyright (c) 2007-2009 Kohana Team
* @license http://kohanaphp.com/license
*/
// Kohana benchmarks are prefixed to prevent collisions
define('SYSTEM_BENCHMARK', 'system_benchmark');
// Load benchmarking support
require SYSPATH.'core/Benchmark'.EXT;
// Start total_execution
Benchmark::start(SYSTEM_BENCHMARK.'_total_execution');
// Start kohana_loading
Benchmark::start(SYSTEM_BENCHMARK.'_kohana_loading');
// Load core files
require SYSPATH.'core/Event'.EXT;
final class Event extends Event_Core {}
require SYSPATH.'core/Kohana'.EXT;
final class Kohana extends Kohana_Core {}
require SYSPATH.'core/Kohana_Exception'.EXT;
class Kohana_Exception extends Kohana_Exception_Core {}
require SYSPATH.'core/Kohana_Config'.EXT;
require SYSPATH.'libraries/drivers/Config'.EXT;
require SYSPATH.'libraries/drivers/Config/Array'.EXT;
final class Kohana_Config extends Kohana_Config_Core {}
// Prepare the environment
Kohana::setup();
// End kohana_loading
Benchmark::stop(SYSTEM_BENCHMARK.'_kohana_loading');
// Start system_initialization
Benchmark::start(SYSTEM_BENCHMARK.'_system_initialization');
// Prepare the system
Event::run('system.ready');
// Determine routing
Event::run('system.routing');
// End system_initialization
Benchmark::stop(SYSTEM_BENCHMARK.'_system_initialization');
// Make the magic happen!
Event::run('system.execute');

View File

@ -1,123 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Base path of the web site. If this includes a domain, eg: localhost/kohana/
* then a full URL will be used, eg: http://localhost/kohana/. If it only includes
* the path, and a site_protocol is specified, the domain will be auto-detected.
*/
$config['site_domain'] = '/g3_client/';
/**
* Force a default protocol to be used by the site. If no site_protocol is
* specified, then the current protocol is used, or when possible, only an
* absolute path (with no protocol/domain) is used.
*/
$config['site_protocol'] = 'http';
/**
* Name of the front controller for this application. Default: index.php
*
* This can be removed by using URL rewriting.
*/
$config['index_page'] = 'index.php';
/**
* Fake file extension that will be added to all generated URLs. Example: .html
*/
$config['url_suffix'] = '';
/**
* Length of time of the internal cache in seconds. 0 or FALSE means no caching.
* The internal cache stores file paths and config entries across requests and
* can give significant speed improvements at the expense of delayed updating.
*/
$config['internal_cache'] = FALSE;
/**
* Internal cache directory.
*/
$config['internal_cache_path'] = APPPATH.'cache/';
/**
* Enable internal cache encryption - speed/processing loss
* is neglible when this is turned on. Can be turned off
* if application directory is not in the webroot.
*/
$config['internal_cache_encrypt'] = TRUE;
/**
* Encryption key for the internal cache, only used
* if internal_cache_encrypt is TRUE.
*
* Make sure you specify your own key here!
*
* The cache is deleted when/if the key changes.
*/
$config['internal_cache_key'] = 'g3_client';
/**
* Enable or disable gzip output compression. This can dramatically decrease
* server bandwidth usage, at the cost of slightly higher CPU usage. Set to
* the compression level (1-9) that you want to use, or FALSE to disable.
*
* Do not enable this option if you are using output compression in php.ini!
*/
$config['output_compression'] = FALSE;
/**
* Enable or disable global XSS filtering of GET, POST, and SERVER data. This
* option also accepts a string to specify a specific XSS filtering tool.
*/
$config['global_xss_filtering'] = FALSE;
/**
* Enable or disable hooks.
*/
$config['enable_hooks'] = true;
/**
* Enable or disable displaying of Kohana error pages. This will not affect
* logging. Turning this off will disable ALL error pages.
*/
$config['display_errors'] = TRUE;
/**
* Enable or disable statistics in the final output. Stats are replaced via
* specific strings, such as {execution_time}.
*
* @see http://docs.kohanaphp.com/general/configuration
*/
$config['render_stats'] = TRUE;
/**
* Filename prefixed used to determine extensions. For example, an
* extension to the Controller class would be named MY_Controller.php.
*/
$config['extension_prefix'] = 'MY_';
/**
* An optional list of Config Drivers to use, they "fallback" to the one below them if they
* dont work so the first driver is tried then so on until it hits the built in "array" driver and fails
*/
$config['config_drivers'] = array();
/**
* Additional resource paths, or "modules". Each path can either be absolute
* or relative to the docroot. Modules can include any resource that can exist
* in your application directory, configuration files, controllers, views, etc.
*/
$config['modules'] = array
(
// MODPATH.'auth', // Authentication
// MODPATH.'forge', // Form generation
// MODPATH.'kodoc', // Self-generating documentation
// MODPATH.'media', // Media caching and compression
// MODPATH.'gmaps', // Google Maps integration
// MODPATH.'archive', // Archive utility
// MODPATH.'payment', // Online payments
// MODPATH.'unit_test', // Unit testing
// MODPATH.'object_db', // New OOP Database library (testing only!)
);
/**
* Base path of the gallery3 restFULL API
*/
$config["gallery3_site"] = "http://????/gallery3/index.php/rest";

View File

@ -1,25 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2010 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
// Redirect edit requests to edit handler.
$config["^(edit|add|delete)_(\w+)(.*)$"] = "g3_handlers/$1/$2$3";
// Set the default route
$config['_default'] = 'g3_client';

View File

@ -1,48 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* @package Session
*
* Session driver name.
*/
$config['driver'] = 'cookie';
/**
* Session storage parameter, used by drivers.
*/
$config['storage'] = '';
/**
* Session name.
* It must contain only alphanumeric characters and underscores. At least one letter must be present.
*/
$config['name'] = 'kohanasession';
/**
* Session parameters to validate: user_agent, ip_address, expiration.
*/
$config['validate'] = array('user_agent');
/**
* Enable or disable session encryption.
* Note: this has no effect on the native session driver.
*/
$config['encryption'] = FALSE;
/**
* Session lifetime. Number of seconds that each session will last.
* A value of 0 will keep the session active until the browser is closed (with a limit of 24h).
*/
$config['expiration'] = 43200; // 24 hours
/**
* Number of page loads before the session id is regenerated.
* A value of 0 will disable automatic session id regeneration.
* NOTE: Enabling automatic session regeneration can cause a race condition see the
* docs for details: http://docs.kohanaphp.com/libraries/session#regenerate
*/
$config['regenerate'] = 0;
/**
* Percentage probability that the gc (garbage collection) routine is started.
*/
$config['gc_probability'] = 2;

View File

@ -1,157 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2010 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class G3_Client_Controller extends Template_Controller {
// Set the name of the template to use
public $template = 'g3_template.html';
public function index() {
$this->template->title = 'G3 Web Client';
if (Session::instance()->get("g3_client_access_token")) {
$response = G3Remote::instance()->get_resource("gallery");
$this->template->content = $this->_get_main_view($response->resource);
} else {
$this->template->content = new View('login.html');
$this->template->content->errors = $this->template->content->form =
array("user" => "", "password" => "");
}
}
public function login() {
$form = $errors = array("user" => "", "password" => "");
$post = new Validation($_POST);
$post->add_rules("user", "required");
$post->add_rules("password", "required");
if ($valid = $post->validate()) {
try {
$token = G3Remote::instance()->get_access_token($post["user"], $post["password"]);
Session::instance()->set("g3_client_access_token", $token);
$response = G3Remote::instance()->get_resource("gallery");
$valid = true;
$content = $this->_get_main_view($response->resource);
} catch (Exception $e) {
Kohana_Log::add("error", Kohana_Exception::text($e));
$valid = false;
}
}
if (!$valid) {
$content = new View('login.html');
$content->form = arr::overwrite($form, $post->as_array());
$content->errors = arr::overwrite($errors, $post->errors());
}
$this->auto_render = false;
print json_encode(array("status" => $valid ? "ok" : "error", "content" => (string)$content));
}
public function albums() {
$path = $this->input->get("path");
$response = G3Remote::instance()->get_resource("gallery/$path", array("filter" => "album"));
$this->auto_render = false;
print $this->_get_album_tree($response->resource);
}
public function detail() {
$path = $this->input->get("path");
$response = G3Remote::instance()->get_resource("gallery/$path");
$this->auto_render = false;
print $this->_get_detail($response->resource);
}
public function tagged_album($tags) {
$response = G3Remote::instance()->get_resource("tag/$tags");
$this->auto_render = false;
$v = new View("tag_detail.html");
$v->resources = $response->resources;
print $v;
}
public function block($type) {
switch ($type) {
case "random":
print $this->_get_image_block();
break;
case "tags":
print "";
break;
default:
print "";
}
$this->auto_render = false;
}
private function _get_album_tree($resource) {
$v = new View("tree_part.html");
$v->element = (object)array("title" => $resource->title, "path" => $resource->path);
$v->element->children = array();
foreach ($resource->children as $child) {
if ($child->type != "album") {
continue;
}
$v->element->children[] = $child;
}
return $v;
}
private function _get_main_view($resource) {
$v = new View("main.html");
$v->album_tree = $this->_get_album_tree($resource);
$v->detail = $this->_get_detail($resource);
$v->image_block = $this->_get_image_block();
$v->tag_block = $this->_get_tag_block();
return $v;
}
private function _get_detail($resource) {
$v = new View("{$resource->type}_detail.html");
$v->resource = $resource;
$v->parent_path = substr($resource->path, 0, -strlen($resource->slug));
if (strrpos($v->parent_path, "/") == strlen($v->parent_path) - 1) {
$v->parent_path = substr($v->parent_path, 0, -1);
}
return $v;
}
private function _get_image_block() {
$response = G3Remote::instance()->get_resource("image_block", array("type" => "random"));
if ($response->status == "OK") {
$v = new View("image_block.html");
$v->path = $response->resource->path;
$v->src = $response->resource->thumb_url;
$v->title = $response->resource->title;
} else {
$v = "";
}
return $v;
}
private function _get_tag_block() {
$response = G3Remote::instance()->get_resource("tag", array("limit" => "15"));
if ($response->status == "OK") {
$v = new View("tag_block.html");
$v->tags = $response->tags;
$v->max_count = $response->tags[0]->count;;
} else {
$v = "";
}
return $v;
}
} // End G3 Client Controller

View File

@ -1,120 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2010 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class G3_Handlers_Controller extends Controller {
public function edit($type) {
$path = $this->input->get("path");
if ($_POST) {
try {
unset($_POST["do_edit"]);
$result = G3Remote::instance()->update_resource("gallery/$path", $_POST);
if ($result->status == "OK") {
$form = null;
$result = "success";
} else {
$form = g3_client::get_form($type, false, $path, (object)$_POST);
foreach (array_keys($_POST) as $field) {
if (isset($result->fields->$field)) {
$form->errors[$field] = $result->fields->$field;
}
}
$result = "display";
}
} catch (Exception $e) {
$form = g3_client::get_form($type, false, $path, (object)$_POST);
$form->errors["form_error"] = $e->getMessage();
$result = "error";
}
} else {
$response = G3Remote::instance()->get_resource("gallery/$path");
$form = g3_client::get_form($type, false, $path, $response->resource);
$result = "display";
}
print g3_client::format_response($type, $path, $form, $result);
}
public function add($type) {
$path = $this->input->get("path");
if ($_POST) {
try {
$data = array(
"title" => $_POST["title"],
"name" => $_POST["name"],
"slug" => g3_client::sanitize_title($_POST["slug"], $_POST["name"]),
"description" => $_POST["description"]);
if ($_FILES) {
if (empty($_FILES["image"]["error"])) {
unset($_FILES["image"]["error"]);
$data["image"] = (object)$_FILES["image"];
} else {
throw new Exception("File upload failed for reason: {$_FILES['image']['error']}");
}
}
$path = !empty($path) ? $path . "/" : $path;
$result = G3Remote::instance()->add_resource("gallery/$path{$data['name']}", $data);
if ($result->status == "OK") {
$form = null;
$result = "success";
} else {
$form = g3_client::get_form($type, true, $path, (object)$_POST);
foreach (array_keys($_POST) as $field) {
if (isset($result->fields->$field)) {
$form->errors[$field] = $result->fields->$field;
}
}
$result = "display";
}
} catch (Exception $e) {
Kohana_Log::add("error", (string)$e);
$form = g3_client::get_form($type, true, $path, (object)$_POST);
$form->errors["form_error"] = $e->getMessage();
$result = "error";
}
} else {
$form = g3_client::get_form($type, true, $path);
$result = "display";
}
print g3_client::format_response($type, $path, $form, $result);
}
public function delete($type) {
$path = $this->input->get("path");
if ($_POST) {
try {
$response = G3Remote::instance()->delete_resource("gallery/$path");
print json_encode(array("result" => "success", "path" => $response->resource->parent_path,
"type" => $type));
} catch (Exception $e) {
print json_encode(array("result" => "fail", "message" => $e->getMessage()));
}
return;
} else {
$response = G3Remote::instance()->get_resource("gallery/$path");
$v = new View("delete.html");
$v->title = $response->resource->title;
$v->path = "delete_album/?path=$path";
}
print json_encode(array("form" => (string)$v));
}
} // End G3 Album Controller

View File

@ -1,78 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2010 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class g3_client_Core {
static function get_form($type, $add_form, $path, $data=null) {
$form = new stdClass();
$form->adding = $add_form;
$form->form = array("title" => (object)array("value" => "", "label" => "Title"),
"name" => (object)array("value" => "", "label" => "Name"),
"description" => (object)array("value" => "", "label" => "Description"),
"slug" => (object)array("value" => "", "label" => "Internet Address"));
// @todo add sort column sort order fields
$form->errors = array("title" => "", "name" => "", "description" => "", "slug" => "");
if ($type != "album" && $add_form) {
$form->form["image"] = (object)array("value" => "", "label" => "Image File");
$form->errors["image"] = "";
}
if (empty($path) && !$add_form) {
$form->form["name"]->readonly = $form->form["slug"]->readonly = "readonly";
}
if ($data) {
foreach (array_keys($form->form) as $field) {
if (isset($data->$field)) {
$form->form[$field]->value = $data->$field;
}
}
}
return $form;
}
static function format_response($type, $path, $form, $result) {
$json = (object)array("result" => $result);
if ($result != "success") {
$json->form = new View("edit.html");
$json->form->title = ($form->adding ? "Add " : "Update ") . ucwords($type);
$json->form->url = $form->adding ? "add" : "edit";
$json->form->button_text = $form->adding ? "Add" : "Update";
$json->form->path = $path;
$json->form->type = $type;
$json->form->form = (object)$form->form;
$json->form->errors = (object)$form->errors;
$json->form = (string)$json->form;
} else {
$json->path = $path;
$json->type = $type;
}
return json_encode($json);
}
/**
* Sanitize a filename into something safe
* @param string $filename
* @return string sanitized filename
*/
static function sanitize_title($field, $title) {
$result = preg_replace("/[^A-Za-z0-9-_]+/", "-", empty($field) ? $title : $field);
return trim($result, "-");
}
}

View File

@ -1,23 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2010 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
$access_token = Session::instance()->get("g3_client_access_token");
$site = Kohana::config("core.gallery3_site");
G3Remote::instance($site, $access_token);

View File

@ -1,298 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2010 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
// This class does not depend on any Kohana services so that it can be used in non-Kohana
// applications.
class G3Remote {
protected static $_instance;
private $_gallery3_site;
private $_access_token;
public static function instance($site=null, $access_token=null) {
if (!isset(G3Remote::$_instance)) {
G3Remote::$_instance = new G3Remote($site, $access_token);
}
return G3Remote::$_instance;
}
/**
* Constructs a new G3Remote object
*
* @param array Database config array
* @return G3Remote
*/
protected function __construct($site, $access_token) {
// Store the config locally
$this->_gallery3_site = $site;
$this->_access_token = $access_token;
}
public function get_access_token($user, $password) {
$request = "{$this->_gallery3_site}/access_key";
list ($response_status, $response_headers, $response_body) =
G3Remote::_get($request, array("user" => $user, "password" => $password));
if (G3Remote::_success($response_status)) {
$response = json_decode($response_body);
if ($response->status == "OK") {
$this->_access_token = $response->token;
} else {
throw new Exception("Remote host failure: {$response->message}");
}
} else {
throw new Exception("Remote host failure: $response_status");
}
return $this->_access_token;
}
public function get_resource($path, $params=array()) {
return $this->_do_request("get", $path, $params);
}
public function delete_resource($path) {
return $this->_do_request("delete", $path);
}
public function update_resource($path, $params) {
return $this->_do_request("put", $path, $params);
}
public function add_resource($path, $params) {
return $this->_do_request("post", $path, $params);
}
private function _do_request($method, $path, $params=array()) {
$request_path = "{$this->_gallery3_site}/$path";
$headers = array();
if ($method == "put" || $method == "delete") {
$headers["X_GALLERY_REQUEST_METHOD"] = $method;
$method = "post";
}
if (!empty($this->_access_token)) {
$headers["X_GALLERY_REQUEST_KEY"] = $this->_access_token;
}
list ($response_status, $response_headers, $response_body) =
$method == "get" ? G3Remote::_get($request_path, $params, $headers) :
G3Remote::_post($request_path, $params, $headers);
if (G3Remote::_success($response_status)) {
$response = json_decode($response_body);
switch ($response->status) {
case "OK":
case "VALIDATE_ERROR":
return $response;
default:
throw new Exception("Remote host failure: {$response->message}");
}
} else {
throw new Exception("Remote host failure: $response_status");
}
}
private static function _post($url, $post_data_array, $extra_headers=array()) {
$boundary = str_repeat("-", 9) . md5(microtime());
$boundary_length = strlen($boundary);
$extra_headers['Content-Type'] = "multipart/form-data; boundary=$boundary";
$length = 0;
$fields = array();
foreach ($post_data_array as $field => $value) {
$fields[$field] = array();
if (is_string($value)) {
$fields[$field]["disposition"] = "Content-Disposition: form-data; name=\"$field\"\r\n\r\n";
$fields[$field]["type"] = "";
$fields[$field]["value"] = "$value\r\n";
} else {
$fields[$field]["disposition"] =
"Content-Disposition: form-data; name=\"$field\"; filename=\"{$value->name}\"\r\n";
$fields[$field]["type"] = "Content-Type: {$value->type}\r\n\r\n";
$fields[$field]["value"] = "\r\n";
$fields[$field]["local_file"] = $value->tmp_name;
$length += $value->size;
}
$length += strlen($fields[$field]["disposition"]) + strlen($fields[$field]["value"]) +
strlen($fields[$field]["type"]) + $boundary_length + 4;
}
$length += $boundary_length + 6; // boundary terminator and last crlf
$extra_headers['Content-Length'] = $length;
$socket = G3Remote::_open_socket($url, 'POST', $extra_headers);
$sent_length = 0;
foreach ($fields as $field => $value) {
$sent_length += fwrite($socket, "--$boundary\r\n");
$sent_length += fwrite($socket, $value["disposition"]);
if (!empty($value["type"])) {
$sent_length += fwrite($socket, $value["type"]);
$file = fopen($value["local_file"], "rb");
while (!feof($file)) {
$buffer = fread($file, 8192);
$sent_length += fwrite($socket, $buffer);
fflush($socket);
}
}
$sent_length += fwrite($socket, $value["value"]);
fflush($socket);
}
$sent_length += fwrite($socket, "--$boundary--\r\n");
fflush($socket);
/* Read the web page into a buffer */
return G3Remote::_get_response($socket);
}
private static function _get($url, $_data_array=array(), $extra_headers=array()) {
$_data_raw = self::_encode_data($_data_array, $extra_headers);
$handle = G3Remote::_open_socket("{$url}?$_data_raw", "GET", $extra_headers);
/* Read the web page into a buffer */
return G3Remote::_get_response($handle);
}
private static function _success($response_status) {
return preg_match("/^HTTP\/\d+\.\d+\s2\d{2}(\s|$)/", trim($response_status));
}
/**
* Encode the data. For each key/value pair, urlencode both the key and the value and then
* concatenate together. As per the specification, each key/value pair is separated with an
* ampersand (&)
* @param array $data_array the key/value data
* @param array $extra_headers extra headers to pass to the server
* @return string the encoded post data
*/
private static function _encode_data($_data_array, &$extra_headers) {
$_data_raw = '';
foreach ($_data_array as $key => $value) {
if (!empty($_data_raw)) {
$_data_raw .= '&';
}
$_data_raw .= urlencode($key) . '=' . urlencode($value);
}
return $_data_raw;
}
/**
* Open the socket to server
*/
static function _open_socket($url, $method='GET', $headers=array()) {
/* Convert illegal characters */
$url = str_replace(' ', '%20', $url);
$url_components = self::_parse_url_for_fsockopen($url);
$handle = fsockopen(
$url_components['fsockhost'], $url_components['port'], $errno, $errstr, 5);
if (empty($handle)) {
return array(null, null, null);
}
$header_lines = array('Host: ' . $url_components['host']);
foreach ($headers as $key => $value) {
$header_lines[] = $key . ': ' . $value;
}
$success = fwrite($handle, sprintf("%s %s HTTP/1.0\r\n%s\r\n\r\n",
$method,
$url_components['uri'],
implode("\r\n", $header_lines)));
fflush($handle);
return $handle;
}
/**
* Read the http response
*/
static function _get_response($handle) {
/*
* Read the status line. fgets stops after newlines. The first line is the protocol
* version followed by a numeric status code and its associated textual phrase.
*/
$response_status = trim(fgets($handle, 4096));
if (empty($response_status)) {
// 'Empty http response code, maybe timeout'
return array(null, null, null);
}
/* Read the headers */
$response_headers = array();
while (!feof($handle)) {
$line = trim(fgets($handle, 4096));
if (empty($line)) {
break;
}
/* Normalize the line endings */
$line = str_replace("\r", '', $line);
list ($key, $value) = explode(':', $line, 2);
if (isset($response_headers[$key])) {
if (!is_array($response_headers[$key])) {
$response_headers[$key] = array($response_headers[$key]);
}
$response_headers[$key][] = trim($value);
} else {
$response_headers[$key] = trim($value);
}
}
/* Read the body */
$response_body = '';
while (!feof($handle)) {
$response_body .= fread($handle, 4096);
}
fclose($handle);
return array($response_status, $response_headers, $response_body);
}
/**
* Prepare for fsockopen call.
* @param string $url
* @return array url components
* @access private
*/
private static function _parse_url_for_fsockopen($url) {
$url_components = parse_url($url);
if (strtolower($url_components['scheme']) == 'https') {
$url_components['fsockhost'] = 'ssl://' . $url_components['host'];
$default_port = 443;
} else {
$url_components['fsockhost'] = $url_components['host'];
$default_port = 80;
}
if (empty($url_components['port'])) {
$url_components['port'] = $default_port;
}
if (empty($url_components['path'])) {
$url_components['path'] = '/';
}
$uri = $url_components['path']
. (empty($url_components['query']) ? '' : '?' . $url_components['query']);
/* Unescape ampersands, since if the url comes from form input it will be escaped */
$url_components['uri'] = str_replace('&amp;', '&', $uri);
return $url_components;
}
}

View File

@ -1,20 +0,0 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<script>
var parent_path = "<?= $parent_path ?>";
var current_path = "<?= $resource->path ?>";
var resource_type = "album";
</script>
<ul id="wc-thumb-grid" class="ui-helper-clearfix">
<? foreach ($resource->children as $child): ?>
<li class="wc-thumb-grid-cell" ref="<?= $child->path ?>">
<a class="wc-child-link wc-image-block" href="#">
<? if ($child->has_thumb): ?>
<img src="<?= $child->thumb_url ?>" title="<?= $child->title ?>" />
<? else: ?>
<span><?= $child->title ?></span>
<? endif ?>
</a>
</li>
<? endforeach ?>
</ul>

View File

@ -1,27 +0,0 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<script>
$("#wc-edit").ready(function() {
$("#wc-delete-cancel").click(function(event) {
$("#g-dialog").dialog("close");
return false;
});
});
</script>
<div id="wc-edit">
<?= form::open($path) ?>
<fieldset>
<legend style="display: none">Confirm Delete</legend>
<ul>
<li>
Do you really want to delete '<?= $title ?>'. <br/>
Press <b>Yes</b> to continue, <b>Cancel</b> to quit
</li>
<li style="text-align: center">
<?= form::submit("submit", "Yes", "id=\"wc-delete-continue\"") ?>
<?= form::submit("submit", "Cancel", "id=\"wc-delete-cancel\"") ?>
</li>
</ul>
</fieldset>
</form>
</div>

View File

@ -1,50 +0,0 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<div id="wc-edit">
<?= form::open("{$url}_{$type}?path=$path") ?>
<fieldset>
<legend style="display: none"><?= $title ?></legend>
<ul>
<li>
<?= form::label("title", "{$form->title->label}:") ?><br/>
<?= form::input("title", $form->title->value,
empty($form->title->readonly) ? "" : "readonly={$form->title->readonly}") ?>
<?= empty($errors->title) ? "" : "<span class=\"error\">{$errors->title}</span>" ?>
</li>
<li>
<?= form::label("name", "{$form->name->label}:") ?><br/>
<?= form::input("name", $form->name->value,
empty($form->name->readonly) ? "" : "readonly={$form->name->readonly}") ?>
<?= empty($errors->name) ? "" : "<span class=\"error\">{$errors->name}</span>" ?>
</li>
<li>
<?= form::label("description", "{$form->description->label}:") ?><br/>
<?= form::textarea("description", $form->description->value) ?>
<?= empty($errors->description) ? "" : "<span class=\"error\">{$errors->description}</span>" ?>
</li>
<li>
<?= form::label("slug", "{$form->slug->label}:") ?><br/>
<?= form::input("slug", $form->slug->value,
empty($form->slug->readonly) ? "" : "readonly={$form->slug->readonly}") ?>
<?= empty($errors->slug) ? "" : "<span class=\"error\">{$errors->slug}</span>" ?>
</li>
<? if (!empty($form->image)): ?>
<li>
<?= form::label("image", "{$form->image->label}:") ?><br/>
<?= form::upload("image") ?>
<?= empty($errors->image) ? "" : "<span class=\"error\">{$errors->image}</span>" ?>
</li>
<? endif ?>
<? if (!empty($errors->form_error)): ?>
<li>
<span class="error"><?= $errors->form_error ?></span>
</li>
<? endif ?>
<li style="text-align: center">
<?= form::submit("do_edit", $button_text) ?>
<?= form::input(array('type'=>'reset','name'=>'reset'), "Reset") ?>
</li>
</ul>
</fieldset>
</form>
</div>

View File

@ -1,45 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title><?= html::chars(__($title)) ?></title>
<?= html::stylesheet("css/reset-fonts-grids.css") ?>
<?= html::stylesheet("css/g3_client.css") ?>
<?= html::stylesheet("css/jquery-ui.css") ?>
<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" href="<?= url::file("css/fix-ie.css") ?>"
media="screen,print,projection" />
<![endif]-->
<style type="text/css">
.copyright { font-size: 0.9em; text-transform: uppercase; color: #557d10; }
</style>
<?= html::script("js/jquery.js") ?>
<?= html::script("js/jquery.form.js") ?>
<?= html::script("js/jquery-ui.js") ?>
<?= html::script("lib/flowplayer.js") ?>
<?= html::script("js/g3_client.js") ?>
<script type="text/javascript">
$(document).ready(function () {
$("#wc-body").gallery3_client();
});
</script>
</head>
<body>
<div id="doc4" class="yui-t5">
<div id="wc-header" class="ui-helper-clearfix">
<div>&nbsp;</div>
</div>
<div id="wc-body">
<?= $content ?>
</div>
<div id="wc-footer" class="ui-helper-clearfix">
<p class="wc-copyright">
<?= __('Rendered in {execution_time} seconds, using {memory_usage} of memory')?><br />
Copyright ©20092010 Gallery Team
</p>
</div>
</div>
</body>
</html>

View File

@ -1,17 +0,0 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<script>
$("#image_block").ready(function() {
setTimeout("reloadRandomImage();", 10000); // Change the random image block
});
function reloadRandomImage() {
$.get("/g3_client/index.php/g3_client/block/random", function(data, textStatus) {
$("#image_block").html(data);
});
}
</script>
<h3>Random Image</h3>
<a href="<?= $path ?>">
<img src="<?= $src ?>" alt="<?= $title ?>" />
</a>
<p><?= $title ?></p>

View File

@ -1,29 +0,0 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<div id="login">
<ul>
<li id="g-login-form">
<?= form::open("g3_client/login") ?>
<fieldset>
<legend>Please provide your userid and password for the remote system</legend>
<ul>
<li>
<?= form::label("user", "User Id:") ?><br/>
<?= form::input("user", $form["user"]) ?>
<?= empty($errors["user"]) ? "" : "<span class=\"error\">{$errors["user"]}</span>" ?>
</li>
<li>
<?= form::label("password", "Password") ?><br/>
<?= form::password("password", $form["password"]) ?>
<?= empty($errors["password"]) ? "" : "<span class=\"error\">{$errors["password"]}</span>" ?>
</li>
<li>
<?= form::submit("submit", "Login") ?>
<?= form::input(array('type'=>'reset','name'=>'reset'), "Reset") ?>
</li>
</ul>
</fieldset>
</form>
</li>
</ul>
</div>

View File

@ -1,49 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.'); ?>
<div id="left">
<ul id="album_tree"><?= $album_tree ?></ul>
</div>
<div id="center">
<div class="wc-toolbar ui-widget-header ui-corner-all ui-helper-clearfix">
<div class="wc-buttonset wc-buttonset-single ui-helper-clearfix">
<a href="#" ref="first" class="wc-button ui-state-default ui-state-disabled wc-button-icon-solo ui-corner-left" title="First"><span class="ui-icon ui-icon-seek-first"></span>First</a>
<a href="#" ref="previous" class="wc-button ui-state-default ui-state-disabled wc-button-icon-solo" title="Previous"><span class="ui-icon ui-icon-seek-prev"></span>Previous</a>
<a href="#" ref="next" class="wc-button ui-state-default ui-state-disabled wc-button-icon-solo" title="Next"><span class="ui-icon ui-icon-seek-next"></span>Next</a>
<a href="#" ref="last" class="wc-button ui-state-default ui-state-disabled wc-button-icon-solo ui-corner-right" title="Last"><span class="ui-icon ui-icon-seek-end"></span>Last</a>
</div>
<div class="wc-buttonset ui-helper-clearfix">
<a href="#" ref="parent" class="wc-button ui-state-default ui-state-disabled wc-button-icon-solo ui-corner-all" title="Parent"><span class="ui-icon ui-icon-eject"></span>Parent</a>
</div>
<div class="wc-buttonset ui-helper-clearfix">
<a href="#" ref="edit" class="wc-button ui-state-default wc-button-icon-solo ui-corner-all" title="Edit"><span class="ui-icon ui-icon-pencil"></span>Edit</a>
<a href="#" ref="delete" class="wc-button ui-state-default wc-button-icon-solo ui-corner-all" title="Delete"><span class="ui-icon ui-icon-trash"></span>Delete</a>
</div>
<div class="wc-buttonset wc-buttonset-single ui-helper-clearfix">
<a href="#" id="wc-add-resource" ref="add_album" class="wc-button ui-state-active ui-corner-left" ><span>Add Album</span></a>
<a href="#" id="wc-choose-resource" class="wc-button ui-state-active wc-button-icon-solo ui-corner-right" title="Resources">
<span class="ui-icon ui-icon-triangle-1-s"></span>
&nbsp;
</a>
<div id="wc-resource-list">
<ul>
<li ref="add_album">Add Album</li>
<li ref="add_photo">Add Photo</li>
<li ref="add_movie">Add Movie</li>
</ul>
</div>
</div>
</div>
<div id="wc-detail">
<?= $detail ?>
</div>
</div>
<div id="right">
<div id="image_block">
<?= $image_block ?>
</div>
<div id="tag_block">
<?= $tag_block ?>
</div>
</div>

View File

@ -1,31 +0,0 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<script>
var parent_path = "<?= $parent_path ?>";
var current_path = "<?= $resource->path ?>";
var resource_type = "movie";
</script>
<div id="movie">
<a id="movie-link" href="<?= $resource->url ?>" title="<?= $resource->title ?>"
style="display: block; height: <?= $resource->size->height ?>px; width: <?= $resource->size->width ?>px;" />
</div>
<script type="text/javascript">
flowplayer(
"movie-link",
{
src: "<?= url::file("lib/flowplayer.swf") ?>",
wmode: "transparent"
},
{
plugins: {
h264streaming: {
url: "<?= url::file("lib/flowplayer.h264streaming.swf") ?>"
},
controls: {
autoHide: 'always',
hideDelay: 2000
}
}
}
)
</script>

View File

@ -1,12 +0,0 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<script>
var parent_path = "<?= $parent_path ?>";
var current_path = "<?= $resource->path ?>";
var resource_type = "photo";
</script>
<div id="photo">
<img src="<?= $resource->resize_url ?>" title="<?= $resource->title ?>" />
</div>
<div id="photo-info">
<h1><?= $resource->title ?></hi>
</div>

View File

@ -1,12 +0,0 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<div id="wc-tag-cloud">
<h3>Tags</h3>
<ul>
<? foreach ($tags as $tag): ?>
<li class="size<?=(int)(($tag->count / $max_count) * 7) ?>">
<span><?= $tag->count ?> photos are tagged with </span>
<a href="<?= url::site("g3_client/tagged_album/{$tag->name}") ?>"><?= $tag->name ?></a>
</li>
<? endforeach ?>
</ul>
</div>

View File

@ -1,20 +0,0 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<script>
var parent_path = "";
var current_path = "tags";
var resource_type = "album";
</script>
<ul id="wc-thumb-grid" class="ui-helper-clearfix">
<? foreach ($resources as $child): ?>
<li class="wc-thumb-grid-cell" ref="<?= $child->path ?>">
<a class="wc-child-link wc-image-block" href="#">
<? if ($child->has_thumb): ?>
<img src="<?= $child->thumb_url ?>" title="<?= $child->title ?>" />
<? else: ?>
<span><?= $child->title ?></span>
<? endif ?>
</a>
</li>
<? endforeach ?>
</ul>

View File

@ -1,18 +0,0 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<li class="ui-icon-left" ref="<?= $element->path ?>">
<div class="ui-state-default">
<span class="<?= count($element->children) > 0 ? "ui-icon ui-icon-minus" : "ui-icon-none" ?>" >&nbsp;</span>
<span class="tree-title"><?= $element->title ?></span>
</div>
<ul class="ui-helper-clearfix tree-chidren">
<? foreach ($element->children as $child): ?>
<li ref="<?= $child->path ?>" class="ui-icon-left">
<div class="ui-state-default">
<span class="<?= $child->has_children ? "ui-icon ui-icon-plus" : "ui-icon-none" ?>">&nbsp;</span>
<span class="tree-title"><?= $child->title ?></span>
</div>
</li>
<? endforeach ?>
</ul>
</li>

View File

@ -1,29 +0,0 @@
/**
* Fix display in IE 6, 7
*/
#g-banner {
z-index: 2;
}
input.submit {
clear: none !important;
display: inline !important;
}
#g-add-tag-form input.textbox {
width: 110px;
}
#g-dialog .g-cancel {
display: inline-block !important;
float: none !important;
}
.g-paginator .g-text-right {
width: 29%;
}
.g-paginator .ui-icon-right {
width: 60px;
}

View File

@ -1,396 +0,0 @@
#wc-header {
background-color: #666666;
left: 0px;
min-height: 90px;
padding: 0 20px;
position: fixed;
right: 0px;
height: 90px;
}
#wc-header div {
background-image: url(images/g3_web.png);
background-repeat: no-repeat;
height: 90px;
}
#wc-body {
background-color: #666666;
bottom: 40px;
left: 0px;
position: fixed;
right: 0px;
top: 90px;
}
#wc-body #content {
background-color: #FFFFFF;
border: 1px solid #CCCCCC;
padding: 10px 20px;
height: 100%;
}
#g-dialog {
background-color: #666666;
color: #FF9933;
}
form li {
padding-top: .4em;
text-align: left;
}
#g-dialog form li input[type=text],
#g-dialog form li input[type=file],
#g-dialog form li textarea {
width: 100%;
}
form li input[readonly=readonly],
form li textarea[readonly=readonly] {
background-color: #999999;
color: #FF9933;
}
form legend {
color: #FF9933;
font-size: 1.2em;
font-weight: bold;
}
span.error {
color: #FF9933;
background-color: #880000;
}
#wc-footer {
background-color: #666666;
bottom: 0px;
color: #FF9933;
left: 0px;
min-height: 40px;
padding: 10px 20px;
position: fixed;
right: 0px;
}
.wc-copyright {
font-size: 0.9em;
text-transform: uppercase;
}
#wc-body #login {
background-color: #222222;
color: #FF9933;
border: 3px inset;
bottom: 20px;
left: 20px;
margin: 0;
padding: 5px;
position: absolute;
right: 20px;
top: 11px;
}
#wc-body #left {
background-color: #222222;
border: 3px inset;
bottom: 20px;
left: 20px;
margin: 0;
padding: 5px;
position: absolute;
top: 11px;
width: 191px;
}
#wc-body #left #album_tree {
height: 100%;
overflow: auto;
font-size: 1.1em;
padding-top: 5px;
}
#wc-body #left #album_tree ul li {
padding: 0 0 .2em 1.2em;
}
#wc-body #left #album_tree div {
border: none !important;
background: none !important;
}
#wc-body #center {
background-color: #222222;
border: 3px inset;
bottom: 20px;
left: 230px;
padding: 10px;
position: absolute;
right: 229px;
top: 11px;
}
#wc-body #wc-detail {
bottom: 0;
left: 10px;
overflow-y: auto;
position: absolute;
right: 10px;
top: 60px;
}
.tree-title {
cursor: pointer;
}
#wc-body #center #wc-thumb-grid {
width: 100%;
list-style: none;
}
#wc-body #center .wc-thumb-grid-cell {
border: 1px solid transparent;
float: left;
height: 150px;
line-height: 170px;
margin: 2px;
padding: 7px;
text-align: center;
width: 150px;
}
#wc-body #center .wc-thumb-grid-cell img {
display: block;
margin: 0 auto;
padding: 5%;
width: 89%;
-ms-interpolation-mode: bicubic;
}
#wc-body #center .wc-thumb-grid-cell span {
vertical-align: middle;
}
#wc-body #right {
background-color: #222222;
border: 3px inset;
bottom: 20px;
margin: 0;
padding: 5px;
position: absolute;
right: 20px;
top: 11px;
width: 191px;
}
#wc-body #right #image_block img {
padding: 5px 7px;
width: 175px;
}
#wc-body #right #image_block p,
#wc-body #right #image_block h3 {
color: #FF9933;
text-align: center;
}
.ui-icon-left .ui-icon {
float: left;
margin-right: 0.2em;
}
.ui-icon-left .ui-icon-none {
float: left;
padding-left: 15px;
}
.ui-selected {
background: #222222;
border: 1px solid #CCCCCC !important;
color: #FF9933;
padding: 0 5px;
}
.wc-button {
outline: 0;
margin:0 4px 0 0;
padding: .4em 1em;
text-decoration:none !important;
cursor:pointer;
position: relative;
text-align: center;
zoom: 1;
}
.wc-button .ui-icon {
position: absolute;
top: 50%;
margin-top: -8px;
left: 50%;
margin-left: -8px;
}
a.wc-button {
float:left;
}
a.ui-state-active {
color: #EB8F00 !important;
}
a.ui-state-default {
background: #FFFFFF;
}
/* remove extra button width in IE */
button.wc-button {
width: auto;
overflow: visible;
}
.wc-button-icon-left {
padding-left: 2.1em;
}
.wc-button-icon-right {
padding-right: 2.1em;
}
.wc-button-icon-left .ui-icon {
right: auto;
left: .2em;
margin-left: 0;
}
.wc-button-icon-right .ui-icon {
left: auto;
right: .2em;
margin-left: 0;
}
.wc-button-icon-solo { /* solo icon buttons must have block properties for the text-indent to work */
display: block;
width: 8px;
text-indent: -9999px;
}
.wc-buttonset {
float: left;
}
.wc-buttonset .wc-button {
float: left;
}
.wc-buttonset-single .wc-button,
.wc-buttonset-multi .wc-button {
margin-right: -1px;
}
.wc-toolbar {
padding: .5em;
margin: 0;
}
.wc-toolbar .wc-buttonset {
margin-right:1.5em;
padding-left: 1px;
}
.wc-toolbar .wc-button {
font-size: 1em;
}
#wc-resource-list {
border-style: solid;
border-width: 0px 1px 1px 1px;
background: #FFFFFF;
color: #F6A828;
display: none;
float: left;
position: absolute;
z-index: 200;
}
#wc-resource-list li {
border-top-style: solid;
border-top-width: 1px;
cursor: pointer;
padding: 3px;
}
/* Tag cloud ~~~~~~~~~~~~~~~~~~~~~~~ */
#wc-tag-cloud {
border: 3px inset;
padding: 2px;
}
#wc-tag-cloud ul {
font-size: 1.2em;
text-align: justify;
}
#wc-tag-cloud ul li {
display: inline;
line-height: 1.5em;
text-align: justify;
}
#wc-tag-cloud ul li a {
text-decoration: none;
}
#wc-tag-cloud ul li span {
display: none;
}
#wc-tag-cloud ul li.size1 a {
color: #FF9933;
font-size: 80%;
font-weight: 100;
}
#wc-tag-cloud ul li.size2 a {
color: #FF9933;
font-size: 90%;
font-weight: 300;
}
#wc-tag-cloud ul li.size3 a {
color: #FF9933;
font-size: 100%;
font-weight: 500;
}
#wc-tag-cloud ul li.size4 a {
color: #FF9933;
font-size: 110%;
font-weight: 700;
}
#wc-tag-cloud ul li.size5 a {
color: #FF9933;
font-size: 120%;
font-weight: 900;
}
#wc-tag-cloud ul li.size6 a {
color: #FF9933;
font-size: 130%;
font-weight: 900;
}
#wc-tag-cloud ul li.size7 a {
color: #FF9933;
font-size: 140%;
font-weight: 900;
}
#wc-tag-cloud ul li a:hover {
color: #f30;
text-decoration: underline;
}
#wc-tag-cloud h3 {
color: #FF9933;
text-align: center;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -1,406 +0,0 @@
/*
* jQuery UI CSS Framework
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
*/
/* Layout helpers
----------------------------------*/
.ui-helper-hidden { display: none; }
.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
.ui-helper-clearfix { display: inline-block; }
/* required comment for clearfix to work in Opera \*/
* html .ui-helper-clearfix { height:1%; }
.ui-helper-clearfix { display:block; }
/* end clearfix */
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
/* Interaction Cues
----------------------------------*/
.ui-state-disabled { cursor: default !important; }
/* Icons
----------------------------------*/
/* states and images */
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
/* Misc visuals
----------------------------------*/
/* Overlays */
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
/*
* jQuery UI CSS Framework
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS,%20Tahoma,%20Verdana,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=03_highlight_soft.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=01_flat.png&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px
*/
/* Component containers
----------------------------------*/
.ui-widget { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1.1em; }
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1em; }
.ui-widget-content { border: 1px solid #dddddd; background: #eeeeee url(images/ui-bg_highlight-soft_100_eeeeee_1x100.png) 50% top repeat-x; color: #333333; }
.ui-widget-content a { color: #333333; }
.ui-widget-header { border: 1px solid #e78f08; background: #f6a828 url(images/ui-bg_gloss-wave_35_f6a828_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
.ui-widget-header a { color: #ffffff; }
/* Interaction states
----------------------------------*/
.ui-state-default, .ui-widget-content .ui-state-default { border: 1px solid #cccccc; background: #f6f6f6 url(images/ui-bg_glass_100_f6f6f6_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1c94c4; outline: none; }
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; outline: none; }
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus { border: 1px solid #fbcb09; background: #fdf5ce url(images/ui-bg_glass_100_fdf5ce_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #c77405; outline: none; }
.ui-state-hover a, .ui-state-hover a:hover { color: #c77405; text-decoration: none; outline: none; }
.ui-state-active, .ui-widget-content .ui-state-active { border: 1px solid #fbd850; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #eb8f00; outline: none; }
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #eb8f00; outline: none; text-decoration: none; }
/* Interaction Cues
----------------------------------*/
.ui-state-highlight, .ui-widget-content .ui-state-highlight {border: 1px solid #fed22f; background: #ffe45c url(images/ui-bg_highlight-soft_75_ffe45c_1x100.png) 50% top repeat-x; color: #363636; }
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a { color: #363636; }
.ui-state-error, .ui-widget-content .ui-state-error {border: 1px solid #cd0a0a; background: #b81900 url(images/ui-bg_diagonals-thick_18_b81900_40x40.png) 50% 50% repeat; color: #ffffff; }
.ui-state-error a, .ui-widget-content .ui-state-error a { color: #ffffff; }
.ui-state-error-text, .ui-widget-content .ui-state-error-text { color: #ffffff; }
.ui-state-disabled, .ui-widget-content .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
.ui-priority-primary, .ui-widget-content .ui-priority-primary { font-weight: bold; }
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
/* Icons
----------------------------------*/
/* states and images */
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); }
.ui-state-default .ui-icon { background-image: url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-active .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_228ef1_256x240.png); }
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_ffd27a_256x240.png); }
/* positioning */
.ui-icon-carat-1-n { background-position: 0 0; }
.ui-icon-carat-1-ne { background-position: -16px 0; }
.ui-icon-carat-1-e { background-position: -32px 0; }
.ui-icon-carat-1-se { background-position: -48px 0; }
.ui-icon-carat-1-s { background-position: -64px 0; }
.ui-icon-carat-1-sw { background-position: -80px 0; }
.ui-icon-carat-1-w { background-position: -96px 0; }
.ui-icon-carat-1-nw { background-position: -112px 0; }
.ui-icon-carat-2-n-s { background-position: -128px 0; }
.ui-icon-carat-2-e-w { background-position: -144px 0; }
.ui-icon-triangle-1-n { background-position: 0 -16px; }
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
.ui-icon-triangle-1-e { background-position: -32px -16px; }
.ui-icon-triangle-1-se { background-position: -48px -16px; }
.ui-icon-triangle-1-s { background-position: -64px -16px; }
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
.ui-icon-triangle-1-w { background-position: -96px -16px; }
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
.ui-icon-arrow-1-n { background-position: 0 -32px; }
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
.ui-icon-arrow-1-e { background-position: -32px -32px; }
.ui-icon-arrow-1-se { background-position: -48px -32px; }
.ui-icon-arrow-1-s { background-position: -64px -32px; }
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
.ui-icon-arrow-1-w { background-position: -96px -32px; }
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
.ui-icon-arrow-4 { background-position: 0 -80px; }
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
.ui-icon-extlink { background-position: -32px -80px; }
.ui-icon-newwin { background-position: -48px -80px; }
.ui-icon-refresh { background-position: -64px -80px; }
.ui-icon-shuffle { background-position: -80px -80px; }
.ui-icon-transfer-e-w { background-position: -96px -80px; }
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
.ui-icon-folder-collapsed { background-position: 0 -96px; }
.ui-icon-folder-open { background-position: -16px -96px; }
.ui-icon-document { background-position: -32px -96px; }
.ui-icon-document-b { background-position: -48px -96px; }
.ui-icon-note { background-position: -64px -96px; }
.ui-icon-mail-closed { background-position: -80px -96px; }
.ui-icon-mail-open { background-position: -96px -96px; }
.ui-icon-suitcase { background-position: -112px -96px; }
.ui-icon-comment { background-position: -128px -96px; }
.ui-icon-person { background-position: -144px -96px; }
.ui-icon-print { background-position: -160px -96px; }
.ui-icon-trash { background-position: -176px -96px; }
.ui-icon-locked { background-position: -192px -96px; }
.ui-icon-unlocked { background-position: -208px -96px; }
.ui-icon-bookmark { background-position: -224px -96px; }
.ui-icon-tag { background-position: -240px -96px; }
.ui-icon-home { background-position: 0 -112px; }
.ui-icon-flag { background-position: -16px -112px; }
.ui-icon-calendar { background-position: -32px -112px; }
.ui-icon-cart { background-position: -48px -112px; }
.ui-icon-pencil { background-position: -64px -112px; }
.ui-icon-clock { background-position: -80px -112px; }
.ui-icon-disk { background-position: -96px -112px; }
.ui-icon-calculator { background-position: -112px -112px; }
.ui-icon-zoomin { background-position: -128px -112px; }
.ui-icon-zoomout { background-position: -144px -112px; }
.ui-icon-search { background-position: -160px -112px; }
.ui-icon-wrench { background-position: -176px -112px; }
.ui-icon-gear { background-position: -192px -112px; }
.ui-icon-heart { background-position: -208px -112px; }
.ui-icon-star { background-position: -224px -112px; }
.ui-icon-link { background-position: -240px -112px; }
.ui-icon-cancel { background-position: 0 -128px; }
.ui-icon-plus { background-position: -16px -128px; }
.ui-icon-plusthick { background-position: -32px -128px; }
.ui-icon-minus { background-position: -48px -128px; }
.ui-icon-minusthick { background-position: -64px -128px; }
.ui-icon-close { background-position: -80px -128px; }
.ui-icon-closethick { background-position: -96px -128px; }
.ui-icon-key { background-position: -112px -128px; }
.ui-icon-lightbulb { background-position: -128px -128px; }
.ui-icon-scissors { background-position: -144px -128px; }
.ui-icon-clipboard { background-position: -160px -128px; }
.ui-icon-copy { background-position: -176px -128px; }
.ui-icon-contact { background-position: -192px -128px; }
.ui-icon-image { background-position: -208px -128px; }
.ui-icon-video { background-position: -224px -128px; }
.ui-icon-script { background-position: -240px -128px; }
.ui-icon-alert { background-position: 0 -144px; }
.ui-icon-info { background-position: -16px -144px; }
.ui-icon-notice { background-position: -32px -144px; }
.ui-icon-help { background-position: -48px -144px; }
.ui-icon-check { background-position: -64px -144px; }
.ui-icon-bullet { background-position: -80px -144px; }
.ui-icon-radio-off { background-position: -96px -144px; }
.ui-icon-radio-on { background-position: -112px -144px; }
.ui-icon-pin-w { background-position: -128px -144px; }
.ui-icon-pin-s { background-position: -144px -144px; }
.ui-icon-play { background-position: 0 -160px; }
.ui-icon-pause { background-position: -16px -160px; }
.ui-icon-seek-next { background-position: -32px -160px; }
.ui-icon-seek-prev { background-position: -48px -160px; }
.ui-icon-seek-end { background-position: -64px -160px; }
.ui-icon-seek-first { background-position: -80px -160px; }
.ui-icon-stop { background-position: -96px -160px; }
.ui-icon-eject { background-position: -112px -160px; }
.ui-icon-volume-off { background-position: -128px -160px; }
.ui-icon-volume-on { background-position: -144px -160px; }
.ui-icon-power { background-position: 0 -176px; }
.ui-icon-signal-diag { background-position: -16px -176px; }
.ui-icon-signal { background-position: -32px -176px; }
.ui-icon-battery-0 { background-position: -48px -176px; }
.ui-icon-battery-1 { background-position: -64px -176px; }
.ui-icon-battery-2 { background-position: -80px -176px; }
.ui-icon-battery-3 { background-position: -96px -176px; }
.ui-icon-circle-plus { background-position: 0 -192px; }
.ui-icon-circle-minus { background-position: -16px -192px; }
.ui-icon-circle-close { background-position: -32px -192px; }
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
.ui-icon-circle-zoomin { background-position: -176px -192px; }
.ui-icon-circle-zoomout { background-position: -192px -192px; }
.ui-icon-circle-check { background-position: -208px -192px; }
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
.ui-icon-circlesmall-close { background-position: -32px -208px; }
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
.ui-icon-squaresmall-close { background-position: -80px -208px; }
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
/* Misc visuals
----------------------------------*/
/* Corner radius */
.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; }
.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; }
.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; }
.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; }
.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; }
.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; }
/* Overlays */
.ui-widget-overlay { background: #666666 url(images/ui-bg_diagonals-thick_20_666666_40x40.png) 50% 50% repeat; opacity: .50;filter:Alpha(Opacity=50); }
.ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; background: #000000 url(images/ui-bg_flat_10_000000_40x100.png) 50% 50% repeat-x; opacity: .20;filter:Alpha(Opacity=20); -moz-border-radius: 5px; -webkit-border-radius: 5px; }/* Accordion
----------------------------------*/
.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
.ui-accordion .ui-accordion-li-fix { display: inline; }
.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em 2.2em; }
.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; }
.ui-accordion .ui-accordion-content-active { display: block; }/* Datepicker
----------------------------------*/
.ui-datepicker { width: 17em; padding: .2em .2em 0; }
.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
.ui-datepicker .ui-datepicker-prev { left:2px; }
.ui-datepicker .ui-datepicker-next { right:2px; }
.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
.ui-datepicker .ui-datepicker-next-hover { right:1px; }
.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
.ui-datepicker .ui-datepicker-title select { float:left; font-size:1em; margin:1px 0; }
.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
.ui-datepicker select.ui-datepicker-month,
.ui-datepicker select.ui-datepicker-year { width: 49%;}
.ui-datepicker .ui-datepicker-title select.ui-datepicker-year { float: right; }
.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
.ui-datepicker td { border: 0; padding: 1px; }
.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
/* with multiple calendars */
.ui-datepicker.ui-datepicker-multi { width:auto; }
.ui-datepicker-multi .ui-datepicker-group { float:left; }
.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
.ui-datepicker-row-break { clear:both; width:100%; }
/* RTL support */
.ui-datepicker-rtl { direction: rtl; }
.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
.ui-datepicker-rtl .ui-datepicker-group { float:right; }
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
.ui-datepicker-cover {
display: none; /*sorry for IE5*/
display/**/: block; /*sorry for IE5*/
position: absolute; /*must have*/
z-index: -1; /*must have*/
filter: mask(); /*must have*/
top: -4px; /*must have*/
left: -4px; /*must have*/
width: 200px; /*must have*/
height: 200px; /*must have*/
}/* Dialog
----------------------------------*/
.ui-dialog { position: relative; padding: .2em; width: 300px; }
.ui-dialog .ui-dialog-titlebar { padding: .5em .3em .3em 1em; position: relative; }
.ui-dialog .ui-dialog-title { float: left; margin: .1em 0 .2em; }
.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
.ui-dialog .ui-dialog-content { border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .6em .3em .6em; line-height: 1.4em; width:auto; overflow:visible; }
.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
.ui-draggable .ui-dialog-titlebar { cursor: move; }
/* Progressbar
----------------------------------*/
.ui-progressbar { height:2em; text-align: left; }
.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }/* Resizable
----------------------------------*/
.ui-resizable { position: relative;}
.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0px; }
.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0px; }
.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0px; height: 100%; }
.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0px; height: 100%; }
.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* Slider
----------------------------------*/
.ui-slider { position: relative; text-align: left; }
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; }
.ui-slider-horizontal { height: .8em; }
.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
.ui-slider-horizontal .ui-slider-range-min { left: 0; }
.ui-slider-horizontal .ui-slider-range-max { right: 0; }
.ui-slider-vertical { width: .8em; height: 100px; }
.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
.ui-slider-vertical .ui-slider-range-max { top: 0; }/* Tabs
----------------------------------*/
.ui-tabs { padding: .2em; zoom: 1; }
.ui-tabs .ui-tabs-nav { list-style: none; position: relative; padding: .2em .2em 0; }
.ui-tabs .ui-tabs-nav li { position: relative; float: left; border-bottom-width: 0 !important; margin: 0 .2em -1px 0; padding: 0; }
.ui-tabs .ui-tabs-nav li a { float: left; text-decoration: none; padding: .5em 1em; }
.ui-tabs .ui-tabs-nav li.ui-tabs-selected { padding-bottom: 1px; border-bottom-width: 0; }
.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
.ui-tabs .ui-tabs-panel { padding: 1em 1.4em; display: block; border-width: 0; background: none; }
.ui-tabs .ui-tabs-hide { display: none !important; }

File diff suppressed because one or more lines are too long

View File

@ -1,19 +0,0 @@
# Turn on URL rewriting
RewriteEngine On
# Installation directory
RewriteBase /kohana/
# Protect application and system files from being viewed
# This is only necessary when these files are inside the webserver document root
RewriteRule ^(application|modules|system) - [R=404,L]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT,L]
# Alternativly, if the rewrite rule above does not work try this instead:
#RewriteRule .* index.php?kohana_uri=$0 [PT,QSA,L]

View File

@ -1,107 +0,0 @@
<?php
/**
* This file acts as the "front controller" to your application. You can
* configure your application, modules, and system directories here.
* PHP error_reporting level may also be changed.
*
* @see http://kohanaphp.com
*/
/**
* Define the website environment status. When this flag is set to TRUE, some
* module demonstration controllers will result in 404 errors. For more information
* about this option, read the documentation about deploying Kohana.
*
* @see http://docs.kohanaphp.com/installation/deployment
*/
define('IN_PRODUCTION', FALSE);
/**
* Website application directory. This directory should contain your application
* configuration, controllers, models, views, and other resources.
*
* This path can be absolute or relative to this file.
*/
$kohana_application = 'application';
/**
* Kohana modules directory. This directory should contain all the modules used
* by your application. Modules are enabled and disabled by the application
* configuration file.
*
* This path can be absolute or relative to this file.
*/
$kohana_modules = 'modules';
/**
* Kohana system directory. This directory should contain the core/ directory,
* and the resources you included in your download of Kohana.
*
* This path can be absolute or relative to this file.
*/
$kohana_system = 'system';
/**
* Test to make sure that Kohana is running on PHP 5.2 or newer. Once you are
* sure that your environment is compatible with Kohana, you can comment this
* line out. When running an application on a new server, uncomment this line
* to check the PHP version quickly.
*/
version_compare(PHP_VERSION, '5.2', '<') and exit('Kohana requires PHP 5.2 or newer.');
/**
* Set the error reporting level. Unless you have a special need, E_ALL is a
* good level for error reporting.
*/
error_reporting(E_ALL & ~E_STRICT);
/**
* Turning off display_errors will effectively disable Kohana error display
* and logging. You can turn off Kohana errors in application/config/config.php
*/
ini_set('display_errors', TRUE);
/**
* If you rename all of your .php files to a different extension, set the new
* extension here. This option can left to .php, even if this file has a
* different extension.
*/
define('EXT', '.php');
//
// DO NOT EDIT BELOW THIS LINE, UNLESS YOU FULLY UNDERSTAND THE IMPLICATIONS.
// ----------------------------------------------------------------------------
// $Id: index.php 4587 2009-09-10 16:45:21Z isaiah $
//
$kohana_pathinfo = pathinfo(__FILE__);
// Define the front controller name and docroot
define('DOCROOT', $kohana_pathinfo['dirname'].DIRECTORY_SEPARATOR);
define('KOHANA', $kohana_pathinfo['basename']);
// If the front controller is a symlink, change to the real docroot
is_link(KOHANA) and chdir(dirname(realpath(__FILE__)));
// If kohana folders are relative paths, make them absolute.
$kohana_application = file_exists($kohana_application) ? $kohana_application : DOCROOT.$kohana_application;
$kohana_modules = file_exists($kohana_modules) ? $kohana_modules : DOCROOT.$kohana_modules;
$kohana_system = file_exists($kohana_system) ? $kohana_system : DOCROOT.$kohana_system;
// Define application and system paths
define('APPPATH', str_replace('\\', '/', realpath($kohana_application)).'/');
define('MODPATH', str_replace('\\', '/', realpath($kohana_modules)).'/');
define('SYSPATH', str_replace('\\', '/', realpath($kohana_system)).'/');
// Clean up
unset($kohana_application, $kohana_modules, $kohana_system);
if (file_exists(DOCROOT.'install'.EXT) AND is_readable(DOCROOT.'install'.EXT))
{
// Load the installation tests
include DOCROOT.'install'.EXT;
}
else
{
// Initialize Kohana
require APPPATH.'Bootstrap'.EXT;
}

View File

@ -1,326 +0,0 @@
(function($) {
var _paths = [];
$.fn.gallery3_client = function() {
return this.each(function(i) {
ajaxifyLoginForm(this);
});
};
function ajaxifyLoginForm(obj) {
var login = $(obj).find("#g-login-form form");
if (login.length > 0) {
$(login).ajaxForm({
dataType: "json",
beforeSubmit: function(formData, form, options) {
form.find(":submit")
.addClass("ui-state-disabled")
.attr("disabled", "disabled");
return true;
},
success: function(data) {
$(obj).html(data.content);
if (data.status == "ok") {
initializeDetail(obj);
} else {
ajaxifyLoginForm(obj);
}
}
});
} else {
initializeDetail(obj);
}
};
function initializeDetail(obj) {
$(".ui-icon-plus", obj).live("click", function (event) {
var siblings = $("~ ul", this);
if (siblings.length > 0) {
siblings.show();
$(this).removeClass("ui-icon-plus");
$(this).addClass("ui-icon-minus");
} else {
var parent = $(this).parents("li:first");
$.get("/g3_client/index.php/g3_client/albums",
{path: $(parent).attr("ref")},
function(data, textStatus) {
$(parent).replaceWith(data);
});
}
return false;
});
$(".ui-icon-minus", obj).live("click", function (event) {
$("~ ul", this).hide();
$(this).removeClass("ui-icon-minus");
$(this).addClass("ui-icon-plus");
return false;
});
$("#center a.wc-child-link").live("dblclick", function(event) {
event.preventDefault();
event.stopPropagation();
var path = $(this).parents("li:first").attr("ref");
var url = $(this).attr("href");
get_detail(path, _set_active_album);
return false;
});
$("#wc-choose-resource").live("click", function(event){
event.preventDefault();
event.stopPropagation();
if ($("#wc-resource-list:visible").length) {
$("#wc-resource-list").hide();
} else {
var parent = $(this).parent("div");
var width = parent.width();
var height = parent.height();
var top = parent.position().top;
var current_path = $("#wc-add-resource").attr("ref");
$("#wc-resource-list li[ref='" + current_path + "']").addClass("ui-selected");
$("#wc-resource-list")
.css({"top": (top + height - 5) + "px", "width": width + "px"})
.show();
}
return false;
});
$("#wc-resource-list").live("click", function(event) {
var ref = $(event.originalTarget).attr("ref");
var text = $(event.originalTarget).text();
$("#wc-add-resource span").text(text);
$("#wc-add-resource").attr("ref", ref);
$("#wc-resource-list").hide();
$("#wc-resource-list li.ui-selected").removeClass("ui-selected");
});
$("#center a.wc-child-link").live("click", function(event) {
$(".wc-thumb-grid-cell.ui-selected").removeClass("ui-selected");
$(this).parents("li:first").addClass("ui-selected");
_set_navigation_buttons($(".wc-thumb-grid-cell.ui-selected").attr("ref"));
return false;
});
$(".wc-button").live("click", function() {
if ($(this).hasClass("ui-state-disabled")) {
return false;
}
var action = $(this).attr("ref");
switch (action) {
case "parent":
get_detail($("span", this).attr("ref"), _set_active_album);
break;
case "first":
case "previous":
case "next":
case "last":
if (resource_type != "album") {
get_detail($("span", this).attr("ref"));
} else {
var selected = $(".wc-thumb-grid-cell.ui-selected");
selected.removeClass("ui-selected");
switch ($(this).attr("ref")) {
case "first":
$(".wc-thumb-grid-cell:first").addClass("ui-selected");
break;
case "previous":
selected.prev().addClass("ui-selected");
break;
case "next":
selected.next().addClass("ui-selected");
break;
case "last":
$(".wc-thumb-grid-cell:last").addClass("ui-selected");
break;
}
_set_navigation_buttons();
}
break;
case "edit":
case "delete":
_open_dialog(action + "_" + resource_type, $("span", this).attr("ref"));
break;
default:
if (/^add_.*/.test(action)) {
_open_dialog(action, $("span", this).attr("ref"));
} else {
console.group("process toolbar button click: " + $(this).attr("ref"));
console.log(($("span", this).attr("ref")));
console.groupEnd();
}
}
return false;
});
$(".tree-title", obj).live("click", function (event) {
get_detail($(this).parents("li:first").attr("ref"));
$(".ui-selected").removeClass("ui-selected");
$(this).addClass("ui-selected");
return false;
});
$("#album_tree [ref=''] .tree-title:first").addClass("ui-selected");
$("#wc-tag-cloud li a", obj).live("click", function (event) {
$.get($(this).attr("href"), function(data, textStatus) {
$("#wc-detail").html(data);
set_selected_thumb();
save_paths();
});
return false;
});
set_selected_thumb();
save_paths();
}
function _set_active_album(path) {
var album = $("#album_tree [ref='" + path + "']");
if (album.length > 0) {
$(".tree-title.ui-selected").removeClass("ui-selected");
$(".tree-title:first", album).addClass("ui-selected");
}
}
function set_selected_thumb() {
if ($(".wc-thumb-grid-cell.ui-selected").length == 0) {
$(".wc-thumb-grid-cell:first").addClass("ui-selected");
}
}
function _open_dialog(dialog, resource_path) {
$("body").append('<div id="g-dialog"></div>');
$("#g-dialog").dialog({
model: true,
resizable: false,
position: "center",
close: function() {
$("#g-dialog").dialog("destroy").remove();
}
});
$.getJSON("/g3_client/index.php/" + dialog, {path: resource_path}, function(data) {
$("#g-dialog").html(data.form);
if ($("#g-dialog fieldset legend").length) {
$("#g-dialog").dialog('option', 'title', $("#g-dialog fieldset legend:eq(0)").html());
}
_ajaxifyDialog();
$("#g-dialog").dialog("open");
});
}
function _ajaxifyDialog() {
if ($("#g-dialog form").length) {
$("#g-dialog form").ajaxForm({
dataType: "json",
beforeSubmit: function(formData, form, options) {
form.find(":submit, :reset")
.addClass("ui-state-disabled")
.attr("disabled", "disabled");
return true;
},
success: function(data) {
if (data.form) {
$("#g-dialog form").replaceWith(data.form);
$("#g-dialog form :submit").removeClass("ui-state-disabled")
.attr("disabled", null);
_ajaxifyDialog();
}
if (data.result == "success") {
$("#g-dialog").dialog('close');
get_detail(data.path, _set_active_album);
if (data.type == "album") {
var path = data.path;
$.get("/g3_client/index.php/g3_client/albums",
{path: path},
function(data, textStatus) {
var selector = "#album_tree li[ref=" + path + "]";
$(selector).replaceWith(data);
$(selector + " .tree-title:first").addClass("ui-selected");
});
}
} else if (data.result == "fail") {
$("#g-dialog").dialog('close');
alert(data.message);
}
}
});
}
}
function get_detail(path, callback) {
$.get("/g3_client/index.php/g3_client/detail", {path: path}, function(data, textStatus) {
$("#wc-detail").html(data);
set_selected_thumb();
save_paths();
if (callback) {
callback(path);
}
});
}
function save_paths() {
_paths[current_path] = [];
$(".wc-thumb-grid-cell").each(function(i) {
_paths[current_path][i] = $(this).attr("ref");
});
_set_navigation_buttons();
}
function _set_navigation_buttons() {
if (current_path != "") {
$(".wc-toolbar .ui-icon-eject").parent("a").removeClass("ui-state-disabled");
//$(".wc-toolbar .ui-icon-trash").parent("a").removeClass("ui-state-disabled");
} else {
$(".wc-toolbar .ui-icon-eject").parent("a").addClass("ui-state-disabled");
//$(".wc-toolbar .ui-icon-trash").parent("a").addClass("ui-state-disabled");
}
$(".wc-toolbar .ui-icon-eject").attr("ref", parent_path);
$(".wc-toolbar .ui-icon-pencil").attr("ref", current_path);
$(".wc-toolbar #wc-add-resource span")
.attr("ref", resource_type == "album" ? current_path : parent_path);
var paths = _paths[resource_type == "album" ? current_path : parent_path];
$(".wc-toolbar .ui-icon-pencil").attr("ref", current_path);
if (paths.length > 0) {
$(".wc-toolbar .ui-icon-seek-first").parent("a").removeClass("ui-state-disabled");
$(".wc-toolbar .ui-icon-seek-end").parent("a").removeClass("ui-state-disabled");
$(".wc-toolbar .ui-icon-seek-first").attr("ref", paths[0]);
$(".wc-toolbar .ui-icon-seek-end").attr("ref", paths[paths.length - 1]);
} else {
$(".wc-toolbar .ui-icon-seek-first").parent("a").addClass("ui-state-disabled");
$(".wc-toolbar .ui-icon-seek-end").parent("a").addClass("ui-state-disabled");
}
var selected_path =
resource_type == "album" ? $(".wc-thumb-grid-cell.ui-selected").attr("ref") : current_path;
var i = 0;
for (; i < paths.length; i++) {
if (paths[i] == selected_path) {
break;
}
}
$(".wc-toolbar .ui-icon-trash").attr("ref", selected_path);
if (i > 0) {
$(".wc-toolbar .ui-icon-seek-prev").parent("a").removeClass("ui-state-disabled");
$(".wc-toolbar .ui-icon-seek-prev").attr("ref", paths[i - 1]);
} else {
$(".wc-toolbar .ui-icon-seek-first").parent("a").addClass("ui-state-disabled");
$(".wc-toolbar .ui-icon-seek-prev").parent("a").addClass("ui-state-disabled");
}
if (i < paths.length - 1) {
$(".wc-toolbar .ui-icon-seek-next").parent("a").removeClass("ui-state-disabled");
$(".wc-toolbar .ui-icon-seek-next").attr("ref", paths[i + 1]);
} else {
$(".wc-toolbar .ui-icon-seek-next").parent("a").addClass("ui-state-disabled");
$(".wc-toolbar .ui-icon-seek-end").parent("a").addClass("ui-state-disabled");
}
}
})(jQuery);

File diff suppressed because one or more lines are too long

View File

@ -1,645 +0,0 @@
/*
* jQuery Form Plugin
* version: 2.28 (10-MAY-2009)
* @requires jQuery v1.2.2 or later
*
* Examples and documentation at: http://malsup.com/jquery/form/
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
;(function($) {
/*
Usage Note:
-----------
Do not use both ajaxSubmit and ajaxForm on the same form. These
functions are intended to be exclusive. Use ajaxSubmit if you want
to bind your own submit handler to the form. For example,
$(document).ready(function() {
$('#myForm').bind('submit', function() {
$(this).ajaxSubmit({
target: '#output'
});
return false; // <-- important!
});
});
Use ajaxForm when you want the plugin to manage all the event binding
for you. For example,
$(document).ready(function() {
$('#myForm').ajaxForm({
target: '#output'
});
});
When using ajaxForm, the ajaxSubmit function will be invoked for you
at the appropriate time.
*/
/**
* ajaxSubmit() provides a mechanism for immediately submitting
* an HTML form using AJAX.
*/
$.fn.ajaxSubmit = function(options) {
// fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
if (!this.length) {
log('ajaxSubmit: skipping submit process - no element selected');
return this;
}
if (typeof options == 'function')
options = { success: options };
var url = $.trim(this.attr('action'));
if (url) {
// clean url (don't include hash vaue)
url = (url.match(/^([^#]+)/)||[])[1];
}
url = url || window.location.href || ''
options = $.extend({
url: url,
type: this.attr('method') || 'GET'
}, options || {});
// hook for manipulating the form data before it is extracted;
// convenient for use with rich editors like tinyMCE or FCKEditor
var veto = {};
this.trigger('form-pre-serialize', [this, options, veto]);
if (veto.veto) {
log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
return this;
}
// provide opportunity to alter form data before it is serialized
if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
log('ajaxSubmit: submit aborted via beforeSerialize callback');
return this;
}
var a = this.formToArray(options.semantic);
if (options.data) {
options.extraData = options.data;
for (var n in options.data) {
if(options.data[n] instanceof Array) {
for (var k in options.data[n])
a.push( { name: n, value: options.data[n][k] } );
}
else
a.push( { name: n, value: options.data[n] } );
}
}
// give pre-submit callback an opportunity to abort the submit
if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
log('ajaxSubmit: submit aborted via beforeSubmit callback');
return this;
}
// fire vetoable 'validate' event
this.trigger('form-submit-validate', [a, this, options, veto]);
if (veto.veto) {
log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
return this;
}
var q = $.param(a);
if (options.type.toUpperCase() == 'GET') {
options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
options.data = null; // data is null for 'get'
}
else
options.data = q; // data is the query string for 'post'
var $form = this, callbacks = [];
if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
if (options.clearForm) callbacks.push(function() { $form.clearForm(); });
// perform a load on the target only if dataType is not provided
if (!options.dataType && options.target) {
var oldSuccess = options.success || function(){};
callbacks.push(function(data) {
$(options.target).html(data).each(oldSuccess, arguments);
});
}
else if (options.success)
callbacks.push(options.success);
options.success = function(data, status) {
for (var i=0, max=callbacks.length; i < max; i++)
callbacks[i].apply(options, [data, status, $form]);
};
// are there files to upload?
var files = $('input:file', this).fieldValue();
var found = false;
for (var j=0; j < files.length; j++)
if (files[j])
found = true;
var multipart = false;
// var mp = 'multipart/form-data';
// multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
// options.iframe allows user to force iframe mode
if (options.iframe || found || multipart) {
// hack to fix Safari hang (thanks to Tim Molendijk for this)
// see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
if (options.closeKeepAlive)
$.get(options.closeKeepAlive, fileUpload);
else
fileUpload();
}
else
$.ajax(options);
// fire 'notify' event
this.trigger('form-submit-notify', [this, options]);
return this;
// private function for handling file uploads (hat tip to YAHOO!)
function fileUpload() {
var form = $form[0];
/* (this breaks the watermark form uploader, turn it off for now)
if ($(':input[name=submit]', form).length) {
alert('Error: Form elements must not be named "submit".');
return;
}
*/
var opts = $.extend({}, $.ajaxSettings, options);
var s = $.extend(true, {}, $.extend(true, {}, $.ajaxSettings), opts);
var id = 'jqFormIO' + (new Date().getTime());
var $io = $('<iframe id="' + id + '" name="' + id + '" src="about:blank" />');
var io = $io[0];
$io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
var xhr = { // mock object
aborted: 0,
responseText: null,
responseXML: null,
status: 0,
statusText: 'n/a',
getAllResponseHeaders: function() {},
getResponseHeader: function() {},
setRequestHeader: function() {},
abort: function() {
this.aborted = 1;
$io.attr('src','about:blank'); // abort op in progress
}
};
var g = opts.global;
// trigger ajax global events so that activity/block indicators work like normal
if (g && ! $.active++) $.event.trigger("ajaxStart");
if (g) $.event.trigger("ajaxSend", [xhr, opts]);
if (s.beforeSend && s.beforeSend(xhr, s) === false) {
s.global && $.active--;
return;
}
if (xhr.aborted)
return;
var cbInvoked = 0;
var timedOut = 0;
// add submitting element to data if we know it
var sub = form.clk;
if (sub) {
var n = sub.name;
if (n && !sub.disabled) {
options.extraData = options.extraData || {};
options.extraData[n] = sub.value;
if (sub.type == "image") {
options.extraData[name+'.x'] = form.clk_x;
options.extraData[name+'.y'] = form.clk_y;
}
}
}
// take a breath so that pending repaints get some cpu time before the upload starts
setTimeout(function() {
// make sure form attrs are set
var t = $form.attr('target'), a = $form.attr('action');
// update form attrs in IE friendly way
form.setAttribute('target',id);
if (form.getAttribute('method') != 'POST')
form.setAttribute('method', 'POST');
if (form.getAttribute('action') != opts.url)
form.setAttribute('action', opts.url);
// ie borks in some cases when setting encoding
if (! options.skipEncodingOverride) {
$form.attr({
encoding: 'multipart/form-data',
enctype: 'multipart/form-data'
});
}
// support timout
if (opts.timeout)
setTimeout(function() { timedOut = true; cb(); }, opts.timeout);
// add "extra" data to form if provided in options
var extraInputs = [];
try {
if (options.extraData)
for (var n in options.extraData)
extraInputs.push(
$('<input type="hidden" name="'+n+'" value="'+options.extraData[n]+'" />')
.appendTo(form)[0]);
// add iframe to doc and submit the form
$io.appendTo('body');
io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
form.submit();
}
finally {
// reset attrs and remove "extra" input elements
form.setAttribute('action',a);
t ? form.setAttribute('target', t) : $form.removeAttr('target');
$(extraInputs).remove();
}
}, 10);
var nullCheckFlag = 0;
function cb() {
if (cbInvoked++) return;
io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
var ok = true;
try {
if (timedOut) throw 'timeout';
// extract the server response from the iframe
var data, doc;
doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
if ((doc.body == null || doc.body.innerHTML == '') && !nullCheckFlag) {
// in some browsers (cough, Opera 9.2.x) the iframe DOM is not always traversable when
// the onload callback fires, so we give them a 2nd chance
nullCheckFlag = 1;
cbInvoked--;
setTimeout(cb, 100);
return;
}
xhr.responseText = doc.body ? doc.body.innerHTML : null;
xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
xhr.getResponseHeader = function(header){
var headers = {'content-type': opts.dataType};
return headers[header];
};
if (opts.dataType == 'json' || opts.dataType == 'script') {
var ta = doc.getElementsByTagName('textarea')[0];
xhr.responseText = ta ? ta.value : xhr.responseText;
}
else if (opts.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
xhr.responseXML = toXml(xhr.responseText);
}
data = $.httpData(xhr, opts.dataType);
}
catch(e){
ok = false;
$.handleError(opts, xhr, 'error', e);
}
// ordering of these callbacks/triggers is odd, but that's how $.ajax does it
if (ok) {
opts.success(data, 'success');
if (g) $.event.trigger("ajaxSuccess", [xhr, opts]);
}
if (g) $.event.trigger("ajaxComplete", [xhr, opts]);
if (g && ! --$.active) $.event.trigger("ajaxStop");
if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error');
// clean up
setTimeout(function() {
$io.remove();
xhr.responseXML = null;
}, 100);
};
function toXml(s, doc) {
if (window.ActiveXObject) {
doc = new ActiveXObject('Microsoft.XMLDOM');
doc.async = 'false';
doc.loadXML(s);
}
else
doc = (new DOMParser()).parseFromString(s, 'text/xml');
return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
};
};
};
/**
* ajaxForm() provides a mechanism for fully automating form submission.
*
* The advantages of using this method instead of ajaxSubmit() are:
*
* 1: This method will include coordinates for <input type="image" /> elements (if the element
* is used to submit the form).
* 2. This method will include the submit element's name/value data (for the element that was
* used to submit the form).
* 3. This method binds the submit() method to the form for you.
*
* The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
* passes the options argument along after properly binding events for submit elements and
* the form itself.
*/
$.fn.ajaxForm = function(options) {
return this.ajaxFormUnbind().bind('submit.form-plugin',function() {
$(this).ajaxSubmit(options);
return false;
}).each(function() {
// store options in hash
$(":submit,input:image", this).bind('click.form-plugin',function(e) {
var form = this.form;
form.clk = this;
if (this.type == 'image') {
if (e.offsetX != undefined) {
form.clk_x = e.offsetX;
form.clk_y = e.offsetY;
} else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
var offset = $(this).offset();
form.clk_x = e.pageX - offset.left;
form.clk_y = e.pageY - offset.top;
} else {
form.clk_x = e.pageX - this.offsetLeft;
form.clk_y = e.pageY - this.offsetTop;
}
}
// clear form vars
setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 10);
});
});
};
// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
$.fn.ajaxFormUnbind = function() {
this.unbind('submit.form-plugin');
return this.each(function() {
$(":submit,input:image", this).unbind('click.form-plugin');
});
};
/**
* formToArray() gathers form element data into an array of objects that can
* be passed to any of the following ajax functions: $.get, $.post, or load.
* Each object in the array has both a 'name' and 'value' property. An example of
* an array for a simple login form might be:
*
* [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
*
* It is this array that is passed to pre-submit callback functions provided to the
* ajaxSubmit() and ajaxForm() methods.
*/
$.fn.formToArray = function(semantic) {
var a = [];
if (this.length == 0) return a;
var form = this[0];
var els = semantic ? form.getElementsByTagName('*') : form.elements;
if (!els) return a;
for(var i=0, max=els.length; i < max; i++) {
var el = els[i];
var n = el.name;
if (!n) continue;
if (semantic && form.clk && el.type == "image") {
// handle image inputs on the fly when semantic == true
if(!el.disabled && form.clk == el) {
a.push({name: n, value: $(el).val()});
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
}
continue;
}
var v = $.fieldValue(el, true);
if (v && v.constructor == Array) {
for(var j=0, jmax=v.length; j < jmax; j++)
a.push({name: n, value: v[j]});
}
else if (v !== null && typeof v != 'undefined')
a.push({name: n, value: v});
}
if (!semantic && form.clk) {
// input type=='image' are not found in elements array! handle it here
var $input = $(form.clk), input = $input[0], n = input.name;
if (n && !input.disabled && input.type == 'image') {
a.push({name: n, value: $input.val()});
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
}
}
return a;
};
/**
* Serializes form data into a 'submittable' string. This method will return a string
* in the format: name1=value1&amp;name2=value2
*/
$.fn.formSerialize = function(semantic) {
//hand off to jQuery.param for proper encoding
return $.param(this.formToArray(semantic));
};
/**
* Serializes all field elements in the jQuery object into a query string.
* This method will return a string in the format: name1=value1&amp;name2=value2
*/
$.fn.fieldSerialize = function(successful) {
var a = [];
this.each(function() {
var n = this.name;
if (!n) return;
var v = $.fieldValue(this, successful);
if (v && v.constructor == Array) {
for (var i=0,max=v.length; i < max; i++)
a.push({name: n, value: v[i]});
}
else if (v !== null && typeof v != 'undefined')
a.push({name: this.name, value: v});
});
//hand off to jQuery.param for proper encoding
return $.param(a);
};
/**
* Returns the value(s) of the element in the matched set. For example, consider the following form:
*
* <form><fieldset>
* <input name="A" type="text" />
* <input name="A" type="text" />
* <input name="B" type="checkbox" value="B1" />
* <input name="B" type="checkbox" value="B2"/>
* <input name="C" type="radio" value="C1" />
* <input name="C" type="radio" value="C2" />
* </fieldset></form>
*
* var v = $(':text').fieldValue();
* // if no values are entered into the text inputs
* v == ['','']
* // if values entered into the text inputs are 'foo' and 'bar'
* v == ['foo','bar']
*
* var v = $(':checkbox').fieldValue();
* // if neither checkbox is checked
* v === undefined
* // if both checkboxes are checked
* v == ['B1', 'B2']
*
* var v = $(':radio').fieldValue();
* // if neither radio is checked
* v === undefined
* // if first radio is checked
* v == ['C1']
*
* The successful argument controls whether or not the field element must be 'successful'
* (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
* The default value of the successful argument is true. If this value is false the value(s)
* for each element is returned.
*
* Note: This method *always* returns an array. If no valid value can be determined the
* array will be empty, otherwise it will contain one or more values.
*/
$.fn.fieldValue = function(successful) {
for (var val=[], i=0, max=this.length; i < max; i++) {
var el = this[i];
var v = $.fieldValue(el, successful);
if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))
continue;
v.constructor == Array ? $.merge(val, v) : val.push(v);
}
return val;
};
/**
* Returns the value of the field element.
*/
$.fieldValue = function(el, successful) {
var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
if (typeof successful == 'undefined') successful = true;
if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
(t == 'checkbox' || t == 'radio') && !el.checked ||
(t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
tag == 'select' && el.selectedIndex == -1))
return null;
if (tag == 'select') {
var index = el.selectedIndex;
if (index < 0) return null;
var a = [], ops = el.options;
var one = (t == 'select-one');
var max = (one ? index+1 : ops.length);
for(var i=(one ? index : 0); i < max; i++) {
var op = ops[i];
if (op.selected) {
var v = op.value;
if (!v) // extra pain for IE...
v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
if (one) return v;
a.push(v);
}
}
return a;
}
return el.value;
};
/**
* Clears the form data. Takes the following actions on the form's input fields:
* - input text fields will have their 'value' property set to the empty string
* - select elements will have their 'selectedIndex' property set to -1
* - checkbox and radio inputs will have their 'checked' property set to false
* - inputs of type submit, button, reset, and hidden will *not* be effected
* - button elements will *not* be effected
*/
$.fn.clearForm = function() {
return this.each(function() {
$('input,select,textarea', this).clearFields();
});
};
/**
* Clears the selected form elements.
*/
$.fn.clearFields = $.fn.clearInputs = function() {
return this.each(function() {
var t = this.type, tag = this.tagName.toLowerCase();
if (t == 'text' || t == 'password' || tag == 'textarea')
this.value = '';
else if (t == 'checkbox' || t == 'radio')
this.checked = false;
else if (tag == 'select')
this.selectedIndex = -1;
});
};
/**
* Resets the form data. Causes all form elements to be reset to their original value.
*/
$.fn.resetForm = function() {
return this.each(function() {
// guard against an input with the name of 'reset'
// note that IE reports the reset function as an 'object'
if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
this.reset();
});
};
/**
* Enables or disables any matching elements.
*/
$.fn.enable = function(b) {
if (b == undefined) b = true;
return this.each(function() {
this.disabled = !b;
});
};
/**
* Checks/unchecks any matching checkboxes or radio buttons and
* selects/deselects and matching option elements.
*/
$.fn.selected = function(select) {
if (select == undefined) select = true;
return this.each(function() {
var t = this.type;
if (t == 'checkbox' || t == 'radio')
this.checked = select;
else if (this.tagName.toLowerCase() == 'option') {
var $sel = $(this).parent('select');
if (select && $sel[0] && $sel[0].type == 'select-one') {
// deselect all other options
$sel.find('option').selected(false);
}
this.selected = select;
}
});
};
// helper fn for console logging
// set $.fn.ajaxSubmit.debug to true to enable debug logging
function log() {
if ($.fn.ajaxSubmit.debug && window.console && window.console.log)
window.console.log('[jquery.form] ' + Array.prototype.join.call(arguments,''));
};
})(jQuery);

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

File diff suppressed because one or more lines are too long

View File

@ -1,31 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* @package Cache
*
* Cache settings, defined as arrays, or "groups". If no group name is
* used when loading the cache library, the group named "default" will be used.
*
* Each group can be used independently, and multiple groups can be used at once.
*
* Group Options:
* driver - Cache backend driver. Kohana comes with file, database, and memcache drivers.
* > File cache is fast and reliable, but requires many filesystem lookups.
* > Database cache can be used to cache items remotely, but is slower.
* > Memcache is very high performance, but prevents cache tags from being used.
*
* params - Driver parameters, specific to each driver.
*
* lifetime - Default lifetime of caches in seconds. By default caches are stored for
* thirty minutes. Specific lifetime can also be set when creating a new cache.
* Setting this to 0 will never automatically delete caches.
*
* prefix - Adds a prefix to all keys and tags. This can have a severe performance impact.
*
*/
$config['default'] = array
(
'driver' => 'file',
'params' => array('directory' => APPPATH.'cache', 'gc_probability' => 1000),
'lifetime' => 1800,
'prefix' => NULL
);

View File

@ -1,38 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* @package Core
*
* Domain, to restrict the cookie to a specific website domain. For security,
* you are encouraged to set this option. An empty setting allows the cookie
* to be read by any website domain.
*/
$config['domain'] = '';
/**
* Restrict cookies to a specific path, typically the installation directory.
*/
$config['path'] = '/';
/**
* Lifetime of the cookie. A setting of 0 makes the cookie active until the
* users browser is closed or the cookie is deleted.
*/
$config['expire'] = 0;
/**
* Enable this option to only allow the cookie to be read when using the a
* secure protocol.
*/
$config['secure'] = FALSE;
/**
* Enable this option to make the cookie accessible only through the
* HTTP protocol (e.g. no javascript access). This is not supported by all browsers.
*/
$config['httponly'] = FALSE;
/**
* Cookie salt for signed cookies.
* Make sure you change this to a unique value.
*/
$config['salt'] = 'K0hAN4 15 Th3 B357';

View File

@ -1,60 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Credit card validation configuration.
*
* Options for each credit card:
* length - All the allowed card number lengths, in a comma separated string
* prefix - The digits the card needs to start with, in regex format
* luhn - Enable or disable card number validation by the Luhn algorithm
*/
$config = array
(
'default' => array
(
'length' => '13,14,15,16,17,18,19',
'prefix' => '',
'luhn' => TRUE
),
'american express' => array
(
'length' => '15',
'prefix' => '3[47]',
'luhn' => TRUE
),
'diners club' => array
(
'length' => '14,16',
'prefix' => '36|55|30[0-5]',
'luhn' => TRUE
),
'discover' => array
(
'length' => '16',
'prefix' => '6(?:5|011)',
'luhn' => TRUE,
),
'jcb' => array
(
'length' => '15,16',
'prefix' => '3|1800|2131',
'luhn' => TRUE
),
'maestro' => array
(
'length' => '16,18',
'prefix' => '50(?:20|38)|6(?:304|759)',
'luhn' => TRUE
),
'mastercard' => array
(
'length' => '16',
'prefix' => '5[1-5]',
'luhn' => TRUE
),
'visa' => array
(
'length' => '13,16',
'prefix' => '4',
'luhn' => TRUE
),
);

View File

@ -1,46 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* @package Database
*
* Database connection settings, defined as arrays, or "groups". If no group
* name is used when loading the database library, the group named "default"
* will be used.
*
* Each group can be connected to independently, and multiple groups can be
* connected at once.
*
* Group Options:
* benchmark - Enable or disable database benchmarking
* persistent - Enable or disable a persistent connection
* connection - Array of connection specific parameters; alternatively,
* you can use a DSN though it is not as fast and certain
* characters could create problems (like an '@' character
* in a password):
* 'connection' => 'mysql://dbuser:secret@localhost/kohana'
* character_set - Database character set
* table_prefix - Database table prefix
* object - Enable or disable object results
* cache - Enable or disable query caching
* escape - Enable automatic query builder escaping
*/
$config['default'] = array
(
'benchmark' => FALSE,
'persistent' => FALSE,
'connection' => array
(
'type' => 'mysql',
'user' => 'dbuser',
'pass' => 'p@ssw0rd',
'host' => 'localhost',
'port' => FALSE,
'socket' => FALSE,
'database' => 'kohana',
'params' => NULL,
),
'character_set' => 'utf8',
'table_prefix' => '',
'object' => TRUE,
'cache' => FALSE,
'escape' => TRUE
);

View File

@ -1,31 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* @package Encrypt
*
* Encrypt configuration is defined in groups which allows you to easily switch
* between different encryption settings for different uses.
* Note: all groups inherit and overwrite the default group.
*
* Group Options:
* key - Encryption key used to do encryption and decryption. The default option
* should never be used for a production website.
*
* For best security, your encryption key should be at least 16 characters
* long and contain letters, numbers, and symbols.
* @note Do not use a hash as your key. This significantly lowers encryption entropy.
*
* mode - MCrypt encryption mode. By default, MCRYPT_MODE_NOFB is used. This mode
* offers initialization vector support, is suited to short strings, and
* produces the shortest encrypted output.
* @see http://php.net/mcrypt
*
* cipher - MCrypt encryption cipher. By default, the MCRYPT_RIJNDAEL_128 cipher is used.
* This is also known as 128-bit AES.
* @see http://php.net/mcrypt
*/
$config['default'] = array
(
'key' => 'K0H@NA+PHP_7hE-SW!FtFraM3w0R|<',
'mode' => MCRYPT_MODE_NOFB,
'cipher' => MCRYPT_RIJNDAEL_128
);

View File

@ -1,7 +0,0 @@
<?php
/**
* If using HTMLPurifier then this option allows setting an
* alternative path for the cache data. Note that that path
* must be an absolute location.
*/
$config['cache'] = '/tmp/htmlpurifier';

View File

@ -1,19 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
// HTTP-EQUIV type meta tags
$config['meta_equiv'] = array
(
'cache-control',
'content-type', 'content-script-type', 'content-style-type',
'content-disposition',
'content-language',
'default-style',
'expires',
'ext-cache',
'pics-label',
'pragma',
'refresh',
'set-cookie',
'vary',
'window-target',
);

View File

@ -1,13 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* @package Image
*
* Driver name. Default: GD
*/
$config['driver'] = 'GD';
/**
* Driver parameters:
* ImageMagick - set the "directory" parameter to your ImageMagick installation directory
*/
$config['params'] = array();

View File

@ -1,60 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
$config['uncountable'] = array
(
'access',
'advice',
'art',
'baggage',
'dances',
'data',
'equipment',
'fish',
'fuel',
'furniture',
'food',
'heat',
'honey',
'homework',
'impatience',
'information',
'knowledge',
'luggage',
'metadata',
'money',
'music',
'news',
'patience',
'progress',
'pollution',
'research',
'rice',
'sand',
'series',
'sheep',
'sms',
'species',
'staff',
'toothpaste',
'traffic',
'understanding',
'water',
'weather',
'work',
);
$config['irregular'] = array
(
'child' => 'children',
'clothes' => 'clothing',
'man' => 'men',
'movie' => 'movies',
'person' => 'people',
'woman' => 'women',
'mouse' => 'mice',
'goose' => 'geese',
'ox' => 'oxen',
'leaf' => 'leaves',
'course' => 'courses',
'size' => 'sizes',
);

View File

@ -1,17 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* @package Core
*
* Default language locale name(s).
* First item must be a valid i18n directory name, subsequent items are alternative locales
* for OS's that don't support the first (e.g. Windows). The first valid locale in the array will be used.
* @see http://php.net/setlocale
*/
$config['language'] = array('en_US', 'English_United States');
/**
* Locale timezone. Defaults to the timezone you have set in your php config
* This cannot be left empty, a valid timezone is required!
* @see http://php.net/timezones
*/
$config['timezone'] = ini_get('date.timezone');

View File

@ -1,19 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
// Different log levels
$config['log_levels'] = array
(
'error' => 1,
'alert' => 2,
'info' => 3,
'debug' => 4,
);
// See different log levels above
$config['log_threshold'] = 1;
$config['date_format'] = 'Y-m-d H:i:s P';
// We can define multiple logging backends at the same time.
$config['drivers'] = array('file');

View File

@ -1,24 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Database config group to store log messages
*/
$config['group'] = 'default';
/**
* Database table to store log messages in
*/
$config['table'] = 'logs';
/* MySQL Database schema:
CREATE TABLE IF NOT EXISTS `logs` (
`id` int(10) unsigned NOT NULL auto_increment,
`date` int(11) NOT NULL,
`level` varchar(5) NOT NULL,
`message` text NOT NULL,
PRIMARY KEY (`id`),
KEY `date` (`date`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
*/

View File

@ -1,11 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Message logging directory.
*/
$config['log_directory'] = APPPATH.'logs';
/**
* Permissions of the log file
*/
$config['posix_permissions'] = 0644;

View File

@ -1,6 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Ident string added to each syslog message
*/
$config['ident'] = 'KohanaPHP';

View File

@ -1,224 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* @package Core
*
* A list of mime types. Our list is generally more complete and accurate than
* the operating system MIME list.
*
* If there are any missing options, please create a ticket on our issue tracker,
* http://dev.kohanaphp.com/projects/kohana2. Be sure to give the filename and
* expected MIME type, as well as any additional information you can provide.
*/
$config = array
(
'323' => array('text/h323'),
'7z' => array('application/x-7z-compressed'),
'abw' => array('application/x-abiword'),
'acx' => array('application/internet-property-stream'),
'ai' => array('application/postscript'),
'aif' => array('audio/x-aiff'),
'aifc' => array('audio/x-aiff'),
'aiff' => array('audio/x-aiff'),
'asf' => array('video/x-ms-asf'),
'asr' => array('video/x-ms-asf'),
'asx' => array('video/x-ms-asf'),
'atom' => array('application/atom+xml'),
'avi' => array('video/avi', 'video/msvideo', 'video/x-msvideo'),
'bin' => array('application/octet-stream','application/macbinary'),
'bmp' => array('image/bmp'),
'c' => array('text/x-csrc'),
'c++' => array('text/x-c++src'),
'cab' => array('application/x-cab'),
'cc' => array('text/x-c++src'),
'cda' => array('application/x-cdf'),
'class' => array('application/octet-stream'),
'cpp' => array('text/x-c++src'),
'cpt' => array('application/mac-compactpro'),
'csh' => array('text/x-csh'),
'css' => array('text/css'),
'csv' => array('text/x-comma-separated-values', 'application/vnd.ms-excel', 'text/comma-separated-values', 'text/csv'),
'dbk' => array('application/docbook+xml'),
'dcr' => array('application/x-director'),
'deb' => array('application/x-debian-package'),
'diff' => array('text/x-diff'),
'dir' => array('application/x-director'),
'divx' => array('video/divx'),
'dll' => array('application/octet-stream', 'application/x-msdos-program'),
'dmg' => array('application/x-apple-diskimage'),
'dms' => array('application/octet-stream'),
'doc' => array('application/msword'),
'dvi' => array('application/x-dvi'),
'dxr' => array('application/x-director'),
'eml' => array('message/rfc822'),
'eps' => array('application/postscript'),
'evy' => array('application/envoy'),
'exe' => array('application/x-msdos-program', 'application/octet-stream'),
'fla' => array('application/octet-stream'),
'flac' => array('application/x-flac'),
'flc' => array('video/flc'),
'fli' => array('video/fli'),
'flv' => array('video/x-flv'),
'gif' => array('image/gif'),
'gtar' => array('application/x-gtar'),
'gz' => array('application/x-gzip'),
'h' => array('text/x-chdr'),
'h++' => array('text/x-c++hdr'),
'hh' => array('text/x-c++hdr'),
'hpp' => array('text/x-c++hdr'),
'hqx' => array('application/mac-binhex40'),
'hs' => array('text/x-haskell'),
'htm' => array('text/html'),
'html' => array('text/html'),
'ico' => array('image/x-icon'),
'ics' => array('text/calendar'),
'iii' => array('application/x-iphone'),
'ins' => array('application/x-internet-signup'),
'iso' => array('application/x-iso9660-image'),
'isp' => array('application/x-internet-signup'),
'jar' => array('application/java-archive'),
'java' => array('application/x-java-applet'),
'jpe' => array('image/jpeg', 'image/pjpeg'),
'jpeg' => array('image/jpeg', 'image/pjpeg'),
'jpg' => array('image/jpeg', 'image/pjpeg'),
'js' => array('application/x-javascript'),
'json' => array('application/json'),
'latex' => array('application/x-latex'),
'lha' => array('application/octet-stream'),
'log' => array('text/plain', 'text/x-log'),
'lzh' => array('application/octet-stream'),
'm4a' => array('audio/mpeg'),
'm4p' => array('video/mp4v-es'),
'm4v' => array('video/mp4'),
'man' => array('application/x-troff-man'),
'mdb' => array('application/x-msaccess'),
'midi' => array('audio/midi'),
'mid' => array('audio/midi'),
'mif' => array('application/vnd.mif'),
'mka' => array('audio/x-matroska'),
'mkv' => array('video/x-matroska'),
'mov' => array('video/quicktime'),
'movie' => array('video/x-sgi-movie'),
'mp2' => array('audio/mpeg'),
'mp3' => array('audio/mpeg'),
'mp4' => array('application/mp4','audio/mp4','video/mp4'),
'mpa' => array('video/mpeg'),
'mpe' => array('video/mpeg'),
'mpeg' => array('video/mpeg'),
'mpg' => array('video/mpeg'),
'mpg4' => array('video/mp4'),
'mpga' => array('audio/mpeg'),
'mpp' => array('application/vnd.ms-project'),
'mpv' => array('video/x-matroska'),
'mpv2' => array('video/mpeg'),
'ms' => array('application/x-troff-ms'),
'msg' => array('application/msoutlook','application/x-msg'),
'msi' => array('application/x-msi'),
'nws' => array('message/rfc822'),
'oda' => array('application/oda'),
'odb' => array('application/vnd.oasis.opendocument.database'),
'odc' => array('application/vnd.oasis.opendocument.chart'),
'odf' => array('application/vnd.oasis.opendocument.forumla'),
'odg' => array('application/vnd.oasis.opendocument.graphics'),
'odi' => array('application/vnd.oasis.opendocument.image'),
'odm' => array('application/vnd.oasis.opendocument.text-master'),
'odp' => array('application/vnd.oasis.opendocument.presentation'),
'ods' => array('application/vnd.oasis.opendocument.spreadsheet'),
'odt' => array('application/vnd.oasis.opendocument.text'),
'oga' => array('audio/ogg'),
'ogg' => array('application/ogg'),
'ogv' => array('video/ogg'),
'otg' => array('application/vnd.oasis.opendocument.graphics-template'),
'oth' => array('application/vnd.oasis.opendocument.web'),
'otp' => array('application/vnd.oasis.opendocument.presentation-template'),
'ots' => array('application/vnd.oasis.opendocument.spreadsheet-template'),
'ott' => array('application/vnd.oasis.opendocument.template'),
'p' => array('text/x-pascal'),
'pas' => array('text/x-pascal'),
'patch' => array('text/x-diff'),
'pbm' => array('image/x-portable-bitmap'),
'pdf' => array('application/pdf', 'application/x-download'),
'php' => array('application/x-httpd-php'),
'php3' => array('application/x-httpd-php'),
'php4' => array('application/x-httpd-php'),
'php5' => array('application/x-httpd-php'),
'phps' => array('application/x-httpd-php-source'),
'phtml' => array('application/x-httpd-php'),
'pl' => array('text/x-perl'),
'pm' => array('text/x-perl'),
'png' => array('image/png', 'image/x-png'),
'po' => array('text/x-gettext-translation'),
'pot' => array('application/vnd.ms-powerpoint'),
'pps' => array('application/vnd.ms-powerpoint'),
'ppt' => array('application/powerpoint'),
'ps' => array('application/postscript'),
'psd' => array('application/x-photoshop', 'image/x-photoshop'),
'pub' => array('application/x-mspublisher'),
'py' => array('text/x-python'),
'qt' => array('video/quicktime'),
'ra' => array('audio/x-realaudio'),
'ram' => array('audio/x-realaudio', 'audio/x-pn-realaudio'),
'rar' => array('application/rar'),
'rgb' => array('image/x-rgb'),
'rm' => array('audio/x-pn-realaudio'),
'rpm' => array('audio/x-pn-realaudio-plugin', 'application/x-redhat-package-manager'),
'rss' => array('application/rss+xml'),
'rtf' => array('text/rtf'),
'rtx' => array('text/richtext'),
'rv' => array('video/vnd.rn-realvideo'),
'sea' => array('application/octet-stream'),
'sh' => array('text/x-sh'),
'shtml' => array('text/html'),
'sit' => array('application/x-stuffit'),
'smi' => array('application/smil'),
'smil' => array('application/smil'),
'so' => array('application/octet-stream'),
'src' => array('application/x-wais-source'),
'svg' => array('image/svg+xml'),
'swf' => array('application/x-shockwave-flash'),
't' => array('application/x-troff'),
'tar' => array('application/x-tar'),
'tcl' => array('text/x-tcl'),
'tex' => array('application/x-tex'),
'text' => array('text/plain'),
'texti' => array('application/x-texinfo'),
'textinfo' => array('application/x-texinfo'),
'tgz' => array('application/x-tar'),
'tif' => array('image/tiff'),
'tiff' => array('image/tiff'),
'torrent' => array('application/x-bittorrent'),
'tr' => array('application/x-troff'),
'tsv' => array('text/tab-separated-values'),
'txt' => array('text/plain'),
'wav' => array('audio/x-wav'),
'wax' => array('audio/x-ms-wax'),
'wbxml' => array('application/wbxml'),
'wm' => array('video/x-ms-wm'),
'wma' => array('audio/x-ms-wma'),
'wmd' => array('application/x-ms-wmd'),
'wmlc' => array('application/wmlc'),
'wmv' => array('video/x-ms-wmv', 'application/octet-stream'),
'wmx' => array('video/x-ms-wmx'),
'wmz' => array('application/x-ms-wmz'),
'word' => array('application/msword', 'application/octet-stream'),
'wp5' => array('application/wordperfect5.1'),
'wpd' => array('application/vnd.wordperfect'),
'wvx' => array('video/x-ms-wvx'),
'xbm' => array('image/x-xbitmap'),
'xcf' => array('image/xcf'),
'xhtml' => array('application/xhtml+xml'),
'xht' => array('application/xhtml+xml'),
'xl' => array('application/excel', 'application/vnd.ms-excel'),
'xla' => array('application/excel', 'application/vnd.ms-excel'),
'xlc' => array('application/excel', 'application/vnd.ms-excel'),
'xlm' => array('application/excel', 'application/vnd.ms-excel'),
'xls' => array('application/excel', 'application/vnd.ms-excel'),
'xlt' => array('application/excel', 'application/vnd.ms-excel'),
'xml' => array('text/xml'),
'xof' => array('x-world/x-vrml'),
'xpm' => array('image/x-xpixmap'),
'xsl' => array('text/xml'),
'xvid' => array('video/x-xvid'),
'xwd' => array('image/x-xwindowdump'),
'z' => array('application/x-compress'),
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed')
);

View File

@ -1,12 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* @package Profiler
*
* Array of section names to display in the Profiler, TRUE to display all of them.
* Built in sections are benchmarks, database, session, post and cookies, custom sections can be used too.
*/
$config['show'] = TRUE;
$config['time_decimals'] = 3;
$config['memory_decimals'] = 2;

View File

@ -1,7 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* @package Core
*
* Sets the default route to "welcome"
*/
$config['_default'] = 'welcome';

View File

@ -1,48 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* @package Session
*
* Session driver name.
*/
$config['driver'] = 'cookie';
/**
* Session storage parameter, used by drivers.
*/
$config['storage'] = '';
/**
* Session name.
* It must contain only alphanumeric characters and underscores. At least one letter must be present.
*/
$config['name'] = 'kohanasession';
/**
* Session parameters to validate: user_agent, ip_address, expiration.
*/
$config['validate'] = array('user_agent');
/**
* Enable or disable session encryption.
* Note: this has no effect on the native session driver.
*/
$config['encryption'] = FALSE;
/**
* Session lifetime. Number of seconds that each session will last.
* A value of 0 will keep the session active until the browser is closed (with a limit of 24h).
*/
$config['expiration'] = 7200;
/**
* Number of page loads before the session id is regenerated.
* A value of 0 will disable automatic session id regeneration.
* NOTE: Enabling automatic session regeneration can cause a race condition see the
* docs for details: http://docs.kohanaphp.com/libraries/session#regenerate
*/
$config['regenerate'] = 0;
/**
* Percentage probability that the gc (garbage collection) routine is started.
*/
$config['gc_probability'] = 2;

View File

@ -1,93 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* @package Database
*
* SQL data types. If there are missing values, please report them:
*
* @link http://dev.kohanaphp.com/projects/kohana2
*/
$config = array
(
// SQL-92
'bit' => array('type' => 'string', 'exact' => TRUE),
'bit varying' => array('type' => 'string'),
'character' => array('type' => 'string', 'exact' => TRUE),
'character varying' => array('type' => 'string'),
'date' => array('type' => 'string'),
'decimal' => array('type' => 'float', 'exact' => TRUE),
'double precision' => array('type' => 'float'),
'float' => array('type' => 'float'),
'integer' => array('type' => 'int', 'min' => -2147483648, 'max' => 2147483647),
'interval' => array('type' => 'string'),
'national character' => array('type' => 'string', 'exact' => TRUE),
'national character varying' => array('type' => 'string'),
'numeric' => array('type' => 'float', 'exact' => TRUE),
'real' => array('type' => 'float'),
'smallint' => array('type' => 'int', 'min' => -32768, 'max' => 32767),
'time' => array('type' => 'string'),
'time with time zone' => array('type' => 'string'),
'timestamp' => array('type' => 'string'),
'timestamp with time zone' => array('type' => 'string'),
// SQL:1999
//'array','ref','row'
'binary large object' => array('type' => 'string', 'binary' => TRUE),
'boolean' => array('type' => 'boolean'),
'character large object' => array('type' => 'string'),
'national character large object' => array('type' => 'string'),
// SQL:2003
'bigint' => array('type' => 'int', 'min' => -9223372036854775808, 'max' => 9223372036854775807),
// SQL:2008
'binary' => array('type' => 'string', 'binary' => TRUE, 'exact' => TRUE),
'binary varying' => array('type' => 'string', 'binary' => TRUE),
// MySQL
'bigint unsigned' => array('type' => 'int', 'min' => 0, 'max' => 18446744073709551615),
'decimal unsigned' => array('type' => 'float', 'exact' => TRUE, 'min' => 0.0),
'double unsigned' => array('type' => 'float', 'min' => 0.0),
'float unsigned' => array('type' => 'float', 'min' => 0.0),
'integer unsigned' => array('type' => 'int', 'min' => 0, 'max' => 4294967295),
'mediumint' => array('type' => 'int', 'min' => -8388608, 'max' => 8388607),
'mediumint unsigned' => array('type' => 'int', 'min' => 0, 'max' => 16777215),
'real unsigned' => array('type' => 'float', 'min' => 0.0),
'smallint unsigned' => array('type' => 'int', 'min' => 0, 'max' => 65535),
'text' => array('type' => 'string'),
'tinyint' => array('type' => 'int', 'min' => -128, 'max' => 127),
'tinyint unsigned' => array('type' => 'int', 'min' => 0, 'max' => 255),
'year' => array('type' => 'string'),
);
// SQL-92
$config['char'] = $config['character'];
$config['char varying'] = $config['character varying'];
$config['dec'] = $config['decimal'];
$config['int'] = $config['integer'];
$config['nchar'] = $config['national char'] = $config['national character'];
$config['nchar varying'] = $config['national char varying'] = $config['national character varying'];
$config['varchar'] = $config['character varying'];
// SQL:1999
$config['blob'] = $config['binary large object'];
$config['clob'] = $config['char large object'] = $config['character large object'];
$config['nclob'] = $config['nchar large object'] = $config['national character large object'];
$config['time without time zone'] = $config['time'];
$config['timestamp without time zone'] = $config['timestamp'];
// SQL:2008
$config['varbinary'] = $config['binary varying'];
// MySQL
$config['bool'] = $config['boolean'];
$config['datetime'] = $config['timestamp'];
$config['double'] = $config['double precision'];
$config['double precision unsigned'] = $config['double unsigned'];
$config['enum'] = $config['set'] = $config['character varying'];
$config['fixed'] = $config['decimal'];
$config['fixed unsigned'] = $config['decimal unsigned'];
$config['int unsigned'] = $config['integer unsigned'];
$config['longblob'] = $config['mediumblob'] = $config['tinyblob'] = $config['binary large object'];
$config['longtext'] = $config['mediumtext'] = $config['tinytext'] = $config['text'];
$config['numeric unsigned'] = $config['decimal unsigned'];
$config['nvarchar'] = $config['national varchar'] = $config['national character varying'];

View File

@ -1,17 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* @package Core
*
* This path is relative to your index file. Absolute paths are also supported.
*/
$config['directory'] = DOCROOT.'upload';
/**
* Enable or disable directory creation.
*/
$config['create_directories'] = FALSE;
/**
* Remove spaces from uploaded filenames.
*/
$config['remove_spaces'] = TRUE;

View File

@ -1,112 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* @package Core
*
* This file contains four arrays of user agent data. It is used by the
* User Agent library to help identify browser, platform, robot, and
* mobile device data. The array keys are used to identify the device
* and the array values are used to set the actual name of the item.
*/
$config['platform'] = array
(
'windows nt 6.0' => 'Windows Vista',
'windows nt 5.2' => 'Windows 2003',
'windows nt 5.0' => 'Windows 2000',
'windows nt 5.1' => 'Windows XP',
'windows nt 4.0' => 'Windows NT',
'winnt4.0' => 'Windows NT',
'winnt 4.0' => 'Windows NT',
'winnt' => 'Windows NT',
'windows 98' => 'Windows 98',
'win98' => 'Windows 98',
'windows 95' => 'Windows 95',
'win95' => 'Windows 95',
'windows' => 'Unknown Windows OS',
'os x' => 'Mac OS X',
'intel mac' => 'Intel Mac',
'ppc mac' => 'PowerPC Mac',
'powerpc' => 'PowerPC',
'ppc' => 'PowerPC',
'cygwin' => 'Cygwin',
'linux' => 'Linux',
'debian' => 'Debian',
'openvms' => 'OpenVMS',
'sunos' => 'Sun Solaris',
'amiga' => 'Amiga',
'beos' => 'BeOS',
'apachebench' => 'ApacheBench',
'freebsd' => 'FreeBSD',
'netbsd' => 'NetBSD',
'bsdi' => 'BSDi',
'openbsd' => 'OpenBSD',
'os/2' => 'OS/2',
'warp' => 'OS/2',
'aix' => 'AIX',
'irix' => 'Irix',
'osf' => 'DEC OSF',
'hp-ux' => 'HP-UX',
'hurd' => 'GNU/Hurd',
'unix' => 'Unknown Unix OS',
);
// The order of this array should NOT be changed. Many browsers return
// multiple browser types so we want to identify the sub-type first.
$config['browser'] = array
(
'Opera' => 'Opera',
'MSIE' => 'Internet Explorer',
'Internet Explorer' => 'Internet Explorer',
'Shiira' => 'Shiira',
'Firefox' => 'Firefox',
'Chimera' => 'Chimera',
'Phoenix' => 'Phoenix',
'Firebird' => 'Firebird',
'Camino' => 'Camino',
'Netscape' => 'Netscape',
'OmniWeb' => 'OmniWeb',
'Chrome' => 'Chrome',
'Safari' => 'Safari',
'Konqueror' => 'Konqueror',
'Epiphany' => 'Epiphany',
'Galeon' => 'Galeon',
'Mozilla' => 'Mozilla',
'icab' => 'iCab',
'lynx' => 'Lynx',
'links' => 'Links',
'hotjava' => 'HotJava',
'amaya' => 'Amaya',
'IBrowse' => 'IBrowse',
);
$config['mobile'] = array
(
'mobileexplorer' => 'Mobile Explorer',
'openwave' => 'Open Wave',
'opera mini' => 'Opera Mini',
'operamini' => 'Opera Mini',
'elaine' => 'Palm',
'palmsource' => 'Palm',
'digital paths' => 'Palm',
'avantgo' => 'Avantgo',
'xiino' => 'Xiino',
'palmscape' => 'Palmscape',
'nokia' => 'Nokia',
'ericsson' => 'Ericsson',
'blackBerry' => 'BlackBerry',
'motorola' => 'Motorola',
'iphone' => 'iPhone',
'android' => 'Android',
);
// There are hundreds of bots but these are the most common.
$config['robot'] = array
(
'googlebot' => 'Googlebot',
'msnbot' => 'MSNBot',
'slurp' => 'Inktomi Slurp',
'yahoo' => 'Yahoo',
'askjeeves' => 'AskJeeves',
'fastcrawler' => 'FastCrawler',
'infoseek' => 'InfoSeek Robot 1.0',
'lycos' => 'Lycos',
);

View File

@ -1,18 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* @package Core
*
* Allowed non-php view types. Most file extensions are supported.
* Do not forget to add a valid MIME type in mimes.php
*/
$config['allowed_filetypes'] = array
(
'gif',
'jpg', 'jpeg',
'png',
'tif', 'tiff',
'swf',
'htm', 'html',
'css',
'js'
);

View File

@ -1,23 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Outputs the dynamic Captcha resource.
* Usage: Call the Captcha controller from a view, e.g.
* <img src="<?php echo url::site('captcha') ?>" />
*
* $Id: captcha.php 4679 2009-11-10 01:45:52Z isaiah $
*
* @package Captcha
* @author Kohana Team
* @copyright (c) 2007-2009 Kohana Team
* @license http://kohanaphp.com/license
*/
class Captcha_Controller extends Controller {
public function __call($method, $args)
{
// Output the Captcha challenge resource (no html)
// Pull the config group name from the URL
Captcha::factory($this->uri->segment(2))->render(FALSE);
}
} // End Captcha_Controller

View File

@ -1,54 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Allows a template to be automatically loaded and displayed. Display can be
* dynamically turned off in the controller methods, and the template file
* can be overloaded.
*
* To use it, declare your controller to extend this class:
* `class Your_Controller extends Template_Controller`
*
* $Id: template.php 4679 2009-11-10 01:45:52Z isaiah $
*
* @package Core
* @author Kohana Team
* @copyright (c) 2007-2009 Kohana Team
* @license http://kohanaphp.com/license
*/
abstract class Template_Controller extends Controller {
// Template view name
public $template = 'template';
// Default to do auto-rendering
public $auto_render = TRUE;
/**
* Template loading and setup routine.
*/
public function __construct()
{
parent::__construct();
// Load the template
$this->template = new View($this->template);
if ($this->auto_render == TRUE)
{
// Render the template immediately after the controller method
Event::add('system.post_controller', array($this, '_render'));
}
}
/**
* Render the loaded template.
*/
public function _render()
{
if ($this->auto_render == TRUE)
{
// Render the template when the class is destroyed
$this->template->render(TRUE);
}
}
} // End Template_Controller

View File

@ -1,128 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Simple benchmarking.
*
* $Id: Benchmark.php 4679 2009-11-10 01:45:52Z isaiah $
*
* @package Core
* @author Kohana Team
* @copyright (c) 2007-2009 Kohana Team
* @license http://kohanaphp.com/license
*/
final class Benchmark {
// Benchmark timestamps
private static $marks;
/**
* Set a benchmark start point.
*
* @param string benchmark name
* @return void
*/
public static function start($name)
{
if (isset(self::$marks[$name]) AND self::$marks[$name][0]['stop'] === FALSE)
throw new Kohana_Exception('A benchmark named :name is already running.', array(':name' => $name));
if ( ! isset(self::$marks[$name]))
{
self::$marks[$name] = array();
}
$mark = array
(
'start' => microtime(TRUE),
'stop' => FALSE,
'memory_start' => self::memory_usage(),
'memory_stop' => FALSE
);
array_unshift(self::$marks[$name], $mark);
}
/**
* Set a benchmark stop point.
*
* @param string benchmark name
* @return void
*/
public static function stop($name)
{
if (isset(self::$marks[$name]) AND self::$marks[$name][0]['stop'] === FALSE)
{
self::$marks[$name][0]['stop'] = microtime(TRUE);
self::$marks[$name][0]['memory_stop'] = self::memory_usage();
}
}
/**
* Get the elapsed time between a start and stop.
*
* @param string benchmark name, TRUE for all
* @param integer number of decimal places to count to
* @return array
*/
public static function get($name, $decimals = 4)
{
if ($name === TRUE)
{
$times = array();
$names = array_keys(self::$marks);
foreach ($names as $name)
{
// Get each mark recursively
$times[$name] = self::get($name, $decimals);
}
// Return the array
return $times;
}
if ( ! isset(self::$marks[$name]))
return FALSE;
if (self::$marks[$name][0]['stop'] === FALSE)
{
// Stop the benchmark to prevent mis-matched results
self::stop($name);
}
// Return a string version of the time between the start and stop points
// Properly reading a float requires using number_format or sprintf
$time = $memory = 0;
for ($i = 0; $i < count(self::$marks[$name]); $i++)
{
$time += self::$marks[$name][$i]['stop'] - self::$marks[$name][$i]['start'];
$memory += self::$marks[$name][$i]['memory_stop'] - self::$marks[$name][$i]['memory_start'];
}
return array
(
'time' => number_format($time, $decimals),
'memory' => $memory,
'count' => count(self::$marks[$name])
);
}
/**
* Returns the current memory usage. This is only possible if the
* memory_get_usage function is supported in PHP.
*
* @return integer
*/
private static function memory_usage()
{
static $func;
if ($func === NULL)
{
// Test if memory usage can be seen
$func = function_exists('memory_get_usage');
}
return $func ? memory_get_usage() : 0;
}
} // End Benchmark

View File

@ -1,233 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Process queuing/execution class. Allows an unlimited number of callbacks
* to be added to 'events'. Events can be run multiple times, and can also
* process event-specific data. By default, Kohana has several system events.
*
* $Id: Event.php 4679 2009-11-10 01:45:52Z isaiah $
*
* @package Core
* @author Kohana Team
* @copyright (c) 2007-2009 Kohana Team
* @license http://kohanaphp.com/license
* @link http://docs.kohanaphp.com/general/events
*/
abstract class Event_Core {
// Event callbacks
protected static $events = array();
// Cache of events that have been run
protected static $has_run = array();
// Data that can be processed during events
public static $data;
/**
* Add a callback to an event queue.
*
* @param string event name
* @param array http://php.net/callback
* @param boolean prevent duplicates
* @return boolean
*/
public static function add($name, $callback, $unique = FALSE)
{
if ( ! isset(Event::$events[$name]))
{
// Create an empty event if it is not yet defined
Event::$events[$name] = array();
}
elseif ($unique AND in_array($callback, Event::$events[$name], TRUE))
{
// The event already exists
return FALSE;
}
// Add the event
Event::$events[$name][] = $callback;
return TRUE;
}
/**
* Add a callback to an event queue, before a given event.
*
* @param string event name
* @param array existing event callback
* @param array event callback
* @return boolean
*/
public static function add_before($name, $existing, $callback)
{
if (empty(Event::$events[$name]) OR ($key = array_search($existing, Event::$events[$name])) === FALSE)
{
// Just add the event if there are no events
return Event::add($name, $callback);
}
else
{
// Insert the event immediately before the existing event
return Event::insert_event($name, $key, $callback);
}
}
/**
* Add a callback to an event queue, after a given event.
*
* @param string event name
* @param array existing event callback
* @param array event callback
* @return boolean
*/
public static function add_after($name, $existing, $callback)
{
if (empty(Event::$events[$name]) OR ($key = array_search($existing, Event::$events[$name])) === FALSE)
{
// Just add the event if there are no events
return Event::add($name, $callback);
}
else
{
// Insert the event immediately after the existing event
return Event::insert_event($name, $key + 1, $callback);
}
}
/**
* Inserts a new event at a specfic key location.
*
* @param string event name
* @param integer key to insert new event at
* @param array event callback
* @return void
*/
private static function insert_event($name, $key, $callback)
{
if (in_array($callback, Event::$events[$name], TRUE))
return FALSE;
// Add the new event at the given key location
Event::$events[$name] = array_merge
(
// Events before the key
array_slice(Event::$events[$name], 0, $key),
// New event callback
array($callback),
// Events after the key
array_slice(Event::$events[$name], $key)
);
return TRUE;
}
/**
* Replaces an event with another event.
*
* @param string event name
* @param array event to replace
* @param array new callback
* @return boolean
*/
public static function replace($name, $existing, $callback)
{
if (empty(Event::$events[$name]) OR ($key = array_search($existing, Event::$events[$name], TRUE)) === FALSE)
return FALSE;
if ( ! in_array($callback, Event::$events[$name], TRUE))
{
// Replace the exisiting event with the new event
Event::$events[$name][$key] = $callback;
}
else
{
// Remove the existing event from the queue
unset(Event::$events[$name][$key]);
// Reset the array so the keys are ordered properly
Event::$events[$name] = array_values(Event::$events[$name]);
}
return TRUE;
}
/**
* Get all callbacks for an event.
*
* @param string event name
* @return array
*/
public static function get($name)
{
return empty(Event::$events[$name]) ? array() : Event::$events[$name];
}
/**
* Clear some or all callbacks from an event.
*
* @param string event name
* @param array specific callback to remove, FALSE for all callbacks
* @return void
*/
public static function clear($name, $callback = FALSE)
{
if ($callback === FALSE)
{
Event::$events[$name] = array();
}
elseif (isset(Event::$events[$name]))
{
// Loop through each of the event callbacks and compare it to the
// callback requested for removal. The callback is removed if it
// matches.
foreach (Event::$events[$name] as $i => $event_callback)
{
if ($callback === $event_callback)
{
unset(Event::$events[$name][$i]);
}
}
}
}
/**
* Execute all of the callbacks attached to an event.
*
* @param string event name
* @param array data can be processed as Event::$data by the callbacks
* @return void
*/
public static function run($name, & $data = NULL)
{
if ( ! empty(Event::$events[$name]))
{
// So callbacks can access Event::$data
Event::$data =& $data;
$callbacks = Event::get($name);
foreach ($callbacks as $callback)
{
call_user_func_array($callback, array(&$data));
}
// Do this to prevent data from getting 'stuck'
$clear_data = '';
Event::$data =& $clear_data;
}
// The event has been run!
Event::$has_run[$name] = $name;
}
/**
* Check if a given event has been run.
*
* @param string event name
* @return boolean
*/
public static function has_run($name)
{
return isset(Event::$has_run[$name]);
}
} // End Event

File diff suppressed because it is too large Load Diff

View File

@ -1,331 +0,0 @@
<?php defined('SYSPATH') or die('No direct script access.');
/**
* Provides a driver-based interface for setting and getting
* configuration options for the Kohana environment
*
* $Id: Kohana_Config.php 4679 2009-11-10 01:45:52Z isaiah $
*
* @package KohanaConfig
* @author Kohana Team
* @copyright (c) 2007-2009 Kohana Team
* @license http://kohanaphp.com/license
*/
class Kohana_Config_Core implements ArrayAccess {
/**
* The default Kohana_Config driver
* to use for system setup
*
* @var string
* @static
*/
public static $default_driver = 'array';
/**
* Kohana_Config instance
*
* @var array
* @static
*/
protected static $instance;
/**
* Returns a new instance of the Kohana_Config library
* based on the singleton pattern
*
* @param string driver
* @return Kohana_Config
* @access public
* @static
*/
public static function & instance()
{
// If the driver has not been initialised, intialise it
if ( empty(Kohana_Config::$instance))
{
//call a 1 time non singleton of Kohana_Config to get a list of drivers
$config = new Kohana_Config(array(
'config_drivers'=>array(
), 'internal_cache'=>FALSE
));
$core_config = $config->get('core');
Kohana_Config::$instance = new Kohana_Config($core_config);
}
// Return the Kohana_Config driver requested
return Kohana_Config::$instance;
}
/**
* The drivers for this object
*
* @var Kohana_Config_Driver
*/
protected $drivers;
/**
* Kohana_Config constructor to load the supplied driver.
* Enforces the singleton pattern.
*
* @param string driver
* @access protected
*/
protected function __construct(array $core_config)
{
$drivers = $core_config['config_drivers'];
//remove array if it's found in config
if (in_array('array', $drivers))
unset($drivers[array_search('array', $drivers)]);
//add array at the very end
$this->drivers = $drivers = array_merge($drivers, array(
'array'
));
foreach ($this->drivers as & $driver)
{
// Create the driver name
$driver = 'Config_'.ucfirst($driver).'_Driver';
// Ensure the driver loads correctly
if (!Kohana::auto_load($driver))
throw new Kohana_Exception('The :driver: driver for the :library: library could not be found.', array(
':driver:' => $driver, ':library:' => get_class($this)
));
// Load the new driver
$driver = new $driver($core_config);
// Ensure the new driver is valid
if (!$driver instanceof Config_Driver)
throw new Kohana_Exception('The :driver: driver for the :library: library must implement the :interface: interface', array(
':driver:' => $driver, ':library:' => get_class($this), ':interface:' => 'Config_Driver'
));
}
}
/**
* Gets a value from the configuration driver
*
* @param string key
* @param bool slash
* @param bool required
* @return mixed
* @access public
*/
public function get($key, $slash = FALSE, $required = FALSE)
{
foreach ($this->drivers as $driver)
{
try
{
return $driver->get($key, $slash, $required);
}
catch (Kohana_Config_Exception $e)
{
//if it's the last driver in the list and it threw an exception, re throw it
if ($driver === $this->drivers[(count($this->drivers) - 1)])
throw $e;
}
}
}
/**
* Sets a value to the configuration drivers
*
* @param string key
* @param mixed value
* @return bool
* @access public
*/
public function set($key, $value)
{
foreach ($this->drivers as $driver)
{
try
{
$driver->set($key, $value);
}
catch (Kohana_Config_Exception $e)
{
//if it's the last driver in the list and it threw an exception, re throw it
if ($driver === $this->drivers[(count($this->drivers) - 1)])
throw $e;
}
}
return TRUE;
}
/**
* Clears a group from configuration
*
* @param string group
* @return bool
* @access public
*/
public function clear($group)
{
foreach ($this->drivers as $driver)
{
try
{
$driver->clear($group);
}
catch (Kohana_Config_Exception $e)
{
//if it's the last driver in the list and it threw an exception, re throw it
if ($driver === $this->drivers[(count($this->drivers) - 1)])
throw $e;
}
}
return TRUE;
}
/**
* Loads a configuration group
*
* @param string group
* @param bool required
* @return array
* @access public
*/
public function load($group, $required = FALSE)
{
foreach ($this->drivers as $driver)
{
try
{
return $driver->load($group, $required);
}
catch (Kohana_Config_Exception $e)
{
//if it's the last driver in the list and it threw an exception, re throw it
if ($driver === $this->drivers[(count($this->drivers) - 1)])
throw $e;
}
}
}
/**
* Returns true or false if any config has been loaded(either manually or from cache)
*
* @return boolean
*/
public function loaded()
{
return $this->drivers[(count($this->drivers) - 1)]->loaded;
}
/**
* The following allows access using
* array syntax.
*
* @example $config['core.site_domain']
*/
/**
* Allows access to configuration settings
* using the ArrayAccess interface
*
* @param string key
* @return mixed
* @access public
*/
public function offsetGet($key)
{
foreach ($this->drivers as $driver)
{
try
{
return $driver->get($key);
}
catch (Kohana_Config_Exception $e)
{
//if it's the last driver in the list and it threw an exception, re throw it
if ($driver === $this->drivers[(count($this->drivers) - 1)])
throw $e;
}
}
}
/**
* Allows access to configuration settings
* using the ArrayAccess interface
*
* @param string key
* @param mixed value
* @return bool
* @access public
*/
public function offsetSet($key, $value)
{
foreach ($this->drivers as $driver)
{
try
{
$driver->set($key, $value);
}
catch (Kohana_Config_Exception $e)
{
//if it's the last driver in the list and it threw an exception, re throw it
if ($driver === $this->drivers[(count($this->drivers) - 1)])
throw $e;
}
}
return TRUE;
}
/**
* Allows access to configuration settings
* using the ArrayAccess interface
*
* @param string key
* @return bool
* @access public
*/
public function offsetExists($key)
{
foreach ($this->drivers as $driver)
{
try
{
return $driver->setting_exists($key);
}
catch (Kohana_Config_Exception $e)
{
//if it's the last driver in the list and it threw an exception, re throw it
if ($driver === $this->drivers[(count($this->drivers) - 1)])
throw $e;
}
}
}
/**
* Allows access to configuration settings
* using the ArrayAccess interface
*
* @param string key
* @return bool
* @access public
*/
public function offsetUnset($key)
{
foreach ($this->drivers as $driver)
{
try
{
return $driver->set($key, NULL);
}
catch (Kohana_Config_Exception $e)
{
//if it's the last driver in the list and it threw an exception, re throw it
if ($driver === $this->drivers[(count($this->drivers) - 1)])
throw $e;
}
}
return TRUE;
}
} // End KohanaConfig
class Kohana_Config_Exception extends Kohana_Exception {}

View File

@ -1,619 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Kohana Exceptions
*
* $Id: Kohana_Exception.php 4692 2009-12-04 15:59:44Z cbandy $
*
* @package Core
* @author Kohana Team
* @copyright (c) 2007-2009 Kohana Team
* @license http://kohanaphp.com/license
*/
class Kohana_Exception_Core extends Exception {
public static $enabled = FALSE;
// Template file
public static $template = 'kohana/error';
// Show stack traces in errors
public static $trace_output = TRUE;
// Show source code in errors
public static $source_output = TRUE;
// To hold unique identifier to distinguish error output
protected $instance_identifier;
// Error code
protected $code = E_KOHANA;
/**
* Creates a new translated exception.
*
* @param string error message
* @param array translation variables
* @return void
*/
public function __construct($message, array $variables = NULL, $code = 0)
{
$this->instance_identifier = uniqid();
// Translate the error message
$message = __($message, $variables);
// Sets $this->message the proper way
parent::__construct($message, $code);
}
/**
* Enable Kohana exception handling.
*
* @uses Kohana_Exception::$template
* @return void
*/
public static function enable()
{
if ( ! Kohana_Exception::$enabled)
{
set_exception_handler(array('Kohana_Exception', 'handle'));
Kohana_Exception::$enabled = TRUE;
}
}
/**
* Disable Kohana exception handling.
*
* @return void
*/
public static function disable()
{
if (Kohana_Exception::$enabled)
{
restore_exception_handler();
Kohana_Exception::$enabled = FALSE;
}
}
/**
* Get a single line of text representing the exception:
*
* Error [ Code ]: Message ~ File [ Line ]
*
* @param object Exception
* @return string
*/
public static function text($e)
{
return sprintf('%s [ %s ]: %s ~ %s [ %d ]',
get_class($e), $e->getCode(), strip_tags($e->getMessage()), Kohana_Exception::debug_path($e->getFile()), $e->getLine());
}
/**
* exception handler, displays the error message, source of the
* exception, and the stack trace of the error.
*
* @uses Kohana::message()
* @uses Kohana_Exception::text()
* @param object exception object
* @return void
*/
public static function handle(Exception $e)
{
try
{
// Get the exception information
$type = get_class($e);
$code = $e->getCode();
$message = $e->getMessage();
// Create a text version of the exception
$error = Kohana_Exception::text($e);
// Add this exception to the log
Kohana_Log::add('error', $error);
// Manually save logs after exceptions
Kohana_Log::save();
if (Kohana::config('core.display_errors') === FALSE)
{
// Do not show the details
$file = $line = NULL;
$trace = array();
$template = '_disabled';
}
else
{
$file = $e->getFile();
$line = $e->getLine();
$trace = $e->getTrace();
$template = '';
}
if ($e instanceof Kohana_Exception)
{
$template = $e->getTemplate().$template;
if ( ! headers_sent())
{
$e->sendHeaders();
}
// Use the human-readable error name
$code = Kohana::message('core.errors.'.$code);
}
else
{
$template = Kohana_Exception::$template.$template;
if ( ! headers_sent())
{
header('HTTP/1.1 500 Internal Server Error');
}
if ($e instanceof ErrorException)
{
// Use the human-readable error name
$code = Kohana::message('core.errors.'.$e->getSeverity());
if (version_compare(PHP_VERSION, '5.3', '<'))
{
// Workaround for a bug in ErrorException::getTrace() that exists in
// all PHP 5.2 versions. @see http://bugs.php.net/45895
for ($i = count($trace) - 1; $i > 0; --$i)
{
if (isset($trace[$i - 1]['args']))
{
// Re-position the arguments
$trace[$i]['args'] = $trace[$i - 1]['args'];
unset($trace[$i - 1]['args']);
}
}
}
}
}
// Clean the output buffer if one exists
ob_get_level() and ob_clean();
if ($template = Kohana::find_file('views', $template))
{
include $template;
}
}
catch (Exception $e)
{
// Clean the output buffer if one exists
ob_get_level() and ob_clean();
// Display the exception text
echo Kohana_Exception::text($e), "\n";
}
if (Kohana::$server_api === 'cli')
{
// Exit with an error status
exit(1);
}
}
/**
* Returns the template for this exception.
*
* @uses Kohana_Exception::$template
* @return string
*/
public function getTemplate()
{
return Kohana_Exception::$template;
}
/**
* Sends an Internal Server Error header.
*
* @return void
*/
public function sendHeaders()
{
// Send the 500 header
header('HTTP/1.1 500 Internal Server Error');
}
/**
* Returns an HTML string of information about a single variable.
*
* Borrows heavily on concepts from the Debug class of {@link http://nettephp.com/ Nette}.
*
* @param mixed variable to dump
* @param integer maximum length of strings
* @return string
*/
public static function dump($value, $length = 128)
{
return Kohana_Exception::_dump($value, $length);
}
/**
* Helper for Kohana_Exception::dump(), handles recursion in arrays and objects.
*
* @param mixed variable to dump
* @param integer maximum length of strings
* @param integer recursion level (internal)
* @return string
*/
private static function _dump( & $var, $length = 128, $level = 0)
{
if ($var === NULL)
{
return '<small>NULL</small>';
}
elseif (is_bool($var))
{
return '<small>bool</small> '.($var ? 'TRUE' : 'FALSE');
}
elseif (is_float($var))
{
return '<small>float</small> '.$var;
}
elseif (is_resource($var))
{
if (($type = get_resource_type($var)) === 'stream' AND $meta = stream_get_meta_data($var))
{
$meta = stream_get_meta_data($var);
if (isset($meta['uri']))
{
$file = $meta['uri'];
if (function_exists('stream_is_local'))
{
// Only exists on PHP >= 5.2.4
if (stream_is_local($file))
{
$file = Kohana_Exception::debug_path($file);
}
}
return '<small>resource</small><span>('.$type.')</span> '.htmlspecialchars($file, ENT_NOQUOTES, Kohana::CHARSET);
}
}
else
{
return '<small>resource</small><span>('.$type.')</span>';
}
}
elseif (is_string($var))
{
if (strlen($var) > $length)
{
// Encode the truncated string
$str = htmlspecialchars(substr($var, 0, $length), ENT_NOQUOTES, Kohana::CHARSET).'&nbsp;&hellip;';
}
else
{
// Encode the string
$str = htmlspecialchars($var, ENT_NOQUOTES, Kohana::CHARSET);
}
return '<small>string</small><span>('.strlen($var).')</span> "'.$str.'"';
}
elseif (is_array($var))
{
$output = array();
// Indentation for this variable
$space = str_repeat($s = ' ', $level);
static $marker;
if ($marker === NULL)
{
// Make a unique marker
$marker = uniqid("\x00");
}
if (empty($var))
{
// Do nothing
}
elseif (isset($var[$marker]))
{
$output[] = "(\n$space$s*RECURSION*\n$space)";
}
elseif ($level < 5)
{
$output[] = "<span>(";
$var[$marker] = TRUE;
foreach ($var as $key => & $val)
{
if ($key === $marker) continue;
if ( ! is_int($key))
{
$key = '"'.$key.'"';
}
$output[] = "$space$s$key => ".Kohana_Exception::_dump($val, $length, $level + 1);
}
unset($var[$marker]);
$output[] = "$space)</span>";
}
else
{
// Depth too great
$output[] = "(\n$space$s...\n$space)";
}
return '<small>array</small><span>('.count($var).')</span> '.implode("\n", $output);
}
elseif (is_object($var))
{
// Copy the object as an array
$array = (array) $var;
$output = array();
// Indentation for this variable
$space = str_repeat($s = ' ', $level);
$hash = spl_object_hash($var);
// Objects that are being dumped
static $objects = array();
if (empty($var))
{
// Do nothing
}
elseif (isset($objects[$hash]))
{
$output[] = "{\n$space$s*RECURSION*\n$space}";
}
elseif ($level < 5)
{
$output[] = "<code>{";
$objects[$hash] = TRUE;
foreach ($array as $key => & $val)
{
if ($key[0] === "\x00")
{
// Determine if the access is private or protected
$access = '<small>'.($key[1] === '*' ? 'protected' : 'private').'</small>';
// Remove the access level from the variable name
$key = substr($key, strrpos($key, "\x00") + 1);
}
else
{
$access = '<small>public</small>';
}
$output[] = "$space$s$access $key => ".Kohana_Exception::_dump($val, $length, $level + 1);
}
unset($objects[$hash]);
$output[] = "$space}</code>";
}
else
{
// Depth too great
$output[] = "{\n$space$s...\n$space}";
}
return '<small>object</small> <span>'.get_class($var).'('.count($array).')</span> '.implode("\n", $output);
}
else
{
return '<small>'.gettype($var).'</small> '.htmlspecialchars(print_r($var, TRUE), ENT_NOQUOTES, Kohana::CHARSET);
}
}
/**
* Removes APPPATH, SYSPATH, MODPATH, and DOCROOT from filenames, replacing
* them with the plain text equivalents.
*
* @param string path to sanitize
* @return string
*/
public static function debug_path($file)
{
if (strpos($file, APPPATH) === 0)
{
$file = 'APPPATH/'.substr($file, strlen(APPPATH));
}
elseif (strpos($file, SYSPATH) === 0)
{
$file = 'SYSPATH/'.substr($file, strlen(SYSPATH));
}
elseif (strpos($file, MODPATH) === 0)
{
$file = 'MODPATH/'.substr($file, strlen(MODPATH));
}
elseif (strpos($file, DOCROOT) === 0)
{
$file = 'DOCROOT/'.substr($file, strlen(DOCROOT));
}
return $file;
}
/**
* Returns an array of lines from a file.
*
* // Returns the current line of the current file
* echo Kohana_Exception::debug_source(__FILE__, __LINE__);
*
* @param string file to open
* @param integer line number to find
* @param integer number of padding lines
* @return array
*/
public static function debug_source($file, $line_number, $padding = 5)
{
// Make sure we can read the source file
if ( ! is_readable($file))
return array();
// Open the file and set the line position
$file = fopen($file, 'r');
$line = 0;
// Set the reading range
$range = array('start' => $line_number - $padding, 'end' => $line_number + $padding);
// Set the zero-padding amount for line numbers
$format = '% '.strlen($range['end']).'d';
$source = array();
while (($row = fgets($file)) !== FALSE)
{
// Increment the line number
if (++$line > $range['end'])
break;
if ($line >= $range['start'])
{
$source[sprintf($format, $line)] = $row;
}
}
// Close the file
fclose($file);
return $source;
}
/**
* Returns an array of strings that represent each step in the backtrace.
*
* @param array trace to analyze
* @return array
*/
public static function trace($trace = NULL)
{
if ($trace === NULL)
{
// Start a new trace
$trace = debug_backtrace();
}
// Non-standard function calls
$statements = array('include', 'include_once', 'require', 'require_once');
$output = array();
foreach ($trace as $step)
{
if ( ! isset($step['function']))
{
// Invalid trace step
continue;
}
if (isset($step['file']) AND isset($step['line']))
{
// Include the source of this step
$source = Kohana_Exception::debug_source($step['file'], $step['line']);
}
if (isset($step['file']))
{
$file = $step['file'];
if (isset($step['line']))
{
$line = $step['line'];
}
}
// function()
$function = $step['function'];
if (in_array($step['function'], $statements))
{
if (empty($step['args']))
{
// No arguments
$args = array();
}
else
{
// Sanitize the file path
$args = array($step['args'][0]);
}
}
elseif (isset($step['args']))
{
if ($step['function'] === '{closure}')
{
// Introspection on closures in a stack trace is impossible
$params = NULL;
}
else
{
if (isset($step['class']))
{
if (method_exists($step['class'], $step['function']))
{
$reflection = new ReflectionMethod($step['class'], $step['function']);
}
else
{
$reflection = new ReflectionMethod($step['class'], '__call');
}
}
else
{
$reflection = new ReflectionFunction($step['function']);
}
// Get the function parameters
$params = $reflection->getParameters();
}
$args = array();
foreach ($step['args'] as $i => $arg)
{
if (isset($params[$i]))
{
// Assign the argument by the parameter name
$args[$params[$i]->name] = $arg;
}
else
{
// Assign the argument by number
$args[$i] = $arg;
}
}
}
if (isset($step['class']))
{
// Class->method() or Class::method()
$function = $step['class'].$step['type'].$step['function'];
}
$output[] = array(
'function' => $function,
'args' => isset($args) ? $args : NULL,
'file' => isset($file) ? $file : NULL,
'line' => isset($line) ? $line : NULL,
'source' => isset($source) ? $source : NULL,
);
unset($function, $args, $file, $line, $source);
}
return $output;
}
} // End Kohana Exception

View File

@ -1,275 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Array helper class.
*
* $Id: arr.php 4680 2009-11-10 01:57:00Z isaiah $
*
* @package Core
* @author Kohana Team
* @copyright (c) 2007-2009 Kohana Team
* @license http://kohanaphp.com/license
*/
class arr_Core {
/**
* Return a callback array from a string, eg: limit[10,20] would become
* array('limit', array('10', '20'))
*
* @param string callback string
* @return array
*/
public static function callback_string($str)
{
// command[param,param]
if (preg_match('/([^\[]*+)\[(.+)\]/', (string) $str, $match))
{
// command
$command = $match[1];
// param,param
$params = preg_split('/(?<!\\\\),/', $match[2]);
$params = str_replace('\,', ',', $params);
}
else
{
// command
$command = $str;
// No params
$params = NULL;
}
return array($command, $params);
}
/**
* Rotates a 2D array clockwise.
* Example, turns a 2x3 array into a 3x2 array.
*
* @param array array to rotate
* @param boolean keep the keys in the final rotated array. the sub arrays of the source array need to have the same key values.
* if your subkeys might not match, you need to pass FALSE here!
* @return array
*/
public static function rotate($source_array, $keep_keys = TRUE)
{
$new_array = array();
foreach ($source_array as $key => $value)
{
$value = ($keep_keys === TRUE) ? $value : array_values($value);
foreach ($value as $k => $v)
{
$new_array[$k][$key] = $v;
}
}
return $new_array;
}
/**
* Removes a key from an array and returns the value.
*
* @param string key to return
* @param array array to work on
* @return mixed value of the requested array key
*/
public static function remove($key, & $array)
{
if ( ! array_key_exists($key, $array))
return NULL;
$val = $array[$key];
unset($array[$key]);
return $val;
}
/**
* Extract one or more keys from an array. Each key given after the first
* argument (the array) will be extracted. Keys that do not exist in the
* search array will be NULL in the extracted data.
*
* @param array array to search
* @param string key name
* @return array
*/
public static function extract(array $search, $keys)
{
// Get the keys, removing the $search array
$keys = array_slice(func_get_args(), 1);
$found = array();
foreach ($keys as $key)
{
$found[$key] = isset($search[$key]) ? $search[$key] : NULL;
}
return $found;
}
/**
* Get the value of array[key]. If it doesn't exist, return default.
*
* @param array array to search
* @param string key name
* @param mixed default value
* @return mixed
*/
public static function get(array $array, $key, $default = NULL)
{
return isset($array[$key]) ? $array[$key] : $default;
}
/**
* Because PHP does not have this function.
*
* @param array array to unshift
* @param string key to unshift
* @param mixed value to unshift
* @return array
*/
public static function unshift_assoc( array & $array, $key, $val)
{
$array = array_reverse($array, TRUE);
$array[$key] = $val;
$array = array_reverse($array, TRUE);
return $array;
}
/**
* Because PHP does not have this function, and array_walk_recursive creates
* references in arrays and is not truly recursive.
*
* @param mixed callback to apply to each member of the array
* @param array array to map to
* @return array
*/
public static function map_recursive($callback, array $array)
{
foreach ($array as $key => $val)
{
// Map the callback to the key
$array[$key] = is_array($val) ? arr::map_recursive($callback, $val) : call_user_func($callback, $val);
}
return $array;
}
/**
* Emulates array_merge_recursive, but appends numeric keys and replaces
* associative keys, instead of appending all keys.
*
* @param array any number of arrays
* @return array
*/
public static function merge()
{
$total = func_num_args();
$result = array();
for ($i = 0; $i < $total; $i++)
{
foreach (func_get_arg($i) as $key => $val)
{
if (isset($result[$key]))
{
if (is_array($val))
{
// Arrays are merged recursively
$result[$key] = arr::merge($result[$key], $val);
}
elseif (is_int($key))
{
// Indexed arrays are appended
array_push($result, $val);
}
else
{
// Associative arrays are replaced
$result[$key] = $val;
}
}
else
{
// New values are added
$result[$key] = $val;
}
}
}
return $result;
}
/**
* Overwrites an array with values from input array(s).
* Non-existing keys will not be appended!
*
* @param array key array
* @param array input array(s) that will overwrite key array values
* @return array
*/
public static function overwrite($array1, $array2)
{
foreach (array_intersect_key($array2, $array1) as $key => $value)
{
$array1[$key] = $value;
}
if (func_num_args() > 2)
{
foreach (array_slice(func_get_args(), 2) as $array2)
{
foreach (array_intersect_key($array2, $array1) as $key => $value)
{
$array1[$key] = $value;
}
}
}
return $array1;
}
/**
* Recursively convert an array to an object.
*
* @param array array to convert
* @return object
*/
public static function to_object(array $array, $class = 'stdClass')
{
$object = new $class;
foreach ($array as $key => $value)
{
if (is_array($value))
{
// Convert the array to an object
$value = arr::to_object($value, $class);
}
// Add the value to the object
$object->{$key} = $value;
}
return $object;
}
/**
* Returns specific key/column from an array of objects.
*
* @param string|integer $key The key or column number to pluck from each object.
* @param array $array The array of objects to pluck from.
* @return array
*/
public static function pluck($key, $array)
{
$result = array();
foreach ($array as $i => $object)
{
$result[$i] = isset($object[$key]) ? $object[$key] : NULL;
}
return $result;
}
} // End arr

View File

@ -1,151 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Cookie helper class.
*
* $Id: cookie.php 4679 2009-11-10 01:45:52Z isaiah $
*
* @package Core
* @author Kohana Team
* @copyright (c) 2007-2009 Kohana Team
* @license http://kohanaphp.com/license
*/
class cookie_Core {
/**
* Sets a cookie with the given parameters.
*
* @param string cookie name or array of config options
* @param string cookie value
* @param integer number of seconds before the cookie expires
* @param string URL path to allow
* @param string URL domain to allow
* @param boolean HTTPS only
* @param boolean HTTP only (requires PHP 5.2 or higher)
* @return boolean
*/
public static function set($name, $value = NULL, $expire = NULL, $path = NULL, $domain = NULL, $secure = NULL, $httponly = NULL)
{
if (headers_sent())
return FALSE;
// If the name param is an array, we import it
is_array($name) and extract($name, EXTR_OVERWRITE);
// Fetch default options
$config = Kohana::config('cookie');
foreach (array('value', 'expire', 'domain', 'path', 'secure', 'httponly') as $item)
{
if ($$item === NULL AND isset($config[$item]))
{
$$item = $config[$item];
}
}
if ($expire !== 0)
{
// The expiration is expected to be a UNIX timestamp
$expire += time();
}
$value = cookie::salt($name, $value).'~'.$value;
return setcookie($name, $value, $expire, $path, $domain, $secure, $httponly);
}
/**
* Fetch a cookie value, using the Input library.
*
* @param string cookie name
* @param mixed default value
* @param boolean use XSS cleaning on the value
* @return string
*/
public static function get($name = NULL, $default = NULL, $xss_clean = FALSE)
{
// Return an array of all the cookies if we don't have a name
if ($name === NULL)
{
$cookies = array();
foreach($_COOKIE AS $key => $value)
{
$cookies[$key] = cookie::get($key, $default, $xss_clean);
}
return $cookies;
}
if ( ! isset($_COOKIE[$name]))
{
return $default;
}
// Get the cookie value
$cookie = $_COOKIE[$name];
// Find the position of the split between salt and contents
$split = strlen(cookie::salt($name, NULL));
if (isset($cookie[$split]) AND $cookie[$split] === '~')
{
// Separate the salt and the value
list ($hash, $value) = explode('~', $cookie, 2);
if (cookie::salt($name, $value) === $hash)
{
if ($xss_clean === TRUE AND Kohana::config('core.global_xss_filtering') === FALSE)
{
return Input::instance()->xss_clean($value);
}
// Cookie signature is valid
return $value;
}
// The cookie signature is invalid, delete it
cookie::delete($name);
}
return $default;
}
/**
* Nullify and unset a cookie.
*
* @param string cookie name
* @param string URL path
* @param string URL domain
* @return boolean
*/
public static function delete($name, $path = NULL, $domain = NULL)
{
// Delete the cookie from globals
unset($_COOKIE[$name]);
// Sets the cookie value to an empty string, and the expiration to 24 hours ago
return cookie::set($name, '', -86400, $path, $domain, FALSE, FALSE);
}
/**
* Generates a salt string for a cookie based on the name and value.
*
* @param string $name name of cookie
* @param string $value value of cookie
* @return string sha1 hash
*/
public static function salt($name, $value)
{
// Determine the user agent
$agent = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : 'unknown';
// Cookie salt.
$salt = Kohana::config('cookie.salt');
return sha1($agent.$name.$value.$salt);
}
final private function __construct()
{
// Static class.
}
} // End cookie

View File

@ -1,397 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Date helper class.
*
* $Id: date.php 4679 2009-11-10 01:45:52Z isaiah $
*
* @package Core
* @author Kohana Team
* @copyright (c) 2007-2009 Kohana Team
* @license http://kohanaphp.com/license
*/
class date_Core {
/**
* Converts a UNIX timestamp to DOS format.
*
* @param integer UNIX timestamp
* @return integer
*/
public static function unix2dos($timestamp = FALSE)
{
$timestamp = ($timestamp === FALSE) ? getdate() : getdate($timestamp);
if ($timestamp['year'] < 1980)
{
return (1 << 21 | 1 << 16);
}
$timestamp['year'] -= 1980;
// What voodoo is this? I have no idea... Geert can explain it though,
// and that's good enough for me.
return ($timestamp['year'] << 25 | $timestamp['mon'] << 21 |
$timestamp['mday'] << 16 | $timestamp['hours'] << 11 |
$timestamp['minutes'] << 5 | $timestamp['seconds'] >> 1);
}
/**
* Converts a DOS timestamp to UNIX format.
*
* @param integer DOS timestamp
* @return integer
*/
public static function dos2unix($timestamp = FALSE)
{
$sec = 2 * ($timestamp & 0x1f);
$min = ($timestamp >> 5) & 0x3f;
$hrs = ($timestamp >> 11) & 0x1f;
$day = ($timestamp >> 16) & 0x1f;
$mon = ($timestamp >> 21) & 0x0f;
$year = ($timestamp >> 25) & 0x7f;
return mktime($hrs, $min, $sec, $mon, $day, $year + 1980);
}
/**
* Returns the offset (in seconds) between two time zones.
* @see http://php.net/timezones
*
* @param string timezone to find the offset of
* @param string|boolean timezone used as the baseline
* @param string time at which to calculate
* @return integer
*/
public static function offset($remote, $local = TRUE, $when = 'now')
{
if ($local === TRUE)
{
$local = date_default_timezone_get();
}
// Create timezone objects
$remote = new DateTimeZone($remote);
$local = new DateTimeZone($local);
// Create date objects from timezones
$time_there = new DateTime($when, $remote);
$time_here = new DateTime($when, $local);
// Find the offset
return $remote->getOffset($time_there) - $local->getOffset($time_here);
}
/**
* Number of seconds in a minute, incrementing by a step.
*
* @param integer amount to increment each step by, 1 to 30
* @param integer start value
* @param integer end value
* @return array A mirrored (foo => foo) array from 1-60.
*/
public static function seconds($step = 1, $start = 0, $end = 60)
{
// Always integer
$step = (int) $step;
$seconds = array();
for ($i = $start; $i < $end; $i += $step)
{
$seconds[$i] = ($i < 10) ? '0'.$i : $i;
}
return $seconds;
}
/**
* Number of minutes in an hour, incrementing by a step.
*
* @param integer amount to increment each step by, 1 to 30
* @return array A mirrored (foo => foo) array from 1-60.
*/
public static function minutes($step = 5)
{
// Because there are the same number of minutes as seconds in this set,
// we choose to re-use seconds(), rather than creating an entirely new
// function. Shhhh, it's cheating! ;) There are several more of these
// in the following methods.
return date::seconds($step);
}
/**
* Number of hours in a day.
*
* @param integer amount to increment each step by
* @param boolean use 24-hour time
* @param integer the hour to start at
* @return array A mirrored (foo => foo) array from start-12 or start-23.
*/
public static function hours($step = 1, $long = FALSE, $start = NULL)
{
// Default values
$step = (int) $step;
$long = (bool) $long;
$hours = array();
// Set the default start if none was specified.
if ($start === NULL)
{
$start = ($long === FALSE) ? 1 : 0;
}
$hours = array();
// 24-hour time has 24 hours, instead of 12
$size = ($long === TRUE) ? 23 : 12;
for ($i = $start; $i <= $size; $i += $step)
{
$hours[$i] = $i;
}
return $hours;
}
/**
* Returns AM or PM, based on a given hour.
*
* @param integer number of the hour
* @return string
*/
public static function ampm($hour)
{
// Always integer
$hour = (int) $hour;
return ($hour > 11) ? 'PM' : 'AM';
}
/**
* Adjusts a non-24-hour number into a 24-hour number.
*
* @param integer hour to adjust
* @param string AM or PM
* @return string
*/
public static function adjust($hour, $ampm)
{
$hour = (int) $hour;
$ampm = strtolower($ampm);
switch ($ampm)
{
case 'am':
if ($hour == 12)
$hour = 0;
break;
case 'pm':
if ($hour < 12)
$hour += 12;
break;
}
return sprintf('%02s', $hour);
}
/**
* Number of days in month.
*
* @param integer number of month
* @param integer number of year to check month, defaults to the current year
* @return array A mirrored (foo => foo) array of the days.
*/
public static function days($month, $year = FALSE)
{
static $months;
// Always integers
$month = (int) $month;
$year = (int) $year;
// Use the current year by default
$year = ($year == FALSE) ? date('Y') : $year;
// We use caching for months, because time functions are used
if (empty($months[$year][$month]))
{
$months[$year][$month] = array();
// Use date to find the number of days in the given month
$total = date('t', mktime(1, 0, 0, $month, 1, $year)) + 1;
for ($i = 1; $i < $total; $i++)
{
$months[$year][$month][$i] = $i;
}
}
return $months[$year][$month];
}
/**
* Number of months in a year
*
* @return array A mirrored (foo => foo) array from 1-12.
*/
public static function months()
{
return date::hours();
}
/**
* Returns an array of years between a starting and ending year.
* Uses the current year +/- 5 as the max/min.
*
* @param integer starting year
* @param integer ending year
* @return array
*/
public static function years($start = FALSE, $end = FALSE)
{
// Default values
$start = ($start === FALSE) ? date('Y') - 5 : (int) $start;
$end = ($end === FALSE) ? date('Y') + 5 : (int) $end;
$years = array();
// Add one, so that "less than" works
$end += 1;
for ($i = $start; $i < $end; $i++)
{
$years[$i] = $i;
}
return $years;
}
/**
* Returns time difference between two timestamps, in human readable format.
*
* @param integer timestamp
* @param integer timestamp, defaults to the current time
* @param string formatting string
* @return string|array
*/
public static function timespan($time1, $time2 = NULL, $output = 'years,months,weeks,days,hours,minutes,seconds')
{
// Array with the output formats
$output = preg_split('/[^a-z]+/', strtolower((string) $output));
// Invalid output
if (empty($output))
return FALSE;
// Make the output values into keys
extract(array_flip($output), EXTR_SKIP);
// Default values
$time1 = max(0, (int) $time1);
$time2 = empty($time2) ? time() : max(0, (int) $time2);
// Calculate timespan (seconds)
$timespan = abs($time1 - $time2);
// All values found using Google Calculator.
// Years and months do not match the formula exactly, due to leap years.
// Years ago, 60 * 60 * 24 * 365
isset($years) and $timespan -= 31556926 * ($years = (int) floor($timespan / 31556926));
// Months ago, 60 * 60 * 24 * 30
isset($months) and $timespan -= 2629744 * ($months = (int) floor($timespan / 2629743.83));
// Weeks ago, 60 * 60 * 24 * 7
isset($weeks) and $timespan -= 604800 * ($weeks = (int) floor($timespan / 604800));
// Days ago, 60 * 60 * 24
isset($days) and $timespan -= 86400 * ($days = (int) floor($timespan / 86400));
// Hours ago, 60 * 60
isset($hours) and $timespan -= 3600 * ($hours = (int) floor($timespan / 3600));
// Minutes ago, 60
isset($minutes) and $timespan -= 60 * ($minutes = (int) floor($timespan / 60));
// Seconds ago, 1
isset($seconds) and $seconds = $timespan;
// Remove the variables that cannot be accessed
unset($timespan, $time1, $time2);
// Deny access to these variables
$deny = array_flip(array('deny', 'key', 'difference', 'output'));
// Return the difference
$difference = array();
foreach ($output as $key)
{
if (isset($$key) AND ! isset($deny[$key]))
{
// Add requested key to the output
$difference[$key] = $$key;
}
}
// Invalid output formats string
if (empty($difference))
return FALSE;
// If only one output format was asked, don't put it in an array
if (count($difference) === 1)
return current($difference);
// Return array
return $difference;
}
/**
* Returns time difference between two timestamps, in the format:
* N year, N months, N weeks, N days, N hours, N minutes, and N seconds ago
*
* @param integer timestamp
* @param integer timestamp, defaults to the current time
* @param string formatting string
* @return string
*/
public static function timespan_string($time1, $time2 = NULL, $output = 'years,months,weeks,days,hours,minutes,seconds')
{
if ($difference = date::timespan($time1, $time2, $output) AND is_array($difference))
{
// Determine the key of the last item in the array
$last = end($difference);
$last = key($difference);
$span = array();
foreach ($difference as $name => $amount)
{
if ($amount === 0)
{
// Skip empty amounts
continue;
}
// Add the amount to the span
$span[] = ($name === $last ? ' and ' : ', ').$amount.' '.($amount === 1 ? inflector::singular($name) : $name);
}
// If the difference is less than 60 seconds, remove the preceding and.
if (count($span) === 1)
{
$span[0] = ltrim($span[0], 'and ');
}
// Replace difference by making the span into a string
$difference = trim(implode('', $span), ',');
}
elseif (is_int($difference))
{
// Single-value return
$difference = $difference.' '.($difference === 1 ? inflector::singular($output) : $output);
}
return $difference;
}
} // End date

View File

@ -1,49 +0,0 @@
<?php defined('SYSPATH') or die('No direct script access.');
/**
* Database helper class.
*
* $Id: $
*
* @package Core
* @author Kohana Team
* @copyright (c) 2007-2009 Kohana Team
* @license http://kohanaphp.com/license
*/
class db_Core {
public static function query($sql)
{
return new Database_Query($sql);
}
public static function build($database = 'default')
{
return new Database_Builder($database);
}
public static function select($columns = NULL)
{
return db::build()->select($columns);
}
public static function insert($table = NULL, $set = NULL)
{
return db::build()->insert($table, $set);
}
public static function update($table = NULL, $set = NULL, $where = NULL)
{
return db::build()->update($table, $set, $where);
}
public static function delete($table = NULL, $where = NULL)
{
return db::build()->delete($table, $where);
}
public static function expr($expression)
{
return new Database_Expression($expression);
}
} // End db

View File

@ -1,137 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Download helper class.
*
* $Id: download.php 4679 2009-11-10 01:45:52Z isaiah $
*
* @package Core
* @author Kohana Team
* @copyright (c) 2007-2009 Kohana Team
* @license http://kohanaphp.com/license
*/
class download_Core {
/**
* Send headers necessary to invoke a "Save As" dialog
*
* @link http://support.microsoft.com/kb/260519
* @link http://greenbytes.de/tech/tc2231/
*
* @param string file name
* @return string file name as it was sent
*/
public static function dialog($filename)
{
$filename = basename($filename);
header('Content-Disposition: attachment; filename="'.$filename.'"');
return $filename;
}
/**
* Send the contents of a file or a data string with the proper MIME type and exit.
*
* @uses exit()
* @uses Kohana::close_buffers()
*
* @param string a file path or file name
* @param string optional data to send
* @return void
*/
public static function send($filename, $data = NULL)
{
if ($data === NULL)
{
$filepath = realpath($filename);
$filename = basename($filepath);
$filesize = filesize($filepath);
}
else
{
$filename = basename($filename);
$filesize = strlen($data);
}
// Retrieve MIME type by extension
$mime = Kohana::config('mimes.'.strtolower(substr(strrchr($filename, '.'), 1)));
$mime = empty($mime) ? 'application/octet-stream' : $mime[0];
// Close output buffers
Kohana::close_buffers(FALSE);
// Clear any output
Event::add('system.display', create_function('', 'Kohana::$output = "";'));
// Send headers
header("Content-Type: $mime");
header('Content-Length: '.sprintf('%d', $filesize));
header('Content-Transfer-Encoding: binary');
// Send data
if ($data === NULL)
{
$handle = fopen($filepath, 'rb');
fpassthru($handle);
fclose($handle);
}
else
{
echo $data;
}
exit;
}
/**
* Force the download of a file by the user's browser by preventing any
* caching. Contains a workaround for Internet Explorer.
*
* @link http://support.microsoft.com/kb/316431
* @link http://support.microsoft.com/kb/812935
*
* @uses download::dialog()
* @uses download::send()
*
* @param string a file path or file name
* @param mixed data to be sent if the filename does not exist
* @param string suggested filename to display in the download
* @return void
*/
public static function force($filename = NULL, $data = NULL, $nicename = NULL)
{
download::dialog(empty($nicename) ? $filename : $nicename);
// Prevent caching
header('Expires: Thu, 01 Jan 1970 00:00:00 GMT');
if (request::user_agent('browser') === 'Internet Explorer' AND request::user_agent('version') <= '6.0')
{
// HTTP 1.0
header('Pragma:');
// HTTP 1.1 with IE extensions
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
}
else
{
// HTTP 1.0
header('Pragma: no-cache');
// HTTP 1.1
header('Cache-Control: no-cache, max-age=0');
}
if (is_file($filename))
{
download::send($filename);
}
else
{
download::send($filename, $data);
}
}
} // End download

View File

@ -1,120 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Controls headers that effect client caching of pages
*
* $Id: expires.php 4679 2009-11-10 01:45:52Z isaiah $
*
* @package Core
* @author Kohana Team
* @copyright (c) 2007-2009 Kohana Team
* @license http://kohanaphp.com/license
*/
class expires_Core {
/**
* Sets the amount of time before content expires
*
* @param integer Seconds before the content expires
* @return integer Timestamp when the content expires
*/
public static function set($seconds = 60)
{
$now = time();
$expires = $now + $seconds;
header('Last-Modified: '.gmdate('D, d M Y H:i:s T', $now));
// HTTP 1.0
header('Expires: '.gmdate('D, d M Y H:i:s T', $expires));
// HTTP 1.1
header('Cache-Control: max-age='.$seconds);
return $expires;
}
/**
* Parses the If-Modified-Since header
*
* @return integer|boolean Timestamp or FALSE when header is lacking or malformed
*/
public static function get()
{
if ( ! empty($_SERVER['HTTP_IF_MODIFIED_SINCE']))
{
// Some versions of IE6 append "; length=####"
if (($strpos = strpos($_SERVER['HTTP_IF_MODIFIED_SINCE'], ';')) !== FALSE)
{
$mod_time = substr($_SERVER['HTTP_IF_MODIFIED_SINCE'], 0, $strpos);
}
else
{
$mod_time = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
}
return strtotime($mod_time);
}
return FALSE;
}
/**
* Checks to see if content should be updated otherwise sends Not Modified status
* and exits.
*
* @uses exit()
* @uses expires::get()
*
* @param integer Maximum age of the content in seconds
* @return integer|boolean Timestamp of the If-Modified-Since header or FALSE when header is lacking or malformed
*/
public static function check($seconds = 60)
{
if ($last_modified = expires::get())
{
$expires = $last_modified + $seconds;
$max_age = $expires - time();
if ($max_age > 0)
{
// Content has not expired
header($_SERVER['SERVER_PROTOCOL'].' 304 Not Modified');
header('Last-Modified: '.gmdate('D, d M Y H:i:s T', $last_modified));
// HTTP 1.0
header('Expires: '.gmdate('D, d M Y H:i:s T', $expires));
// HTTP 1.1
header('Cache-Control: max-age='.$max_age);
// Clear any output
Event::add('system.display', create_function('', 'Kohana::$output = "";'));
exit;
}
}
return $last_modified;
}
/**
* Check if expiration headers are already set
*
* @return boolean
*/
public static function headers_set()
{
foreach (headers_list() as $header)
{
if (strncasecmp($header, 'Expires:', 8) === 0
OR strncasecmp($header, 'Cache-Control:', 14) === 0
OR strncasecmp($header, 'Last-Modified:', 14) === 0)
{
return TRUE;
}
}
return FALSE;
}
} // End expires

View File

@ -1,122 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Feed helper class.
*
* $Id: feed.php 4679 2009-11-10 01:45:52Z isaiah $
*
* @package Core
* @author Kohana Team
* @copyright (c) 2007-2009 Kohana Team
* @license http://kohanaphp.com/license
*/
class feed_Core {
/**
* Parses a remote feed into an array.
*
* @param string remote feed URL
* @param integer item limit to fetch
* @return array
*/
public static function parse($feed, $limit = 0)
{
// Check if SimpleXML is installed
if( ! function_exists('simplexml_load_file'))
throw new Kohana_User_Exception('Feed Error', 'SimpleXML must be installed!');
// Make limit an integer
$limit = (int) $limit;
// Disable error reporting while opening the feed
$ER = error_reporting(0);
// Allow loading by filename or raw XML string
$load = (is_file($feed) OR valid::url($feed)) ? 'simplexml_load_file' : 'simplexml_load_string';
// Load the feed
$feed = $load($feed, 'SimpleXMLElement', LIBXML_NOCDATA);
// Restore error reporting
error_reporting($ER);
// Feed could not be loaded
if ($feed === FALSE)
return array();
// Detect the feed type. RSS 1.0/2.0 and Atom 1.0 are supported.
$feed = isset($feed->channel) ? $feed->xpath('//item') : $feed->entry;
$i = 0;
$items = array();
foreach ($feed as $item)
{
if ($limit > 0 AND $i++ === $limit)
break;
$items[] = (array) $item;
}
return $items;
}
/**
* Creates a feed from the given parameters.
*
* @param array feed information
* @param array items to add to the feed
* @param string define which format to use
* @param string define which encoding to use
* @return string
*/
public static function create($info, $items, $format = 'rss2', $encoding = 'UTF-8')
{
$info += array('title' => 'Generated Feed', 'link' => '', 'generator' => 'KohanaPHP');
$feed = '<?xml version="1.0" encoding="'.$encoding.'"?><rss version="2.0"><channel></channel></rss>';
$feed = simplexml_load_string($feed);
foreach ($info as $name => $value)
{
if (($name === 'pubDate' OR $name === 'lastBuildDate') AND (is_int($value) OR ctype_digit($value)))
{
// Convert timestamps to RFC 822 formatted dates
$value = date(DATE_RFC822, $value);
}
elseif (($name === 'link' OR $name === 'docs') AND strpos($value, '://') === FALSE)
{
// Convert URIs to URLs
$value = url::site($value, 'http');
}
// Add the info to the channel
$feed->channel->addChild($name, $value);
}
foreach ($items as $item)
{
// Add the item to the channel
$row = $feed->channel->addChild('item');
foreach ($item as $name => $value)
{
if ($name === 'pubDate' AND (is_int($value) OR ctype_digit($value)))
{
// Convert timestamps to RFC 822 formatted dates
$value = date(DATE_RFC822, $value);
}
elseif (($name === 'link' OR $name === 'guid') AND strpos($value, '://') === FALSE)
{
// Convert URIs to URLs
$value = url::site($value, 'http');
}
// Add the info to the row
$row->addChild($name, $value);
}
}
return $feed->asXML();
}
} // End feed

View File

@ -1,186 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* File helper class.
*
* $Id: file.php 4679 2009-11-10 01:45:52Z isaiah $
*
* @package Core
* @author Kohana Team
* @copyright (c) 2007-2009 Kohana Team
* @license http://kohanaphp.com/license
*/
class file_Core {
/**
* Attempt to get the mime type from a file. This method is horribly
* unreliable, due to PHP being horribly unreliable when it comes to
* determining the mime-type of a file.
*
* @param string filename
* @return string mime-type, if found
* @return boolean FALSE, if not found
*/
public static function mime($filename)
{
// Make sure the file is readable
if ( ! (is_file($filename) AND is_readable($filename)))
return FALSE;
// Get the extension from the filename
$extension = strtolower(substr(strrchr($filename, '.'), 1));
if (preg_match('/^(?:jpe?g|png|[gt]if|bmp|swf)$/', $extension))
{
// Disable error reporting
$ER = error_reporting(0);
// Use getimagesize() to find the mime type on images
$mime = getimagesize($filename);
// Turn error reporting back on
error_reporting($ER);
// Return the mime type
if (isset($mime['mime']))
return $mime['mime'];
}
if (function_exists('finfo_open'))
{
// Use the fileinfo extension
$finfo = finfo_open(FILEINFO_MIME);
$mime = finfo_file($finfo, $filename);
finfo_close($finfo);
// Return the mime type
return $mime;
}
if (ini_get('mime_magic.magicfile') AND function_exists('mime_content_type'))
{
// Return the mime type using mime_content_type
return mime_content_type($filename);
}
if ( ! KOHANA_IS_WIN)
{
// Attempt to locate use the file command, checking the return value
if ($command = trim(exec('which file', $output, $return)) AND $return === 0)
{
return trim(exec($command.' -bi '.escapeshellarg($filename)));
}
}
if ( ! empty($extension) AND is_array($mime = Kohana::config('mimes.'.$extension)))
{
// Return the mime-type guess, based on the extension
return $mime[0];
}
// Unable to find the mime-type
return FALSE;
}
/**
* Split a file into pieces matching a specific size.
*
* @param string file to be split
* @param string directory to output to, defaults to the same directory as the file
* @param integer size, in MB, for each chunk to be
* @return integer The number of pieces that were created.
*/
public static function split($filename, $output_dir = FALSE, $piece_size = 10)
{
// Find output dir
$output_dir = ($output_dir == FALSE) ? pathinfo(str_replace('\\', '/', realpath($filename)), PATHINFO_DIRNAME) : str_replace('\\', '/', realpath($output_dir));
$output_dir = rtrim($output_dir, '/').'/';
// Open files for writing
$input_file = fopen($filename, 'rb');
// Change the piece size to bytes
$piece_size = 1024 * 1024 * (int) $piece_size; // Size in bytes
// Set up reading variables
$read = 0; // Number of bytes read
$piece = 1; // Current piece
$chunk = 1024 * 8; // Chunk size to read
// Split the file
while ( ! feof($input_file))
{
// Open a new piece
$piece_name = $filename.'.'.str_pad($piece, 3, '0', STR_PAD_LEFT);
$piece_open = @fopen($piece_name, 'wb+') or die('Could not write piece '.$piece_name);
// Fill the current piece
while ($read < $piece_size AND $data = fread($input_file, $chunk))
{
fwrite($piece_open, $data) or die('Could not write to open piece '.$piece_name);
$read += $chunk;
}
// Close the current piece
fclose($piece_open);
// Prepare to open a new piece
$read = 0;
$piece++;
// Make sure that piece is valid
($piece < 999) or die('Maximum of 999 pieces exceeded, try a larger piece size');
}
// Close input file
fclose($input_file);
// Returns the number of pieces that were created
return ($piece - 1);
}
/**
* Join a split file into a whole file.
*
* @param string split filename, without .000 extension
* @param string output filename, if different then an the filename
* @return integer The number of pieces that were joined.
*/
public static function join($filename, $output = FALSE)
{
if ($output == FALSE)
$output = $filename;
// Set up reading variables
$piece = 1; // Current piece
$chunk = 1024 * 8; // Chunk size to read
// Open output file
$output_file = @fopen($output, 'wb+') or die('Could not open output file '.$output);
// Read each piece
while ($piece_open = @fopen(($piece_name = $filename.'.'.str_pad($piece, 3, '0', STR_PAD_LEFT)), 'rb'))
{
// Write the piece into the output file
while ( ! feof($piece_open))
{
fwrite($output_file, fread($piece_open, $chunk));
}
// Close the current piece
fclose($piece_open);
// Prepare for a new piece
$piece++;
// Make sure piece is valid
($piece < 999) or die('Maximum of 999 pieces exceeded');
}
// Close the output file
fclose($output_file);
// Return the number of pieces joined
return ($piece - 1);
}
} // End file

View File

@ -1,468 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Form helper class.
*
* $Id: form.php 4699 2009-12-08 18:45:14Z isaiah $
*
* @package Core
* @author Kohana Team
* @copyright (c) 2007-2009 Kohana Team
* @license http://kohanaphp.com/license
*/
class form_Core {
/**
* Generates an opening HTML form tag.
*
* @param string form action attribute
* @param array extra attributes
* @param array hidden fields to be created immediately after the form tag
* @param string non-default protocol, eg: https
* @return string
*/
public static function open($action = NULL, $attr = array(), $hidden = NULL, $protocol = NULL)
{
// Make sure that the method is always set
empty($attr['method']) and $attr['method'] = 'post';
if ($attr['method'] !== 'post' AND $attr['method'] !== 'get')
{
// If the method is invalid, use post
$attr['method'] = 'post';
}
if ($action === NULL)
{
// Use the current URL as the default action
$action = url::site(Router::$complete_uri, $protocol);
}
elseif (strpos($action, '://') === FALSE)
{
// Make the action URI into a URL
$action = url::site($action, $protocol);
}
// Set action
$attr['action'] = $action;
// Form opening tag
$form = '<form'.form::attributes($attr).'>'."\n";
// Add hidden fields immediate after opening tag
empty($hidden) or $form .= form::hidden($hidden);
return $form;
}
/**
* Generates an opening HTML form tag that can be used for uploading files.
*
* @param string form action attribute
* @param array extra attributes
* @param array hidden fields to be created immediately after the form tag
* @return string
*/
public static function open_multipart($action = NULL, $attr = array(), $hidden = array())
{
// Set multi-part form type
$attr['enctype'] = 'multipart/form-data';
return form::open($action, $attr, $hidden);
}
/**
* Creates a HTML form hidden input tag.
*
* @param string|array input name or an array of HTML attributes
* @param string input value, when using a name
* @param string a string to be attached to the end of the attributes
* @return string
*/
public static function hidden($data, $value = '', $extra = '')
{
if ( ! is_array($data))
{
$data = array('name' => $data);
}
$data['type'] = 'hidden';
return form::input($data, $value, $extra);
}
/**
* Creates an HTML form input tag. Defaults to a text type.
*
* @param string|array input name or an array of HTML attributes
* @param string input value, when using a name
* @param string a string to be attached to the end of the attributes
* @return string
*/
public static function input($data, $value = '', $extra = '')
{
if ( ! is_array($data))
{
$data = array('name' => $data);
}
// Type and value are required attributes
$data += array
(
'type' => 'text',
'value' => $value
);
return '<input'.form::attributes($data).' '.$extra.' />';
}
/**
* Creates a HTML form password input tag.
*
* @param string|array input name or an array of HTML attributes
* @param string input value, when using a name
* @param string a string to be attached to the end of the attributes
* @return string
*/
public static function password($data, $value = '', $extra = '')
{
if ( ! is_array($data))
{
$data = array('name' => $data);
}
$data['type'] = 'password';
return form::input($data, $value, $extra);
}
/**
* Creates an HTML form upload input tag.
*
* @param string|array input name or an array of HTML attributes
* @param string input value, when using a name
* @param string a string to be attached to the end of the attributes
* @return string
*/
public static function upload($data, $value = '', $extra = '')
{
if ( ! is_array($data))
{
$data = array('name' => $data);
}
$data['type'] = 'file';
return form::input($data, $value, $extra);
}
/**
* Creates an HTML form textarea tag.
*
* @param string|array input name or an array of HTML attributes
* @param string input value, when using a name
* @param string a string to be attached to the end of the attributes
* @param boolean encode existing entities
* @return string
*/
public static function textarea($data, $value = '', $extra = '', $double_encode = TRUE)
{
if ( ! is_array($data))
{
$data = array('name' => $data);
}
if ( ! isset($data['rows']))
{
$data['rows'] = '';
}
if ( ! isset($data['cols']))
{
$data['cols'] = '';
}
// Use the value from $data if possible, or use $value
$value = isset($data['value']) ? $data['value'] : $value;
// Value is not part of the attributes
unset($data['value']);
return '<textarea'.form::attributes($data, 'textarea').' '.$extra.'>'.htmlspecialchars($value, ENT_QUOTES, Kohana::CHARSET, $double_encode).'</textarea>';
}
/**
* Creates an HTML form select tag, or "dropdown menu".
*
* @param string|array input name or an array of HTML attributes
* @param array select options, when using a name
* @param string|array option key(s) that should be selected by default
* @param string a string to be attached to the end of the attributes
* @return string
*/
public static function dropdown($data, $options = NULL, $selected = NULL, $extra = '')
{
if ( ! is_array($data))
{
$data = array('name' => $data);
}
else
{
if (isset($data['options']))
{
// Use data options
$options = $data['options'];
}
if (isset($data['selected']))
{
// Use data selected
$selected = $data['selected'];
}
}
if (is_array($selected))
{
// Multi-select box
$data['multiple'] = 'multiple';
}
else
{
// Single selection (but converted to an array)
$selected = array($selected);
}
$input = '<select'.form::attributes($data, 'select').' '.$extra.'>'."\n";
foreach ((array) $options as $key => $val)
{
// Key should always be a string
$key = (string) $key;
if (is_array($val))
{
$input .= '<optgroup label="'.$key.'">'."\n";
foreach ($val as $inner_key => $inner_val)
{
// Inner key should always be a string
$inner_key = (string) $inner_key;
$sel = in_array($inner_key, $selected) ? ' selected="selected"' : '';
$input .= '<option value="'.$inner_key.'"'.$sel.'>'.htmlspecialchars($inner_val, ENT_QUOTES, Kohana::CHARSET).'</option>'."\n";
}
$input .= '</optgroup>'."\n";
}
else
{
$sel = in_array($key, $selected) ? ' selected="selected"' : '';
$input .= '<option value="'.$key.'"'.$sel.'>'.htmlspecialchars($val, ENT_QUOTES, Kohana::CHARSET).'</option>'."\n";
}
}
$input .= '</select>';
return $input;
}
/**
* Creates an HTML form checkbox input tag.
*
* @param string|array input name or an array of HTML attributes
* @param string input value, when using a name
* @param boolean make the checkbox checked by default
* @param string a string to be attached to the end of the attributes
* @return string
*/
public static function checkbox($data, $value = '', $checked = FALSE, $extra = '')
{
if ( ! is_array($data))
{
$data = array('name' => $data);
}
$data['type'] = 'checkbox';
if ($checked == TRUE OR (isset($data['checked']) AND $data['checked'] == TRUE))
{
$data['checked'] = 'checked';
}
else
{
unset($data['checked']);
}
return form::input($data, $value, $extra);
}
/**
* Creates an HTML form radio input tag.
*
* @param string|array input name or an array of HTML attributes
* @param string input value, when using a name
* @param boolean make the radio selected by default
* @param string a string to be attached to the end of the attributes
* @return string
*/
public static function radio($data = '', $value = '', $checked = FALSE, $extra = '')
{
if ( ! is_array($data))
{
$data = array('name' => $data);
}
$data['type'] = 'radio';
if ($checked == TRUE OR (isset($data['checked']) AND $data['checked'] == TRUE))
{
$data['checked'] = 'checked';
}
else
{
unset($data['checked']);
}
return form::input($data, $value, $extra);
}
/**
* Creates an HTML form submit input tag.
*
* @param string|array input name or an array of HTML attributes
* @param string input value, when using a name
* @param string a string to be attached to the end of the attributes
* @return string
*/
public static function submit($data = '', $value = '', $extra = '')
{
if ( ! is_array($data))
{
$data = array('name' => $data);
}
if (empty($data['name']))
{
// Remove the name if it is empty
unset($data['name']);
}
$data['type'] = 'submit';
return form::input($data, $value, $extra);
}
/**
* Creates an HTML form button input tag.
*
* @param string|array input name or an array of HTML attributes
* @param string input value, when using a name
* @param string a string to be attached to the end of the attributes
* @return string
*/
public static function button($data = '', $value = '', $extra = '')
{
if ( ! is_array($data))
{
$data = array('name' => $data);
}
if (empty($data['name']))
{
// Remove the name if it is empty
unset($data['name']);
}
if (isset($data['value']) AND empty($value))
{
$value = arr::remove('value', $data);
}
return '<button'.form::attributes($data, 'button').' '.$extra.'>'.$value.'</button>';
}
/**
* Creates an HTML form label tag.
*
* @param string|array label "for" name or an array of HTML attributes
* @param string label text or HTML
* @param string a string to be attached to the end of the attributes
* @return string
*/
public static function label($data = '', $text = NULL, $extra = '')
{
if ( ! is_array($data))
{
if (is_string($data))
{
// Specify the input this label is for
$data = array('for' => $data);
}
else
{
// No input specified
$data = array();
}
}
if ($text === NULL AND isset($data['for']))
{
// Make the text the human-readable input name
$text = ucwords(inflector::humanize($data['for']));
}
return '<label'.form::attributes($data).' '.$extra.'>'.$text.'</label>';
}
/**
* Sorts a key/value array of HTML attributes, putting form attributes first,
* and returns an attribute string.
*
* @param array HTML attributes array
* @return string
*/
public static function attributes($attr, $type = NULL)
{
if (empty($attr))
return '';
$order = array
(
'action',
'method',
'type',
'id',
'name',
'value',
'src',
'size',
'maxlength',
'rows',
'cols',
'accept',
'tabindex',
'accesskey',
'align',
'alt',
'title',
'class',
'style',
'selected',
'checked',
'readonly',
'disabled'
);
$sorted = array();
foreach ($order as $key)
{
if (isset($attr[$key]))
{
// Move the attribute to the sorted array
$sorted[$key] = $attr[$key];
// Remove the attribute from unsorted array
unset($attr[$key]);
}
}
// Combine the sorted and unsorted attributes and create an HTML string
return html::attributes(array_merge($sorted, $attr));
}
} // End form

View File

@ -1,114 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Format helper class.
*
* $Id: format.php 4679 2009-11-10 01:45:52Z isaiah $
*
* @package Core
* @author Kohana Team
* @copyright (c) 2007-2009 Kohana Team
* @license http://kohanaphp.com/license
*/
class format_Core {
/**
* Formats a number according to the current locale.
*
* @param float
* @param int|boolean number of fractional digits or TRUE to use the locale default
* @return string
*/
public static function number($number, $decimals = 0)
{
$locale = localeconv();
if ($decimals === TRUE)
return number_format($number, $locale['frac_digits'], $locale['decimal_point'], $locale['thousands_sep']);
return number_format($number, $decimals, $locale['decimal_point'], $locale['thousands_sep']);
}
/**
* Formats a phone number according to the specified format.
*
* @param string phone number
* @param string format string
* @return string
*/
public static function phone($number, $format = '3-3-4')
{
// Get rid of all non-digit characters in number string
$number_clean = preg_replace('/\D+/', '', (string) $number);
// Array of digits we need for a valid format
$format_parts = preg_split('/[^1-9][^0-9]*/', $format, -1, PREG_SPLIT_NO_EMPTY);
// Number must match digit count of a valid format
if (strlen($number_clean) !== array_sum($format_parts))
return $number;
// Build regex
$regex = '(\d{'.implode('})(\d{', $format_parts).'})';
// Build replace string
for ($i = 1, $c = count($format_parts); $i <= $c; $i++)
{
$format = preg_replace('/(?<!\$)[1-9][0-9]*/', '\$'.$i, $format, 1);
}
// Hocus pocus!
return preg_replace('/^'.$regex.'$/', $format, $number_clean);
}
/**
* Formats a URL to contain a protocol at the beginning.
*
* @param string possibly incomplete URL
* @return string
*/
public static function url($str = '')
{
// Clear protocol-only strings like "http://"
if ($str === '' OR substr($str, -3) === '://')
return '';
// If no protocol given, prepend "http://" by default
if (strpos($str, '://') === FALSE)
return 'http://'.$str;
// Return the original URL
return $str;
}
/**
* Normalizes a hexadecimal HTML color value. All values will be converted
* to lowercase, have a "#" prepended and contain six characters.
*
* @param string hexadecimal HTML color value
* @return string
*/
public static function color($str = '')
{
// Reject invalid values
if ( ! valid::color($str))
return '';
// Convert to lowercase
$str = strtolower($str);
// Prepend "#"
if ($str[0] !== '#')
{
$str = '#'.$str;
}
// Expand short notation
if (strlen($str) === 4)
{
$str = '#'.$str[1].$str[1].$str[2].$str[2].$str[3].$str[3];
}
return $str;
}
} // End format

View File

@ -1,366 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* HTML helper class.
*
* $Id: html.php 4679 2009-11-10 01:45:52Z isaiah $
*
* @package Core
* @author Kohana Team
* @copyright (c) 2007-2009 Kohana Team
* @license http://kohanaphp.com/license
*/
class html_Core {
// Enable or disable automatic setting of target="_blank"
public static $windowed_urls = FALSE;
/**
* Convert special characters to HTML entities
*
* @param string string to convert
* @param boolean encode existing entities
* @return string
*/
public static function chars($str, $double_encode = TRUE)
{
// Return HTML entities using the Kohana charset
return htmlspecialchars($str, ENT_QUOTES, Kohana::CHARSET, $double_encode);
}
/**
* Create HTML link anchors.
*
* @param string URL or URI string
* @param string link text
* @param array HTML anchor attributes
* @param string non-default protocol, eg: https
* @param boolean option to escape the title that is output
* @return string
*/
public static function anchor($uri, $title = NULL, $attributes = NULL, $protocol = NULL, $escape_title = FALSE)
{
if ($uri === '')
{
$site_url = url::base(FALSE);
}
elseif (strpos($uri, '#') === 0)
{
// This is an id target link, not a URL
$site_url = $uri;
}
elseif (strpos($uri, '://') === FALSE)
{
$site_url = url::site($uri, $protocol);
}
else
{
if (html::$windowed_urls === TRUE AND empty($attributes['target']))
{
$attributes['target'] = '_blank';
}
$site_url = $uri;
}
return
// Parsed URL
'<a href="'.htmlspecialchars($site_url, ENT_QUOTES, Kohana::CHARSET, FALSE).'"'
// Attributes empty? Use an empty string
.(is_array($attributes) ? html::attributes($attributes) : '').'>'
// Title empty? Use the parsed URL
.($escape_title ? htmlspecialchars((($title === NULL) ? $site_url : $title), ENT_QUOTES, Kohana::CHARSET, FALSE) : (($title === NULL) ? $site_url : $title)).'</a>';
}
/**
* Creates an HTML anchor to a file.
*
* @param string name of file to link to
* @param string link text
* @param array HTML anchor attributes
* @param string non-default protocol, eg: ftp
* @return string
*/
public static function file_anchor($file, $title = NULL, $attributes = NULL, $protocol = NULL)
{
return
// Base URL + URI = full URL
'<a href="'.htmlspecialchars(url::base(FALSE, $protocol).$file, ENT_QUOTES, Kohana::CHARSET, FALSE).'"'
// Attributes empty? Use an empty string
.(is_array($attributes) ? html::attributes($attributes) : '').'>'
// Title empty? Use the filename part of the URI
.(($title === NULL) ? end(explode('/', $file)) : $title) .'</a>';
}
/**
* Generates an obfuscated version of an email address.
*
* @param string email address
* @return string
*/
public static function email($email)
{
$safe = '';
foreach (str_split($email) as $letter)
{
switch (($letter === '@') ? rand(1, 2) : rand(1, 3))
{
// HTML entity code
case 1: $safe .= '&#'.ord($letter).';'; break;
// Hex character code
case 2: $safe .= '&#x'.dechex(ord($letter)).';'; break;
// Raw (no) encoding
case 3: $safe .= $letter;
}
}
return $safe;
}
/**
* Creates an email anchor.
*
* @param string email address to send to
* @param string link text
* @param array HTML anchor attributes
* @return string
*/
public static function mailto($email, $title = NULL, $attributes = NULL)
{
if (empty($email))
return $title;
// Remove the subject or other parameters that do not need to be encoded
if (strpos($email, '?') !== FALSE)
{
// Extract the parameters from the email address
list ($email, $params) = explode('?', $email, 2);
// Make the params into a query string, replacing spaces
$params = '?'.str_replace(' ', '%20', $params);
}
else
{
// No parameters
$params = '';
}
// Obfuscate email address
$safe = html::email($email);
// Title defaults to the encoded email address
empty($title) and $title = $safe;
// Parse attributes
empty($attributes) or $attributes = html::attributes($attributes);
// Encoded start of the href="" is a static encoded version of 'mailto:'
return '<a href="&#109;&#097;&#105;&#108;&#116;&#111;&#058;'.$safe.$params.'"'.$attributes.'>'.$title.'</a>';
}
/**
* Generate a "breadcrumb" list of anchors representing the URI.
*
* @param array segments to use as breadcrumbs, defaults to using Router::$segments
* @return string
*/
public static function breadcrumb($segments = NULL)
{
empty($segments) and $segments = Router::$segments;
$array = array();
while ($segment = array_pop($segments))
{
$array[] = html::anchor
(
// Complete URI for the URL
implode('/', $segments).'/'.$segment,
// Title for the current segment
ucwords(inflector::humanize($segment))
);
}
// Retrun the array of all the segments
return array_reverse($array);
}
/**
* Creates a meta tag.
*
* @param string|array tag name, or an array of tags
* @param string tag "content" value
* @return string
*/
public static function meta($tag, $value = NULL)
{
if (is_array($tag))
{
$tags = array();
foreach ($tag as $t => $v)
{
// Build each tag and add it to the array
$tags[] = html::meta($t, $v);
}
// Return all of the tags as a string
return implode("\n", $tags);
}
// Set the meta attribute value
$attr = in_array(strtolower($tag), Kohana::config('http.meta_equiv')) ? 'http-equiv' : 'name';
return '<meta '.$attr.'="'.$tag.'" content="'.$value.'" />';
}
/**
* Creates a stylesheet link.
*
* @param string|array filename, or array of filenames to match to array of medias
* @param string|array media type of stylesheet, or array to match filenames
* @param boolean include the index_page in the link
* @return string
*/
public static function stylesheet($style, $media = FALSE, $index = FALSE)
{
return html::link($style, 'stylesheet', 'text/css', $media, $index);
}
/**
* Creates a link tag.
*
* @param string|array filename
* @param string|array relationship
* @param string|array mimetype
* @param string|array specifies on what device the document will be displayed
* @param boolean include the index_page in the link
* @return string
*/
public static function link($href, $rel, $type, $media = FALSE, $index = FALSE)
{
$compiled = '';
if (is_array($href))
{
foreach ($href as $_href)
{
$_rel = is_array($rel) ? array_shift($rel) : $rel;
$_type = is_array($type) ? array_shift($type) : $type;
$_media = is_array($media) ? array_shift($media) : $media;
$compiled .= html::link($_href, $_rel, $_type, $_media, $index);
}
}
else
{
if (strpos($href, '://') === FALSE)
{
// Make the URL absolute
$href = url::base($index).$href;
}
$attr = array
(
'rel' => $rel,
'type' => $type,
'href' => $href,
);
if ( ! empty($media))
{
// Add the media type to the attributes
$attr['media'] = $media;
}
$compiled = '<link'.html::attributes($attr).' />';
}
return $compiled."\n";
}
/**
* Creates a script link.
*
* @param string|array filename
* @param boolean include the index_page in the link
* @return string
*/
public static function script($script, $index = FALSE)
{
$compiled = '';
if (is_array($script))
{
foreach ($script as $name)
{
$compiled .= html::script($name, $index);
}
}
else
{
if (strpos($script, '://') === FALSE)
{
// Add the suffix only when it's not already present
$script = url::base((bool) $index).$script;
}
$compiled = '<script type="text/javascript" src="'.$script.'"></script>';
}
return $compiled."\n";
}
/**
* Creates a image link.
*
* @param string image source, or an array of attributes
* @param string|array image alt attribute, or an array of attributes
* @param boolean include the index_page in the link
* @return string
*/
public static function image($src = NULL, $alt = NULL, $index = FALSE)
{
// Create attribute list
$attributes = is_array($src) ? $src : array('src' => $src);
if (is_array($alt))
{
$attributes += $alt;
}
elseif ( ! empty($alt))
{
// Add alt to attributes
$attributes['alt'] = $alt;
}
if (strpos($attributes['src'], '://') === FALSE)
{
// Make the src attribute into an absolute URL
$attributes['src'] = url::base($index).$attributes['src'];
}
return '<img'.html::attributes($attributes).' />';
}
/**
* Compiles an array of HTML attributes into an attribute string.
*
* @param string|array array of attributes
* @return string
*/
public static function attributes($attrs)
{
if (empty($attrs))
return '';
if (is_string($attrs))
return ' '.$attrs;
$compiled = '';
foreach ($attrs as $key => $val)
{
$compiled .= ' '.$key.'="'.htmlspecialchars($val, ENT_QUOTES, Kohana::CHARSET).'"';
}
return $compiled;
}
} // End html

View File

@ -1,254 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Inflector helper class.
*
* $Id: inflector.php 4679 2009-11-10 01:45:52Z isaiah $
*
* @package Core
* @author Kohana Team
* @copyright (c) 2007-2009 Kohana Team
* @license http://kohanaphp.com/license
*/
class inflector_Core {
// Cached inflections
protected static $cache = array();
// Uncountable and irregular words
protected static $uncountable;
protected static $irregular;
/**
* Checks if a word is defined as uncountable.
*
* @param string word to check
* @return boolean
*/
public static function uncountable($str)
{
if (inflector::$uncountable === NULL)
{
// Cache uncountables
inflector::$uncountable = Kohana::config('inflector.uncountable');
// Make uncountables mirroed
inflector::$uncountable = array_combine(inflector::$uncountable, inflector::$uncountable);
}
return isset(inflector::$uncountable[strtolower($str)]);
}
/**
* Makes a plural word singular.
*
* @param string word to singularize
* @param integer number of things
* @return string
*/
public static function singular($str, $count = NULL) {
$parts = explode('_', $str);
$last = inflector::_singular(array_pop($parts), $count);
$pre = implode('_', $parts);
if (strlen($pre))
$pre .= '_';
return $pre.$last;
}
/**
* Makes a plural word singular.
*
* @param string word to singularize
* @param integer number of things
* @return string
*/
public static function _singular($str, $count = NULL)
{
// Remove garbage
$str = strtolower(trim($str));
if (is_string($count))
{
// Convert to integer when using a digit string
$count = (int) $count;
}
// Do nothing with a single count
if ($count === 0 OR $count > 1)
return $str;
// Cache key name
$key = 'singular_'.$str.$count;
if (isset(inflector::$cache[$key]))
return inflector::$cache[$key];
if (inflector::uncountable($str))
return inflector::$cache[$key] = $str;
if (empty(inflector::$irregular))
{
// Cache irregular words
inflector::$irregular = Kohana::config('inflector.irregular');
}
if ($irregular = array_search($str, inflector::$irregular))
{
$str = $irregular;
}
elseif (preg_match('/[sxz]es$/', $str) OR preg_match('/[^aeioudgkprt]hes$/', $str))
{
// Remove "es"
$str = substr($str, 0, -2);
}
elseif (preg_match('/[^aeiou]ies$/', $str))
{
$str = substr($str, 0, -3).'y';
}
elseif (substr($str, -1) === 's' AND substr($str, -2) !== 'ss')
{
$str = substr($str, 0, -1);
}
return inflector::$cache[$key] = $str;
}
/**
* Makes a singular word plural.
*
* @param string word to pluralize
* @return string
*/
public static function plural($str, $count = NULL)
{
if ( ! $str)
return $str;
$parts = explode('_', $str);
$last = inflector::_plural(array_pop($parts), $count);
$pre = implode('_', $parts);
if (strlen($pre))
$pre .= '_';
return $pre.$last;
}
/**
* Makes a singular word plural.
*
* @param string word to pluralize
* @return string
*/
public static function _plural($str, $count = NULL)
{
// Remove garbage
$str = strtolower(trim($str));
if (is_string($count))
{
// Convert to integer when using a digit string
$count = (int) $count;
}
// Do nothing with singular
if ($count === 1)
return $str;
// Cache key name
$key = 'plural_'.$str.$count;
if (isset(inflector::$cache[$key]))
return inflector::$cache[$key];
if (inflector::uncountable($str))
return inflector::$cache[$key] = $str;
if (empty(inflector::$irregular))
{
// Cache irregular words
inflector::$irregular = Kohana::config('inflector.irregular');
}
if (isset(inflector::$irregular[$str]))
{
$str = inflector::$irregular[$str];
}
elseif (preg_match('/[sxz]$/', $str) OR preg_match('/[^aeioudgkprt]h$/', $str))
{
$str .= 'es';
}
elseif (preg_match('/[^aeiou]y$/', $str))
{
// Change "y" to "ies"
$str = substr_replace($str, 'ies', -1);
}
else
{
$str .= 's';
}
// Set the cache and return
return inflector::$cache[$key] = $str;
}
/**
* Makes a word possessive.
*
* @param string word to to make possessive
* @return string
*/
public static function possessive($string)
{
$length = strlen($string);
if (substr($string, $length - 1, $length) == 's')
{
return $string.'\'';
}
return $string.'\'s';
}
/**
* Makes a phrase camel case.
*
* @param string phrase to camelize
* @return string
*/
public static function camelize($str)
{
$str = 'x'.strtolower(trim($str));
$str = ucwords(preg_replace('/[\s_]+/', ' ', $str));
return substr(str_replace(' ', '', $str), 1);
}
/**
* Makes a phrase underscored instead of spaced.
*
* @param string phrase to underscore
* @return string
*/
public static function underscore($str)
{
return trim(preg_replace('/[\s_]+/', '_', $str), '_');
}
/**
* Makes an underscored or dashed phrase human-reable.
*
* @param string phrase to make human-reable
* @return string
*/
public static function humanize($str)
{
return trim(preg_replace('/[_-\s]+/', ' ', $str));
}
} // End inflector

View File

@ -1,26 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Number helper class.
*
* $Id: num.php 4679 2009-11-10 01:45:52Z isaiah $
*
* @package Core
* @author Kohana Team
* @copyright (c) 2007-2009 Kohana Team
* @license http://kohanaphp.com/license
*/
class num_Core {
/**
* Round a number to the nearest nth
*
* @param integer number to round
* @param integer number to round to
* @return integer
*/
public static function round($number, $nearest = 5)
{
return round($number / $nearest) * $nearest;
}
} // End num

View File

@ -1,66 +0,0 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Remote url/file helper.
*
* $Id: remote.php 4679 2009-11-10 01:45:52Z isaiah $
*
* @package Core
* @author Kohana Team
* @copyright (c) 2007-2009 Kohana Team
* @license http://kohanaphp.com/license
*/
class remote_Core {
public static function status($url)
{
if ( ! valid::url($url, 'http'))
return FALSE;
// Get the hostname and path
$url = parse_url($url);
if (empty($url['path']))
{
// Request the root document
$url['path'] = '/';
}
// Open a remote connection
$remote = fsockopen($url['host'], 80, $errno, $errstr, 5);
if ( ! is_resource($remote))
return FALSE;
// Set CRLF
$CRLF = "\r\n";
// Send request
fwrite($remote, 'HEAD '.$url['path'].(isset($url['query']) ? '?'.$url['query'] : '').' HTTP/1.0'.$CRLF);
fwrite($remote, 'Host: '.$url['host'].$CRLF);
fwrite($remote, 'Connection: close'.$CRLF);
fwrite($remote, 'User-Agent: Kohana Framework (+http://kohanaphp.com/)'.$CRLF);
// Send one more CRLF to terminate the headers
fwrite($remote, $CRLF);
while ( ! feof($remote))
{
// Get the line
$line = trim(fgets($remote, 512));
if ($line !== '' AND preg_match('#^HTTP/1\.[01] (\d{3})#', $line, $matches))
{
// Response code found
$response = (int) $matches[1];
break;
}
}
// Close the connection
fclose($remote);
return isset($response) ? $response : FALSE;
}
} // End remote

Some files were not shown because too many files have changed in this diff Show More