Merge branch 'master' of git@github.com:gallery/gallery3

This commit is contained in:
jhilden
2009-06-10 00:10:18 -04:00
7 changed files with 190 additions and 78 deletions
+3 -1
View File
@@ -26,7 +26,9 @@ class Albums_Controller extends Items_Controller {
$page_size = module::get_var("gallery", "page_size", 9);
if (!access::can("view", $album)) {
if ($album->id == 1) {
print new Theme_View("login_page.html");
$view = new Theme_View("page.html", "page");
$view->content = user::get_login_form("login/auth_html");
print $view;
return;
} else {
access::forbidden();
+25
View File
@@ -0,0 +1,25 @@
<?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 Upgrader_Controller extends Controller {
public function index() {
$view = new View("upgrader.html");
print $view;
}
}
+6 -1
View File
@@ -123,7 +123,12 @@ class l10n_client_Core {
$key = $message_data->key;
$locale = $message_data->locale;
$revision = $message_data->rev;
$translation = serialize(json_decode($message_data->translation));
$translation = json_decode($message_data->translation);
if (!is_string($translation)) {
// Normalize stdclass to array
$translation = (array) $translation;
}
$translation = serialize($translation);
// @todo Should we normalize the incoming_translations table into messages(id, key, message)
// and incoming_translations(id, translation, locale, revision)? Or just allow
+20 -14
View File
@@ -27,6 +27,7 @@ class module_Core {
public static $active = array();
public static $modules = array();
public static $var_cache = null;
public static $available = array();
/**
* Set the version of the corresponding Module_Model
@@ -74,22 +75,27 @@ class module_Core {
* Return the list of available modules, including uninstalled modules.
*/
static function available() {
$modules = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS);
foreach (glob(MODPATH . "*/module.info") as $file) {
$module_name = basename(dirname($file));
$modules->$module_name = new ArrayObject(parse_ini_file($file), ArrayObject::ARRAY_AS_PROPS);
$modules->$module_name->installed = self::is_installed($module_name);
$modules->$module_name->active = self::is_active($module_name);
$modules->$module_name->version = self::get_version($module_name);
$modules->$module_name->locked = false;
if (empty(self::$available)) {
$modules = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS);
foreach (glob(MODPATH . "*/module.info") as $file) {
$module_name = basename(dirname($file));
$modules->$module_name = new ArrayObject(parse_ini_file($file), ArrayObject::ARRAY_AS_PROPS);
$m =& $modules->$module_name;
$m->installed = self::is_installed($module_name);
$m->active = self::is_active($module_name);
$m->code_version = $m->version;
$m->version = self::get_version($module_name);
$m->locked = false;
}
// Lock certain modules
$modules->gallery->locked = true;
$modules->user->locked = true;
$modules->ksort();
self::$available = $modules;
}
// Lock certain modules
$modules->gallery->locked = true;
$modules->user->locked = true;
$modules->ksort();
return $modules;
return self::$available;
}
/**
@@ -6,7 +6,7 @@
</p>
<ul id="gMessage">
<li class="gWarning">
<b><?= t("Change these values at your own risk!</b>") ?>
<b><?= t("Change these values at your own risk!") ?>
</li>
</ul>
+135
View File
@@ -0,0 +1,135 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<html>
<head>
<title><?= t("Gallery3 Upgrader") ?></title>
</head>
<style>
body {
background: #eee;
font-family: Trebuchet MS;
font-size: 1.1em;
}
div#outer {
width: 650px;
background: white;
border: 1px solid #999;
margin: 0 auto;
padding: -10px;
}
div#inner {
padding: 0 1em 0 1em;
margin: 0px;
}
div#footer {
border-top: 1px solid #ccc;
margin: 1em;
}
td.name {
text-align: left;
padding-left: 30px;
}
td {
text-align: center;
border-bottom: 1px solid #eee;
}
tr.current td {
color: #999;
font-style: italic;
}
tr.upgradeable td {
font-weight: bold;
}
table {
width: 600px;
margin-bottom: 10px;
}
p {
font-size: .9em;
}
ul {
font-size: .9em;
list-style: none;
}
li {
display: inline;
}
li:before {
content: "\00BB \0020";
}
div.button {
margin: 0 auto;
width: 120px;
text-align: center;
border: 1px solid #999;
background: #eee;
}
div.button:hover {
background: #ccc;
}
</style>
<body>
<div id="outer">
<img src="<?= url::file("modules/gallery/images/gallery.png") ?>" />
<div id="inner">
<p>
<?= t("Welcome to the Gallery upgrader. One click and you're done!") ?>
</p>
<table>
<tr>
<th> <?= t("Module name") ?> </th>
<th> <?= t("Installed version") ?> </th>
<th> <?= t("Available version") ?> </th>
</tr>
<? foreach (module::available() as $module): ?>
<? if ($module->active): ?>
<tr class="<?= $module->version == $module->code_version ? "current" : "upgradeable" ?>" >
<td class="name">
<?= $module->name ?>
</td>
<td>
<?= $module->version ?>
</td>
<td>
<?= $module->code_version ?>
</td>
</tr>
<? else: ?>
<? @$inactive++ ?>
<? endif ?>
<? endforeach ?>
</table>
<div class="button">
<a href="<?= url::site("upgrader/upgrade") ?>">
<?= t("Upgrade all") ?>
</a>
</div>
<? if (@$inactive): ?>
<p>
<?= t("The following modules are inactive and don't require an upgrade.") ?>
</p>
<ul>
<? foreach (module::available() as $module): ?>
<? if (!$module->active): ?>
<li>
<?= $module->name ?>
</li>
<? endif ?>
<? endforeach ?>
</p>
<? endif ?>
</div>
<div id="footer">
<p>
<i>
<?= t("Did something go wrong? Try the <a href=\"%faq_url\">FAQ</a> or ask in the <a href=\"%forums_url\">Gallery forums</a>.</i>",
array("faq_url" => "http://codex.gallery2.org/Gallery3:FAQ",
"forums_url" => "http://gallery.menalto.com/forum")) ?>
</i>
</p>
</div>
</div>
</body>
</html>
-61
View File
@@ -1,61 +0,0 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Tranisitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>
<?= t("Please Login to Gallery") ?>
</title>
<link rel="shortcut icon" href="<?= $theme->url("images/favicon.ico") ?>" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="<?= url::file("lib/yui/reset-fonts-grids.css") ?>"
media="screen,print,projection" />
<link rel="stylesheet" type="text/css" href="<?= url::file("lib/superfish/css/superfish.css") ?>"
media="screen" />
<link rel="stylesheet" type="text/css" href="<?= url::file("lib/themeroller/ui.base.css") ?>"
media="screen,print,projection" />
<link rel="stylesheet" type="text/css" href="<?= $theme->url("css/screen.css") ?>"
media="screen,print,projection" />
<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" href="<?= $theme->url("css/fix-ie.css") ?>"
media="screen,print,projection" />
<![endif]-->
<script src="<?= url::file("lib/jquery.js") ?>" type="text/javascript"></script>
<script src="<?= url::file("lib/jquery.form.js") ?>" type="text/javascript"></script>
<script src="<?= url::file("lib/jquery-ui.js") ?>" type="text/javascript"></script>
<script src="<?= url::file("lib/gallery.common.js") ?>" type="text/javascript"></script>
<script src="<?= url::file("lib/gallery.dialog.js") ?>" type="text/javascript"></script>
<script src="<?= url::file("lib/gallery.form.js") ?>" type="text/javascript"></script>
<script src="<?= url::file("lib/superfish/js/superfish.js") ?>" type="text/javascript"></script>
<script src="<?= $theme->url("js/jquery.scrollTo.js") ?>" type="text/javascript"></script>
<script src="<?= $theme->url("js/jquery.localscroll.js") ?>" type="text/javascript"></script>
<script src="<?= $theme->url("js/ui.init.js") ?>" type="text/javascript"></script>
<?= $theme->head() ?>
</head>
<body <?= $theme->main_element_attributes() ?>>
<?= $theme->page_top() ?>
<div id="doc4" class="yui-t5 gView">
<?= $theme->site_status() ?>
<div id="gHeader">
<?= $theme->display("header.html") ?>
</div>
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<div id="gContent" class="yui-g">
<?= $theme->messages() ?>
<?= user::get_login_form("login/auth_html") ?>
</div>
</div>
</div>
<div id="gSidebar" class="yui-b">
</div>
</div>
<div id="gFooter">
<?= $theme->display("footer.html") ?>
</div>
</div>
<?= $theme->page_bottom() ?>
</body>
</html>