Skip to content

Commit

Permalink
Merge branch 'master' of github.com:gallery/gallery3-contrib
Browse files Browse the repository at this point in the history
  • Loading branch information
ckieffer committed Jan 11, 2010
2 parents fd724e8 + 5add59a commit 01f1078
Show file tree
Hide file tree
Showing 240 changed files with 28,535 additions and 716 deletions.
2 changes: 1 addition & 1 deletion modules/atom/libraries/Atom_Entry.php
Expand Up @@ -36,7 +36,7 @@ public function title($title) {
}

public function content($text, $type="html") {
$content = $this->dom->createElement("content", html::specialchars($text));
$content = $this->dom->createElement("content", html::chars($text));
$content->setAttribute("type", $type);
$this->element->appendChild($content);
return $this;
Expand Down
2 changes: 1 addition & 1 deletion modules/atom/libraries/Gallery_Atom_Entry.php
Expand Up @@ -27,7 +27,7 @@ function __construct() {
parent::__construct("entry");

/* Set feed ID and self link. */
$this->id(html::specialchars(url::abs_current()));
$this->id(html::chars(url::abs_current()));
$this->link()
->rel("self")
->href(url::abs_current());
Expand Down
2 changes: 1 addition & 1 deletion modules/atom/libraries/Gallery_Atom_Feed.php
Expand Up @@ -27,7 +27,7 @@ function __construct() {
parent::__construct("feed");

/* Set feed ID and self link. */
$this->id(html::specialchars(url::abs_current()));
$this->id(html::chars(url::abs_current()));
$this->link()
->rel("self")
->href(url::abs_current());
Expand Down
2 changes: 1 addition & 1 deletion modules/basket/controllers/admin_configure.php
Expand Up @@ -48,7 +48,7 @@ public function index()


$view->content->form = $form;
//$view->content->products = ORM::factory("product")->orderby("name")->find_all();
//$view->content->products = ORM::factory("product")->order_by("name")->find_all();

print $view;
}
Expand Down
28 changes: 14 additions & 14 deletions modules/basket/controllers/admin_postage_bands.php
Expand Up @@ -27,7 +27,7 @@ public function index()
{
$view = new Admin_View("admin.html");
$view->content = new View("admin_postage_bands.html");
$view->content->postage_bands = ORM::factory("postage_band")->orderby("name")->find_all();
$view->content->postage_bands = ORM::factory("postage_band")->order_by("name")->find_all();

print $view;
}
Expand All @@ -43,8 +43,8 @@ public function add_postage_band() {
$form = postage_band::get_add_form_admin();
$valid = $form->validate();
$name = $form->add_postage->inputs["name"]->value;
$postage = ORM::factory("postage_band")->where("name", $name)->find();
if ($postage->loaded) {
$postage = ORM::factory("postage_band")->where("name", "=", $name)->find();
if ($postage->loaded()) {
$form->add_postage->inputs["name"]->add_error("in_use", 1);
$valid = false;
}
Expand All @@ -68,8 +68,8 @@ public function add_postage_band() {

public function delete_postage_band_form($id) {
$postage = ORM::factory("postage_band", $id);
if (!$postage->loaded) {
kohana::show_404();
if (!$postage->loaded()) {
throw new Kohana_404_Exception();
}
print postage_band::get_delete_form_admin($postage);
}
Expand All @@ -82,8 +82,8 @@ public function delete_postage_band($id) {
}

$postage = ORM::factory("postage_band", $id);
if (!$postage->loaded) {
kohana::show_404();
if (!$postage->loaded()) {
throw new Kohana_404_Exception();
}

$form = postage_band::get_delete_form_admin($postage);
Expand All @@ -105,8 +105,8 @@ public function edit_postage_band($id) {
access::verify_csrf();

$postage = ORM::factory("postage_band", $id);
if (!$postage->loaded) {
kohana::show_404();
if (!$postage->loaded()) {
throw new Kohana_404_Exception();
}

$form = postage_band::get_edit_form_admin($postage);
Expand All @@ -115,10 +115,10 @@ public function edit_postage_band($id) {
$new_name = $form->edit_postage->inputs["name"]->value;
if ($new_name != $postage->name &&
ORM::factory("postage_band")
->where("name", $new_name)
->where("id !=", $postage->id)
->where("name", "=", $new_name)
->where("id", "<>", $postage->id)
->find()
->loaded) {
->loaded()) {
$form->edit_postage->inputs["name"]->add_error("in_use", 1);
$valid = false;
} else {
Expand All @@ -142,8 +142,8 @@ public function edit_postage_band($id) {

public function edit_postage_band_form($id) {
$postage = ORM::factory("postage_band", $id);
if (!$postage->loaded) {
kohana::show_404();
if (!$postage->loaded()) {
throw new Kohana_404_Exception();
}

$form = postage_band::get_edit_form_admin($postage);
Expand Down
28 changes: 14 additions & 14 deletions modules/basket/controllers/admin_product_lines.php
Expand Up @@ -27,7 +27,7 @@ public function index()
{
$view = new Admin_View("admin.html");
$view->content = new View("admin_product_lines.html");
$view->content->products = ORM::factory("product")->orderby("name")->find_all();
$view->content->products = ORM::factory("product")->order_by("name")->find_all();

print $view;
}
Expand All @@ -43,8 +43,8 @@ public function add_product() {
$form = product::get_add_form_admin();
$valid = $form->validate();
$name = $form->add_product->inputs["name"]->value;
$product = ORM::factory("product")->where("name", $name)->find();
if ($product->loaded) {
$product = ORM::factory("product")->where("name", "=", $name)->find();
if ($product->loaded()) {
$form->add_product->inputs["name"]->add_error("in_use", 1);
$valid = false;
}
Expand All @@ -69,8 +69,8 @@ public function add_product() {

public function delete_product_form($id) {
$product = ORM::factory("product", $id);
if (!$product->loaded) {
kohana::show_404();
if (!$product->loaded()) {
throw new Kohana_404_Exception();
}
print product::get_delete_form_admin($product);
}
Expand All @@ -83,8 +83,8 @@ public function delete_product($id) {
}

$product = ORM::factory("product", $id);
if (!$product->loaded) {
kohana::show_404();
if (!$product->loaded()) {
throw new Kohana_404_Exception();
}

$form = product::get_delete_form_admin($product);
Expand All @@ -106,8 +106,8 @@ public function edit_product($id) {
access::verify_csrf();

$product = ORM::factory("product", $id);
if (!$product->loaded) {
kohana::show_404();
if (!$product->loaded()) {
throw new Kohana_404_Exception();
}

$form = product::get_edit_form_admin($product);
Expand All @@ -116,10 +116,10 @@ public function edit_product($id) {
$new_name = $form->edit_product->inputs["name"]->value;
if ($new_name != $product->name &&
ORM::factory("product")
->where("name", $new_name)
->where("id !=", $product->id)
->where("name", "=", $new_name)
->where("id", "<>", $product->id)
->find()
->loaded) {
->loaded()) {
$form->edit_product->inputs["name"]->add_error("in_use", 1);
$valid = false;
} else {
Expand All @@ -144,8 +144,8 @@ public function edit_product($id) {

public function edit_product_form($id) {
$product = ORM::factory("product", $id);
if (!$product->loaded) {
kohana::show_404();
if (!$product->loaded()) {
throw new Kohana_404_Exception();
}

$form = product::get_edit_form_admin($product);
Expand Down
2 changes: 1 addition & 1 deletion modules/basket/controllers/basket.php
Expand Up @@ -205,7 +205,7 @@ public function add_to_basket_ajax($id) {

// get the item to add
$item = ORM::factory("item", $id);
if (!$item->loaded)
if (!$item->loaded())
{
//TODO
die("Not loaded id");
Expand Down
20 changes: 10 additions & 10 deletions modules/basket/helpers/basket_event.php
Expand Up @@ -49,9 +49,9 @@ static function admin_menu($menu, $theme){
static function item_edit_form($item, $form){
$group = $form->group("products")->label(t("Available Products"));

$product_override = ORM::factory("product_override")->where('item_id', $item->id)->find();
$product_override = ORM::factory("product_override")->where('item_id', "=", $item->id)->find();
$group->checkbox("all")->label("No products except..");
if ($product_override->loaded){
if ($product_override->loaded()){
$group->all->checked($product_override->none);
}

Expand All @@ -63,11 +63,11 @@ static function item_edit_form($item, $form){
$cost = $product->cost;
$checked = false;

if ($product_override->loaded){
if ($product_override->loaded()){
$item_product = ORM::factory("item_product")
->where('product_override_id', $product_override->id)
->where('product_id', $product->id)->find();
if ($item_product->loaded){
->where('product_override_id', "=", $product_override->id)
->where('product_id', "=", $product->id)->find();
if ($item_product->loaded()){
$checked = $item_product->include;
if ($item_product->cost != -1){
$cost = $item_product->cost;
Expand All @@ -82,7 +82,7 @@ static function item_edit_form($item, $form){
}

static function item_edit_form_completed($item, $form){
$product_override = ORM::factory("product_override")->where('item_id', $item->id)->find();
$product_override = ORM::factory("product_override")->where('item_id', "=", $item->id)->find();

if ($form->products->all->checked)
{
Expand All @@ -93,8 +93,8 @@ static function item_edit_form_completed($item, $form){
foreach ($products as $product){
$p_group = $form->products->__get("product_$product->id");
$item_product = ORM::factory("item_product")
->where('product_override_id', $product_override->id)
->where('product_id', $product->id)->find();
->where('product_override_id', "=", $product_override->id)
->where('product_id', "=", $product->id)->find();

$item_product->include = $p_group->__get("exclude_$product->id")->checked;
$item_product->cost = $p_group->__get("cost_$product->id")->value;
Expand All @@ -105,7 +105,7 @@ static function item_edit_form_completed($item, $form){
}
else
{
if ($product_override->loaded){
if ($product_override->loaded()){
$product_override->delete();
}
}
Expand Down
4 changes: 2 additions & 2 deletions modules/basket/helpers/postage_band.php
Expand Up @@ -67,8 +67,8 @@ static function get_delete_form_admin($postage) {
* @return User_Model
*/
static function create($name, $flatrate, $peritemcost) {
$postage = ORM::factory("postage_band")->where("name", $name)->find();
if ($postage->loaded) {
$postage = ORM::factory("postage_band")->where("name", "=", $name)->find();
if ($postage->loaded()) {
throw new Exception("@todo postage already EXISTS $name");
}

Expand Down
36 changes: 18 additions & 18 deletions modules/basket/helpers/product.php
Expand Up @@ -74,8 +74,8 @@ static function get_delete_form_admin($product) {
* @return User_Model
*/
static function create($name, $cost, $description, $postage_band) {
$product = ORM::factory("product")->where("name", $name)->find();
if ($product->loaded) {
$product = ORM::factory("product")->where("name", "=", $name)->find();
if ($product->loaded()) {
throw new Exception("@todo USER_ALREADY_EXISTS $name");
}

Expand All @@ -90,18 +90,18 @@ static function create($name, $cost, $description, $postage_band) {
static function getProductArray($id){
$producta = array();
// check for product override
$product_override = ORM::factory("product_override")->where('item_id', $id)->find();
$product_override = ORM::factory("product_override")->where('item_id', "=", $id)->find();

if (!$product_override->loaded){
if (!$product_override->loaded()){
// no override found so check parents
// check parents for product override
$item = ORM::factory("item",$id);

$parents = $item->parents();
foreach ($parents as $parent){
// check for product override
$product_override = ORM::factory("product_override")->where('item_id', $parent->id)->find();
if ($product_override->loaded){
$product_override = ORM::factory("product_override")->where('item_id', "=", $parent->id)->find();
if ($product_override->loaded()){
break;
}
}
Expand All @@ -111,13 +111,13 @@ static function getProductArray($id){
foreach ($products as $product){
$show = true;
$cost = $product->cost;
if ($product_override->loaded){
if ($product_override->loaded()){
$show = !$product_override->none;
$item_product = ORM::factory("item_product")
->where('product_override_id', $product_override->id)
->where('product_id', $product->id)->find();
->where('product_override_id', "=", $product_override->id)
->where('product_id', "=", $product->id)->find();

if ($item_product->loaded){
if ($item_product->loaded()){
$cost = $item_product->cost;
if (!$show){
$show = $item_product->include;
Expand All @@ -137,34 +137,34 @@ static function getProductArray($id){
static function isForSale($id){

// check for product override
$product_override = ORM::factory("product_override")->where('item_id', $id)->find();
$product_override = ORM::factory("product_override")->where('item_id', "=", $id)->find();

if (!$product_override->loaded){
if (!$product_override->loaded()){
// no override found so check parents
// check parents for product override
$item = ORM::factory("item",$id);

$parents = $item->parents();
foreach ($parents as $parent){
// check for product override
$product_override = ORM::factory("product_override")->where('item_id', $parent->id)->find();
if ($product_override->loaded){
$product_override = ORM::factory("product_override")->where('item_id', "=", $parent->id)->find();
if ($product_override->loaded()){
break;
}
}
}

$products = ORM::factory("product")->find_all();

if ($product_override->loaded && $product_override->none){
if ($product_override->loaded() && $product_override->none){

foreach ($products as $product){

$item_product = ORM::factory("item_product")
->where('product_override_id', $product_override->id)
->where('product_id', $product->id)->find();
->where('product_override_id', "=", $product_override->id)
->where('product_id', "=", $product->id)->find();

if ($item_product->loaded){
if ($item_product->loaded()){

if ($item_product->include){
return true;
Expand Down
2 changes: 1 addition & 1 deletion modules/basket/models/postage_band.php
Expand Up @@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class Postage_Band_Model extends ORM {
var $rules = array(
var $form_rules = array(
"name" => "length[1,32]");

protected $has_many=array('products');
Expand Down
2 changes: 1 addition & 1 deletion modules/basket/models/product.php
Expand Up @@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class Product_Model extends ORM {
var $rules = array(
var $form_rules = array(
"name" => "length[1,32]",
"description" => "length[0,255]");
protected $belongs_to=array('postage_band');
Expand Down

0 comments on commit 01f1078

Please sign in to comment.