some backup work (part 1)

parent 0c962ab0
......@@ -8,7 +8,7 @@
*/
define('IN_ACP3', true);
define('ACP3_ROOT', realpath(__DIR__) . '/');
require ACP3_ROOT . 'includes/bootstrap.php';
define('ACP3_ROOT_DIR', realpath(__DIR__) . '/');
require ACP3_ROOT_DIR . 'ACP3/CMS.php';
ACP3_CMS::run();
\ No newline at end of file
\ACP3\CMS::run();
\ No newline at end of file
......@@ -14,21 +14,21 @@ function CheckAuthentication($acp3_path) {
$current_cwd = getcwd();
define('IN_ACP3', true);
if (!defined('ACP3_ROOT'))
define('ACP3_ROOT', $acp3_path);
if (!defined('ACP3_ROOT_DIR'))
define('ACP3_ROOT_DIR', $acp3_path);
require_once ACP3_ROOT . 'includes/bootstrap.php';
require_once ACP3_ROOT_DIR . 'ACP3/CMS.php';
ACP3_CMS::defineDirConstants();
ACP3_CMS::includeAutoLoader();
ACP3_CMS::initializeDoctrineDBAL();
ACP3_CMS::initializeClasses();
\ACP3\CMS::defineDirConstants();
\ACP3\CMS::startupChecks();
\ACP3\CMS::includeAutoLoader();
\ACP3\CMS::initializeClasses();
// Simulate being in the drupal root folder so we can share the session
chdir(ACP3_ROOT);
chdir(ACP3_ROOT_DIR);
// if user has access permission...
if (ACP3_CMS::$auth->isUser()) {
if (\ACP3\CMS::$injector['Auth']->isUser()) {
if (!isset($_SESSION['KCFINDER'])) {
$_SESSION['KCFINDER'] = array();
$_SESSION['KCFINDER']['disabled'] = false;
......
<IfModule mod_rewrite.c>
RewriteEngine on
# You may need RewriteBase on some servers
#RewriteBase /min
# rewrite URLs like "/min/f=..." to "/min/?f=..."
RewriteRule ^([bfg]=.*) index.php?$1 [L,NE]
</IfModule>
<IfModule mod_env.c>
# In case AddOutputFilterByType has been added
SetEnv no-gzip
</IfModule>
<?php
/**
* Configuration for "min", the default application built with the Minify
* library
*
* @package Minify
*/
/**
* Allow use of the Minify URI Builder app. Only set this to true while you need it.
*/
$min_enableBuilder = false;
/**
* If non-empty, the Builder will be protected with HTTP Digest auth.
* The username is "admin".
*/
$min_builderPassword = 'admin';
/**
* Set to true to log messages to FirePHP (Firefox Firebug addon).
* Set to false for no error logging (Minify may be slightly faster).
* @link http://www.firephp.org/
*
* If you want to use a custom error logger, set this to your logger
* instance. Your object should have a method log(string $message).
*/
$min_errorLogger = false;
/**
* To allow debug mode output, you must set this option to true.
*
* Once true, you can send the cookie minDebug to request debug mode output. The
* cookie value should match the URIs you'd like to debug. E.g. to debug
* /min/f=file1.js send the cookie minDebug=file1.js
* You can manually enable debugging by appending "&debug" to a URI.
* E.g. /min/?f=script1.js,script2.js&debug
*
* In 'debug' mode, Minify combines files with no minification and adds comments
* to indicate line #s of the original files.
*/
$min_allowDebugFlag = false;
/**
* For best performance, specify your temp directory here. Otherwise Minify
* will have to load extra code to guess. Some examples below:
*/
//$min_cachePath = 'c:\\WINDOWS\\Temp';
//$min_cachePath = '/tmp';
//$min_cachePath = preg_replace('/^\\d+;/', '', session_save_path());
/**
* To use APC/Memcache/ZendPlatform for cache storage, require the class and
* set $min_cachePath to an instance. Example below:
*/
//require dirname(__FILE__) . '/lib/Minify/Cache/APC.php';
//$min_cachePath = new Minify_Cache_APC();
$min_cachePath = realpath(__DIR__ . '/../../uploads/cache/minify');
/**
* Leave an empty string to use PHP's $_SERVER['DOCUMENT_ROOT'].
*
* On some servers, this value may be misconfigured or missing. If so, set this
* to your full document root path with no trailing slash.
* E.g. '/home/accountname/public_html' or 'c:\\xampp\\htdocs'
*
* If /min/ is directly inside your document root, just uncomment the
* second line. The third line might work on some Apache servers.
*/
$min_documentRoot = '';
//$min_documentRoot = substr(__FILE__, 0, -15);
//$min_documentRoot = $_SERVER['SUBDOMAIN_DOCUMENT_ROOT'];
/**
* Cache file locking. Set to false if filesystem is NFS. On at least one
* NFS system flock-ing attempts stalled PHP for 30 seconds!
*/
$min_cacheFileLocking = true;
/**
* Combining multiple CSS files can place @import declarations after rules, which
* is invalid. Minify will attempt to detect when this happens and place a
* warning comment at the top of the CSS output. To resolve this you can either
* move the @imports within your CSS files, or enable this option, which will
* move all @imports to the top of the output. Note that moving @imports could
* affect CSS values (which is why this option is disabled by default).
*/
$min_serveOptions['bubbleCssImports'] = false;
/**
* Cache-Control: max-age value sent to browser (in seconds). After this period,
* the browser will send another conditional GET. Use a longer period for lower
* traffic but you may want to shorten this before making changes if it's crucial
* those changes are seen immediately.
*
* Note: Despite this setting, if you include a number at the end of the
* querystring, maxAge will be set to one year. E.g. /min/f=hello.css&123456
*/
$min_serveOptions['maxAge'] = 1800;
/**
* To use Google's Closure Compiler API to minify Javascript (falling back to JSMin
* on failure), uncomment the following line:
*/
//$min_serveOptions['minifiers']['application/x-javascript'] = array('Minify_JS_ClosureCompiler', 'minify');
/**
* If you'd like to restrict the "f" option to files within/below
* particular directories below DOCUMENT_ROOT, set this here.
* You will still need to include the directory in the
* f or b GET parameters.
*
* // = shortcut for DOCUMENT_ROOT
*/
//$min_serveOptions['minApp']['allowDirs'] = array('//js', '//css');
/**
* Set to true to disable the "f" GET parameter for specifying files.
* Only the "g" parameter will be considered.
*/
$min_serveOptions['minApp']['groupsOnly'] = true;
/**
* By default, Minify will not minify files with names containing .min or -min
* before the extension. E.g. myFile.min.js will not be processed by JSMin
*
* To minify all files, set this option to null. You could also specify your
* own pattern that is matched against the filename.
*/
//$min_serveOptions['minApp']['noMinPattern'] = '@[-\\.]min\\.(?:js|css)$@i';
/**
* If you minify CSS files stored in symlink-ed directories, the URI rewriting
* algorithm can fail. To prevent this, provide an array of link paths to
* target paths, where the link paths are within the document root.
*
* Because paths need to be normalized for this to work, use "//" to substitute
* the doc root in the link paths (the array keys). E.g.:
* <code>
* array('//symlink' => '/real/target/path') // unix
* array('//static' => 'D:\\staticStorage') // Windows
* </code>
*/
$min_symlinks = array();
/**
* If you upload files from Windows to a non-Windows server, Windows may report
* incorrect mtimes for the files. This may cause Minify to keep serving stale
* cache files when source file changes are made too frequently (e.g. more than
* once an hour).
*
* Immediately after modifying and uploading a file, use the touch command to
* update the mtime on the server. If the mtime jumps ahead by a number of hours,
* set this variable to that number. If the mtime moves back, this should not be
* needed.
*
* In the Windows SFTP client WinSCP, there's an option that may fix this
* issue without changing the variable below. Under login > environment,
* select the option "Adjust remote timestamp with DST".
* @link http://winscp.net/eng/docs/ui_login_environment#daylight_saving_time
*/
$min_uploaderHoursBehind = 0;
/**
* Path to Minify's lib folder. If you happen to move it, change
* this accordingly.
*/
$min_libPath = dirname(__FILE__) . '/lib';
// try to disable output_compression (may not have an effect)
ini_set('zlib.output_compression', '0');
<?php
/**
* Groups configuration for default Minify implementation
* @package Minify
*/
/**
* You may wish to use the Minify URI Builder app to suggest
* changes. http://yourdomain/min/builder/
*
* See http://code.google.com/p/minify/wiki/CustomSource for other ideas
**/
define('IN_ACP3', true);
define('ACP3_ROOT_DIR', realpath(__DIR__ . '/../../') . '/');
require_once ACP3_ROOT_DIR . 'ACP3/CMS.php';
\ACP3\CMS::defineDirConstants();
\ACP3\CMS::startupChecks();
\ACP3\CMS::includeAutoLoader();
\ACP3\CMS::initializeClasses();
// Cache-Lebenszeit setzen
$min_serveOptions['maxAge'] = CONFIG_CACHE_MINIFY;
$libraries = !empty($_GET['libraries']) ? explode(',', $_GET['libraries']) : array();
$layout = isset($_GET['layout']) && !preg_match('=/=', $_GET['layout']) ? $_GET['layout'] : 'layout';
if ($_GET['g'] === 'css') {
$design_info = \ACP3\Core\XML::parseXmlFile(DESIGN_PATH_INTERNAL . 'info.xml', '/design/responsive_layouts');
$styles = array();
$styles['css'][] = LIBRARIES_DIR . 'bootstrap/css/bootstrap.css';
// Styles für das Responsive Design nur einbinden,
// falls dies vom Design benötigt wird
if (isset($design_info['layout']) &&
($design_info['layout'] === $layout || (is_array($design_info['layout']) === true && in_array($layout, $design_info['layout']) === true)))
$styles['css'][] = LIBRARIES_DIR . 'bootstrap/css/bootstrap-responsive.css';
// Stylesheets der Bibliotheken zuerst laden,
// damit deren Styles überschrieben werden können
if (in_array('jquery-ui', $libraries))
$styles['css'][] = LIBRARIES_DIR . 'js/jquery-ui.css';
if (in_array('timepicker', $libraries))
$styles['css'][] = LIBRARIES_DIR . 'js/jquery-timepicker.css';
if (in_array('fancybox', $libraries))
$styles['css'][] = LIBRARIES_DIR . 'js/jquery-fancybox.css';
if (in_array('datatables', $libraries))
$styles['css'][] = LIBRARIES_DIR . 'js/jquery-datatables.css';
// Stylesheet für das Layout-Tenplate
$styles['css'][] = DESIGN_PATH_INTERNAL . 'common.css';
$styles['css'][] = DESIGN_PATH_INTERNAL . (is_file(DESIGN_PATH_INTERNAL . $layout . '.css') === true ? $layout : 'layout') . '.css';
// Zusätzliche Stylesheets einbinden
$extra_css = explode(',', CONFIG_EXTRA_CSS);
if (count($extra_css) > 0) {
foreach ($extra_css as $file) {
$path = DESIGN_PATH_INTERNAL . 'css/' . trim($file);
if (is_file($path) && in_array($path, $styles['css'])) {
$styles['css'][] = $path;
}
}
}
// Stylesheets der Module
$modules = \ACP3\Core\Modules::getActiveModules();
foreach ($modules as $module) {
$path_design = DESIGN_PATH_INTERNAL . $module['dir'] . '/style.css';
$path_module = MODULES_DIR . $module['dir'] . '/templates/style.css';
if (is_file($path_design) === true) {
$styles['css'][] = $path_design;
} elseif (is_file($path_module) === true) {
$styles['css'][] = $path_module;
}
}
return $styles;
} elseif ($_GET['g'] === 'js') {
$scripts = array();
$scripts['js'][] = LIBRARIES_DIR . 'js/jquery.min.js';
$scripts['js'][] = LIBRARIES_DIR . 'bootstrap/js/bootstrap.min.js';
if (in_array('bootbox', $libraries))
$scripts['js'][] = LIBRARIES_DIR . 'js/bootbox.min.js';
if (in_array('jquery-ui', $libraries))
$scripts['js'][] = LIBRARIES_DIR . 'js/jquery-ui.min.js';
if (in_array('timepicker', $libraries))
$scripts['js'][] = LIBRARIES_DIR . 'js/jquery.timepicker.js';
if (in_array('fancybox', $libraries))
$scripts['js'][] = LIBRARIES_DIR . 'js/jquery.fancybox.min.js';
if (in_array('datatables', $libraries))
$scripts['js'][] = LIBRARIES_DIR . 'js/jquery.datatables.min.js';
if (is_file(DESIGN_PATH_INTERNAL . $layout . '.js') === true)
$scripts['js'][] = DESIGN_PATH_INTERNAL . $layout . '.js';
// Zusätzliche JavaScript Dateien einbinden
$extra_js = explode(',', CONFIG_EXTRA_JS);
if (count($extra_js) > 0) {
foreach ($extra_js as $file) {
$path = DESIGN_PATH_INTERNAL . 'js/' . trim($file);
if (is_file($path) && in_array($path, $styles['js'])) {
$styles['js'][] = $path;
}
}
}
return $scripts;
}
\ No newline at end of file
<?php
/**
* Front controller for default Minify implementation
*
* DO NOT EDIT! Configure this utility via config.php and groupsConfig.php
*
* @package Minify
*/
define('MINIFY_MIN_DIR', dirname(__FILE__));
// load config
require MINIFY_MIN_DIR . '/config.php';
if (isset($_GET['test'])) {
include MINIFY_MIN_DIR . '/config-test.php';
}
require "$min_libPath/Minify/Loader.php";
Minify_Loader::register();
Minify::$uploaderHoursBehind = $min_uploaderHoursBehind;
Minify::setCache(
isset($min_cachePath) ? $min_cachePath : ''
,$min_cacheFileLocking
);
if ($min_documentRoot) {
$_SERVER['DOCUMENT_ROOT'] = $min_documentRoot;
Minify::$isDocRootSet = true;
}
$min_serveOptions['minifierOptions']['text/css']['symlinks'] = $min_symlinks;
// auto-add targets to allowDirs
foreach ($min_symlinks as $uri => $target) {
$min_serveOptions['minApp']['allowDirs'][] = $target;
}
if ($min_allowDebugFlag) {
$min_serveOptions['debug'] = Minify_DebugDetector::shouldDebugRequest($_COOKIE, $_GET, $_SERVER['REQUEST_URI']);
}
if ($min_errorLogger) {
if (true === $min_errorLogger) {
$min_errorLogger = FirePHP::getInstance(true);
}
Minify_Logger::setLogger($min_errorLogger);
}
// check for URI versioning
if (preg_match('/&\\d/', $_SERVER['QUERY_STRING'])) {
$min_serveOptions['maxAge'] = 31536000;
}
if (isset($_GET['g'])) {
// well need groups config
$min_serveOptions['minApp']['groups'] = (require MINIFY_MIN_DIR . '/groupsConfig.php');
}
if (isset($_GET['f']) || isset($_GET['g'])) {
// serve!
if (! isset($min_serveController)) {
$min_serveController = new Minify_Controller_MinApp();
}
Minify::serve($min_serveController, $min_serveOptions);
} elseif ($min_enableBuilder) {
header('Location: builder/');
exit();
} else {
header("Location: /");
exit();
}
\ No newline at end of file
This diff is collapsed.
<?php
/**
* DooDigestAuth class file.
*
* @author Leng Sheng Hong <darkredz@gmail.com>
* @link http://www.doophp.com/
* @copyright Copyright &copy; 2009 Leng Sheng Hong
* @license http://www.doophp.com/license
*/
/**
* Handles HTTP digest authentication
*
* <p>HTTP digest authentication can be used with the URI router.
* HTTP digest is much more recommended over the use of HTTP Basic auth which doesn't provide any encryption.
* If you are running PHP on Apache in CGI/FastCGI mode, you would need to
* add the following line to your .htaccess for digest auth to work correctly.</p>
* <code>RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]</code>
*
* <p>This class is tested under Apache 2.2 and Cherokee web server. It should work in both mod_php and cgi mode.</p>
*
* @author Leng Sheng Hong <darkredz@gmail.com>
* @version $Id: DooDigestAuth.php 1000 2009-07-7 18:27:22
* @package doo.auth
* @since 1.0
*/
class DooDigestAuth{
/**
* Authenticate against a list of username and passwords.
*
* <p>HTTP Digest Authentication doesn't work with PHP in CGI mode,
* you have to add this into your .htaccess <code>RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]</code></p>
*
* @param string $realm Name of the authentication session
* @param array $users An assoc array of username and password: array('uname1'=>'pwd1', 'uname2'=>'pwd2')
* @param string $fail_msg Message to be displayed if the User cancel the login
* @param string $fail_url URL to be redirect if the User cancel the login
* @return string The username if login success.
*/
public static function http_auth($realm, $users, $fail_msg=NULL, $fail_url=NULL){
$realm = "Restricted area - $realm";
//user => password
//$users = array('admin' => '1234', 'guest' => 'guest');
if(!empty($_SERVER['REDIRECT_HTTP_AUTHORIZATION']) && strpos($_SERVER['REDIRECT_HTTP_AUTHORIZATION'], 'Digest')===0){
$_SERVER['PHP_AUTH_DIGEST'] = $_SERVER['REDIRECT_HTTP_AUTHORIZATION'];
}
if (empty($_SERVER['PHP_AUTH_DIGEST'])) {
header('WWW-Authenticate: Digest realm="'.$realm.
'",qop="auth",nonce="'.uniqid().'",opaque="'.md5($realm).'"');
header('HTTP/1.1 401 Unauthorized');
if($fail_msg!=NULL)
die($fail_msg);
if($fail_url!=NULL)
die("<script>window.location.href = '$fail_url'</script>");
exit;
}
// analyze the PHP_AUTH_DIGEST variable
if (!($data = self::http_digest_parse($_SERVER['PHP_AUTH_DIGEST'])) || !isset($users[$data['username']])){
header('WWW-Authenticate: Digest realm="'.$realm.
'",qop="auth",nonce="'.uniqid().'",opaque="'.md5($realm).'"');
header('HTTP/1.1 401 Unauthorized');
if($fail_msg!=NULL)
die($fail_msg);
if($fail_url!=NULL)
die("<script>window.location.href = '$fail_url'</script>");
exit;
}
// generate the valid response
$A1 = md5($data['username'] . ':' . $realm . ':' . $users[$data['username']]);
$A2 = md5($_SERVER['REQUEST_METHOD'].':'.$data['uri']);
$valid_response = md5($A1.':'.$data['nonce'].':'.$data['nc'].':'.$data['cnonce'].':'.$data['qop'].':'.$A2);
if ($data['response'] != $valid_response){
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Digest realm="'.$realm.
'",qop="auth",nonce="'.uniqid().'",opaque="'.md5($realm).'"');
if($fail_msg!=NULL)
die($fail_msg);
if($fail_url!=NULL)
die("<script>window.location.href = '$fail_url'</script>");
exit;
}
// ok, valid username & password
return $data['username'];
}
/**
* Method to parse the http auth header, works with IE.
*
* Internet Explorer returns a qop="xxxxxxxxxxx" in the header instead of qop=xxxxxxxxxxx as most browsers do.
*
* @param string $txt header string to parse
* @return array An assoc array of the digest auth session
*/
private static function http_digest_parse($txt)
{
$res = preg_match("/username=\"([^\"]+)\"/i", $txt, $match);
$data['username'] = (isset($match[1]))?$match[1]:null;
$res = preg_match('/nonce=\"([^\"]+)\"/i', $txt, $match);
$data['nonce'] = $match[1];
$res = preg_match('/nc=([0-9]+)/i', $txt, $match);
$data['nc'] = $match[1];
$res = preg_match('/cnonce=\"([^\"]+)\"/i', $txt, $match);
$data['cnonce'] = $match[1];
$res = preg_match('/qop=([^,]+)/i', $txt, $match);
$data['qop'] = str_replace('"','',$match[1]);
$res = preg_match('/uri=\"([^\"]+)\"/i', $txt, $match);
$data['uri'] = $match[1];
$res = preg_match('/response=\"([^\"]+)\"/i', $txt, $match);
$data['response'] = $match[1];
return $data;
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<?php
/**
* Class Minify_Build
* @package Minify
*/
/**
* Maintain a single last modification time for a group of Minify sources to
* allow use of far off Expires headers in Minify.
*
* <code>
* // in config file
* $groupSources = array(
* 'js' => array('file1.js', 'file2.js')
* ,'css' => array('file1.css', 'file2.css', 'file3.css')
* )
*
* // during HTML generation
* $jsBuild = new Minify_Build($groupSources['js']);
* $cssBuild = new Minify_Build($groupSources['css']);
*
* $script = "<script type='text/javascript' src='"
* . $jsBuild->uri('/min.php/js') . "'></script>";
* $link = "<link rel='stylesheet' type='text/css' href='"
* . $cssBuild->uri('/min.php/css') . "'>";
*
* // in min.php
* Minify::serve('Groups', array(
* 'groups' => $groupSources
* ,'setExpires' => (time() + 86400 * 365)
* ));
* </code>
*
* @package Minify
* @author Stephen Clay <steve@mrclay.org>
*/
class Minify_Build {
/**
* Last modification time of all files in the build
*
* @var int
*/
public $lastModified = 0;
/**
* String to use as ampersand in uri(). Set this to '&' if
* you are not HTML-escaping URIs.
*
* @var string
*/
public static $ampersand = '&amp;';
/**
* Get a time-stamped URI
*
* <code>
* echo $b->uri('/site.js');
* // outputs "/site.js?1678242"
*
* echo $b->uri('/scriptaculous.js?load=effects');
* // outputs "/scriptaculous.js?load=effects&amp1678242"
* </code>
*
* @param string $uri
* @param boolean $forceAmpersand (default = false) Force the use of ampersand to
* append the timestamp to the URI.
* @return string
*/
public function uri($uri, $forceAmpersand = false) {
$sep = ($forceAmpersand || strpos($uri, '?') !== false)
? self::$ampersand
: '?';
return "{$uri}{$sep}{$this->lastModified}";
}
/**
* Create a build object
*
* @param array $sources array of Minify_Source objects and/or file paths
*
* @return null
*/
public function __construct($sources)
{
$max = 0;
foreach ((array)$sources as $source) {
if ($source instanceof Minify_Source) {
$max = max($max, $source->lastModified);
} elseif (is_string($source)) {
if (0 === strpos($source, '//')) {
$source = $_SERVER['DOCUMENT_ROOT'] . substr($source, 1);
}
if (is_file($source)) {
$max = max($max, filemtime($source));
}
}
}
$this->lastModified = $max;
}
}
<?php
/**
* Class Minify_CSS
* @package Minify
*/
/**
* Minify CSS
*
* This class uses Minify_CSS_Compressor and Minify_CSS_UriRewriter to
* minify CSS and rewrite relative URIs.
*
* @package Minify
* @author Stephen Clay <steve@mrclay.org>
* @author http://code.google.com/u/1stvamp/ (Issue 64 patch)
*/
class Minify_CSS {
/**
* Minify a CSS string
*
* @param string $css
*
* @param array $options available options:
*
* 'preserveComments': (default true) multi-line comments that begin
* with "/*!" will be preserved with newlines before and after to
* enhance readability.
*
* 'removeCharsets': (default true) remove all @charset at-rules
*
* 'prependRelativePath': (default null) if given, this string will be
* prepended to all relative URIs in import/url declarations
*
* 'currentDir': (default null) if given, this is assumed to be the
* directory of the current CSS file. Using this, minify will rewrite
* all relative URIs in import/url declarations to correctly point to
* the desired files. For this to work, the files *must* exist and be
* visible by the PHP process.
*
* 'symlinks': (default = array()) If the CSS file is stored in
* a symlink-ed directory, provide an array of link paths to
* target paths, where the link paths are within the document root. Because
* paths need to be normalized for this to work, use "//" to substitute
* the doc root in the link paths (the array keys). E.g.:
* <code>
* array('//symlink' => '/real/target/path') // unix
* array('//static' => 'D:\\staticStorage') // Windows
* </code>
*
* 'docRoot': (default = $_SERVER['DOCUMENT_ROOT'])
* see Minify_CSS_UriRewriter::rewrite
*