From 5b3b675b6d8a1cd9a5f2b9455c551791e18d88ff Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Thu, 16 Jul 2009 11:19:34 -0700
Subject: Non-trivial changes to the event handling code:
1) The item_updated event no longer takes the old and new items.
Instead we overload ORM to track the original data and make
that available via the item. This will allow us to move event
publishing down into the API methods which in turn will give us
more stability since we won't require each controller to remember
to do it.
2) ORM class now tracks the original values. It doesn't track
the original relationships (no need for that, yet)
3) Added new events:
item_deleted
group_deleted
user_deleted
---
modules/exif/helpers/exif_event.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'modules/exif/helpers')
diff --git a/modules/exif/helpers/exif_event.php b/modules/exif/helpers/exif_event.php
index f5677653..24243f4d 100644
--- a/modules/exif/helpers/exif_event.php
+++ b/modules/exif/helpers/exif_event.php
@@ -22,7 +22,7 @@ class exif_event_Core {
exif::extract($item);
}
- static function item_before_delete($item) {
+ static function item_deleted($item) {
Database::instance()->delete("exif_records", array("item_id" => $item->id));
}
}
--
cgit v1.2.3
From 0f766b149d0cee7af664f2321fddc6f04cda70ac Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Thu, 16 Jul 2009 12:29:16 -0700
Subject: Second non-trivial change to the event code. We now publish model
related events from within the model handling code. The only exception to
this currently is item_created which is challenging because we have to save
the item using ORM_MPTT::add_to_parent() before the object itself is fully
set up. When we get that down to one call to save() we can publish that
event from within the model also.
---
modules/comment/controllers/admin_comments.php | 4 ----
modules/comment/controllers/comments.php | 1 -
modules/comment/helpers/comment.php | 5 -----
modules/comment/models/comment.php | 17 ++++++++++++++++-
modules/exif/helpers/exif_event.php | 4 +++-
modules/gallery/controllers/albums.php | 3 ---
modules/gallery/controllers/movies.php | 3 ---
modules/gallery/controllers/photos.php | 3 ---
modules/gallery/helpers/album.php | 2 ++
modules/gallery/helpers/movie.php | 2 ++
modules/gallery/helpers/photo.php | 2 ++
modules/gallery/models/item.php | 7 ++++++-
modules/organize/controllers/organize.php | 4 ----
modules/user/helpers/group.php | 1 -
modules/user/helpers/user.php | 1 -
modules/user/models/group.php | 13 +++++++++++++
modules/user/models/user.php | 13 +++++++++++++
17 files changed, 57 insertions(+), 28 deletions(-)
(limited to 'modules/exif/helpers')
diff --git a/modules/comment/controllers/admin_comments.php b/modules/comment/controllers/admin_comments.php
index ea76b188..a164f79f 100644
--- a/modules/comment/controllers/admin_comments.php
+++ b/modules/comment/controllers/admin_comments.php
@@ -113,10 +113,6 @@ class Admin_Comments_Controller extends Admin_Controller {
if ($comment->loaded) {
$comment->state = $state;
$comment->save();
- module::event("comment_updated", $comment);
- if ($comment->original("state") == "published" || $comment->state == "published") {
- module::event("item_related_update", $comment->item());
- }
}
}
diff --git a/modules/comment/controllers/comments.php b/modules/comment/controllers/comments.php
index 02c38491..9fb4796e 100644
--- a/modules/comment/controllers/comments.php
+++ b/modules/comment/controllers/comments.php
@@ -152,7 +152,6 @@ class Comments_Controller extends REST_Controller {
$comment->url = $form->edit_comment->url->value;
$comment->text = $form->edit_comment->text->value;
$comment->save();
- module::event("comment_updated", $comment);
print json_encode(
array("result" => "success",
diff --git a/modules/comment/helpers/comment.php b/modules/comment/helpers/comment.php
index 08cba096..3d743325 100644
--- a/modules/comment/helpers/comment.php
+++ b/modules/comment/helpers/comment.php
@@ -61,11 +61,6 @@ class comment_Core {
$comment->server_remote_port = substr($input->server("REMOTE_PORT"), 0, 16);
$comment->save();
- module::event("comment_created", $comment);
- if ($comment->state == "published") {
- module::event("item_related_update", $comment->item());
- }
-
return $comment;
}
diff --git a/modules/comment/models/comment.php b/modules/comment/models/comment.php
index 22c465df..551fb245 100644
--- a/modules/comment/models/comment.php
+++ b/modules/comment/models/comment.php
@@ -61,8 +61,23 @@ class Comment_Model extends ORM {
$this->updated = time();
if (!$this->loaded && empty($this->created)) {
$this->created = $this->updated;
+ $created = true;
}
}
- return parent::save();
+ parent::save();
+
+ if (isset($created)) {
+ module::event("comment_created", $this);
+ } else {
+ module::event("comment_updated", $this);
+ }
+
+ // We only notify on the related items if we're making a visible change, which means moving in
+ // or out of a published state
+ if ($this->original("state") == "published" || $this->state == "published") {
+ module::event("item_related_update", $this->item());
+ }
+
+ return $this;
}
}
diff --git a/modules/exif/helpers/exif_event.php b/modules/exif/helpers/exif_event.php
index 24243f4d..826ec959 100644
--- a/modules/exif/helpers/exif_event.php
+++ b/modules/exif/helpers/exif_event.php
@@ -19,7 +19,9 @@
*/
class exif_event_Core {
static function item_created($item) {
- exif::extract($item);
+ if (!$item->is_album()) {
+ exif::extract($item);
+ }
}
static function item_deleted($item) {
diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php
index c378e3ce..9980b676 100644
--- a/modules/gallery/controllers/albums.php
+++ b/modules/gallery/controllers/albums.php
@@ -182,7 +182,6 @@ class Albums_Controller extends Items_Controller {
}
if ($valid) {
- $orig = clone $album;
$album->title = $form->edit_album->title->value;
$album->description = $form->edit_album->description->value;
$album->sort_column = $form->edit_album->sort_order->column->value;
@@ -192,8 +191,6 @@ class Albums_Controller extends Items_Controller {
}
$album->save();
- module::event("item_updated", $album);
-
log::success("content", "Updated album", "id\">view");
message::success(
t("Saved album %album_title", array("album_title" => p::clean($album->title))));
diff --git a/modules/gallery/controllers/movies.php b/modules/gallery/controllers/movies.php
index fc511082..d954ad8d 100644
--- a/modules/gallery/controllers/movies.php
+++ b/modules/gallery/controllers/movies.php
@@ -85,14 +85,11 @@ class Movies_Controller extends Items_Controller {
}
if ($valid) {
- $orig = clone $photo;
$photo->title = $form->edit_photo->title->value;
$photo->description = $form->edit_photo->description->value;
$photo->rename($form->edit_photo->filename->value);
$photo->save();
- module::event("item_updated", $photo);
-
log::success("content", "Updated photo", "id\">view");
message::success(
t("Saved photo %photo_title", array("photo_title" => p::clean($photo->title))));
diff --git a/modules/gallery/controllers/photos.php b/modules/gallery/controllers/photos.php
index 77627009..9ce6ed23 100644
--- a/modules/gallery/controllers/photos.php
+++ b/modules/gallery/controllers/photos.php
@@ -78,14 +78,11 @@ class Photos_Controller extends Items_Controller {
}
if ($valid) {
- $orig = clone $photo;
$photo->title = $form->edit_photo->title->value;
$photo->description = $form->edit_photo->description->value;
$photo->rename($form->edit_photo->filename->value);
$photo->save();
- module::event("item_updated", $photo);
-
log::success("content", "Updated photo", "id\">view");
message::success(
t("Saved photo %photo_title", array("photo_title" => p::clean($photo->title))));
diff --git a/modules/gallery/helpers/album.php b/modules/gallery/helpers/album.php
index 1197f243..f1a6c060 100644
--- a/modules/gallery/helpers/album.php
+++ b/modules/gallery/helpers/album.php
@@ -71,6 +71,8 @@ class album_Core {
mkdir(dirname($album->thumb_path()));
mkdir(dirname($album->resize_path()));
+ // @todo: publish this from inside Item_Model::save() when we refactor to the point where
+ // there's only one save() happening here.
module::event("item_created", $album);
return $album;
diff --git a/modules/gallery/helpers/movie.php b/modules/gallery/helpers/movie.php
index d62ead76..4f4169d5 100644
--- a/modules/gallery/helpers/movie.php
+++ b/modules/gallery/helpers/movie.php
@@ -102,6 +102,8 @@ class movie_Core {
copy($filename, $movie->file_path());
+ // @todo: publish this from inside Item_Model::save() when we refactor to the point where
+ // there's only one save() happening here.
module::event("item_created", $movie);
// Build our thumbnail
diff --git a/modules/gallery/helpers/photo.php b/modules/gallery/helpers/photo.php
index e8a4f357..ce964c14 100644
--- a/modules/gallery/helpers/photo.php
+++ b/modules/gallery/helpers/photo.php
@@ -105,6 +105,8 @@ class photo_Core {
copy($filename, $photo->file_path());
+ // @todo: publish this from inside Item_Model::save() when we refactor to the point where
+ // there's only one save() happening here.
module::event("item_created", $photo);
// Build our thumbnail/resizes
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php
index 80f19d26..94e2fcf7 100644
--- a/modules/gallery/models/item.php
+++ b/modules/gallery/models/item.php
@@ -350,9 +350,14 @@ class Item_Model extends ORM_MPTT {
$this->created = $this->updated;
$r = ORM::factory("item")->select("MAX(weight) as max_weight")->find();
$this->weight = $r->max_weight + 1;
+ $created = 1;
}
}
- return parent::save();
+ parent::save();
+ if (!isset($created)) {
+ module::event("item_updated", $this);
+ }
+ return $this;
}
/**
diff --git a/modules/organize/controllers/organize.php b/modules/organize/controllers/organize.php
index 54e04071..27852904 100644
--- a/modules/organize/controllers/organize.php
+++ b/modules/organize/controllers/organize.php
@@ -279,8 +279,6 @@ class Organize_Controller extends Controller {
$item->rename($form->dirname->value);
$item->save();
- module::event("item_updated", $item);
-
if ($item->is_album()) {
log::success("content", "Updated album", "id\">view");
$message = t("Saved album %album_title", array("album_title" => p::purify($item->title)));
@@ -322,8 +320,6 @@ class Organize_Controller extends Controller {
$item->sort_order = $form->direction->value;
$item->save();
- module::event("item_updated", $item);
-
log::success("content", "Updated album", "id\">view");
$message = t("Saved album %album_title", array("album_title" => p::purify($item->title)));
print json_encode(array("form" => $form->__toString(), "message" => $message));
diff --git a/modules/user/helpers/group.php b/modules/user/helpers/group.php
index 1dace840..04e6efd6 100644
--- a/modules/user/helpers/group.php
+++ b/modules/user/helpers/group.php
@@ -39,7 +39,6 @@ class group_Core {
$group->name = $name;
$group->save();
- module::event("group_created", $group);
return $group;
}
diff --git a/modules/user/helpers/user.php b/modules/user/helpers/user.php
index a59588f8..4105d745 100644
--- a/modules/user/helpers/user.php
+++ b/modules/user/helpers/user.php
@@ -202,7 +202,6 @@ class user_Core {
$user->add(group::registered_users());
$user->save();
- module::event("user_created", $user);
return $user;
}
diff --git a/modules/user/models/group.php b/modules/user/models/group.php
index e0724e30..bb3fb58b 100644
--- a/modules/user/models/group.php
+++ b/modules/user/models/group.php
@@ -32,4 +32,17 @@ class Group_Model extends ORM {
parent::delete($id);
module::event("group_deleted", $old);
}
+
+ public function save() {
+ if (!$this->loaded) {
+ $created = 1;
+ }
+ parent::save();
+ if (isset($created)) {
+ module::event("group_created", $this);
+ } else {
+ module::event("group_updated", $this);
+ }
+ return $this;
+ }
}
\ No newline at end of file
diff --git a/modules/user/models/user.php b/modules/user/models/user.php
index e3260270..0234f186 100644
--- a/modules/user/models/user.php
+++ b/modules/user/models/user.php
@@ -59,4 +59,17 @@ class User_Model extends ORM {
return sprintf("http://www.gravatar.com/avatar/%s.jpg?s=%d&r=pg%s",
md5($this->email), $size, $default ? "&d=" . urlencode($default) : "");
}
+
+ public function save() {
+ if (!$this->loaded) {
+ $created = 1;
+ }
+ parent::save();
+ if (isset($created)) {
+ module::event("user_created", $this);
+ } else {
+ module::event("user_updated", $this);
+ }
+ return $this;
+ }
}
\ No newline at end of file
--
cgit v1.2.3
From bad6d215846cb115c88be0dae0039e89318b21b1 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Sun, 19 Jul 2009 13:48:38 -0700
Subject: Remove success logging from exif_task.
---
modules/exif/helpers/exif_task.php | 4 ----
1 file changed, 4 deletions(-)
(limited to 'modules/exif/helpers')
diff --git a/modules/exif/helpers/exif_task.php b/modules/exif/helpers/exif_task.php
index f3e77975..c269b732 100644
--- a/modules/exif/helpers/exif_task.php
+++ b/modules/exif/helpers/exif_task.php
@@ -42,7 +42,6 @@ class exif_task_Core {
$completed = $task->get("completed", 0);
$start = microtime(true);
- $message = array();
foreach (ORM::factory("item")
->join("exif_records", "items.id", "exif_records.item_id", "left")
->where("type", "photo")
@@ -57,11 +56,8 @@ class exif_task_Core {
$completed++;
exif::extract($item);
- $message[] = t("Updated Exif meta data for '%title'",
- array("title" => p::purify($item->title)));
}
- $task->log($message);
list ($remaining, $total, $percent) = exif::stats();
$task->set("completed", $completed);
if ($remaining == 0 || !($remaining + $completed)) {
--
cgit v1.2.3
From 4828db003f3ee505eb9e6d056cdb142da34b78ff Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Thu, 27 Aug 2009 15:47:54 -0700
Subject: Remove 'ENGINE=InnoDB' specification from tables that we create. Use
the system's default table specification. Fixes ticket #597.
---
installer/install.sql | 44 +++++++++++-----------
modules/comment/helpers/comment_installer.php | 2 +-
modules/digibug/helpers/digibug_installer.php | 2 +-
modules/exif/helpers/exif_installer.php | 2 +-
modules/g2_import/helpers/g2_import_installer.php | 2 +-
modules/gallery/controllers/packager.php | 4 ++
modules/gallery/helpers/gallery_installer.php | 32 ++++++++--------
.../helpers/notification_installer.php | 4 +-
modules/search/helpers/search_installer.php | 2 +-
.../server_add/helpers/server_add_installer.php | 4 +-
modules/tag/helpers/tag_installer.php | 4 +-
modules/user/helpers/user_installer.php | 6 +--
modules/watermark/helpers/watermark_installer.php | 2 +-
13 files changed, 57 insertions(+), 53 deletions(-)
(limited to 'modules/exif/helpers')
diff --git a/installer/install.sql b/installer/install.sql
index 48b504ba..21464379 100755
--- a/installer/install.sql
+++ b/installer/install.sql
@@ -11,7 +11,7 @@ CREATE TABLE {access_caches} (
`edit_2` binary(1) NOT NULL default '0',
`add_2` binary(1) NOT NULL default '0',
PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
INSERT INTO {access_caches} VALUES (1,1,'1','0','0','1','0','0');
DROP TABLE IF EXISTS {access_intents};
@@ -29,7 +29,7 @@ CREATE TABLE {access_intents} (
`edit_2` binary(1) default NULL,
`add_2` binary(1) default NULL,
PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
INSERT INTO {access_intents} VALUES (1,1,'1','1','0','0','1','1','0','0');
DROP TABLE IF EXISTS {caches};
@@ -43,7 +43,7 @@ CREATE TABLE {caches} (
`cache` longblob,
PRIMARY KEY (`id`),
KEY `tags` (`tags`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS {comments};
SET @saved_cs_client = @@character_set_client;
@@ -72,7 +72,7 @@ CREATE TABLE {comments} (
`text` text,
`updated` int(9) NOT NULL,
PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS {graphics_rules};
SET @saved_cs_client = @@character_set_client;
@@ -86,7 +86,7 @@ CREATE TABLE {graphics_rules} (
`priority` int(9) NOT NULL,
`target` varchar(32) NOT NULL,
PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
INSERT INTO {graphics_rules} VALUES (1,1,'a:3:{s:5:\"width\";i:200;s:6:\"height\";i:200;s:6:\"master\";i:2;}','gallery','resize',100,'thumb');
INSERT INTO {graphics_rules} VALUES (2,1,'a:3:{s:5:\"width\";i:640;s:6:\"height\";i:480;s:6:\"master\";i:2;}','gallery','resize',100,'resize');
@@ -99,7 +99,7 @@ CREATE TABLE {groups} (
`special` tinyint(1) default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
-) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
INSERT INTO {groups} VALUES (1,'Everybody',1);
INSERT INTO {groups} VALUES (2,'Registered Users',1);
@@ -111,7 +111,7 @@ CREATE TABLE {groups_users} (
`user_id` int(9) NOT NULL,
PRIMARY KEY (`group_id`,`user_id`),
UNIQUE KEY `user_id` (`user_id`,`group_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
INSERT INTO {groups_users} VALUES (1,1);
INSERT INTO {groups_users} VALUES (1,2);
@@ -129,7 +129,7 @@ CREATE TABLE {incoming_translations} (
PRIMARY KEY (`id`),
UNIQUE KEY `key` (`key`,`locale`),
KEY `locale_key` (`locale`,`key`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS {items};
SET @saved_cs_client = @@character_set_client;
@@ -171,7 +171,7 @@ CREATE TABLE {items} (
KEY `type` (`type`),
KEY `random` (`rand_key`),
KEY `weight` (`weight`)
-) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
INSERT INTO {items} VALUES (1,NULL,NULL,UNIX_TIMESTAMP(),'',NULL,1,1,NULL,NULL,NULL,0,NULL,'',1,NULL,NULL,2,'weight','ASC',1,NULL,NULL,'Gallery','album',UNIX_TIMESTAMP(),0,1,NULL,'1','1');
DROP TABLE IF EXISTS {items_tags};
@@ -184,7 +184,7 @@ CREATE TABLE {items_tags} (
PRIMARY KEY (`id`),
KEY `tag_id` (`tag_id`,`id`),
KEY `item_id` (`item_id`,`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS {logs};
SET @saved_cs_client = @@character_set_client;
@@ -200,7 +200,7 @@ CREATE TABLE {logs} (
`url` varchar(255) default NULL,
`user_id` int(9) default '0',
PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS {messages};
SET @saved_cs_client = @@character_set_client;
@@ -212,7 +212,7 @@ CREATE TABLE {messages} (
`value` varchar(255) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `key` (`key`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS {modules};
SET @saved_cs_client = @@character_set_client;
@@ -224,7 +224,7 @@ CREATE TABLE {modules} (
`version` int(9) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
-) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
INSERT INTO {modules} VALUES (1,1,'gallery',10);
INSERT INTO {modules} VALUES (2,1,'user',1);
@@ -248,7 +248,7 @@ CREATE TABLE {outgoing_translations} (
PRIMARY KEY (`id`),
UNIQUE KEY `key` (`key`,`locale`),
KEY `locale_key` (`locale`,`key`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS {permissions};
SET @saved_cs_client = @@character_set_client;
@@ -259,7 +259,7 @@ CREATE TABLE {permissions} (
`name` varchar(64) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
-) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
INSERT INTO {permissions} VALUES (1,'View','view');
INSERT INTO {permissions} VALUES (2,'View Full Size','view_full');
@@ -276,7 +276,7 @@ CREATE TABLE {search_records} (
PRIMARY KEY (`id`),
KEY `item_id` (`item_id`),
FULLTEXT KEY `data` (`data`)
-) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
INSERT INTO {search_records} VALUES (1,1,0,' Gallery');
DROP TABLE IF EXISTS {sessions};
@@ -287,7 +287,7 @@ CREATE TABLE {sessions} (
`data` text NOT NULL,
`last_activity` int(10) unsigned NOT NULL,
PRIMARY KEY (`session_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS {tags};
SET @saved_cs_client = @@character_set_client;
@@ -298,7 +298,7 @@ CREATE TABLE {tags} (
`count` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS {tasks};
SET @saved_cs_client = @@character_set_client;
@@ -316,7 +316,7 @@ CREATE TABLE {tasks} (
`updated` int(9) default NULL,
PRIMARY KEY (`id`),
KEY `owner_id` (`owner_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS {themes};
SET @saved_cs_client = @@character_set_client;
@@ -327,7 +327,7 @@ CREATE TABLE {themes} (
`version` int(9) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
-) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
INSERT INTO {themes} VALUES (1,'default',1);
INSERT INTO {themes} VALUES (2,'admin_default',1);
@@ -350,7 +350,7 @@ CREATE TABLE {users} (
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`),
UNIQUE KEY `hash` (`hash`)
-) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
INSERT INTO {users} VALUES (1,'guest','Guest User','',0,0,NULL,0,1,NULL,NULL,NULL);
INSERT INTO {users} VALUES (2,'admin','Gallery Administrator','',0,0,NULL,1,0,NULL,NULL,NULL);
@@ -364,7 +364,7 @@ CREATE TABLE {vars} (
`value` text,
PRIMARY KEY (`id`),
UNIQUE KEY `module_name` (`module_name`,`name`)
-) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=27 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
INSERT INTO {vars} VALUES (1,'gallery','active_site_theme','default');
INSERT INTO {vars} VALUES (2,'gallery','active_admin_theme','admin_default');
diff --git a/modules/comment/helpers/comment_installer.php b/modules/comment/helpers/comment_installer.php
index edf2427c..80594c16 100644
--- a/modules/comment/helpers/comment_installer.php
+++ b/modules/comment/helpers/comment_installer.php
@@ -44,7 +44,7 @@ class comment_installer {
`text` text,
`updated` int(9) NOT NULL,
PRIMARY KEY (`id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
block_manager::add("dashboard_center", "comment", "recent_comments");
module::set_var("comment", "spam_caught", 0);
diff --git a/modules/digibug/helpers/digibug_installer.php b/modules/digibug/helpers/digibug_installer.php
index 1cd78b44..7e8145d2 100644
--- a/modules/digibug/helpers/digibug_installer.php
+++ b/modules/digibug/helpers/digibug_installer.php
@@ -26,7 +26,7 @@ class digibug_installer {
`request_date` TIMESTAMP NOT NULL DEFAULT current_timestamp,
`item_id` int(9) NOT NULL,
PRIMARY KEY (`id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
module::set_var("digibug", "company_id", "3153");
module::set_var("digibug", "event_id", "8491");
diff --git a/modules/exif/helpers/exif_installer.php b/modules/exif/helpers/exif_installer.php
index 0233f2bb..66226061 100644
--- a/modules/exif/helpers/exif_installer.php
+++ b/modules/exif/helpers/exif_installer.php
@@ -28,7 +28,7 @@ class exif_installer {
`dirty` BOOLEAN default 1,
PRIMARY KEY (`id`),
KEY(`item_id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
module::set_version("exif", 1);
}
diff --git a/modules/g2_import/helpers/g2_import_installer.php b/modules/g2_import/helpers/g2_import_installer.php
index 0f87da6c..feacb518 100644
--- a/modules/g2_import/helpers/g2_import_installer.php
+++ b/modules/g2_import/helpers/g2_import_installer.php
@@ -26,7 +26,7 @@ class g2_import_installer {
`g3_id` int(9) NOT NULL,
PRIMARY KEY (`id`),
KEY (`g2_id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
module::set_version("g2_import", 1);
mkdir(VARPATH . "modules/g2_import");
diff --git a/modules/gallery/controllers/packager.php b/modules/gallery/controllers/packager.php
index 7b4d68f6..fbb1d07d 100644
--- a/modules/gallery/controllers/packager.php
+++ b/modules/gallery/controllers/packager.php
@@ -123,6 +123,10 @@ class Packager_Controller extends Controller {
// Normalize dates
$line = preg_replace("/,$root_created_timestamp,/", ",UNIX_TIMESTAMP(),", $line);
$line = preg_replace("/,$root_updated_timestamp,/", ",UNIX_TIMESTAMP(),", $line);
+
+ // Remove ENGINE= specifications
+ $line = preg_replace("/ENGINE=\S+ /", "", $line);
+
$buf .= $line;
}
$fd = fopen($sql_file, "wb");
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index d12dad70..a212ef85 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -24,13 +24,13 @@ class gallery_installer {
`id` int(9) NOT NULL auto_increment,
`item_id` int(9),
PRIMARY KEY (`id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {access_intents} (
`id` int(9) NOT NULL auto_increment,
`item_id` int(9),
PRIMARY KEY (`id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {caches} (
`id` int(9) NOT NULL auto_increment,
@@ -40,7 +40,7 @@ class gallery_installer {
`cache` longblob,
PRIMARY KEY (`id`),
KEY (`tags`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {graphics_rules} (
`id` int(9) NOT NULL auto_increment,
@@ -51,7 +51,7 @@ class gallery_installer {
`priority` int(9) NOT NULL,
`target` varchar(32) NOT NULL,
PRIMARY KEY (`id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {incoming_translations} (
`id` int(9) NOT NULL auto_increment,
@@ -63,7 +63,7 @@ class gallery_installer {
PRIMARY KEY (`id`),
UNIQUE KEY(`key`, `locale`),
KEY `locale_key` (`locale`, `key`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {items} (
`id` int(9) NOT NULL auto_increment,
@@ -100,7 +100,7 @@ class gallery_installer {
KEY `type` (`type`),
KEY `random` (`rand_key`),
KEY `weight` (`weight` DESC))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {logs} (
`id` int(9) NOT NULL auto_increment,
@@ -113,7 +113,7 @@ class gallery_installer {
`url` varchar(255) default NULL,
`user_id` int(9) default 0,
PRIMARY KEY (`id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {messages} (
`id` int(9) NOT NULL auto_increment,
@@ -122,7 +122,7 @@ class gallery_installer {
`value` varchar(255) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY(`key`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {modules} (
`id` int(9) NOT NULL auto_increment,
@@ -131,7 +131,7 @@ class gallery_installer {
`version` int(9) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY(`name`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {outgoing_translations} (
`id` int(9) NOT NULL auto_increment,
@@ -143,7 +143,7 @@ class gallery_installer {
PRIMARY KEY (`id`),
UNIQUE KEY(`key`, `locale`),
KEY `locale_key` (`locale`, `key`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {permissions} (
`id` int(9) NOT NULL auto_increment,
@@ -151,14 +151,14 @@ class gallery_installer {
`name` varchar(64) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY(`name`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {sessions} (
`session_id` varchar(127) NOT NULL,
`data` text NOT NULL,
`last_activity` int(10) UNSIGNED NOT NULL,
PRIMARY KEY (`session_id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {tasks} (
`id` int(9) NOT NULL auto_increment,
@@ -173,7 +173,7 @@ class gallery_installer {
`updated` int(9) default NULL,
PRIMARY KEY (`id`),
KEY (`owner_id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {themes} (
`id` int(9) NOT NULL auto_increment,
@@ -181,7 +181,7 @@ class gallery_installer {
`version` int(9) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY(`name`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {vars} (
`id` int(9) NOT NULL auto_increment,
@@ -190,7 +190,7 @@ class gallery_installer {
`value` text,
PRIMARY KEY (`id`),
UNIQUE KEY(`module_name`, `name`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
foreach (array("albums", "logs", "modules", "resizes", "thumbs", "tmp", "uploads") as $dir) {
@mkdir(VARPATH . $dir);
@@ -284,7 +284,7 @@ class gallery_installer {
`cache` text,
PRIMARY KEY (`id`),
KEY (`tags`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
module::set_version("gallery", $version = 4);
}
diff --git a/modules/notification/helpers/notification_installer.php b/modules/notification/helpers/notification_installer.php
index 3d450258..aa2e09f7 100644
--- a/modules/notification/helpers/notification_installer.php
+++ b/modules/notification/helpers/notification_installer.php
@@ -27,14 +27,14 @@ class notification_installer {
PRIMARY KEY (`id`),
UNIQUE KEY (`item_id`, `user_id`),
UNIQUE KEY (`user_id`, `item_id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE IF NOT EXISTS {pending_notifications} (
`id` int(9) NOT NULL auto_increment,
`email` varchar(128) NOT NULL,
`subject` varchar(255) NOT NULL,
`text` text,
PRIMARY KEY (`id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
module::set_version("notification", 1);
}
diff --git a/modules/search/helpers/search_installer.php b/modules/search/helpers/search_installer.php
index cd253be4..10d8211f 100644
--- a/modules/search/helpers/search_installer.php
+++ b/modules/search/helpers/search_installer.php
@@ -28,7 +28,7 @@ class search_installer {
PRIMARY KEY (`id`),
KEY(`item_id`),
FULLTEXT INDEX (`data`))
- ENGINE=MyISAM DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
module::set_version("search", 1);
}
diff --git a/modules/server_add/helpers/server_add_installer.php b/modules/server_add/helpers/server_add_installer.php
index cd278eb7..c3c1572d 100644
--- a/modules/server_add/helpers/server_add_installer.php
+++ b/modules/server_add/helpers/server_add_installer.php
@@ -27,7 +27,7 @@ class server_add_installer {
`parent_id` int(9),
`task_id` int(9) NOT NULL,
PRIMARY KEY (`id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
module::set_version("server_add", 3);
server_add::check_config();
}
@@ -40,7 +40,7 @@ class server_add_installer {
`task_id` int(9) NOT NULL,
`file` varchar(255) NOT NULL,
PRIMARY KEY (`id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
module::set_version("server_add", $version = 2);
}
diff --git a/modules/tag/helpers/tag_installer.php b/modules/tag/helpers/tag_installer.php
index 3c16e3f3..bcb830e4 100644
--- a/modules/tag/helpers/tag_installer.php
+++ b/modules/tag/helpers/tag_installer.php
@@ -26,7 +26,7 @@ class tag_installer {
`count` int(10) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY(`name`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE IF NOT EXISTS {items_tags} (
`id` int(9) NOT NULL auto_increment,
@@ -35,7 +35,7 @@ class tag_installer {
PRIMARY KEY (`id`),
KEY(`tag_id`, `id`),
KEY(`item_id`, `id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
module::set_version("tag", 1);
}
diff --git a/modules/user/helpers/user_installer.php b/modules/user/helpers/user_installer.php
index 1959d038..8ef4f13d 100644
--- a/modules/user/helpers/user_installer.php
+++ b/modules/user/helpers/user_installer.php
@@ -36,7 +36,7 @@ class user_installer {
PRIMARY KEY (`id`),
UNIQUE KEY(`hash`),
UNIQUE KEY(`name`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE IF NOT EXISTS {groups} (
`id` int(9) NOT NULL auto_increment,
@@ -44,14 +44,14 @@ class user_installer {
`special` BOOLEAN default 0,
PRIMARY KEY (`id`),
UNIQUE KEY(`name`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE IF NOT EXISTS {groups_users} (
`group_id` int(9) NOT NULL,
`user_id` int(9) NOT NULL,
PRIMARY KEY (`group_id`, `user_id`),
UNIQUE KEY(`user_id`, `group_id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$everybody = group::create("Everybody");
$everybody->special = true;
diff --git a/modules/watermark/helpers/watermark_installer.php b/modules/watermark/helpers/watermark_installer.php
index 705b89d4..b3e91044 100644
--- a/modules/watermark/helpers/watermark_installer.php
+++ b/modules/watermark/helpers/watermark_installer.php
@@ -30,7 +30,7 @@ class watermark_installer {
`mime_type` varchar(64) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY(`name`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
@mkdir(VARPATH . "modules/watermark");
module::set_version("watermark", 1);
--
cgit v1.2.3
From b4b638be44375c93f5222c7b48ed547845d6d7e5 Mon Sep 17 00:00:00 2001
From: Andy Staudacher
Date: Sat, 29 Aug 2009 16:28:30 -0700
Subject: Undo url helper changes - url methods no longer return a SafeString.
Adding SafeString::of_safe_html() calls where urls are passed as parameters to t() and t2().
---
modules/akismet/helpers/akismet.php | 2 +-
modules/digibug/views/admin_digibug.html.php | 2 +-
modules/exif/helpers/exif.php | 2 +-
modules/g2_import/views/admin_g2_import.html.php | 10 ++++-----
modules/gallery/helpers/MY_url.php | 24 +---------------------
modules/gallery/helpers/graphics.php | 2 +-
modules/gallery/tests/Xss_Security_Test.php | 15 +++++++++++---
modules/gallery/views/admin_block_welcome.html.php | 10 ++++-----
modules/gallery/views/upgrader.html.php | 2 +-
modules/recaptcha/helpers/recaptcha.php | 2 +-
modules/search/helpers/search.php | 2 +-
modules/server_add/helpers/server_add.php | 2 +-
modules/user/views/reset_password.html.php | 4 +++-
system/helpers/request.php | 2 +-
14 files changed, 35 insertions(+), 46 deletions(-)
(limited to 'modules/exif/helpers')
diff --git a/modules/akismet/helpers/akismet.php b/modules/akismet/helpers/akismet.php
index db45a6ab..abca78d2 100644
--- a/modules/akismet/helpers/akismet.php
+++ b/modules/akismet/helpers/akismet.php
@@ -94,7 +94,7 @@ class akismet_Core {
if (empty($api_key)) {
site_status::warning(
t("Akismet is not quite ready! Please provide an API Key",
- array("url" => url::site("admin/akismet"))),
+ array("url" => SafeString::of_safe_html(url::site("admin/akismet")))),
"akismet_config");
} else {
site_status::clear("akismet_config");
diff --git a/modules/digibug/views/admin_digibug.html.php b/modules/digibug/views/admin_digibug.html.php
index 7e4436ff..5f27a3fd 100644
--- a/modules/digibug/views/admin_digibug.html.php
+++ b/modules/digibug/views/admin_digibug.html.php
@@ -16,7 +16,7 @@
= t("You don't need an account with Digibug, but if you register with Digibug and enter your Digibug id in the Advanced Settings page you can make money off of your photos!",
array("signup_url" => "http://www.digibug.com/signup.php",
- "advanced_settings_url" => url::site("admin/advanced_settings"))) ?>
+ "advanced_settings_url" => SafeString::of_safe_html(url::site("admin/advanced_settings")))) ?>
diff --git a/modules/exif/helpers/exif.php b/modules/exif/helpers/exif.php
index 20ecd0cb..d4e60338 100644
--- a/modules/exif/helpers/exif.php
+++ b/modules/exif/helpers/exif.php
@@ -164,7 +164,7 @@ class exif_Core {
if ($remaining) {
site_status::warning(
t('Your Exif index needs to be updated. Fix this now',
- array("url" => url::site("admin/maintenance/start/exif_task::update_index?csrf=__CSRF__"))),
+ array("url" => SafeString::of_safe_html(url::site("admin/maintenance/start/exif_task::update_index?csrf=__CSRF__")))),
"exif_index_out_of_date");
}
}
diff --git a/modules/g2_import/views/admin_g2_import.html.php b/modules/g2_import/views/admin_g2_import.html.php
index da2bb5d1..f53510f6 100644
--- a/modules/g2_import/views/admin_g2_import.html.php
+++ b/modules/g2_import/views/admin_g2_import.html.php
@@ -37,9 +37,9 @@
if ($g2_sizes["thumb"]["size"] && $thumb_size != $g2_sizes["thumb"]["size"]): ?>
= t("Your most common thumbnail size in Gallery 2 is %g2_pixels pixels, but your Gallery 3 thumbnail size is set to %g3_pixels pixels. Using the same value will speed up your import.",
- array("g2_pixels" => $g2_sizes["thumb"]["size"],
- "g3_pixels" => $thumb_size,
- "url" => url::site("admin/theme_options"))) ?>
+ array("g2_pixels" => $g2_sizes["thumb"]["size"],
+ "g3_pixels" => $thumb_size,
+ "url" => SafeString::of_safe_html(url::site("admin/theme_options")))) ?>
endif ?>
@@ -47,8 +47,8 @@
= t("Your most common intermediate size in Gallery 2 is %g2_pixels pixels, but your Gallery 3 thumbnail size is set to %g3_pixels pixels. Using the same value will speed up your import.",
array("g2_pixels" => $g2_sizes["resize"]["size"],
- "g3_pixels" => $resize_size,
- "url" => url::site("admin/theme_options"))) ?>
+ "g3_pixels" => $resize_size,
+ "url" => SafeString::of_safe_html(url::site("admin/theme_options")))) ?>
endif ?>
diff --git a/modules/gallery/helpers/MY_url.php b/modules/gallery/helpers/MY_url.php
index 6092a9d8..c4967c52 100644
--- a/modules/gallery/helpers/MY_url.php
+++ b/modules/gallery/helpers/MY_url.php
@@ -30,8 +30,7 @@ class url extends url_Core {
if ($parts[0] == "albums" || $parts[0] == "photos") {
$uri = model_cache::get("item", $parts[1])->relative_path();
}
- $url = parent::site($uri . $query, $protocol);
- return SafeString::of_safe_html($url);
+ return parent::site($uri . $query, $protocol);
}
static function parse_url() {
@@ -100,25 +99,4 @@ class url extends url_Core {
static function abs_current($qs=false) {
return self::abs_site(url::current($qs));
}
-
- public static function base($index=false, $protocol=false) {
- $url = parent::base($index, $protocol);
- return SafeString::of_safe_html($url);
- }
-
- public static function current($qs=false) {
- $url = parent::current($qs);
- return SafeString::of_safe_html($url);
- }
-
- public static function file($file, $index=false) {
- $url = parent::file($file, $index);
- return SafeString::of_safe_html($url);
- }
-
- public static function merge(array $arguments) {
- $url = parent::merge($arguments);
- return SafeString::of_safe_html($url);
- }
-
}
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php
index 7dc46eeb..fbb85bec 100644
--- a/modules/gallery/helpers/graphics.php
+++ b/modules/gallery/helpers/graphics.php
@@ -442,7 +442,7 @@ class graphics_Core {
if (!module::get_var("gallery", "graphics_toolkit")) {
site_status::warning(
t("Graphics toolkit missing! Please choose a toolkit",
- array("url" => url::site("admin/graphics"))),
+ array("url" => SafeString::of_safe_html(url::site("admin/graphics")))),
"missing_graphics_toolkit");
}
}
diff --git a/modules/gallery/tests/Xss_Security_Test.php b/modules/gallery/tests/Xss_Security_Test.php
index 690dc760..a2d3d59b 100644
--- a/modules/gallery/tests/Xss_Security_Test.php
+++ b/modules/gallery/tests/Xss_Security_Test.php
@@ -130,14 +130,14 @@ class Xss_Security_Test extends Unit_Test_Case {
$token = $tokens[$token_number];
}
} else if ($token[1] == "url") {
- // url methods return a SafeString
+ // url methods return safe HTML
if (self::_token_matches(array(T_DOUBLE_COLON, "::"), $tokens, $token_number + 1) &&
self::_token_matches(array(T_STRING), $tokens, $token_number + 2) &&
in_array($tokens[$token_number + 2][1],
array("site", "current", "base", "file", "abs_site", "abs_current",
"abs_file", "merge")) &&
self::_token_matches("(", $tokens, $token_number + 3)) {
- $frame->is_safestring(true);
+ $frame->is_safe_html(true);
$method = $tokens[$token_number + 2][1];
$frame->expr_append("::$method(");
@@ -203,7 +203,8 @@ class Xss_Security_Test extends Unit_Test_Case {
$state = "CLEAN";
}
} else {
- if ($frame->is_safestring() || $frame->purified_html_called() || $frame->for_html_called()) {
+ if ($frame->is_safe_html() || $frame->is_safestring() ||
+ $frame->purified_html_called() || $frame->for_html_called()) {
$state = "CLEAN";
}
}
@@ -259,6 +260,7 @@ class Xss_Security_Test_Frame {
private $_for_html_called = false;
private $_purified_html_called = false;
private $_json_encode_called = false;
+ private $_is_safe_html = false;
private $_line;
function __construct($line_number, $in_script_block) {
@@ -288,6 +290,13 @@ class Xss_Security_Test_Frame {
return $this->_is_safestring;
}
+ function is_safe_html($new_val=NULL) {
+ if ($new_val !== NULL) {
+ $this->_is_safe_html = (bool) $new_val;
+ }
+ return $this->_is_safe_html;
+ }
+
function json_encode_called($new_val=NULL) {
if ($new_val !== NULL) {
$this->_json_encode_called = (bool) $new_val;
diff --git a/modules/gallery/views/admin_block_welcome.html.php b/modules/gallery/views/admin_block_welcome.html.php
index 38d2bd56..c6ccdbf3 100644
--- a/modules/gallery/views/admin_block_welcome.html.php
+++ b/modules/gallery/views/admin_block_welcome.html.php
@@ -5,16 +5,16 @@
-
= t("General Settings - choose your graphics and language settings.",
- array("graphics_url" => url::site("admin/graphics"),
- "language_url" => url::site("admin/languages"))) ?>
+ array("graphics_url" => SafeString::of_safe_html(url::site("admin/graphics")),
+ "language_url" => SafeString::of_safe_html(url::site("admin/languages")))) ?>
-
= t("Appearance - choose a theme, or customize the way it looks.",
- array("theme_url" => url::site("admin/themes"),
- "theme_options_url" => url::site("admin/theme_options"))) ?>
+ array("theme_url" => SafeString::of_safe_html(url::site("admin/themes")),
+ "theme_options_url" => SafeString::of_safe_html(url::site("admin/theme_options")))) ?>
-
= t("Customize - install modules to add cool features!",
- array("modules_url" => url::site("admin/modules"))) ?>
+ array("modules_url" => SafeString::of_safe_html(url::site("admin/modules")))) ?>
diff --git a/modules/gallery/views/upgrader.html.php b/modules/gallery/views/upgrader.html.php
index 37578855..ccc86da8 100644
--- a/modules/gallery/views/upgrader.html.php
+++ b/modules/gallery/views/upgrader.html.php
@@ -18,7 +18,7 @@
= t("That's it!") ?>
= t("Your Gallery is up to date.",
- array("url" => url::site("albums/1"))) ?>
+ array("url" => SafeString::of_safe_html(url::site("albums/1")))) ?>
diff --git a/modules/recaptcha/helpers/recaptcha.php b/modules/recaptcha/helpers/recaptcha.php
index 501dd972..35d9febd 100644
--- a/modules/recaptcha/helpers/recaptcha.php
+++ b/modules/recaptcha/helpers/recaptcha.php
@@ -43,7 +43,7 @@ class recaptcha_Core {
if (empty($public_key) || empty($private_key)) {
site_status::warning(
t("reCAPTCHA is not quite ready! Please configure the reCAPTCHA Keys",
- array("url" => url::site("admin/recaptcha"))),
+ array("url" => SafeString::of_safe_html(url::site("admin/recaptcha")))),
"recaptcha_config");
} else {
site_status::clear("recaptcha_config");
diff --git a/modules/search/helpers/search.php b/modules/search/helpers/search.php
index 355c4493..4be04039 100644
--- a/modules/search/helpers/search.php
+++ b/modules/search/helpers/search.php
@@ -58,7 +58,7 @@ class search_Core {
if ($remaining) {
site_status::warning(
t('Your search index needs to be updated. Fix this now',
- array("url" => url::site("admin/maintenance/start/search_task::update_index?csrf=__CSRF__"))),
+ array("url" => SafeString::of_safe_html(url::site("admin/maintenance/start/search_task::update_index?csrf=__CSRF__")))),
"search_index_out_of_date");
}
}
diff --git a/modules/server_add/helpers/server_add.php b/modules/server_add/helpers/server_add.php
index 74f51ad9..57afac12 100644
--- a/modules/server_add/helpers/server_add.php
+++ b/modules/server_add/helpers/server_add.php
@@ -25,7 +25,7 @@ class server_add_Core {
if (empty($paths)) {
site_status::warning(
t("Server Add needs configuration. Configure it now!",
- array("url" => url::site("admin/server_add"))),
+ array("url" => SafeString::of_safe_html(url::site("admin/server_add")))),
"server_add_configuration");
} else {
site_status::clear("server_add_configuration");
diff --git a/modules/user/views/reset_password.html.php b/modules/user/views/reset_password.html.php
index 3dc7aebf..6fa92d54 100644
--- a/modules/user/views/reset_password.html.php
+++ b/modules/user/views/reset_password.html.php
@@ -9,7 +9,9 @@
= t("Hello, %name,", array("name" => $user->full_name ? $user->full_name : $user->name)) ?>
- = t("We received a request to reset your password for %site_url. If you made this request, you can confirm it by clicking this link. If you didn't request this password reset, it's ok to ignore this mail.", array("site_url" => url::base(false, "http"), "confirm_url" => $confirm_url)) ?>
+ = t("We received a request to reset your password for %site_url. If you made this request, you can confirm it by clicking this link. If you didn't request this password reset, it's ok to ignore this mail.",
+ array("site_url" => SafeString::of_safe_html(url::base(false, "http")),
+ "confirm_url" => $confirm_url)) ?>