summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-06-10 07:42:00 -0700
committerTim Almdal <tnalmdal@shaw.ca>2009-06-10 07:42:00 -0700
commita3c9104568704b5e626c9ac9b95921c8a67ef79a (patch)
tree23be8f92ec3119c9fbc37eea5629fa8f5c11f1d2
parent1f1cb01a967b508374ec9202815cb190bf4ea463 (diff)
parent66014819b4e7fd8a5438eb800675641f7d213e27 (diff)
Merge branch 'master' of git@github.com:gallery/gallery3
-rw-r--r--index.php59
-rw-r--r--modules/akismet/module.info2
-rw-r--r--modules/gallery/controllers/packager.php (renamed from modules/gallery/controllers/package.php)10
-rw-r--r--modules/gallery/controllers/upgrader.php39
-rw-r--r--modules/gallery/helpers/module.php2
-rw-r--r--modules/gallery/tests/xss_data.txt13
-rw-r--r--modules/gallery/views/kohana_error_page.php2
-rw-r--r--modules/gallery/views/upgrader.html.php54
-rw-r--r--modules/gallery_unit_test/controllers/gallery_unit_test.php7
-rw-r--r--modules/recaptcha/module.info2
-rw-r--r--themes/admin_default/css/screen.css4
11 files changed, 151 insertions, 43 deletions
diff --git a/index.php b/index.php
index f5b24ee7..b2170fb1 100644
--- a/index.php
+++ b/index.php
@@ -18,55 +18,64 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
// Set this to true to disable demo/debugging controllers
-define('IN_PRODUCTION', true);
+define("IN_PRODUCTION", true);
// Gallery requires PHP 5.2+
-version_compare(PHP_VERSION, '5.2.3', '<') and exit('Gallery requires PHP 5.2.3 or newer.');
+version_compare(PHP_VERSION, "5.2.3", "<") and exit("Gallery requires PHP 5.2.3 or newer.");
// Gallery requires short_tags to be on
-!ini_get('short_open_tag') and exit('Gallery requires short_open_tag to be on.');
+!ini_get("short_open_tag") and exit("Gallery requires short_open_tag to be on.");
// Set the error reporting level. Use E_ALL unless you have a special need.
error_reporting(0);
// Disabling 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', false);
+ini_set("display_errors", false);
-define('EXT', '.php');
-define('DOCROOT', strtr(getcwd() . '/', DIRECTORY_SEPARATOR, '/'));
-define('KOHANA', 'index.php');
+define("EXT", ".php");
+define("DOCROOT", getcwd() . "/");
+define("KOHANA", "index.php");
// If the front controller is a symlink, change to the real docroot
is_link(basename(__FILE__)) and chdir(dirname(realpath(__FILE__)));
// Define application and system paths
-define('APPPATH', strtr(realpath('application') . '/', DIRECTORY_SEPARATOR, '/'));
-define('MODPATH', strtr(realpath('modules') . '/', DIRECTORY_SEPARATOR, '/'));
-define('THEMEPATH', strtr(realpath('themes') . '/', DIRECTORY_SEPARATOR, '/'));
-define('SYSPATH', strtr(realpath('system') . '/', DIRECTORY_SEPARATOR, '/'));
+define("APPPATH", realpath("application") . "/");
+define("MODPATH", realpath("modules") . "/");
+define("THEMEPATH", realpath("themes") . "/");
+define("SYSPATH", realpath("system") . "/");
-// Force a test run if we're in command line mode.
-if (PHP_SAPI == 'cli') {
- if ($_SERVER['argv'][1] != "package") {
- array_splice($_SERVER['argv'], 1, 0, 'gallery_unit_test');
- define('TEST_MODE', 1);
- @mkdir('test/var/logs', 0777, true);
- define('VARPATH', strtr(realpath('test/var') . '/', DIRECTORY_SEPARATOR, '/'));
+// We only accept a few controllers on the command line
+if (PHP_SAPI == "cli") {
+ switch ($arg_1 = $_SERVER["argv"][1]) {
+ case "upgrade":
+ case "package":
+ $_SERVER["argv"] = array("index.php", "{$arg_1}r/$arg_1");
+ define("TEST_MODE", 0);
+ define("VARPATH", realpath("var") . "/");
+ break;
+
+ case "test":
+ array_splice($_SERVER["argv"], 1, 1, "gallery_unit_test");
+ define("TEST_MODE", 1);
+ @mkdir("test/var/logs", 0777, true);
+ define("VARPATH", realpath("test/var") . "/");
@copy("var/database.php", VARPATH . "database.php");
- } else {
- define('TEST_MODE', 0);
- define('VARPATH', strtr(realpath('var') . '/', DIRECTORY_SEPARATOR, '/'));
+
+ default:
+ print "Usage: php index.php { upgrade | package | test }\n";
+ exit(1);
}
} else {
- define('TEST_MODE', 0);
- define('VARPATH', strtr(realpath('var') . '/', DIRECTORY_SEPARATOR, '/'));
+ define("TEST_MODE", 0);
+ define("VARPATH", realpath("var") . "/");
}
-define('TMPPATH', VARPATH . '/tmp/');
+define("TMPPATH", VARPATH . "/tmp/");
if (file_exists("local.php")) {
include("local.php");
}
// Initialize.
-require SYSPATH . 'core/Bootstrap' . EXT;
+require SYSPATH . "core/Bootstrap" . EXT;
diff --git a/modules/akismet/module.info b/modules/akismet/module.info
index 8655927d..d45d8a7b 100644
--- a/modules/akismet/module.info
+++ b/modules/akismet/module.info
@@ -1,3 +1,3 @@
name = Akismet
-description = "Filter comments through the <a href='http://akismet.com'>Akismet web service</a> to detect and eliminate spam. You'll need a <a href='http://wordpress.com/api-keys/'>WordPress.com API</a> key to use it."
+description = "Filter comments through the Akismet web service to detect and eliminate spam (http://akismet.com). You'll need a WordPress.com API key to use it."
version = 1
diff --git a/modules/gallery/controllers/package.php b/modules/gallery/controllers/packager.php
index f5146fc8..da0a7983 100644
--- a/modules/gallery/controllers/package.php
+++ b/modules/gallery/controllers/packager.php
@@ -17,12 +17,14 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
-class Package_Controller extends Controller {
- function index() {
- if (PHP_SAPI != 'cli') {
- Kohana::show_404();
+class Packager_Controller extends Controller {
+ function package() {
+ if (PHP_SAPI != "cli") {
+ access::forbidden();
}
+ $_SERVER["HTTP_HOST"] = "example.com";
+
try {
$this->_reset(); // empty and reinstall the standard modules
$this->_dump_database(); // Dump the database
diff --git a/modules/gallery/controllers/upgrader.php b/modules/gallery/controllers/upgrader.php
index e8798de5..0833e253 100644
--- a/modules/gallery/controllers/upgrader.php
+++ b/modules/gallery/controllers/upgrader.php
@@ -19,7 +19,46 @@
*/
class Upgrader_Controller extends Controller {
public function index() {
+ // Todo: give the admin a chance to log in here
+ if (!user::active()->admin) {
+ access::forbidden();
+ }
+
$view = new View("upgrader.html");
+ $view->available = module::available();
+ $view->done = Input::instance()->get("done");
print $view;
}
+
+ public function upgrade() {
+ // Todo: give the admin a chance to log in here
+ if (php_sapi_name() == "cli") {
+ // @todo this may screw up some module installers, but we don't have a better answer at
+ // this time.
+ $_SERVER["HTTP_HOST"] = "example.com";
+ } else if (!user::active()->admin) {
+ access::forbidden();
+ }
+
+ // Upgrade gallery and user first
+ module::install("gallery");
+ module::install("user");
+
+ // Then upgrade the rest
+ foreach (module::available() as $id => $module) {
+ if ($id == "gallery") {
+ continue;
+ }
+
+ if ($module->active && $module->code_version != $module->version) {
+ module::install($id);
+ }
+ }
+
+ if (php_sapi_name() == "cli") {
+ print "Upgrade complete\n";
+ } else {
+ url::redirect("upgrader?done=1");
+ }
+ }
}
diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php
index 58f9b20d..dea8e22c 100644
--- a/modules/gallery/helpers/module.php
+++ b/modules/gallery/helpers/module.php
@@ -40,7 +40,7 @@ class module_Core {
$module->name = $module_name;
$module->active = $module_name == "gallery"; // only gallery is active by default
}
- $module->version = 1;
+ $module->version = $version;
$module->save();
Kohana::log("debug", "$module_name: version is now $version");
}
diff --git a/modules/gallery/tests/xss_data.txt b/modules/gallery/tests/xss_data.txt
index b71262df..f47ae0dc 100644
--- a/modules/gallery/tests/xss_data.txt
+++ b/modules/gallery/tests/xss_data.txt
@@ -73,7 +73,7 @@ modules/gallery/views/admin_advanced_settings.html.php 25 DIRTY $var->mod
modules/gallery/views/admin_advanced_settings.html.php 25 $var->name
modules/gallery/views/admin_advanced_settings.html.php 27 $var->name
modules/gallery/views/admin_advanced_settings.html.php 27 DIRTY $var->module_name
-modules/gallery/views/admin_advanced_settings.html.php 28 $var->value
+modules/gallery/views/admin_advanced_settings.html.php 29 $var->value
modules/gallery/views/admin_block_log_entries.html.php 4 DIRTY $entry->severity
modules/gallery/views/admin_block_log_entries.html.php 5 DIRTY $entry->user_id
modules/gallery/views/admin_block_log_entries.html.php 5 $entry->user->name
@@ -278,6 +278,14 @@ modules/gallery/views/simple_uploader.html.php 28 $parent->
modules/gallery/views/simple_uploader.html.php 30 $item->title
modules/gallery/views/simple_uploader.html.php 77 DIRTY $item->id
modules/gallery/views/simple_uploader.html.php 81 DIRTY $csrf
+modules/gallery/views/upgrader.html.php 94 DIRTY $done
+modules/gallery/views/upgrader.html.php 124 DIRTY $module->version
+modules/gallery/views/upgrader.html.php 124 DIRTY $module->code_version
+modules/gallery/views/upgrader.html.php 125 DIRTY $id
+modules/gallery/views/upgrader.html.php 126 DIRTY $module->name
+modules/gallery/views/upgrader.html.php 129 DIRTY $module->version
+modules/gallery/views/upgrader.html.php 132 DIRTY $module->code_version
+modules/gallery/views/upgrader.html.php 155 DIRTY $module->name
modules/image_block/views/image_block_block.html.php 3 DIRTY $item->url()
modules/image_block/views/image_block_block.html.php 4 DIRTY $item->thumb_img(array("class" => "gThumbnail"))
modules/info/views/info_block.html.php 6 $item->title
@@ -492,6 +500,7 @@ themes/admin_default/views/admin.html.php 20 DIRTY $theme->u
themes/admin_default/views/admin.html.php 29 DIRTY $theme->url("js/jquery.dropshadow.js")
themes/admin_default/views/admin.html.php 30 DIRTY $theme->url("js/ui.init.js")
themes/admin_default/views/admin.html.php 31 DIRTY $theme->admin_head()
+themes/admin_default/views/admin.html.php 34 DIRTY $theme->body_attributes()
themes/admin_default/views/admin.html.php 35 DIRTY $theme->admin_page_top()
themes/admin_default/views/admin.html.php 41 DIRTY $theme->site_status()
themes/admin_default/views/admin.html.php 43 DIRTY $theme->admin_header_top()
@@ -563,7 +572,6 @@ themes/default/views/header.html.php 21 DIRTY $parent->
themes/default/views/header.html.php 21 DIRTY $item->id
themes/default/views/header.html.php 22 $parent->title
themes/default/views/header.html.php 26 $item->title
-themes/default/views/login_page.html.php 10 DIRTY $theme->url("css/screen.css")
themes/default/views/movie.html.php 4 DIRTY $theme->photo_top()
themes/default/views/movie.html.php 7 DIRTY $position
themes/default/views/movie.html.php 7 DIRTY $sibling_count
@@ -590,6 +598,7 @@ themes/default/views/page.html.php 51 DIRTY $theme->u
themes/default/views/page.html.php 52 DIRTY $theme->url("js/jquery.localscroll.js")
themes/default/views/page.html.php 53 DIRTY $theme->url("js/ui.init.js")
themes/default/views/page.html.php 54 DIRTY $theme->head()
+themes/default/views/page.html.php 57 DIRTY $theme->body_attributes()
themes/default/views/page.html.php 58 DIRTY $theme->page_top()
themes/default/views/page.html.php 60 DIRTY $theme->site_status()
themes/default/views/page.html.php 62 DIRTY $theme->display("header.html")
diff --git a/modules/gallery/views/kohana_error_page.php b/modules/gallery/views/kohana_error_page.php
index d9bf9698..6bf48549 100644
--- a/modules/gallery/views/kohana_error_page.php
+++ b/modules/gallery/views/kohana_error_page.php
@@ -59,7 +59,7 @@
</head>
<body>
<? try { $user = user::active(); } catch (Exception $e) { } ?>
- <? $admin = isset($user) && $user->admin ?>
+ <? $admin = php_sapi_name() == "cli" || isset($user) && $user->admin ?>
<div class="big_box" id="framework_error">
<h1>
<?= t("Dang... Something went wrong!") ?>
diff --git a/modules/gallery/views/upgrader.html.php b/modules/gallery/views/upgrader.html.php
index ecf2e265..6b9a0110 100644
--- a/modules/gallery/views/upgrader.html.php
+++ b/modules/gallery/views/upgrader.html.php
@@ -36,9 +36,15 @@
color: #999;
font-style: italic;
}
+ tr.current td.gallery {
+ color: #00d;
+ }
tr.upgradeable td {
font-weight: bold;
}
+ tr.upgradeable td.gallery {
+ color: #00d;
+ }
table {
width: 600px;
margin-bottom: 10px;
@@ -63,28 +69,60 @@
border: 1px solid #999;
background: #eee;
}
+ div.button a {
+ text-decoration: none;
+ }
div.button:hover {
background: #ccc;
}
+ div#confirmation {
+ position: fixed;
+ top: 400px;
+ left: 325px;
+ background: blue;
+ z-index: 1000;
+ margin: 10px;
+ text-align: center;
+ }
+ div#confirmation div {
+ margin: 2px;
+ padding: 20px;
+ border: 2px solid #999;
+ background: white;
+ }
+ .gray_on_done {
+ opacity: <?= $done ? "0.5" : "1" ?>;
+ }
</style>
<body>
<div id="outer">
<img src="<?= url::file("modules/gallery/images/gallery.png") ?>" />
<div id="inner">
- <p>
+ <? if ($done): ?>
+ <div id="confirmation">
+ <div>
+ <h1> <?= t("That's it!") ?> </h1>
+ <p>
+ <?= t("Your <a href=\"%url\">Gallery</a> is up to date.",
+ array("url" => url::site("albums/1"))) ?>
+ </p>
+ </div>
+ </div>
+ <? endif ?>
+ <p class="gray_on_done">
<?= t("Welcome to the Gallery upgrader. One click and you're done!") ?>
</p>
<table>
- <tr>
+ <tr class="gray_on_done">
<th> <?= t("Module name") ?> </th>
<th> <?= t("Installed version") ?> </th>
<th> <?= t("Available version") ?> </th>
</tr>
- <? foreach (module::available() as $module): ?>
+ <? foreach ($available as $id => $module): ?>
<? if ($module->active): ?>
<tr class="<?= $module->version == $module->code_version ? "current" : "upgradeable" ?>" >
- <td class="name">
+ <td class="name <?= $id ?>">
<?= $module->name ?>
</td>
<td>
@@ -100,18 +138,18 @@
<? endforeach ?>
</table>
- <div class="button">
+ <div class="button gray_on_done">
<a href="<?= url::site("upgrader/upgrade") ?>">
<?= t("Upgrade all") ?>
</a>
</div>
<? if (@$inactive): ?>
- <p>
+ <p class="gray_on_done">
<?= t("The following modules are inactive and don't require an upgrade.") ?>
</p>
- <ul>
- <? foreach (module::available() as $module): ?>
+ <ul class="gray_on_done">
+ <? foreach ($available as $module): ?>
<? if (!$module->active): ?>
<li>
<?= $module->name ?>
diff --git a/modules/gallery_unit_test/controllers/gallery_unit_test.php b/modules/gallery_unit_test/controllers/gallery_unit_test.php
index 56220a19..8f3353dc 100644
--- a/modules/gallery_unit_test/controllers/gallery_unit_test.php
+++ b/modules/gallery_unit_test/controllers/gallery_unit_test.php
@@ -23,6 +23,13 @@ class Gallery_Unit_Test_Controller extends Controller {
print Kohana::show_404();
}
+ // Jump through some hoops to satisfy the way that we check for the site_domain in
+ // config.php. We structure this such that the code in config will leave us with a
+ // site_domain of "." (for historical reasons)
+ // @todo: for tests, we should force the site_domain to something like example.com
+ $_SERVER["SCRIPT_FILENAME"] = "index.php";
+ $_SERVER["SCRIPT_NAME"] = "./index.php";
+
$original_config = DOCROOT . "var/database.php";
$test_config = VARPATH . "database.php";
if (!file_exists($original_config)) {
diff --git a/modules/recaptcha/module.info b/modules/recaptcha/module.info
index 85397580..f2cc50cf 100644
--- a/modules/recaptcha/module.info
+++ b/modules/recaptcha/module.info
@@ -1,3 +1,3 @@
name = Recaptcha
-description = "<a href='http://recaptcha.net'>Recaptcha</a> displays a graphical verification that protects the input form from abuse from 'bots,' or automated programs usually written to generate spam."
+description = "Recaptcha displays a graphical verification that protects the input form from abuse from 'bots,' or automated programs usually written to generate spam (http://recaptcha.net)."
version = 1
diff --git a/themes/admin_default/css/screen.css b/themes/admin_default/css/screen.css
index 82f85f21..de4d2413 100644
--- a/themes/admin_default/css/screen.css
+++ b/themes/admin_default/css/screen.css
@@ -432,3 +432,7 @@ li.gDefaultGroup h4, li.gDefaultGroup .gUser {
cursor: pointer;
}
+#gLanguageSettingsForm .checklist li {
+ width: 150px;
+ overflow: hidden;
+}