<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2012 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 g2_import_Core {
public static $init = false;
public static $map = array();
public static $g2_base_url = null;
private static $current_g2_item = null;
private static $error_reporting = null;
static function is_configured() {
return module::get_var("g2_import", "embed_path");
}
static function is_initialized() {
return g2_import::$init == "ok";
}
static function init() {
if (g2_import::$init) {
return;
}
$embed_path = module::get_var("g2_import", "embed_path");
if (empty($embed_path)) {
throw new Exception("@todo G2_IMPORT_NOT_CONFIGURED");
}
g2_import::$init = g2_import::init_embed($embed_path);
}
static function is_valid_embed_path($embed_path) {
$mod_path = VARPATH . "modules/g2_import/" . md5($embed_path);
if (file_exists($mod_path)) {
dir::unlink($mod_path);
}
return g2_import::init_embed($embed_path);
}
/**
* Initialize the embedded Gallery 2 instance. Call this before any other Gallery 2 calls.
*
* Return values:
* "ok" - the Gallery 2 install is fine
* "missing" - the embed path does not exist
* "invalid" - the install path is not a valid Gallery 2 code base
* "broken" - the embed path is correct, but the Gallery 2 install is broken
*/
static function init_embed($embed_path) {
if (!is_file($embed_path)) {
return "missing";
}
try {
// Gallery 2 defines a class called Gallery. So does Gallery 3. They don't get along. So do
// a total hack here and copy over a few critical files (embed.php, main.php, bootstrap.inc
// and Gallery.class) and munge them so that we can rename the Gallery class to be
// G2_Gallery. Is this retarded? Why yes it is.
//
// Store the munged files in a directory that's the md5 hash of the embed path so that
// multiple import sources don't interfere with each other.
$mod_path = VARPATH . "modules/g2_import/" . md5($embed_path);
if (!file_exists($mod_path) || !file_exists("$mod_path/embed.php")) {
@dir::unlink($mod_path);
mkdir($mod_path);
$config_dir = dirname($embed_path);
if (filesize($embed_path) > 200) {
// Regular install
$base_dir = $config_dir;
} else {
// Multisite install. Line 2 of embed.php will be something like:
// require('/usr/home/bharat/public_html/gallery2/embed.php');
$lines = file($embed_path);
preg_match("#require\('(.*)/embed.php'\);#", $lines[2], $matches);
$base_dir = $matches[1];
}
file_put_contents(
"$mod_path/embed.php",
str_replace(
array(
"require_once(dirname(__FILE__) . '/modules/core/classes/GalleryDataCache.class');",
"require(dirname(__FILE__) . '/modules/core/classes/GalleryEmbed.class');"),
array(
"require_once('$base_dir/modules/core/classes/GalleryDataCache.class');",
"require('$base_dir/modules/core/classes/GalleryEmbed.class');"),
array_merge(
array("<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>\n"),
file("$base_dir/embed.php"))));
file_put_contents(
"$mod_path/main.php",
str_replace(
array(
"include(dirname(__FILE__) . '/bootstrap.inc');",
"require_once(dirname(__FILE__) . '/init.inc');"),
array(
"include(dirname(__FILE__) . '/bootstrap.inc');",
"require_once('$base_dir/init.inc');"),
array_merge(
array("<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>\n"),
file("$base_dir/main.php"))));
file_put_contents(
"$mod_path/bootstrap.inc",
str_replace(
array(
"require_once(dirname(__FILE__) . '/modules/core/classes/Gallery.class');",
"require_once(dirname(__FILE__) . '/modules/core/classes/GalleryDataCache.class');",
"define('GALLERY_CONFIG_DIR', dirname(__FILE__));",
"\$gallery =& new Gallery();",
"\$GLOBALS['gallery'] =& new Gallery();",
"\$gallery = new Gallery();"),
array(
"require_once(dirname(__FILE__) . '/Gallery.class');",
"require_once('$base_dir/modules/core/classes/GalleryDataCache.class');",
"define('GALLERY_CONFIG_DIR', '$config_dir');",
"\$gallery =& new G2_Gallery();",
"\$GLOBALS['gallery'] =& new G2_Gallery();",
"\$gallery = new G2_Gallery();"),
array_merge(
array("<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>\n"),
file("$base_dir/bootstrap.inc"))));
file_put_contents(
"$mod_path/Gallery.class",
str_replace(
array("class Gallery",
"function Gallery"),
array("class G2_Gallery",
"function G2_Gallery"),
array_merge(
array("<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>\n"),
file("$base_dir/modules/core/classes/Gallery.class"))));
} else {
// Ok, this is a good one. If you're running a bytecode accelerator and you move your
// Gallery install, these files sometimes get cached with the wrong path and then fail to
// load properly.
// Documented in https://sourceforge.net/apps/trac/gallery/ticket/1253
touch("$mod_path/embed.php");
touch("$mod_path/main.php");
touch("$mod_path/bootstrap.inc");
touch("$mod_path/Gallery.class.inc");
}
require("$mod_path/embed.php");
if (!class_exists("GalleryEmbed")) {
return "invalid";
}
$ret = GalleryEmbed::init();
if ($ret) {
Kohana_Log::add("error", "Gallery 2 call failed with: " . $ret->getAsText());
return "broken";
}
$admin_group_id = g2(GalleryCoreApi::getPluginParameter("module", "core", "id.adminGroup"));
$admins = g2(GalleryCoreApi::fetchUsersForGroup($admin_group_id, 1));
$admin_id = current(array_flip($admins));
$admin = g2(GalleryCoreApi::loadEntitiesById($admin_id));
$GLOBALS["gallery"]->setActiveUser($admin);
// Make sure we have an embed location so that embedded url generation comes out ok. Without
// this, the Gallery2 ModRewrite code won't try to do url generation.
$g2_embed_location =
g2(GalleryCoreApi::getPluginParameter("module", "rewrite", "modrewrite.embeddedLocation"));
if (empty($g2_embed_location)) {
$g2_embed_location =
g2(GalleryCoreApi::getPluginParameter("module", "rewrite", "modrewrite.galleryLocation"));
g2(GalleryCoreApi::setPluginParameter("module", "rewrite", "modrewrite.embeddedLocation",
$g2_embed_location));
g2($gallery->getStorage()->checkPoint());
}
if ($g2_embed_location) {
self::$g2_base_url = $g2_embed_location;
}
没有合适的资源?快使用搜索试试~ 我知道了~
Menalto gallery v3.04 多国语言版.zip
共727个文件
php:505个
png:79个
css:42个
需积分: 0 1 下载量 23 浏览量
2019-07-08
02:12:30
上传
评论
收藏 1.77MB ZIP 举报
温馨提示
Gallery是一款用PHP开发的基于WEB的相片管理系统,Gallery 非常易于使用,包括一个配置向导,对于相片的操作包括自动生成缩略图、相片的大小改变、选择、排序等。 Gallery v3.0.4是一个安全维护版本,建议及时更新。
资源推荐
资源详情
资源评论
收起资源包目录
Menalto gallery v3.04 多国语言版.zip (727个子文件)
ext-all.css 136KB
ux-all.css 17KB
ui.theme.css 17KB
ui.theme.css 17KB
screen.css 16KB
screen.css 16KB
screen-rtl.css 8KB
screen-rtl.css 7KB
reset-fonts-grids.css 6KB
l10n_client.css 4KB
ui.datepicker.css 4KB
ui.datepicker.css 4KB
superfish.css 3KB
gallery.css 3KB
organize_frame.css 2KB
upgrader.css 2KB
uploadify.css 2KB
user.css 2KB
tag.css 1KB
ui.core.css 1KB
ui.core.css 1KB
install.css 1KB
ui.dialog.css 1KB
ui.dialog.css 1KB
table.css 1KB
ui.resizable.css 993B
ui.resizable.css 993B
base-min.css 911B
jquery.autocomplete.css 827B
fix-ie.css 774B
comment.css 626B
ui.tabs.css 590B
ui.tabs.css 590B
server_add.css 528B
debug.css 473B
organize_dialog.css 335B
fix-ie.css 241B
ui.base.css 182B
ui.base.css 182B
ui.progressbar.css 169B
ui.progressbar.css 169B
recaptcha.css 125B
uploadify.fla 123KB
loading-large.gif 8KB
loading-large.gif 8KB
tool-sprites.gif 4KB
btn.gif 4KB
trigger.gif 2KB
broken-image.gif 2KB
bg.gif 1KB
drop-yes.gif 1016B
drop-add.gif 1001B
delete.gif 989B
folder-open.gif 956B
folder.gif 952B
drop-no.gif 949B
drop-over.gif 911B
drop-between.gif 907B
bg.gif 904B
white-top-bottom.gif 872B
tb-blue.gif 851B
progress-bg.gif 834B
text-bg.gif 819B
invalid_line.gif 815B
loading.gif 771B
loading.gif 771B
loading-small.gif 673B
loading-small.gif 673B
arrows.gif 617B
ico-separator.gif 106B
ico-separator-rtl.gif 106B
ico-separator.gif 106B
ico-separator-rtl.gif 106B
s.gif 43B
.htaccess 3KB
说明.htm 4KB
KohanaLicense.html 2KB
favicon.ico 1KB
module.info 438B
theme.info 416B
module.info 403B
theme.info 380B
module.info 346B
module.info 340B
module.info 334B
module.info 321B
module.info 314B
module.info 310B
module.info 306B
module.info 305B
module.info 302B
module.info 301B
module.info 297B
module.info 296B
module.info 290B
module.info 286B
module.info 284B
module.info 283B
module.info 263B
php.ini 467B
共 727 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
weixin_39841856
- 粉丝: 487
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功