Commit bda08664 authored by root's avatar root Committed by lechuck
Browse files

updated constructor to 1.5.10

parent c932a52e
......@@ -10,11 +10,6 @@ if (CONSTRUCTOR_DEBUG || isset($_REQUEST['debug'])) {
require_once CONSTRUCTOR_DIRECTORY .'/libs/debug.php';
}
// PHP4 compatibility
if (version_compare(phpversion(), '5.0.0', '<')) {
require_once CONSTRUCTOR_DIRECTORY .'/admin/compatibility.php';
}
// init modules for admin pages
// you can disable any
$constructor_modules = array(
......@@ -38,6 +33,55 @@ $constructor_modules = array(
require_once CONSTRUCTOR_DIRECTORY .'/libs/Constructor/Admin.php';
/**
* Replace scandir()
*
* @category PHP
* @package PHP_Compat
* @link http://php.net/function.scandir
* @author Aidan Lister <aidan@php.net>
* @version $Revision: 1.18 $
* @since PHP 5
* @require PHP 4.0.0 (user_error)
*/
if (!function_exists('scandir')) {
function scandir($directory, $sorting_order = 0)
{
if (!is_string($directory)) {
user_error('scandir() expects parameter 1 to be string, ' .
gettype($directory) . ' given', E_USER_WARNING);
return;
}
if (!is_int($sorting_order) && !is_bool($sorting_order)) {
user_error('scandir() expects parameter 2 to be long, ' .
gettype($sorting_order) . ' given', E_USER_WARNING);
return;
}
if (!is_dir($directory) || (false === $fh = @opendir($directory))) {
user_error('scandir() failed to open dir: Invalid argument', E_USER_WARNING);
return false;
}
$files = array ();
while (false !== ($filename = readdir($fh))) {
$files[] = $filename;
}
closedir($fh);
if ($sorting_order == 1) {
rsort($files);
} else {
sort($files);
}
return $files;
}
}
$admin = new Constructor_Admin();
$admin -> init($constructor_modules);
<?php
/**
* @package WordPress
* @subpackage Constructor
*/
require_once 'compatibility/json_encode.php';
require_once 'compatibility/scandir.php';
require_once 'compatibility/file_put_contents.php';
require_once 'compatibility/file_get_contents.php';
?>
\ No newline at end of file
<?php
// $Id: file_get_contents.php,v 1.24 2007/04/17 10:09:56 arpad Exp $
define('PHP_COMPAT_FILE_GET_CONTENTS_MAX_REDIRECTS', 5);
/**
* Replace file_get_contents()
*
* @category PHP
* @package PHP_Compat
* @license LGPL - http://www.gnu.org/licenses/lgpl.html
* @copyright 2004-2007 Aidan Lister <aidan@php.net>, Arpad Ray <arpad@php.net>
* @link http://php.net/function.file_get_contents
* @author Aidan Lister <aidan@php.net>
* @author Arpad Ray <arpad@php.net>
* @version $Revision: 1.24 $
* @internal resource_context is only supported for PHP 4.3.0+ (stream_context_get_options)
* @since PHP 5
* @require PHP 4.0.0 (user_error)
*/
function php_compat_file_get_contents($filename, $incpath = false, $resource_context = null)
{
if (is_resource($resource_context) && function_exists('stream_context_get_options')) {
$opts = stream_context_get_options($resource_context);
}
$colon_pos = strpos($filename, '://');
$wrapper = $colon_pos === false ? 'file' : substr($filename, 0, $colon_pos);
$opts = (empty($opts) || empty($opts[$wrapper])) ? array() : $opts[$wrapper];
switch ($wrapper) {
case 'http':
$max_redirects = (isset($opts[$wrapper]['max_redirects'])
? $opts[$proto]['max_redirects']
: PHP_COMPAT_FILE_GET_CONTENTS_MAX_REDIRECTS);
for ($i = 0; $i < $max_redirects; $i++) {
$contents = php_compat_http_get_contents_helper($filename, $opts);
if (is_array($contents)) {
// redirected
$filename = rtrim($contents[1]);
$contents = '';
continue;
}
return $contents;
}
user_error('redirect limit exceeded', E_USER_WARNING);
return;
case 'ftp':
case 'https':
case 'ftps':
case 'socket':
// tbc
}
if (false === $fh = fopen($filename, 'rb', $incpath)) {
user_error('failed to open stream: No such file or directory',
E_USER_WARNING);
return false;
}
clearstatcache();
if ($fsize = @filesize($filename)) {
$data = fread($fh, $fsize);
} else {
$data = '';
while (!feof($fh)) {
$data .= fread($fh, 8192);
}
}
fclose($fh);
return $data;
}
/**
* Performs HTTP requests
*
* @param string $filename
* the full path to request
* @param array $opts
* an array of stream context options
* @return mixed
* either the contents of the requested path (as a string),
* or an array where $array[1] is the path redirected to.
*/
function php_compat_http_get_contents_helper($filename, $opts)
{
$path = parse_url($filename);
if (!isset($path['host'])) {
return '';
}
$fp = fsockopen($path['host'], 80, $errno, $errstr, 4);
if (!$fp) {
return '';
}
if (!isset($path['path'])) {
$path['path'] = '/';
}
$headers = array(
'Host' => $path['host'],
'Conection' => 'close'
);
// enforce some options (proxy isn't supported)
$opts_defaults = array(
'method' => 'GET',
'header' => null,
'user_agent' => ini_get('user_agent'),
'content' => null,
'request_fulluri' => false
);
foreach ($opts_defaults as $key => $value) {
if (!isset($opts[$key])) {
$opts[$key] = $value;
}
}
$opts['path'] = $opts['request_fulluri'] ? $filename : $path['path'];
// build request
$request = $opts['method'] . ' ' . $opts['path'] . " HTTP/1.0\r\n";
// build headers
if (isset($opts['header'])) {
$optheaders = explode("\r\n", $opts['header']);
for ($i = count($optheaders); $i--;) {
$sep_pos = strpos($optheaders[$i], ': ');
$headers[substr($optheaders[$i], 0, $sep_pos)] = substr($optheaders[$i], $sep_pos + 2);
}
}
foreach ($headers as $key => $value) {
$request .= "$key: $value\r\n";
}
$request .= "\r\n" . $opts['content'];
// make request
fputs($fp, $request);
$response = '';
while (!feof($fp)) {
$response .= fgets($fp, 8192);
}
fclose($fp);
$content_pos = strpos($response, "\r\n\r\n");
// recurse for redirects
if (preg_match('/^Location: (.*)$/mi', $response, $matches)) {
return $matches;
}
return ($content_pos != -1 ? substr($response, $content_pos + 4) : $response);
}
function php_compat_ftp_get_contents_helper($filename, $opts)
{
}
if (!function_exists('file_get_contents')) {
function file_get_contents($filename, $incpath = false, $resource_context = null)
{
return php_compat_file_get_contents($filename, $incpath, $resource_context);
}
}
?>
\ No newline at end of file
<?php
// $Id: file_put_contents.php,v 1.27 2007/04/17 10:09:56 arpad Exp $
if (!defined('FILE_USE_INCLUDE_PATH')) {
define('FILE_USE_INCLUDE_PATH', 1);
}
if (!defined('LOCK_EX')) {
define('LOCK_EX', 2);
}
if (!defined('FILE_APPEND')) {
define('FILE_APPEND', 8);
}
/**
* Replace file_put_contents()
*
* @category PHP
* @package PHP_Compat
* @license LGPL - http://www.gnu.org/licenses/lgpl.html
* @copyright 2004-2007 Aidan Lister <aidan@php.net>, Arpad Ray <arpad@php.net>
* @link http://php.net/function.file_put_contents
* @author Aidan Lister <aidan@php.net>
* @version $Revision: 1.27 $
* @internal resource_context is not supported
* @since PHP 5
* @require PHP 4.0.0 (user_error)
*/
function php_compat_file_put_contents($filename, $content, $flags = null, $resource_context = null)
{
// If $content is an array, convert it to a string
if (is_array($content)) {
$content = implode('', $content);
}
// If we don't have a string, throw an error
if (!is_scalar($content)) {
user_error('file_put_contents() The 2nd parameter should be either a string or an array',
E_USER_WARNING);
return false;
}
// Get the length of data to write
$length = strlen($content);
// Check what mode we are using
$mode = ($flags & FILE_APPEND) ?
'a' :
'wb';
// Check if we're using the include path
$use_inc_path = ($flags & FILE_USE_INCLUDE_PATH) ?
true :
false;
// Open the file for writing
if (($fh = @fopen($filename, $mode, $use_inc_path)) === false) {
user_error('file_put_contents() failed to open stream: Permission denied',
E_USER_WARNING);
return false;
}
// Attempt to get an exclusive lock
$use_lock = ($flags & LOCK_EX) ? true : false ;
if ($use_lock === true) {
if (!flock($fh, LOCK_EX)) {
return false;
}
}
// Write to the file
$bytes = 0;
if (($bytes = @fwrite($fh, $content)) === false) {
$errormsg = sprintf('file_put_contents() Failed to write %d bytes to %s',
$length,
$filename);
user_error($errormsg, E_USER_WARNING);
return false;
}
// Close the handle
@fclose($fh);
// Check all the data was written
if ($bytes != $length) {
$errormsg = sprintf('file_put_contents() Only %d of %d bytes written, possibly out of free disk space.',
$bytes,
$length);
user_error($errormsg, E_USER_WARNING);
return false;
}
// Return length
return $bytes;
}
// Define
if (!function_exists('file_put_contents')) {
function file_put_contents($filename, $content, $flags = null, $resource_context = null)
{
return php_compat_file_put_contents($filename, $content, $flags, $resource_context);
}
}
<?php
if (!function_exists('json_encode'))
{
function json_encode($a=false)
{
if (is_null($a)) return 'null';
if ($a === false) return 'false';
if ($a === true) return 'true';
if (is_scalar($a)) {
if (is_float($a)) {
// Always use "." for floats.
return floatval(str_replace(",", ".", strval($a)));
}
if (is_string($a)) {
static $jsonReplaces = array(array("\\", "/", "\n", "\t", "\r", "\b", "\f", '"'), array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\"'));
return '"' . str_replace($jsonReplaces[0], $jsonReplaces[1], $a) . '"';
} else {
return $a;
}
}
$isList = true;
for ($i = 0, reset($a); $i < count($a); $i++, next($a)) {
if (key($a) !== $i) {
$isList = false;
break;
}
}
$result = array();
if ($isList) {
foreach ($a as $v) $result[] = json_encode($v);
return '[' . join(',', $result) . ']';
} else {
foreach ($a as $k => $v) $result[] = json_encode($k).':'.json_encode($v);
return '{' . join(',', $result) . '}';
}
}
}
?>
\ No newline at end of file
<?php
// +----------------------------------------------------------------------+
// | PHP Version 4 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2004 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 3.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/3_0.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Aidan Lister <aidan@php.net> |
// +----------------------------------------------------------------------+
//
// $Id: scandir.php,v 1.18 2005/01/26 04:55:13 aidan Exp $
/**
* Replace scandir()
*
* @category PHP
* @package PHP_Compat
* @link http://php.net/function.scandir
* @author Aidan Lister <aidan@php.net>
* @version $Revision: 1.18 $
* @since PHP 5
* @require PHP 4.0.0 (user_error)
*/
if (!function_exists('scandir')) {
function scandir($directory, $sorting_order = 0)
{
if (!is_string($directory)) {
user_error('scandir() expects parameter 1 to be string, ' .
gettype($directory) . ' given', E_USER_WARNING);
return;
}
if (!is_int($sorting_order) && !is_bool($sorting_order)) {
user_error('scandir() expects parameter 2 to be long, ' .
gettype($sorting_order) . ' given', E_USER_WARNING);
return;
}
if (!is_dir($directory) || (false === $fh = @opendir($directory))) {
user_error('scandir() failed to open dir: Invalid argument', E_USER_WARNING);
return false;
}
$files = array ();
while (false !== ($filename = readdir($fh))) {
$files[] = $filename;
}
closedir($fh);
if ($sorting_order == 1) {
rsort($files);
} else {
sort($files);
}
return $files;
}
}
?>
\ No newline at end of file
......@@ -27,7 +27,8 @@
height: 28px;
background: url(../images/select2.png) center;
}
.constructor .select {
.constructor .select,
.constructor .checkbox {
overflow:hidden;
}
.constructor .select a, .constructor .select span {
......@@ -45,14 +46,30 @@
-moz-box-shadow: 2px 2px 4px #aaa;
-webkit-box-shadow: 2px 2px 4px #aaa
}
.constructor .checkbox a {
width:48px;
height:48px;
float:left;
display:block;
margin:0 8px 8px 0;
border:2px solid #ccc;
border-radius: 6px;
-moz-border-radius: 6px;
-khtml-border-radius: 6px;
-webkit-border-radius: 6px;
box-shadow: 2px 2px 4px #aaa;
-moz-box-shadow: 2px 2px 4px #aaa;
-webkit-box-shadow: 2px 2px 4px #aaa
}
.constructor .select span {
background-color:#ccc;
}
.constructor .select a.selected {
.constructor .select a.selected,
.constructor .checkbox a.checked {
border:2px solid #21759B
}
.constructor .select a:hover {
.constructor .select a:hover,
.constructor .checkbox a:hover {
border:2px solid #D54E21
}
.constructor .position a, .constructor .position span{
......@@ -78,6 +95,34 @@
background-position:100% 100%;
}
.social a {
background:url('../../images/social.png') no-repeat 0 0 ;
display:block;
float:right;
width:48px;
height:48px;
text-indent:-9999%;
}
.social a.twitter { background-position: 0 0; }
.social a.twitter:hover { background-position: 0 100%; }
.social a.facebook { background-position: -48px 0; }
.social a.facebook:hover { background-position: -48px 100%; }
.social a.delicious { background-position: -96px 0; }
.social a.delicious:hover { background-position: -96px 100%; }
.social a.reddit { background-position: -144px 0; }
.social a.reddit:hover { background-position: -144px 100%; }
.social a.vkontakte { background-position: -192px 0; }
.social a.vkontakte:hover { background-position: -192px 100%; }
.social a.digg { background-position: -240px 0; }
.social a.digg:hover { background-position: -240px 100%; }
.social a.mixx { background-position: -288px 0; }
.social a.mixx:hover { background-position: -288px 100%; }
.social a.stumbleupon { background-position: -336px 0; }
.social a.stumbleupon:hover { background-position: -336px 100%; }
.social a.google { background-position: -384px 0; }
.social a.google:hover { background-position: -384px 100%; }
.social a.memori { background-position: -432px 0; }
.social a.memori:hover { background-position: -432px 100%; }
.constructor #slideshow a{
width:auto !important;
......
.colorpicker {
width: 356px;
height: 176px;
overflow: hidden;
position: absolute;
background: url(../images/background.png);
font-family: Arial, Helvetica, sans-serif;
display: none;
}
.colorpicker_color {
width: 150px;
height: 150px;
left: 14px;
top: 13px;
position: absolute;
background: #f00;
overflow: hidden;
cursor: crosshair;
}
.colorpicker_color div {
position: absolute;
top: 0;
left: 0;
width: 150px;
height: 150px;
background: url(../images/overlay.png);
}
.colorpicker_color div div {
position: absolute;
top: 0;
left: 0;
width: 11px;
height: 11px;
overflow: hidden;
background: url(../images/select.gif);
margin: -5px 0 0 -5px;
}
.colorpicker_hue {
position: absolute;
top: 13px;
left: 171px;