summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-11-03 13:28:26 -0800
committerBharat Mediratta <bharat@menalto.com>2009-11-03 13:28:26 -0800
commit93ec51aa0fd91e1534563d9e9514e85be4e3ce2e (patch)
tree012d6ff2c9fda6c7812d6f4397396b627ffd606c
parent595e03b556a8675844f868778c65f79e1b632d24 (diff)
parent192b11724ef315ebaabb3088a0daba1450fd7df0 (diff)
Merge branch 'master' of git@github.com:gallery/gallery3
-rw-r--r--lib/gallery.common.css53
-rw-r--r--modules/comment/helpers/comment_event.php27
-rw-r--r--modules/comment/views/comments.html.php2
-rw-r--r--modules/gallery/helpers/block_manager.php1
-rw-r--r--modules/gallery/helpers/gallery_event.php28
-rw-r--r--modules/gallery/tests/Database_Test.php22
-rw-r--r--modules/gallery/views/login.html.php2
-rw-r--r--modules/notification/helpers/notification_event.php7
-rw-r--r--modules/recaptcha/helpers/recaptcha_theme.php28
-rw-r--r--modules/search/views/search_link.html.php2
-rw-r--r--system/libraries/Database.php12
-rw-r--r--themes/admin_wind/css/screen.css26
-rw-r--r--themes/admin_wind/views/admin.html.php4
-rw-r--r--themes/wind/css/screen.css17
-rw-r--r--themes/wind/views/pager.html.php2
-rw-r--r--themes/wind/views/photo.html.php2
16 files changed, 187 insertions, 48 deletions
diff --git a/lib/gallery.common.css b/lib/gallery.common.css
index 4cb5735f..2cbce900 100644
--- a/lib/gallery.common.css
+++ b/lib/gallery.common.css
@@ -9,7 +9,9 @@
* 4) States and interactions
* 5) Positioning and order
* 6) Containers/widgets
+ * 7) Right to left language styles
*
+ * @todo Update .g-message-block, don't force it to 100%, bad things happen is themes when you do.
* @todo Remove extra white space at the top of the add comment form, above the first field
*/
@@ -85,6 +87,11 @@ option:focus {
color: #000;
}
+input.checkbox {
+ float: left;
+ margin-right: .4em;
+}
+
/* Form layout ~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
form li {
@@ -502,7 +509,7 @@ div#g-action-status {
.g-breadcrumbs li {
background: transparent url('images/ico-separator.gif') no-repeat scroll left center;
float: left;
- padding: 1em .6em 1em 1.4em;
+ padding: 1em 8px 1em 18px;
}
.g-breadcrumbs .g-first {
@@ -523,7 +530,7 @@ div#g-action-status {
/* Pagination ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
.g-pager {
- padding: 5px 0;
+ padding: .2em 0;
width: 100%;
}
@@ -566,17 +573,23 @@ div#g-action-status {
}
/** *******************************************************************
- * 7) Right to left styles
+ * 7) Right to left language styles
**********************************************************************/
.rtl {
direction: rtl;
}
+.rtl #g-header,
+.rtl #g-content,
+.rtl #g-sidebar,
+.rtl #g-footer,
.rtl caption,
.rtl th,
.rtl #g-dialog,
-.g-message {
+.rtl .g-context-menu li a,
+.rtl .g-message-box li,
+.rtl #g-site-status li {
text-align: right;
}
@@ -584,6 +597,14 @@ div#g-action-status {
text-align: left;
}
+.rtl .g-error,
+.rtl .g-info,
+.rtl .g-success,
+.rtl .g-warning {
+ background-position: center right;
+ padding-right: 30px !important;
+}
+
.rtl .g-left,
.rtl .g-inline li,
.rtl form ul ul li,
@@ -594,7 +615,8 @@ div#g-action-status {
.rtl .g-breadcrumbs li,
.rtl .g-pager li,
.rtl .g-buttonset li,
-.rtl .ui-icon-left .ui-icon {
+.rtl .ui-icon-left .ui-icon,
+.rtl input.checkbox {
float: right;
}
@@ -610,3 +632,24 @@ div#g-action-status {
.rtl .g-inline li.g-first {
margin-right: 0;
}
+
+.rtl .g-breadcrumbs li {
+ background-position: right center;
+ padding: 1em 18px 1em 8px;
+}
+
+.rtl .g-breadcrumbs .g-first {
+ padding-right: 0;
+}
+
+.rtl .g-pager .g-info {
+ width: 35%;
+}
+
+.rtl .g-pager .g-txt-right {
+ margin-left: 0;
+}
+
+.rtl input.checkbox {
+ margin-right: .4em;
+}
diff --git a/modules/comment/helpers/comment_event.php b/modules/comment/helpers/comment_event.php
index ddf72e3c..a72102b9 100644
--- a/modules/comment/helpers/comment_event.php
+++ b/modules/comment/helpers/comment_event.php
@@ -24,23 +24,24 @@ class comment_event_Core {
static function user_deleted($user) {
$guest = identity::guest();
- Database::instance()
- ->query("UPDATE {comments}
- SET author_id = {$guest->id},
- guest_email = NULL,
- guest_name = 'guest',
- guest_url = NULL
- WHERE author_id = {$user->id}");
+ Database::instance()->from("comments")
+ ->set(array("author_id" => $guest->id,
+ "guest_email" => null,
+ "guest_name" => "guest",
+ "guest_url" => null))
+ ->where(array("author_id" => $user->id))
+ ->update();
}
static function identity_provider_changed($old_provider, $new_provider) {
$guest = identity::guest();
- Database::instance()
- ->query("UPDATE {comments}
- SET author_id = {$guest->id},
- guest_email = NULL,
- guest_name = 'guest',
- guest_url = null");
+ Database::instance()->from("comments")
+ ->set(array("author_id" => $guest->id,
+ "guest_email" => null,
+ "guest_name" => "guest",
+ "guest_url" => null))
+ ->where("1 = 1")
+ ->update();
}
static function admin_menu($menu, $theme) {
diff --git a/modules/comment/views/comments.html.php b/modules/comment/views/comments.html.php
index 636f1522..fc54e3d2 100644
--- a/modules/comment/views/comments.html.php
+++ b/modules/comment/views/comments.html.php
@@ -1,5 +1,5 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
- <a href="<?= url::site("form/add/comments/{$item->id})") ?>" id="g-admin-comment-button"
+ <a href="<?= url::site("form/add/comments/{$item->id}") ?>" id="g-admin-comment-button"
class="g-button ui-corner-all ui-icon-left ui-state-default right">
<span class="ui-icon ui-icon-comment"></span>
<?= t("Add a comment") ?>
diff --git a/modules/gallery/helpers/block_manager.php b/modules/gallery/helpers/block_manager.php
index f26c3660..0e78661a 100644
--- a/modules/gallery/helpers/block_manager.php
+++ b/modules/gallery/helpers/block_manager.php
@@ -36,7 +36,6 @@ class block_manager_Core {
$block_class = "{$module_name}_block";
if (method_exists($block_class, "get_site_list")) {
$blocks = call_user_func(array($block_class, "get_site_list"));
- Kohana::log("error", Kohana::debug($blocks));
foreach (array_keys($blocks) as $block_id) {
self::add("site.sidebar", $module_name, $block_id);
}
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index 582e3267..67a6f41f 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -31,15 +31,35 @@ class gallery_event_Core {
static function user_deleted($user) {
$admin = identity::admin_user();
$db = Database::instance();
- $db->query("UPDATE {tasks} SET owner_id = {$admin->id} where owner_id = {$user->id}");
- $db->query("UPDATE {items} SET owner_id = {$admin->id} where owner_id = {$user->id}");
+ $db->from("tasks")
+ ->set(array("owner_id" => $admin->id))
+ ->where(array("owner_id" => $user->id))
+ ->update();
+ $db->from("items")
+ ->set(array("owner_id" => $admin->id))
+ ->where(array("owner_id" => $user->id))
+ ->update();
+ $db->from("logs")
+ ->set(array("user_id" => $admin->id))
+ ->where(array("user_id" => $user->id))
+ ->update();
}
static function identity_provider_changed($old_provider, $new_provider) {
$admin = identity::admin_user();
$db = Database::instance();
- $db->query("UPDATE {tasks} SET owner_id = {$admin->id}");
- $db->query("UPDATE {items} SET owner_id = {$admin->id}");
+ $db->from("tasks")
+ ->set(array("owner_id" => $admin->id))
+ ->where("1 = 1")
+ ->update();
+ $db->from("items")
+ ->set(array("owner_id" => $admin->id))
+ ->where("1 = 1")
+ ->update();
+ $db->from("logs")
+ ->set(array("user_id" => $admin->id))
+ ->where("1 = 1")
+ ->update();
}
static function group_created($group) {
diff --git a/modules/gallery/tests/Database_Test.php b/modules/gallery/tests/Database_Test.php
index d83212ad..ad2bbba1 100644
--- a/modules/gallery/tests/Database_Test.php
+++ b/modules/gallery/tests/Database_Test.php
@@ -99,7 +99,7 @@ class Database_Test extends Unit_Test_Case {
UNIQUE KEY(`name`))
ENGINE=InnoDB DEFAULT CHARSET=utf8";
$this->assert_same($expected, $converted);
-
+
$sql = "UPDATE {test_tables} SET `name` = '{test string}' " .
"WHERE `item_id` IN " .
" (SELECT `id` FROM {items} " .
@@ -116,12 +116,16 @@ class Database_Test extends Unit_Test_Case {
$this->assert_same($expected, $sql);
}
- public function setup() {
- }
+ function prefix_no_replacement_test() {
+ $update = Database_For_Test::instance()->from("test_tables")
+ ->where("1 = 1")
+ ->set(array("name" => "Test Name"))
+ ->update();
- public function teardown() {
- }
+ $expected = "UPDATE `g3test_test_tables` SET `name` = 'Test Name' WHERE 1 = 1";
+ $this->assert_same($expected, $update);
+ }
}
class Database_For_Test extends Database {
@@ -131,4 +135,12 @@ class Database_For_Test extends Database {
$db->config["table_prefix"] = "g3test_";
return $db;
}
+
+ public function query($sql = '') {
+ if (!empty($sql)) {
+ print " query($sql)\n";
+ $sql = $this->add_table_prefixes($sql);
+ }
+ return $sql;
+ }
}
diff --git a/modules/gallery/views/login.html.php b/modules/gallery/views/login.html.php
index a7734369..4c13ef4b 100644
--- a/modules/gallery/views/login.html.php
+++ b/modules/gallery/views/login.html.php
@@ -1,5 +1,5 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
-<ul id="g-login-menu" class="g-inline g-right">
+<ul id="g-login-menu" class="g-inline ui-helper-clearfix">
<? if ($user->guest): ?>
<li class="g-first">
<a href="<?= url::site("login/ajax") ?>"
diff --git a/modules/notification/helpers/notification_event.php b/modules/notification/helpers/notification_event.php
index b82e4f0f..6b2df574 100644
--- a/modules/notification/helpers/notification_event.php
+++ b/modules/notification/helpers/notification_event.php
@@ -53,11 +53,14 @@ class notification_event_Core {
}
static function user_deleted($user) {
- Database::instance()->query("DELETE FROM {subscriptions} where user_id = {$user->id}");
+ ORM::factory("subscriptions")
+ ->where(array("user_id", $user->id))
+ ->delete_all();
}
static function identity_provider_changed($old_provider, $new_provider) {
- Database::instance()->query("DELETE FROM {subscriptions}");
+ ORM::factory("subscriptions")
+ ->delete_all();
}
static function comment_created($comment) {
diff --git a/modules/recaptcha/helpers/recaptcha_theme.php b/modules/recaptcha/helpers/recaptcha_theme.php
new file mode 100644
index 00000000..fd1f563c
--- /dev/null
+++ b/modules/recaptcha/helpers/recaptcha_theme.php
@@ -0,0 +1,28 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2009 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 recaptcha_theme_Core {
+ static function head($theme) {
+ $theme->css("recaptcha.css");
+ }
+
+ static function admin_head($theme) {
+ $theme->css("recaptcha.css");
+ }
+} \ No newline at end of file
diff --git a/modules/search/views/search_link.html.php b/modules/search/views/search_link.html.php
index 9d1ce83b..481d0c82 100644
--- a/modules/search/views/search_link.html.php
+++ b/modules/search/views/search_link.html.php
@@ -1,5 +1,5 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
-<form action="<?= url::site("search") ?>" id="g-quick-search-form" class="g-short-form g-right">
+<form action="<?= url::site("search") ?>" id="g-quick-search-form" class="g-short-form">
<ul>
<li>
<label for="g-search"><?= t("Search the gallery") ?></label>
diff --git a/system/libraries/Database.php b/system/libraries/Database.php
index 2039371c..4cd29c58 100644
--- a/system/libraries/Database.php
+++ b/system/libraries/Database.php
@@ -1031,8 +1031,12 @@ class Database_Core {
$table = $this->from[0];
}
+ else
+ {
+ $table = $this->config['table_prefix'].$table;
+ }
- $sql = $this->driver->merge($this->config['table_prefix'].$table, array_keys($this->set), array_values($this->set));
+ $sql = $this->driver->merge($table, array_keys($this->set), array_values($this->set));
$this->reset_write();
return $this->query($sql);
@@ -1068,8 +1072,12 @@ class Database_Core {
$table = $this->from[0];
}
+ else
+ {
+ $table = $this->config['table_prefix'].$table;
+ }
- $sql = $this->driver->update($this->config['table_prefix'].$table, $this->set, $this->where);
+ $sql = $this->driver->update($table, $this->set, $this->where);
$this->reset_write();
return $this->query($sql);
diff --git a/themes/admin_wind/css/screen.css b/themes/admin_wind/css/screen.css
index fbcdf4ae..5ed42391 100644
--- a/themes/admin_wind/css/screen.css
+++ b/themes/admin_wind/css/screen.css
@@ -1,5 +1,5 @@
/**
- * Gallery 3 Default Theme Screen Styles
+ * Gallery 3 Admin Wind Theme Screen Styles
*
* @requires YUI reset, font, grids CSS
*
@@ -195,6 +195,12 @@ th {
* 3) Page layout containers
*********************************************************************/
+/* Header ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
+
+#g-header #g-login-menu {
+ margin-top: 1em;
+}
+
/* View container ~~~~~~~~~~~~~~~~~~~~~~~~ */
.g-view {
@@ -217,7 +223,7 @@ th {
#g-content {
font-size: 1.1em;
- padding-left: 20px;
+ padding: 0 2em;
width: 96%;
}
@@ -457,11 +463,6 @@ th {
* 7) Right to left styles
*********************************************************************/
-.rtl #g-admin-menu {
- left: auto;
- right: 150px;
-}
-
.rtl #g-content #g-album-grid .g-item,
.rtl #g-site-theme,
.rtl #g-admin-theme,
@@ -478,3 +479,14 @@ th {
margin-left: 1em;
margin-right: 0em;
}
+
+.rtl #g-site-admin-menu {
+ left: auto;
+ right: 150px;
+}
+
+.rtl #g-header #g-login-menu li {
+ margin-left: 0;
+ padding-left: 0;
+ padding-right: 1.2em;
+}
diff --git a/themes/admin_wind/views/admin.html.php b/themes/admin_wind/views/admin.html.php
index e554b817..25ba1c97 100644
--- a/themes/admin_wind/views/admin.html.php
+++ b/themes/admin_wind/views/admin.html.php
@@ -41,7 +41,7 @@
<div id="doc3" class="yui-t7 g-view">
<? endif; ?>
<?= $theme->site_status() ?>
- <div id="g-header">
+ <div id="g-header" class="ui-helper-clearfix">
<?= $theme->admin_header_top() ?>
<ul id="g-login-menu" class="g-inline g-right">
<li class="g-first">
@@ -57,7 +57,7 @@
</li>
<li id="g-logout-link"><a href="<?= url::site("logout?csrf=$csrf&amp;continue=" . urlencode(item::root()->url())) ?>"><?= t("Logout") ?></a></li>
</ul>
- <a id="g-logo" href="<?= item::root()->url() ?>" title="<?= t("go back to the Gallery")->for_html_attr() ?>">
+ <a id="g-logo" class="g-left" href="<?= item::root()->url() ?>" title="<?= t("go back to the Gallery")->for_html_attr() ?>">
&larr; <?= t("back to the ...") ?>
</a>
<div id="g-site-admin-menu" class="ui-helper-clearfix">
diff --git a/themes/wind/css/screen.css b/themes/wind/css/screen.css
index b73c21f0..1fc5fa65 100644
--- a/themes/wind/css/screen.css
+++ b/themes/wind/css/screen.css
@@ -1,5 +1,5 @@
/**
- * Gallery 3 Default Theme Screen Styles
+ * Gallery 3 Wind Theme Screen Styles
*
* @requires YUI reset, font, grids CSS
*
@@ -307,6 +307,7 @@ td {
#g-banner #g-login-menu {
color: #999;
+ float: right;
}
#g-banner #g-login-menu li {
@@ -412,9 +413,21 @@ td {
}
/** *******************************************************************
- * 7) Right to left styles
+ * 7) Right to left language styles
*********************************************************************/
+.rtl #g-header #g-login-menu,
+.rtl #g-header #g-quick-search-form {
+ clear: left;
+ float: left;
+}
+
+.rtl #g-header #g-login-menu li {
+ margin-left: 0;
+ padding-left: 0;
+ padding-right: 1.2em;
+}
+
.rtl #g-site-menu {
left: auto;
right: 150px;
diff --git a/themes/wind/views/pager.html.php b/themes/wind/views/pager.html.php
index ba325d03..36b2c13f 100644
--- a/themes/wind/views/pager.html.php
+++ b/themes/wind/views/pager.html.php
@@ -8,7 +8,7 @@
array("from_number" => $current_first_item,
"to_number" => $current_last_item,
"count" => $total_items)) ?>
- <li>
+ <li class="g-first">
<? if ($first_page): ?>
<a href="<?= str_replace('{page}', 1, $url) ?>" class="g-button ui-icon-left ui-state-default ui-corner-all">
<span class="ui-icon ui-icon-seek-first"></span><?= t("First") ?></a>
diff --git a/themes/wind/views/photo.html.php b/themes/wind/views/photo.html.php
index e1231f65..cee44134 100644
--- a/themes/wind/views/photo.html.php
+++ b/themes/wind/views/photo.html.php
@@ -16,7 +16,7 @@
<?= $theme->photo_top() ?>
<ul class="g-pager ui-helper-clearfix">
- <li>
+ <li class="g-first">
<? if ($previous_item): ?>
<a href="<?= $previous_item->url() ?>" class="g-button ui-icon-left ui-state-default ui-corner-all">
<span class="ui-icon ui-icon-triangle-1-w"></span><?= t("previous") ?></a>