Initial Commit
23
.htaccess
Normal file
@@ -0,0 +1,23 @@
|
||||
Options -Indexes
|
||||
|
||||
# Created by http://htaccess.xnet.tk/
|
||||
# Wed, 20 June 2012
|
||||
<IfModule mod_rewrite.c>
|
||||
|
||||
# Enable Rewrite Engine
|
||||
RewriteEngine On
|
||||
RewriteBase /
|
||||
|
||||
# Redirect Domains (Permanent)
|
||||
RewriteCond %{HTTP_HOST} ^htaccessbuilder\.co\.uk$ [OR]
|
||||
RewriteCond %{HTTP_HOST} ^www\.htaccessbuilder\.co\.uk$ [OR]
|
||||
RewriteCond %{HTTP_HOST} ^www\.htaccessbuilder\.com$
|
||||
RewriteRule ^(.*)$ http\://htaccessbuilder\.com/$1 [R=301,L]
|
||||
|
||||
RewriteRule ^rules/([\w]+)/?$ recall.php?id=$1
|
||||
|
||||
RewriteCond %{HTTP_HOST} ^dev\.htaccessbuilder\.com$
|
||||
RewriteCond %{REMOTE_ADDR} !=109.224.133.59
|
||||
RewriteRule .* - [F]
|
||||
|
||||
</IfModule>
|
||||
155
Classes/HtRule/Form.php
Normal file
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
|
||||
class HtRule_Form
|
||||
{
|
||||
private $rule;
|
||||
private $index;
|
||||
|
||||
public function __construct(HtRule $rule)
|
||||
{
|
||||
$this->rule = $rule;
|
||||
$rules = new HtRule_List();
|
||||
$this->index = array_search($rule, $rules->GetRules());
|
||||
}
|
||||
|
||||
function Validate($values, &$error)
|
||||
{
|
||||
$params = $this->rule->GetParams();
|
||||
foreach($params as $p)
|
||||
{
|
||||
/* @var $p HtRule_Param */
|
||||
$name = $p->Name();
|
||||
$value = get_request($name);
|
||||
if ($value === False && $p->Type() != HtRule_Param::TYPE_BOOLEAN)
|
||||
{
|
||||
$error = "Missing value for ".$p->Title();
|
||||
return False;
|
||||
}
|
||||
switch($p->Type())
|
||||
{
|
||||
case HtRule_Param::TYPE_STRING:
|
||||
|
||||
break;
|
||||
case HtRule_Param::TYPE_TEXT:
|
||||
|
||||
break;
|
||||
case HtRule_Param::TYPE_INT:
|
||||
if (!preg_match('/-?[0-9]+/', $value))
|
||||
{
|
||||
$error = "Invalid integer for ".$p->Title();
|
||||
return False;
|
||||
}
|
||||
break;
|
||||
case HtRule_Param::TYPE_DECIMAL:
|
||||
if (!is_numeric($value))
|
||||
{
|
||||
$error = "Invalid number for ".$p->Title();
|
||||
return False;
|
||||
}
|
||||
break;
|
||||
}//Switch
|
||||
}//For each
|
||||
return True;
|
||||
}
|
||||
function Save($values)
|
||||
{
|
||||
$params = $this->rule->GetParams();
|
||||
foreach($params as $p)
|
||||
{
|
||||
/* @var $p HtRule_Param */
|
||||
$name = $p->Name();
|
||||
$value = get_request($name);
|
||||
|
||||
if ($p->Type() == HtRule_Param::TYPE_BOOLEAN)
|
||||
$p->Value(False);
|
||||
|
||||
if ($value === False)
|
||||
continue;
|
||||
|
||||
if ($p->Type() == HtRule_Param::TYPE_BOOLEAN &&
|
||||
$value == 'yes')
|
||||
$p->Value(True);
|
||||
else
|
||||
$p->Value($value);
|
||||
}
|
||||
}
|
||||
|
||||
function ShowForm()
|
||||
{
|
||||
$params = $this->rule->GetParams();
|
||||
|
||||
$formName = 'form_'.get_class($this->rule);
|
||||
echo '<h3>Edit "'.$this->rule->GetName().'"</h3>';
|
||||
echo '<div id="rule-edit-form"><form name="'.$formName.'" id="'.$formName.'" method="POST" class="ajaxForm" onsubmit="return rules.completeRuleEdit()">';
|
||||
echo '<input type="hidden" name="id" value="'.$this->index.'"/>';
|
||||
foreach($params as $p)
|
||||
{
|
||||
/* @var $p HtRule_Param */
|
||||
$id = 'field-'.$p->Name();
|
||||
$name = $p->Name();
|
||||
$class = '';
|
||||
if ($p->IsMulti())
|
||||
{
|
||||
$class .= ' multi';
|
||||
$name .= '[]';
|
||||
}
|
||||
$value = $p->Value();
|
||||
|
||||
if ($p->Help() != "")
|
||||
$help = 'class="tooltip" title="'.$p->Help().'"';
|
||||
else
|
||||
$help = '';
|
||||
|
||||
switch($p->Type())
|
||||
{
|
||||
case HtRule_Param::TYPE_STRING:
|
||||
$class .= ' type-string';
|
||||
if ($p->IsMulti())
|
||||
{
|
||||
echo '<div class="multi">';
|
||||
foreach($p->Value() as $value)
|
||||
{
|
||||
echo "<label $help>".$p->Title().'</label>';
|
||||
echo '<input type="text" name="'.$name.'" class="'.$id.' '.$class.'" value="'.$value.'"/>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<label '.$help.' for="'.$id.'">'.$p->Title().'</label>';
|
||||
echo '<input type="text" name="'.$name.'" id="'.$id.'" class="'.$class.'" value="'.$value.'"/>';
|
||||
}
|
||||
break;
|
||||
case HtRule_Param::TYPE_TEXT:
|
||||
$class .= ' type-text';
|
||||
echo '<label '.$help.' for="'.$id.'">'.$p->Title().'</label><textarea name="'.$name.'" id="'.$id.'" class="'.$class.'" rows="5">'.$value.'</textarea>';
|
||||
break;
|
||||
case HtRule_Param::TYPE_DUALTEXT:
|
||||
$class .= ' type-dualtext';
|
||||
echo '<label '.$help.' for="'.$id.'-0">'.$p->Title().'</label>'.
|
||||
'<div style="clear:both;"></div>'.
|
||||
'<textarea name="'.$name.'" id="'.$id.'-0" class="'.$class.'" wrap="off">'.((isset($value[0])) ? $value[0] : '').'</textarea>'.
|
||||
'<textarea name="'.$name.'" id="'.$id.'-1" class="'.$class.'"wrap="off">'.((isset($value[1])) ? $value[1] : '').'</textarea>';
|
||||
break;
|
||||
case HtRule_Param::TYPE_INT:
|
||||
$class .= ' type-int';
|
||||
echo '<label '.$help.' for="'.$id.'">'.$p->Title().'</label><input type="text" name="'.$name.'" id="'.$id.'" class="'.$class.'" value="'.$value.'"/>';
|
||||
break;
|
||||
case HtRule_Param::TYPE_DECIMAL:
|
||||
$class .= ' type-decimal';
|
||||
echo '<label '.$help.' for="'.$id.'">'.$p->Title().'</label><input type="text" name="'.$name.'" id="'.$id.'" class="'.$class.'" value="'.$value.'"/>';
|
||||
break;
|
||||
case HtRule_Param::TYPE_BOOLEAN:
|
||||
$class .= ' type-checkbox';
|
||||
$checked = '';
|
||||
if ($value == True)
|
||||
$checked = ' checked="checked"';
|
||||
echo '<label '.$help.' for="'.$id.'">'.$p->Title().'</label><input type="checkbox" name="'.$name.'" id="'.$id.'" class="'.$class.'" value="yes"'.$checked.'/>';
|
||||
break;
|
||||
}//Switch
|
||||
}//Foreach param
|
||||
echo '<label> </label><input type="submit" class="button" value="Save" id="button-save"/><input type="button" class="button" value="Cancel" onclick="javascript:rules.cancelRuleEdit();" id="button-cancel"/>';
|
||||
echo '</form></div>';
|
||||
echo '<div style="clear:both;"></div>';
|
||||
}//ShowForm
|
||||
}
|
||||
47
Classes/HtRule/HtRule.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
abstract class HtRule
|
||||
{
|
||||
protected $params = array();
|
||||
|
||||
static function GetName()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function GetParams()
|
||||
{
|
||||
return $this->params;
|
||||
}
|
||||
|
||||
function AddParam(HtRule_Param $param)
|
||||
{
|
||||
$this->params[$param->Name()] = $param;
|
||||
}
|
||||
|
||||
function ParamValues()
|
||||
{
|
||||
$values = array();
|
||||
foreach($this->params as $param)
|
||||
{
|
||||
/* @var $param HtRule_Param */
|
||||
$values[$param->Name()] = $param->Value();
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
|
||||
function RequireRewriteEngine()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
function __toString()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
188
Classes/HtRule/List.php
Normal file
@@ -0,0 +1,188 @@
|
||||
<?php
|
||||
|
||||
class HtRule_List
|
||||
{
|
||||
public static function ListRules()
|
||||
{
|
||||
$files = glob('Classes/HtRule/Rule/*.php');
|
||||
$classes = array();
|
||||
foreach($files as $file)
|
||||
{
|
||||
$class = 'HtRule_Rule_'.basename($file,'.php');
|
||||
include_once($file);
|
||||
if (class_exists($class) && is_subclass_of($class, 'HtRule'))
|
||||
{
|
||||
$name = call_user_func(array($class,'GetName'));
|
||||
if ($name)
|
||||
{
|
||||
$classes[$class] = $name;
|
||||
}
|
||||
}
|
||||
}
|
||||
asort($classes);
|
||||
return $classes;
|
||||
}
|
||||
|
||||
private $rules = array();
|
||||
private $id = false;
|
||||
private $changed = false;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->Load();
|
||||
}
|
||||
public function __destruct()
|
||||
{
|
||||
$this->Save();
|
||||
}
|
||||
|
||||
public function Load()
|
||||
{
|
||||
if (!isset($_SESSION['HtRules']['rules']))
|
||||
{
|
||||
$this->AddRule(new HtRule_Rule_EnableRewrite());
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->rules = $_SESSION['HtRules']['rules'];
|
||||
if (!is_array($this->rules))
|
||||
$this->rules = array();
|
||||
}
|
||||
if (isset($_SESSION['HtRules']['id']))
|
||||
$this->id = $_SESSION['HtRules']['id'];
|
||||
}
|
||||
public function Save()
|
||||
{
|
||||
if ($this->changed)
|
||||
{
|
||||
$this->id = false;
|
||||
}
|
||||
$_SESSION['HtRules']['rules'] = $this->rules;
|
||||
$_SESSION['HtRules']['id'] = $this->id;
|
||||
}
|
||||
public function MarkChanged()
|
||||
{
|
||||
$this->changed = true;
|
||||
}
|
||||
|
||||
public function SetID($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
public function GetID()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
public function SaveToFile()
|
||||
{
|
||||
$this->id = uniqid();
|
||||
|
||||
$ds = DIRECTORY_SEPARATOR;
|
||||
$dir = BASE_PATH.$ds.'Saved'.$ds;
|
||||
$dir .= substr($this->id, 0,2).$ds;
|
||||
$dir .= substr($this->id, 2,2).$ds;
|
||||
|
||||
if (!is_dir($dir))
|
||||
mkdir($dir, 0755, True);
|
||||
|
||||
file_put_contents($dir.$this->id.'.txt', serialize($this));
|
||||
}
|
||||
|
||||
public function AddRule(HtRule $rule, $position=False)
|
||||
{
|
||||
if (count($this->rules) > 250)
|
||||
return;
|
||||
if ($position !== False)
|
||||
{
|
||||
array_splice($this->rules, $position, 0, array($rule));
|
||||
}
|
||||
else
|
||||
$this->rules[] = $rule;
|
||||
|
||||
$this->MarkChanged();
|
||||
|
||||
return array_search($rule, $this->rules);
|
||||
}
|
||||
public function DeleteRule(HtRule $rule)
|
||||
{
|
||||
array_splice($this->rules, array_search($rule, $this->rules), 1);
|
||||
$this->MarkChanged();
|
||||
}
|
||||
public function GetRules()
|
||||
{
|
||||
return $this->rules;
|
||||
}
|
||||
public function GetAtIndex($index)
|
||||
{
|
||||
if (isset($this->rules[$index]))
|
||||
return $this->rules[$index];
|
||||
return False;
|
||||
}
|
||||
public function ClearRules()
|
||||
{
|
||||
$this->rules = array();
|
||||
$this->MarkChanged();
|
||||
}
|
||||
|
||||
public function UpdateOrder(array $newOrder)
|
||||
{
|
||||
$newRules = array();
|
||||
|
||||
foreach($newOrder as $index)
|
||||
{
|
||||
$rule = $this->GetAtIndex($index);
|
||||
if ($rule)
|
||||
$newRules[] = $rule;
|
||||
}
|
||||
|
||||
$this->rules = $newRules;
|
||||
$this->MarkChanged();
|
||||
}
|
||||
|
||||
public function GetHeaderText()
|
||||
{
|
||||
$str = '# Created by '.System::Config()->BasePath."\n";
|
||||
if ($this->GetID())
|
||||
$str .= '# Edit at '.System::Config()->BasePath.'rules/'.$this->GetID()."/\n";
|
||||
$str.= "# ". date('D, jS F Y');
|
||||
foreach($this->rules as $rule)
|
||||
{
|
||||
/* @var $rule HtRule */
|
||||
if ($rule->RequireRewriteEngine())
|
||||
{
|
||||
$str .= "\n<IfModule mod_rewrite.c>";
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
public function GetFooterText()
|
||||
{
|
||||
$str = '';
|
||||
foreach($this->rules as $rule)
|
||||
{
|
||||
/* @var $rule HtRule */
|
||||
if ($rule->RequireRewriteEngine())
|
||||
{
|
||||
$str .= "</IfModule>";
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
$str = $this->GetHeaderText()."\n\n";
|
||||
foreach($this->rules as $rule)
|
||||
{
|
||||
/* @var $rule HtRule */
|
||||
$str .= strval($rule);
|
||||
$str .= "\n\n";
|
||||
}
|
||||
|
||||
$str .= $this->GetFooterText();
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
60
Classes/HtRule/Param.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
class HtRule_Param
|
||||
{
|
||||
const TYPE_STRING = 1;
|
||||
const TYPE_TEXT = 2;
|
||||
const TYPE_INT = 3;
|
||||
const TYPE_DECIMAL = 4;
|
||||
const TYPE_BOOLEAN = 5;
|
||||
const TYPE_DUALTEXT = 6;
|
||||
|
||||
private $name;
|
||||
private $title;
|
||||
private $type;
|
||||
private $multi;
|
||||
private $default;
|
||||
private $help;
|
||||
|
||||
private $value;
|
||||
|
||||
public function Name() { return $this->name; }
|
||||
public function Title() { return $this->title; }
|
||||
public function Type() { return $this->type; }
|
||||
public function IsMulti() { return $this->multi; }
|
||||
public function DefaultValue() { return $this->default; }
|
||||
public function Help() { return $this->help; }
|
||||
|
||||
public function __construct($name, $title, $type, $default='', $help='', $multi=false)
|
||||
{
|
||||
$this->name = (string)$name;
|
||||
$this->title = (string)$title;
|
||||
$this->multi = (bool)$multi;
|
||||
$this->type = (int)$type;
|
||||
$this->default = (string)$default;
|
||||
$this->help = (string)$help;
|
||||
|
||||
$this->Value($this->default);
|
||||
|
||||
if (!($type == self::TYPE_STRING ||
|
||||
$type == self::TYPE_TEXT ||
|
||||
$type == self::TYPE_INT ||
|
||||
$type == self::TYPE_DECIMAL ||
|
||||
$type == self::TYPE_BOOLEAN ||
|
||||
$type == self::TYPE_DUALTEXT))
|
||||
throw new Exception("Invalid Type");
|
||||
}
|
||||
|
||||
function Value($newValue = null)
|
||||
{
|
||||
if ($newValue !== null)
|
||||
{
|
||||
if ($this->multi)
|
||||
$this->value = $newValue;
|
||||
else
|
||||
$this->value = (string)$newValue;
|
||||
}
|
||||
|
||||
return $this->value;
|
||||
}
|
||||
}
|
||||
26
Classes/HtRule/Rule/AppendSlash.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
class HtRule_Rule_AppendSlash extends HtRule
|
||||
{
|
||||
public static function GetName()
|
||||
{
|
||||
return 'Append /';
|
||||
}
|
||||
|
||||
public function RequireRewriteEngine()
|
||||
{
|
||||
return True;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
$name = self::GetName();
|
||||
return <<<EOT
|
||||
# $name
|
||||
RewriteCond %{REQUEST_URI} !^.*/$
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_METHOD} !^POST$
|
||||
RewriteRule (.*) $1/ [R=301,L]
|
||||
EOT;
|
||||
}
|
||||
}
|
||||
26
Classes/HtRule/Rule/Comment.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
class HtRule_Rule_Comment extends HtRule
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->AddParam(new HtRule_Param('text', 'Comment', HtRule_Param::TYPE_TEXT, 'A Comment'));
|
||||
parent::__construct();
|
||||
}
|
||||
public static function GetName()
|
||||
{
|
||||
return 'Comment';
|
||||
}
|
||||
public function RequireRewriteEngine()
|
||||
{
|
||||
return False;
|
||||
}
|
||||
public function __toString()
|
||||
{
|
||||
$text = $this->params['text']->Value();
|
||||
|
||||
$text = '# '.str_replace("\n", "\n# ", $text);
|
||||
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
22
Classes/HtRule/Rule/Custom.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
class HtRule_Rule_Custom extends HtRule
|
||||
{
|
||||
public static function GetName()
|
||||
{
|
||||
return 'Custom Directives';
|
||||
}
|
||||
public function __construct()
|
||||
{
|
||||
$this->AddParam(new HtRule_Param('Text', 'Directives', HtRule_Param::TYPE_TEXT));
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
$params = $this->ParamValues();
|
||||
|
||||
return $params['Text'];
|
||||
}
|
||||
}
|
||||
38
Classes/HtRule/Rule/DenyFiles.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
class HtRule_Rule_DenyFiles extends HtRule
|
||||
{
|
||||
public static function GetName()
|
||||
{
|
||||
return 'Deny access to File Types';
|
||||
}
|
||||
public function __construct()
|
||||
{
|
||||
$this->AddParam(new HtRule_Param('filetypes', 'File Type', HtRule_Param::TYPE_TEXT, ".sql\n.log", 'Specify the file extensions that you want to deny access to (one per line)', False));
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
$params = $this->ParamValues();
|
||||
|
||||
$types = $params['filetypes'];
|
||||
|
||||
$types = str_replace("\r", "", $types);
|
||||
$types = explode("\n", $types);
|
||||
|
||||
$rules = '';
|
||||
for($i=0;$i < count($types);$i++)
|
||||
{
|
||||
$type = preg_quote($types[$i]);
|
||||
$rules .= "RewriteCond %{REQUEST_FILENAME} $type$";
|
||||
if ($i < count($types))
|
||||
$rules .= ' [OR]';
|
||||
$rules .= "\n";
|
||||
}
|
||||
$rules .= "RewriteRule .* - [F,L]\n";
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
31
Classes/HtRule/Rule/EnableRewrite.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
class HtRule_Rule_EnableRewrite extends HtRule
|
||||
{
|
||||
public static function GetName()
|
||||
{
|
||||
return 'Enable Rewrite Engine';
|
||||
}
|
||||
|
||||
public function RequireRewriteEngine()
|
||||
{
|
||||
return True;
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->AddParam(new HtRule_Param('base', 'Rewrite Base', HtRule_Param::TYPE_STRING, '/', 'With leading and trailing slashes'));
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
public function __toString()
|
||||
{
|
||||
$base = $this->params['base']->Value();
|
||||
$name = self::GetName();
|
||||
return <<<EOT
|
||||
# $name
|
||||
RewriteEngine On
|
||||
RewriteBase $base
|
||||
EOT;
|
||||
}
|
||||
}
|
||||
36
Classes/HtRule/Rule/FromWWW.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
class HtRule_Rule_FromWWW extends HtRule
|
||||
{
|
||||
public static function GetName()
|
||||
{
|
||||
return 'Redirect from www.';
|
||||
}
|
||||
|
||||
public function RequireRewriteEngine()
|
||||
{
|
||||
return True;
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->AddParam(new HtRule_Param('domain', 'Domain Name', HtRule_Param::TYPE_STRING, 'domain.com', 'The domain without the www'));
|
||||
$this->AddParam(new HtRule_Param('https', 'Use Https', HtRule_Param::TYPE_BOOLEAN, False, 'Redirect to https'));
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
$domain = $this->params['domain']->Value();
|
||||
$name = self::GetName();
|
||||
$proto = 'http';
|
||||
if ($this->params['https']->Value())
|
||||
$proto = 'https';
|
||||
return <<<EOT
|
||||
# $name
|
||||
RewriteCond %{HTTP_HOST} ^www.${domain}$
|
||||
RewriteRule (.*) ${proto}://${domain}/$1 [R=301,L]
|
||||
EOT;
|
||||
}
|
||||
}
|
||||
33
Classes/HtRule/Rule/IndexToRoot.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
class HtRule_Rule_IndexToRoot extends HtRule
|
||||
{
|
||||
public static function GetName()
|
||||
{
|
||||
return 'Redirect index.php to /';
|
||||
}
|
||||
|
||||
public function RequireRewriteEngine()
|
||||
{
|
||||
return True;
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->AddParam(new HtRule_Param('indexfile', 'Index File', HtRule_Param::TYPE_STRING, 'index.php'));
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
$name = self::GetName();
|
||||
$file = str_replace('.', '\\.', $this->params['indexfile']->Value());
|
||||
return <<<EOT
|
||||
# $name
|
||||
RewriteCond %{QUERY_STRING} ^$
|
||||
RewriteCond %{REQUEST_METHOD} !^POST$
|
||||
RewriteRule ^$file$ / [R=301,L]
|
||||
EOT;
|
||||
}
|
||||
}
|
||||
39
Classes/HtRule/Rule/MapIndex.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
class HtRule_Rule_MapIndex extends HtRule
|
||||
{
|
||||
public static function GetName()
|
||||
{
|
||||
return 'Map urls to index.php';
|
||||
}
|
||||
|
||||
public function RequireRewriteEngine()
|
||||
{
|
||||
return True;
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->AddParam(new HtRule_Param('Target', 'Target File', HtRule_Param::TYPE_STRING, 'index.php', 'The file to map request to'));
|
||||
$this->AddParam(new HtRule_Param('AppendUrl', 'Append Url to rewrite', HtRule_Param::TYPE_BOOLEAN, False, 'This adds the url to the end of the rewritten url, ie /test/ => /index.php/test/'));
|
||||
$this->AddParam(new HtRule_Param('AppendMethod', 'Method of appending', HtRule_Param::TYPE_STRING, '/', 'eg. ? or ?page= (/ May not work in a CGI environment)'));
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
$params = $this->ParamValues();
|
||||
|
||||
$append = '';
|
||||
if ($params['AppendUrl'])
|
||||
$append .= $params['AppendMethod'].'$1';
|
||||
|
||||
return <<<EOT
|
||||
# Map urls to $params[Target]
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule (.*) $params[Target]{$append} [L,QSA]
|
||||
EOT;
|
||||
}
|
||||
}
|
||||
45
Classes/HtRule/Rule/RedirectDomain.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
class HtRule_Rule_RedirectDomain extends HtRule
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->AddParam(new HtRule_Param('permanent', 'Permanent', HtRule_Param::TYPE_BOOLEAN, true, ''));
|
||||
$this->AddParam(new HtRule_Param('subdomains', 'Include All Subdomains', HtRule_Param::TYPE_BOOLEAN, true, ''));
|
||||
$this->AddParam(new HtRule_Param('to', 'Destination Domain', HtRule_Param::TYPE_STRING, 'http://newdomain.com/', 'The full url to direct to'));
|
||||
$this->AddParam(new HtRule_Param('from', 'Source Domains', HtRule_Param::TYPE_TEXT, 'olddomain.com', ''));
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
public static function GetName()
|
||||
{
|
||||
return 'Redirect Domains';
|
||||
}
|
||||
public function __toString()
|
||||
{
|
||||
$values = $this->ParamValues();
|
||||
|
||||
$type = ($values['permanent']) ? 301 : 302;
|
||||
$typeText = ($values['permanent']) ? 'Permanent' : 'Temporary';
|
||||
|
||||
$domains = explode("\n", str_replace("\r", '', $values['from']));
|
||||
|
||||
$subdomains = ($values['subdomains']) ? '' : '^';
|
||||
|
||||
$rules = "# Redirect Domains ($typeText)".PHP_EOL;
|
||||
if (empty($domains))
|
||||
return $rules;
|
||||
foreach($domains as $domain)
|
||||
{
|
||||
$rules .= "RewriteCond %{HTTP_HOST} {$subdomains}".preg_quote($domain)."$ [OR]".PHP_EOL;
|
||||
}
|
||||
$rules = substr($rules, 0, strlen($rules)-strlen(" [OR]".PHP_EOL)).PHP_EOL;
|
||||
|
||||
$destination = rtrim($values['to'], '/');
|
||||
$destination = preg_quote($destination);
|
||||
|
||||
$rules .= "RewriteRule ^(.*)$ {$destination}/$1 [R=$type,L]";
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
96
Classes/HtRule/Rule/RedirectUrls.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
class HtRule_Rule_RedirectUrls extends HtRule
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->AddParam(new HtRule_Param('permanent', 'Permanent Redirects', HtRule_Param::TYPE_BOOLEAN, True, ''));
|
||||
$this->AddParam(new HtRule_Param('host', 'Check Host', HtRule_Param::TYPE_BOOLEAN, false, 'Check the hostname is correct for each redirect'));
|
||||
$this->AddParam(new HtRule_Param('ignorewww', 'Ignore www. prefix', HtRule_Param::TYPE_BOOLEAN, false, 'Ignores the www, from the domain name. Requires check host be enabled'));
|
||||
$this->AddParam(new HtRule_Param('urls', 'Urls', HtRule_Param::TYPE_DUALTEXT, '', 'Full Urls, from on the left, to on the right', True));
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
public static function GetName()
|
||||
{
|
||||
return 'Redirect Urls';
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
$values = $this->ParamValues();
|
||||
|
||||
$type = ($values['permanent']) ? 301 : 302;
|
||||
$typeText = ($values['permanent']) ? 'Permanent' : 'Temporary';
|
||||
|
||||
$urls = $values['urls'];
|
||||
|
||||
$rules = '';
|
||||
if (is_array($urls) && count($urls) == 2)
|
||||
{
|
||||
$fromUrls = explode("\n", str_replace("\r", '', $urls[0]));
|
||||
$toUrls = explode("\n", str_replace("\r", '', $urls[1]));
|
||||
foreach($fromUrls as $key => $from)
|
||||
{
|
||||
$from = trim($from);
|
||||
if ($from == "")
|
||||
continue;
|
||||
if (isset($toUrls[$key]))
|
||||
{
|
||||
$to = trim($toUrls[$key]);
|
||||
if ($to == "")
|
||||
continue;
|
||||
$rule = $this->CreateRewrite($from, $to, $type, $values['host'], @$values['ignorewww']);
|
||||
if ($rule)
|
||||
$rules .= $rule.PHP_EOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return <<<EOT
|
||||
# Redirect Urls ($typeText)
|
||||
$rules
|
||||
EOT;
|
||||
}
|
||||
|
||||
private function CreateRewrite($from, $to, $type, $checkhost, $ignorewww)
|
||||
{
|
||||
$from = parse_url($from);
|
||||
$toUrl = $to;
|
||||
$to = parse_url($to);
|
||||
|
||||
if (!$from || !$to)
|
||||
return False;
|
||||
$default = array('scheme'=>false,'host'=>false,'port'=>false,'path'=>false,'query'=>false,'fragment'=>false);
|
||||
$from = array_replace($default, $from);
|
||||
$to = array_replace($default, $to);
|
||||
$rule = '';
|
||||
if ($checkhost)
|
||||
{
|
||||
$domain = $from['host'];
|
||||
$domainCheck = '^'.str_replace(array('.','\-'),array('\.','\-'),$domain).'$';
|
||||
if ($ignorewww)
|
||||
{
|
||||
$domain = preg_replace('/^www\./', '', $domain);
|
||||
$domainCheck = "^(www\.)?".str_replace(array('.','\-'),array('\.','\-'),$domain)."\$";
|
||||
}
|
||||
$rule .= 'RewriteCond %{HTTP_HOST} '.$domainCheck.PHP_EOL;
|
||||
}
|
||||
if (!empty($from['query']))
|
||||
{
|
||||
$end = '';
|
||||
if ($to['query'] == false)
|
||||
$end = '?';
|
||||
|
||||
|
||||
$rule .= "RewriteCond %{QUERY_STRING} ^".str_replace('.','\.',$from['query'])."\$".PHP_EOL;
|
||||
$rule .= "RewriteRule ^".ltrim(preg_quote($from['path']),'/')."\$ $toUrl$end [R=$type,L]";
|
||||
}
|
||||
else
|
||||
{
|
||||
$rule .= "RewriteRule ^".ltrim(preg_quote($from['path']),'/')."\$ $toUrl [R=$type,L]";
|
||||
}
|
||||
|
||||
return $rule;
|
||||
}
|
||||
}
|
||||
36
Classes/HtRule/Rule/ToWWW.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
class HtRule_Rule_ToWWW extends HtRule
|
||||
{
|
||||
public static function GetName()
|
||||
{
|
||||
return 'Redirect to www.';
|
||||
}
|
||||
|
||||
public function RequireRewriteEngine()
|
||||
{
|
||||
return True;
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->AddParam(new HtRule_Param('domain', 'Domain Name', HtRule_Param::TYPE_STRING, 'domain.com', 'The domain without the www'));
|
||||
$this->AddParam(new HtRule_Param('https', 'Use Https', HtRule_Param::TYPE_BOOLEAN, False, 'Redirect to https'));
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
$domain = $this->params['domain']->Value();
|
||||
$name = self::GetName();
|
||||
$proto = 'http';
|
||||
if ($this->params['https']->Value())
|
||||
$proto = 'https';
|
||||
return <<<EOT
|
||||
# $name
|
||||
RewriteCond %{HTTP_HOST} ^${domain}$
|
||||
RewriteRule (.*) ${proto}://www.${domain}/$1 [R=301,L]
|
||||
EOT;
|
||||
}
|
||||
}
|
||||
48
Classes/HtRule/Rule/UseHttps.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
class HtRule_Rule_UseHttps extends HtRule
|
||||
{
|
||||
public static function GetName()
|
||||
{
|
||||
return 'Force SSL';
|
||||
}
|
||||
|
||||
public function RequireRewriteEngine()
|
||||
{
|
||||
return True;
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->AddParam(new HtRule_Param('DetectHttps', 'Detect Using %{HTTPS}', HtRule_Param::TYPE_BOOLEAN, True, 'This will work on most servers'));
|
||||
$this->AddParam(new HtRule_Param('Domain', 'Rewrite To Domain', HtRule_Param::TYPE_STRING, 'www.domain.com', 'The full domain to rewrite to'));
|
||||
$this->AddParam(new HtRule_Param('DetectPort', 'Detect By Port Number', HtRule_Param::TYPE_BOOLEAN, False, 'HTTP uses port 80 whereas HTTPS uses port 443 (default ports)'));
|
||||
$this->AddParam(new HtRule_Param('HttpsPort', 'Https Port', HtRule_Param::TYPE_INT, 443, 'Redirect the request if the port in use is not this port'));
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
$params = $this->ParamValues();
|
||||
|
||||
$rule = "# Force clients to use https\n";
|
||||
if ($params['DetectPort'])
|
||||
{
|
||||
$rule .= "RewriteCond %{SERVER_PORT} !$params[HttpsPort]";
|
||||
if ($params['DetectHttps'])
|
||||
$rule .= " [OR]";
|
||||
$rule .= "\n";
|
||||
}
|
||||
if ($params['DetectHttps'])
|
||||
$rule .= "RewriteCond %{HTTPS} !=on\n";
|
||||
|
||||
$port = '';
|
||||
if ($params['HttpsPort'] != 443)
|
||||
$port = ':'.$params['HttpsPort'];
|
||||
|
||||
$rule .= "RewriteRule (.*) https://$params[Domain]{$port}/$1 [R=301,L]";
|
||||
|
||||
return $rule;
|
||||
}
|
||||
}
|
||||
26
Classes/System.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
class System
|
||||
{
|
||||
private static $db;
|
||||
private static $config;
|
||||
|
||||
public static function Init(array $config)
|
||||
{
|
||||
self::$config = (object) $config;
|
||||
self::StartSession();
|
||||
|
||||
}
|
||||
|
||||
public static function Config()
|
||||
{
|
||||
return self::$config;
|
||||
}
|
||||
public static function StartSession()
|
||||
{
|
||||
header('Cache-Control: no-cache, no-store, must-revalidate');
|
||||
header('Pragma: no-cache');
|
||||
|
||||
session_set_cookie_params(60*60*24, self::$config->BasePath, $_SERVER['HTTP_HOST'], False, True);
|
||||
session_start();
|
||||
}
|
||||
}
|
||||
7
LICENSE
Normal file
@@ -0,0 +1,7 @@
|
||||
Copyright (C) 2013 Sam Stevens
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
BIN
Media/Images/loading.gif
Normal file
|
After Width: | Height: | Size: 9.2 KiB |
BIN
Media/Images/menu-wrapper.jpg
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
Media/Images/page-fullwidth.jpg
Normal file
|
After Width: | Height: | Size: 980 B |
BIN
Media/Images/page.jpg
Normal file
|
After Width: | Height: | Size: 536 B |
BIN
Media/Images/pagebottom.jpg
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
BIN
Media/Images/pagetop-fullwidth.jpg
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
Media/Images/pagetop.jpg
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
Media/Images/post.jpg
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
Media/Images/sidebar.jpg
Normal file
|
After Width: | Height: | Size: 415 B |
60
Media/impromptu.css
Normal file
@@ -0,0 +1,60 @@
|
||||
.jqifade{
|
||||
position: absolute;
|
||||
background-color: #000000;
|
||||
}
|
||||
div.jqi{
|
||||
width: 300px;
|
||||
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
|
||||
position: absolute;
|
||||
background-color: #ffffff;
|
||||
font-size: 11px;
|
||||
text-align: left;
|
||||
border: solid 1px #eeeeee;
|
||||
border-radius: 10px;
|
||||
-moz-border-radius: 10px;
|
||||
-webkit-border-radius: 10px;
|
||||
padding: 7px;
|
||||
}
|
||||
div.jqi label {
|
||||
width: 100px;
|
||||
}
|
||||
div.jqi .jqicontainer{
|
||||
font-weight: bold;
|
||||
}
|
||||
div.jqi .jqiclose{
|
||||
position: absolute;
|
||||
top: 4px; right: -2px;
|
||||
width: 18px;
|
||||
cursor: default;
|
||||
color: #bbbbbb;
|
||||
font-weight: bold;
|
||||
}
|
||||
div.jqi .jqimessage{
|
||||
padding: 10px;
|
||||
line-height: 20px;
|
||||
color: #444444;
|
||||
}
|
||||
div.jqi .jqibuttons{
|
||||
text-align: right;
|
||||
padding: 5px 0 5px 0;
|
||||
border: solid 1px #eeeeee;
|
||||
background-color: #f4f4f4;
|
||||
}
|
||||
div.jqi button{
|
||||
padding: 3px 10px;
|
||||
margin: 0 10px;
|
||||
background-color: #2F6073;
|
||||
border: solid 2px #0F6059;
|
||||
color: #ffffff;
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
}
|
||||
div.jqi button:hover{
|
||||
background-color: #728A8C;
|
||||
}
|
||||
div.jqi button.jqidefaultbutton{
|
||||
background-color: #00312D;
|
||||
}
|
||||
.jqiwarning .jqi .jqibuttons{
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
78
Media/index.js
Normal file
@@ -0,0 +1,78 @@
|
||||
$(document).ready(function(){
|
||||
rules.init();
|
||||
|
||||
$('#save-as').click(function(){
|
||||
$.prompt({
|
||||
state0: {
|
||||
html: '<label for="filename-prompt">Save As :</label> <input type="text" id="filename-prompt" value=".htaccess"/>',
|
||||
focus: 1,
|
||||
buttons: {Save: true, Cancel: false},
|
||||
submit: function(value) {
|
||||
if (value == true) {
|
||||
var val = $('#filename-prompt').val();
|
||||
if (val == '') {
|
||||
$('#filename-prompt').css("border","solid #ff0000 1px");
|
||||
return false;
|
||||
}
|
||||
window.location = 'download.php?filename='+encodeURI(val);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
},{
|
||||
show: 'fadeIn',
|
||||
opacity: '0.7',
|
||||
loaded: function() {
|
||||
$('#filename-prompt').keydown(function(event){
|
||||
switch (event.keyCode) {
|
||||
case 13:
|
||||
$('#jqi_state0_buttonSave').click();
|
||||
break;
|
||||
case 27:
|
||||
jQuery.prompt.close();
|
||||
break;
|
||||
}
|
||||
}).focus();
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#delete').click(function(){
|
||||
return confirm('Delete Rules? This will also delete our saved copy (if any)');
|
||||
});
|
||||
|
||||
$('#save').click(function(){
|
||||
$.post($(this).attr('href'), {}, function(){
|
||||
rules.reloadRules();
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#field-rule-select').change(function(){
|
||||
var val = $(this).val();
|
||||
if (val == '')
|
||||
return;
|
||||
$('#form-add-rule').submit();
|
||||
$(this).val('');
|
||||
});
|
||||
|
||||
});
|
||||
var ajaxes_running = 0;
|
||||
function do_ajax(method, params, callback)
|
||||
{
|
||||
ajaxes_running++;
|
||||
$('#loading').show();
|
||||
$.ajax('ajax.php?action='+method,{
|
||||
cache : false,
|
||||
data : params,
|
||||
type : 'post',
|
||||
success : callback,
|
||||
complete : function(){
|
||||
ajaxes_running--;
|
||||
if (ajaxes_running == 0)
|
||||
$('#loading').hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
13
Media/jquery-impromptu.3.2.min.js
vendored
Normal file
4
Media/jquery.min.js
vendored
Normal file
112
Media/nicEdit.js
Normal file
@@ -0,0 +1,112 @@
|
||||
/* NicEdit - Micro Inline WYSIWYG
|
||||
* Copyright 2007-2008 Brian Kirchoff
|
||||
*
|
||||
* NicEdit is distributed under the terms of the MIT license
|
||||
* For more information visit http://nicedit.com/
|
||||
* Do not remove this copyright message
|
||||
*/
|
||||
var bkExtend=function(){var A=arguments;if(A.length==1){A=[this,A[0]]}for(var B in A[1]){A[0][B]=A[1][B]}return A[0]};function bkClass(){}bkClass.prototype.construct=function(){};bkClass.extend=function(C){var A=function(){if(arguments[0]!==bkClass){return this.construct.apply(this,arguments)}};var B=new this(bkClass);bkExtend(B,C);A.prototype=B;A.extend=this.extend;return A};var bkElement=bkClass.extend({construct:function(B,A){if(typeof (B)=="string"){B=(A||document).createElement(B)}B=$BK(B);return B},appendTo:function(A){A.appendChild(this);return this},appendBefore:function(A){A.parentNode.insertBefore(this,A);return this},addEvent:function(B,A){bkLib.addEvent(this,B,A);return this},setContent:function(A){this.innerHTML=A;return this},pos:function(){var C=curtop=0;var B=obj=this;if(obj.offsetParent){do{C+=obj.offsetLeft;curtop+=obj.offsetTop}while(obj=obj.offsetParent)}var A=(!window.opera)?parseInt(this.getStyle("border-width")||this.style.border)||0:0;return[C+A,curtop+A+this.offsetHeight]},noSelect:function(){bkLib.noSelect(this);return this},parentTag:function(A){var B=this;do{if(B&&B.nodeName&&B.nodeName.toUpperCase()==A){return B}B=B.parentNode}while(B);return false},hasClass:function(A){return this.className.match(new RegExp("(\\s|^)nicEdit-"+A+"(\\s|$)"))},addClass:function(A){if(!this.hasClass(A)){this.className+=" nicEdit-"+A}return this},removeClass:function(A){if(this.hasClass(A)){this.className=this.className.replace(new RegExp("(\\s|^)nicEdit-"+A+"(\\s|$)")," ")}return this},setStyle:function(A){var B=this.style;for(var C in A){switch(C){case"float":B.cssFloat=B.styleFloat=A[C];break;case"opacity":B.opacity=A[C];B.filter="alpha(opacity="+Math.round(A[C]*100)+")";break;case"className":this.className=A[C];break;default:B[C]=A[C]}}return this},getStyle:function(A,C){var B=(!C)?document.defaultView:C;if(this.nodeType==1){return(B&&B.getComputedStyle)?B.getComputedStyle(this,null).getPropertyValue(A):this.currentStyle[bkLib.camelize(A)]}},remove:function(){this.parentNode.removeChild(this);return this},setAttributes:function(A){for(var B in A){this[B]=A[B]}return this}});var bkLib={isMSIE:(navigator.appVersion.indexOf("MSIE")!=-1),addEvent:function(C,B,A){(C.addEventListener)?C.addEventListener(B,A,false):C.attachEvent("on"+B,A)},toArray:function(C){var B=C.length,A=new Array(B);while(B--){A[B]=C[B]}return A},noSelect:function(B){if(B.setAttribute&&B.nodeName.toLowerCase()!="input"&&B.nodeName.toLowerCase()!="textarea"){B.setAttribute("unselectable","on")}for(var A=0;A<B.childNodes.length;A++){bkLib.noSelect(B.childNodes[A])}},camelize:function(A){return A.replace(/\-(.)/g,function(B,C){return C.toUpperCase()})},inArray:function(A,B){return(bkLib.search(A,B)!=null)},search:function(A,C){for(var B=0;B<A.length;B++){if(A[B]==C){return B}}return null},cancelEvent:function(A){A=A||window.event;if(A.preventDefault&&A.stopPropagation){A.preventDefault();A.stopPropagation()}return false},domLoad:[],domLoaded:function(){if(arguments.callee.done){return }arguments.callee.done=true;for(i=0;i<bkLib.domLoad.length;i++){bkLib.domLoad[i]()}},onDomLoaded:function(A){this.domLoad.push(A);if(document.addEventListener){document.addEventListener("DOMContentLoaded",bkLib.domLoaded,null)}else{if(bkLib.isMSIE){document.write("<style>.nicEdit-main p { margin: 0; }</style><script id=__ie_onload defer "+((location.protocol=="https:")?"src='javascript:void(0)'":"src=//0")+"><\/script>");$BK("__ie_onload").onreadystatechange=function(){if(this.readyState=="complete"){bkLib.domLoaded()}}}}window.onload=bkLib.domLoaded}};function $BK(A){if(typeof (A)=="string"){A=document.getElementById(A)}return(A&&!A.appendTo)?bkExtend(A,bkElement.prototype):A}var bkEvent={addEvent:function(A,B){if(B){this.eventList=this.eventList||{};this.eventList[A]=this.eventList[A]||[];this.eventList[A].push(B)}return this},fireEvent:function(){var A=bkLib.toArray(arguments),C=A.shift();if(this.eventList&&this.eventList[C]){for(var B=0;B<this.eventList[C].length;B++){this.eventList[C][B].apply(this,A)}}}};function __(A){return A}Function.prototype.closure=function(){var A=this,B=bkLib.toArray(arguments),C=B.shift();return function(){if(typeof (bkLib)!="undefined"){return A.apply(C,B.concat(bkLib.toArray(arguments)))}}};Function.prototype.closureListener=function(){var A=this,C=bkLib.toArray(arguments),B=C.shift();return function(E){E=E||window.event;if(E.target){var D=E.target}else{var D=E.srcElement}return A.apply(B,[E,D].concat(C))}};
|
||||
|
||||
|
||||
|
||||
var nicEditorConfig = bkClass.extend({
|
||||
buttons : {
|
||||
'bold' : {name : __('Click to Bold'), command : 'Bold', tags : ['B','STRONG'], css : {'font-weight' : 'bold'}, key : 'b'},
|
||||
'italic' : {name : __('Click to Italic'), command : 'Italic', tags : ['EM','I'], css : {'font-style' : 'italic'}, key : 'i'},
|
||||
'underline' : {name : __('Click to Underline'), command : 'Underline', tags : ['U'], css : {'text-decoration' : 'underline'}, key : 'u'},
|
||||
'left' : {name : __('Left Align'), command : 'justifyleft', noActive : true},
|
||||
'center' : {name : __('Center Align'), command : 'justifycenter', noActive : true},
|
||||
'right' : {name : __('Right Align'), command : 'justifyright', noActive : true},
|
||||
'justify' : {name : __('Justify Align'), command : 'justifyfull', noActive : true},
|
||||
'ol' : {name : __('Insert Ordered List'), command : 'insertorderedlist', tags : ['OL']},
|
||||
'ul' : {name : __('Insert Unordered List'), command : 'insertunorderedlist', tags : ['UL']},
|
||||
'subscript' : {name : __('Click to Subscript'), command : 'subscript', tags : ['SUB']},
|
||||
'superscript' : {name : __('Click to Superscript'), command : 'superscript', tags : ['SUP']},
|
||||
'strikethrough' : {name : __('Click to Strike Through'), command : 'strikeThrough', css : {'text-decoration' : 'line-through'}},
|
||||
'removeformat' : {name : __('Remove Formatting'), command : 'removeformat', noActive : true},
|
||||
'indent' : {name : __('Indent Text'), command : 'indent', noActive : true},
|
||||
'outdent' : {name : __('Remove Indent'), command : 'outdent', noActive : true},
|
||||
'hr' : {name : __('Horizontal Rule'), command : 'insertHorizontalRule', noActive : true}
|
||||
},
|
||||
iconsPath : '../nicEditorIcons.gif',
|
||||
buttonList : ['save','bold','italic','underline','left','center','right','justify','ol','ul','fontSize','fontFamily','fontFormat','indent','outdent','image','upload','link','unlink','forecolor','bgcolor'],
|
||||
iconList : {"xhtml":1,"bgcolor":2,"forecolor":3,"bold":4,"center":5,"hr":6,"indent":7,"italic":8,"justify":9,"left":10,"ol":11,"outdent":12,"removeformat":13,"right":14,"save":25,"strikethrough":16,"subscript":17,"superscript":18,"ul":19,"underline":20,"image":21,"link":22,"unlink":23,"close":24,"arrow":26}
|
||||
|
||||
});
|
||||
;
|
||||
var nicEditors={nicPlugins:[],editors:[],registerPlugin:function(B,A){this.nicPlugins.push({p:B,o:A})},allTextAreas:function(C){var A=document.getElementsByTagName("textarea");for(var B=0;B<A.length;B++){nicEditors.editors.push(new nicEditor(C).panelInstance(A[B]))}return nicEditors.editors},findEditor:function(C){var B=nicEditors.editors;for(var A=0;A<B.length;A++){if(B[A].instanceById(C)){return B[A].instanceById(C)}}}};var nicEditor=bkClass.extend({construct:function(C){this.options=new nicEditorConfig();bkExtend(this.options,C);this.nicInstances=new Array();this.loadedPlugins=new Array();var A=nicEditors.nicPlugins;for(var B=0;B<A.length;B++){this.loadedPlugins.push(new A[B].p(this,A[B].o))}nicEditors.editors.push(this);bkLib.addEvent(document.body,"mousedown",this.selectCheck.closureListener(this))},panelInstance:function(B,C){B=this.checkReplace($BK(B));var A=new bkElement("DIV").setStyle({width:(parseInt(B.getStyle("width"))||B.clientWidth)+"px"}).appendBefore(B);this.setPanel(A);return this.addInstance(B,C)},checkReplace:function(B){var A=nicEditors.findEditor(B);if(A){A.removeInstance(B);A.removePanel()}return B},addInstance:function(B,C){B=this.checkReplace($BK(B));if(B.contentEditable||!!window.opera){var A=new nicEditorInstance(B,C,this)}else{var A=new nicEditorIFrameInstance(B,C,this)}this.nicInstances.push(A);return this},removeInstance:function(C){C=$BK(C);var B=this.nicInstances;for(var A=0;A<B.length;A++){if(B[A].e==C){B[A].remove();this.nicInstances.splice(A,1)}}},removePanel:function(A){if(this.nicPanel){this.nicPanel.remove();this.nicPanel=null}},instanceById:function(C){C=$BK(C);var B=this.nicInstances;for(var A=0;A<B.length;A++){if(B[A].e==C){return B[A]}}},setPanel:function(A){this.nicPanel=new nicEditorPanel($BK(A),this.options,this);this.fireEvent("panel",this.nicPanel);return this},nicCommand:function(B,A){if(this.selectedInstance){this.selectedInstance.nicCommand(B,A)}},getIcon:function(D,A){var C=this.options.iconList[D];var B=(A.iconFiles)?A.iconFiles[D]:"";return{backgroundImage:"url('"+((C)?this.options.iconsPath:B)+"')",backgroundPosition:((C)?((C-1)*-18):0)+"px 0px"}},selectCheck:function(C,A){var B=false;do{if(A.className&&A.className.indexOf("nicEdit")!=-1){return false}}while(A=A.parentNode);this.fireEvent("blur",this.selectedInstance,A);this.lastSelectedInstance=this.selectedInstance;this.selectedInstance=null;return false}});nicEditor=nicEditor.extend(bkEvent);
|
||||
var nicEditorInstance=bkClass.extend({isSelected:false,construct:function(G,D,C){this.ne=C;this.elm=this.e=G;this.options=D||{};newX=parseInt(G.getStyle("width"))||G.clientWidth;newY=parseInt(G.getStyle("height"))||G.clientHeight;this.initialHeight=newY-8;var H=(G.nodeName.toLowerCase()=="textarea");if(H||this.options.hasPanel){var B=(bkLib.isMSIE&&!((typeof document.body.style.maxHeight!="undefined")&&document.compatMode=="CSS1Compat"));var E={width:newX+"px",border:"1px solid #ccc",borderTop:0,overflowY:"auto",overflowX:"hidden"};E[(B)?"height":"maxHeight"]=(this.ne.options.maxHeight)?this.ne.options.maxHeight+"px":null;this.editorContain=new bkElement("DIV").setStyle(E).appendBefore(G);var A=new bkElement("DIV").setStyle({width:(newX-8)+"px",margin:"4px",minHeight:newY+"px"}).addClass("main").appendTo(this.editorContain);G.setStyle({display:"none"});A.innerHTML=G.innerHTML;if(H){A.setContent(G.value);this.copyElm=G;var F=G.parentTag("FORM");if(F){bkLib.addEvent(F,"submit",this.saveContent.closure(this))}}A.setStyle((B)?{height:newY+"px"}:{overflow:"hidden"});this.elm=A}this.ne.addEvent("blur",this.blur.closure(this));this.init();this.blur()},init:function(){this.elm.setAttribute("contentEditable","true");if(this.getContent()==""){this.setContent("<br />")}this.instanceDoc=document.defaultView;this.elm.addEvent("mousedown",this.selected.closureListener(this)).addEvent("keypress",this.keyDown.closureListener(this)).addEvent("focus",this.selected.closure(this)).addEvent("blur",this.blur.closure(this)).addEvent("keyup",this.selected.closure(this));this.ne.fireEvent("add",this)},remove:function(){this.saveContent();if(this.copyElm||this.options.hasPanel){this.editorContain.remove();this.e.setStyle({display:"block"});this.ne.removePanel()}this.disable();this.ne.fireEvent("remove",this)},disable:function(){this.elm.setAttribute("contentEditable","false")},getSel:function(){return(window.getSelection)?window.getSelection():document.selection},getRng:function(){var A=this.getSel();if(!A||A.rangeCount===0){return }return(A.rangeCount>0)?A.getRangeAt(0):A.createRange()},selRng:function(A,B){if(window.getSelection){B.removeAllRanges();B.addRange(A)}else{A.select()}},selElm:function(){var C=this.getRng();if(!C){return }if(C.startContainer){var D=C.startContainer;if(C.cloneContents().childNodes.length==1){for(var B=0;B<D.childNodes.length;B++){var A=D.childNodes[B].ownerDocument.createRange();A.selectNode(D.childNodes[B]);if(C.compareBoundaryPoints(Range.START_TO_START,A)!=1&&C.compareBoundaryPoints(Range.END_TO_END,A)!=-1){return $BK(D.childNodes[B])}}}return $BK(D)}else{return $BK((this.getSel().type=="Control")?C.item(0):C.parentElement())}},saveRng:function(){this.savedRange=this.getRng();this.savedSel=this.getSel()},restoreRng:function(){if(this.savedRange){this.selRng(this.savedRange,this.savedSel)}},keyDown:function(B,A){if(B.ctrlKey){this.ne.fireEvent("key",this,B)}},selected:function(C,A){if(!A&&!(A=this.selElm)){A=this.selElm()}if(!C.ctrlKey){var B=this.ne.selectedInstance;if(B!=this){if(B){this.ne.fireEvent("blur",B,A)}this.ne.selectedInstance=this;this.ne.fireEvent("focus",B,A)}this.ne.fireEvent("selected",B,A);this.isFocused=true;this.elm.addClass("selected")}return false},blur:function(){this.isFocused=false;this.elm.removeClass("selected")},saveContent:function(){if(this.copyElm||this.options.hasPanel){this.ne.fireEvent("save",this);(this.copyElm)?this.copyElm.value=this.getContent():this.e.innerHTML=this.getContent()}},getElm:function(){return this.elm},getContent:function(){this.content=this.getElm().innerHTML;this.ne.fireEvent("get",this);return this.content},setContent:function(A){this.content=A;this.ne.fireEvent("set",this);this.elm.innerHTML=this.content},nicCommand:function(B,A){document.execCommand(B,false,A)}});
|
||||
var nicEditorIFrameInstance=nicEditorInstance.extend({savedStyles:[],init:function(){var B=this.elm.innerHTML.replace(/^\s+|\s+$/g,"");this.elm.innerHTML="";(!B)?B="<br />":B;this.initialContent=B;this.elmFrame=new bkElement("iframe").setAttributes({src:"javascript:;",frameBorder:0,allowTransparency:"true",scrolling:"no"}).setStyle({height:"100px",width:"100%"}).addClass("frame").appendTo(this.elm);if(this.copyElm){this.elmFrame.setStyle({width:(this.elm.offsetWidth-4)+"px"})}var A=["font-size","font-family","font-weight","color"];for(itm in A){this.savedStyles[bkLib.camelize(itm)]=this.elm.getStyle(itm)}setTimeout(this.initFrame.closure(this),50)},disable:function(){this.elm.innerHTML=this.getContent()},initFrame:function(){var B=$BK(this.elmFrame.contentWindow.document);B.designMode="on";B.open();var A=this.ne.options.externalCSS;B.write("<html><head>"+((A)?'<link href="'+A+'" rel="stylesheet" type="text/css" />':"")+'</head><body id="nicEditContent" style="margin: 0 !important; background-color: transparent !important;">'+this.initialContent+"</body></html>");B.close();this.frameDoc=B;this.frameWin=$BK(this.elmFrame.contentWindow);this.frameContent=$BK(this.frameWin.document.body).setStyle(this.savedStyles);this.instanceDoc=this.frameWin.document.defaultView;this.heightUpdate();this.frameDoc.addEvent("mousedown",this.selected.closureListener(this)).addEvent("keyup",this.heightUpdate.closureListener(this)).addEvent("keydown",this.keyDown.closureListener(this)).addEvent("keyup",this.selected.closure(this));this.ne.fireEvent("add",this)},getElm:function(){return this.frameContent},setContent:function(A){this.content=A;this.ne.fireEvent("set",this);this.frameContent.innerHTML=this.content;this.heightUpdate()},getSel:function(){return(this.frameWin)?this.frameWin.getSelection():this.frameDoc.selection},heightUpdate:function(){this.elmFrame.style.height=Math.max(this.frameContent.offsetHeight,this.initialHeight)+"px"},nicCommand:function(B,A){this.frameDoc.execCommand(B,false,A);setTimeout(this.heightUpdate.closure(this),100)}});
|
||||
var nicEditorPanel=bkClass.extend({construct:function(E,B,A){this.elm=E;this.options=B;this.ne=A;this.panelButtons=new Array();this.buttonList=bkExtend([],this.ne.options.buttonList);this.panelContain=new bkElement("DIV").setStyle({overflow:"hidden",width:"100%",border:"1px solid #cccccc",backgroundColor:"#efefef"}).addClass("panelContain");this.panelElm=new bkElement("DIV").setStyle({margin:"2px",marginTop:"0px",zoom:1,overflow:"hidden"}).addClass("panel").appendTo(this.panelContain);this.panelContain.appendTo(E);var C=this.ne.options;var D=C.buttons;for(button in D){this.addButton(button,C,true)}this.reorder();E.noSelect()},addButton:function(buttonName,options,noOrder){var button=options.buttons[buttonName];var type=(button.type)?eval("(typeof("+button.type+') == "undefined") ? null : '+button.type+";"):nicEditorButton;var hasButton=bkLib.inArray(this.buttonList,buttonName);if(type&&(hasButton||this.ne.options.fullPanel)){this.panelButtons.push(new type(this.panelElm,buttonName,options,this.ne));if(!hasButton){this.buttonList.push(buttonName)}}},findButton:function(B){for(var A=0;A<this.panelButtons.length;A++){if(this.panelButtons[A].name==B){return this.panelButtons[A]}}},reorder:function(){var C=this.buttonList;for(var B=0;B<C.length;B++){var A=this.findButton(C[B]);if(A){this.panelElm.appendChild(A.margin)}}},remove:function(){this.elm.remove()}});
|
||||
var nicEditorButton=bkClass.extend({construct:function(D,A,C,B){this.options=C.buttons[A];this.name=A;this.ne=B;this.elm=D;this.margin=new bkElement("DIV").setStyle({"float":"left",marginTop:"2px"}).appendTo(D);this.contain=new bkElement("DIV").setStyle({width:"20px",height:"20px"}).addClass("buttonContain").appendTo(this.margin);this.border=new bkElement("DIV").setStyle({backgroundColor:"#efefef",border:"1px solid #efefef"}).appendTo(this.contain);this.button=new bkElement("DIV").setStyle({width:"18px",height:"18px",overflow:"hidden",zoom:1,cursor:"pointer"}).addClass("button").setStyle(this.ne.getIcon(A,C)).appendTo(this.border);this.button.addEvent("mouseover",this.hoverOn.closure(this)).addEvent("mouseout",this.hoverOff.closure(this)).addEvent("mousedown",this.mouseClick.closure(this)).noSelect();if(!window.opera){this.button.onmousedown=this.button.onclick=bkLib.cancelEvent}B.addEvent("selected",this.enable.closure(this)).addEvent("blur",this.disable.closure(this)).addEvent("key",this.key.closure(this));this.disable();this.init()},init:function(){},hide:function(){this.contain.setStyle({display:"none"})},updateState:function(){if(this.isDisabled){this.setBg()}else{if(this.isHover){this.setBg("hover")}else{if(this.isActive){this.setBg("active")}else{this.setBg()}}}},setBg:function(A){switch(A){case"hover":var B={border:"1px solid #666",backgroundColor:"#ddd"};break;case"active":var B={border:"1px solid #666",backgroundColor:"#ccc"};break;default:var B={border:"1px solid #efefef",backgroundColor:"#efefef"}}this.border.setStyle(B).addClass("button-"+A)},checkNodes:function(A){var B=A;do{if(this.options.tags&&bkLib.inArray(this.options.tags,B.nodeName)){this.activate();return true}}while(B=B.parentNode&&B.className!="nicEdit");B=$BK(A);while(B.nodeType==3){B=$BK(B.parentNode)}if(this.options.css){for(itm in this.options.css){if(B.getStyle(itm,this.ne.selectedInstance.instanceDoc)==this.options.css[itm]){this.activate();return true}}}this.deactivate();return false},activate:function(){if(!this.isDisabled){this.isActive=true;this.updateState();this.ne.fireEvent("buttonActivate",this)}},deactivate:function(){this.isActive=false;this.updateState();if(!this.isDisabled){this.ne.fireEvent("buttonDeactivate",this)}},enable:function(A,B){this.isDisabled=false;this.contain.setStyle({opacity:1}).addClass("buttonEnabled");this.updateState();this.checkNodes(B)},disable:function(A,B){this.isDisabled=true;this.contain.setStyle({opacity:0.6}).removeClass("buttonEnabled");this.updateState()},toggleActive:function(){(this.isActive)?this.deactivate():this.activate()},hoverOn:function(){if(!this.isDisabled){this.isHover=true;this.updateState();this.ne.fireEvent("buttonOver",this)}},hoverOff:function(){this.isHover=false;this.updateState();this.ne.fireEvent("buttonOut",this)},mouseClick:function(){if(this.options.command){this.ne.nicCommand(this.options.command,this.options.commandArgs);if(!this.options.noActive){this.toggleActive()}}this.ne.fireEvent("buttonClick",this)},key:function(A,B){if(this.options.key&&B.ctrlKey&&String.fromCharCode(B.keyCode||B.charCode).toLowerCase()==this.options.key){this.mouseClick();if(B.preventDefault){B.preventDefault()}}}});
|
||||
var nicPlugin=bkClass.extend({construct:function(B,A){this.options=A;this.ne=B;this.ne.addEvent("panel",this.loadPanel.closure(this));this.init()},loadPanel:function(C){var B=this.options.buttons;for(var A in B){C.addButton(A,this.options)}C.reorder()},init:function(){}});
|
||||
|
||||
|
||||
var nicPaneOptions = { };
|
||||
|
||||
var nicEditorPane=bkClass.extend({construct:function(D,C,B,A){this.ne=C;this.elm=D;this.pos=D.pos();this.contain=new bkElement("div").setStyle({zIndex:"99999",overflow:"hidden",position:"absolute",left:this.pos[0]+"px",top:this.pos[1]+"px"});this.pane=new bkElement("div").setStyle({fontSize:"12px",border:"1px solid #ccc",overflow:"hidden",padding:"4px",textAlign:"left",backgroundColor:"#ffffc9"}).addClass("pane").setStyle(B).appendTo(this.contain);if(A&&!A.options.noClose){this.close=new bkElement("div").setStyle({"float":"right",height:"16px",width:"16px",cursor:"pointer"}).setStyle(this.ne.getIcon("close",nicPaneOptions)).addEvent("mousedown",A.removePane.closure(this)).appendTo(this.pane)}this.contain.noSelect().appendTo(document.body);this.position();this.init()},init:function(){},position:function(){if(this.ne.nicPanel){var B=this.ne.nicPanel.elm;var A=B.pos();var C=A[0]+parseInt(B.getStyle("width"))-(parseInt(this.pane.getStyle("width"))+8);if(C<this.pos[0]){this.contain.setStyle({left:C+"px"})}}},toggle:function(){this.isVisible=!this.isVisible;this.contain.setStyle({display:((this.isVisible)?"block":"none")})},remove:function(){if(this.contain){this.contain.remove();this.contain=null}},append:function(A){A.appendTo(this.pane)},setContent:function(A){this.pane.setContent(A)}});
|
||||
|
||||
var nicEditorAdvancedButton=nicEditorButton.extend({init:function(){this.ne.addEvent("selected",this.removePane.closure(this)).addEvent("blur",this.removePane.closure(this))},mouseClick:function(){if(!this.isDisabled){if(this.pane&&this.pane.pane){this.removePane()}else{this.pane=new nicEditorPane(this.contain,this.ne,{width:(this.width||"270px"),backgroundColor:"#fff"},this);this.addPane();this.ne.selectedInstance.saveRng()}}},addForm:function(C,G){this.form=new bkElement("form").addEvent("submit",this.submit.closureListener(this));this.pane.append(this.form);this.inputs={};for(itm in C){var D=C[itm];var F="";if(G){F=G.getAttribute(itm)}if(!F){F=D.value||""}var A=C[itm].type;if(A=="title"){new bkElement("div").setContent(D.txt).setStyle({fontSize:"14px",fontWeight:"bold",padding:"0px",margin:"2px 0"}).appendTo(this.form)}else{var B=new bkElement("div").setStyle({overflow:"hidden",clear:"both"}).appendTo(this.form);if(D.txt){new bkElement("label").setAttributes({"for":itm}).setContent(D.txt).setStyle({margin:"2px 4px",fontSize:"13px",width:"50px",lineHeight:"20px",textAlign:"right","float":"left"}).appendTo(B)}switch(A){case"text":this.inputs[itm]=new bkElement("input").setAttributes({id:itm,value:F,type:"text"}).setStyle({margin:"2px 0",fontSize:"13px","float":"left",height:"20px",border:"1px solid #ccc",overflow:"hidden"}).setStyle(D.style).appendTo(B);break;case"select":this.inputs[itm]=new bkElement("select").setAttributes({id:itm}).setStyle({border:"1px solid #ccc","float":"left",margin:"2px 0"}).appendTo(B);for(opt in D.options){var E=new bkElement("option").setAttributes({value:opt,selected:(opt==F)?"selected":""}).setContent(D.options[opt]).appendTo(this.inputs[itm])}break;case"content":this.inputs[itm]=new bkElement("textarea").setAttributes({id:itm}).setStyle({border:"1px solid #ccc","float":"left"}).setStyle(D.style).appendTo(B);this.inputs[itm].value=F}}}new bkElement("input").setAttributes({type:"submit"}).setStyle({backgroundColor:"#efefef",border:"1px solid #ccc",margin:"3px 0","float":"left",clear:"both"}).appendTo(this.form);this.form.onsubmit=bkLib.cancelEvent},submit:function(){},findElm:function(B,A,E){var D=this.ne.selectedInstance.getElm().getElementsByTagName(B);for(var C=0;C<D.length;C++){if(D[C].getAttribute(A)==E){return $BK(D[C])}}},removePane:function(){if(this.pane){this.pane.remove();this.pane=null;this.ne.selectedInstance.restoreRng()}}});
|
||||
|
||||
var nicButtonTips=bkClass.extend({construct:function(A){this.ne=A;A.addEvent("buttonOver",this.show.closure(this)).addEvent("buttonOut",this.hide.closure(this))},show:function(A){this.timer=setTimeout(this.create.closure(this,A),400)},create:function(A){this.timer=null;if(!this.pane){this.pane=new nicEditorPane(A.button,this.ne,{fontSize:"12px",marginTop:"5px"});this.pane.setContent(A.options.name)}},hide:function(A){if(this.timer){clearTimeout(this.timer)}if(this.pane){this.pane=this.pane.remove()}}});nicEditors.registerPlugin(nicButtonTips);
|
||||
|
||||
|
||||
var nicSelectOptions = {
|
||||
buttons : {
|
||||
'fontSize' : {name : __('Select Font Size'), type : 'nicEditorFontSizeSelect', command : 'fontsize'},
|
||||
'fontFamily' : {name : __('Select Font Family'), type : 'nicEditorFontFamilySelect', command : 'fontname'},
|
||||
'fontFormat' : {name : __('Select Font Format'), type : 'nicEditorFontFormatSelect', command : 'formatBlock'}
|
||||
}
|
||||
};
|
||||
|
||||
var nicEditorSelect=bkClass.extend({construct:function(D,A,C,B){this.options=C.buttons[A];this.elm=D;this.ne=B;this.name=A;this.selOptions=new Array();this.margin=new bkElement("div").setStyle({"float":"left",margin:"2px 1px 0 1px"}).appendTo(this.elm);this.contain=new bkElement("div").setStyle({width:"90px",height:"20px",cursor:"pointer",overflow:"hidden"}).addClass("selectContain").addEvent("click",this.toggle.closure(this)).appendTo(this.margin);this.items=new bkElement("div").setStyle({overflow:"hidden",zoom:1,border:"1px solid #ccc",paddingLeft:"3px",backgroundColor:"#fff"}).appendTo(this.contain);this.control=new bkElement("div").setStyle({overflow:"hidden","float":"right",height:"18px",width:"16px"}).addClass("selectControl").setStyle(this.ne.getIcon("arrow",C)).appendTo(this.items);this.txt=new bkElement("div").setStyle({overflow:"hidden","float":"left",width:"66px",height:"14px",marginTop:"1px",fontFamily:"sans-serif",textAlign:"center",fontSize:"12px"}).addClass("selectTxt").appendTo(this.items);if(!window.opera){this.contain.onmousedown=this.control.onmousedown=this.txt.onmousedown=bkLib.cancelEvent}this.margin.noSelect();this.ne.addEvent("selected",this.enable.closure(this)).addEvent("blur",this.disable.closure(this));this.disable();this.init()},disable:function(){this.isDisabled=true;this.close();this.contain.setStyle({opacity:0.6})},enable:function(A){this.isDisabled=false;this.close();this.contain.setStyle({opacity:1})},setDisplay:function(A){this.txt.setContent(A)},toggle:function(){if(!this.isDisabled){(this.pane)?this.close():this.open()}},open:function(){this.pane=new nicEditorPane(this.items,this.ne,{width:"88px",padding:"0px",borderTop:0,borderLeft:"1px solid #ccc",borderRight:"1px solid #ccc",borderBottom:"0px",backgroundColor:"#fff"});for(var C=0;C<this.selOptions.length;C++){var B=this.selOptions[C];var A=new bkElement("div").setStyle({overflow:"hidden",borderBottom:"1px solid #ccc",width:"88px",textAlign:"left",overflow:"hidden",cursor:"pointer"});var D=new bkElement("div").setStyle({padding:"0px 4px"}).setContent(B[1]).appendTo(A).noSelect();D.addEvent("click",this.update.closure(this,B[0])).addEvent("mouseover",this.over.closure(this,D)).addEvent("mouseout",this.out.closure(this,D)).setAttributes("id",B[0]);this.pane.append(A);if(!window.opera){D.onmousedown=bkLib.cancelEvent}}},close:function(){if(this.pane){this.pane=this.pane.remove()}},over:function(A){A.setStyle({backgroundColor:"#ccc"})},out:function(A){A.setStyle({backgroundColor:"#fff"})},add:function(B,A){this.selOptions.push(new Array(B,A))},update:function(A){this.ne.nicCommand(this.options.command,A);this.close()}});var nicEditorFontSizeSelect=nicEditorSelect.extend({sel:{1:"1 (8pt)",2:"2 (10pt)",3:"3 (12pt)",4:"4 (14pt)",5:"5 (18pt)",6:"6 (24pt)"},init:function(){this.setDisplay("Font Size...");for(itm in this.sel){this.add(itm,'<font size="'+itm+'">'+this.sel[itm]+"</font>")}}});var nicEditorFontFamilySelect=nicEditorSelect.extend({sel:{arial:"Arial","comic sans ms":"Comic Sans","courier new":"Courier New",georgia:"Georgia",helvetica:"Helvetica",impact:"Impact","times new roman":"Times","trebuchet ms":"Trebuchet",verdana:"Verdana"},init:function(){this.setDisplay("Font Family...");for(itm in this.sel){this.add(itm,'<font face="'+itm+'">'+this.sel[itm]+"</font>")}}});var nicEditorFontFormatSelect=nicEditorSelect.extend({sel:{p:"Paragraph",pre:"Pre",h6:"Heading 6",h5:"Heading 5",h4:"Heading 4",h3:"Heading 3",h2:"Heading 2",h1:"Heading 1"},init:function(){this.setDisplay("Font Format...");for(itm in this.sel){var A=itm.toUpperCase();this.add("<"+A+">","<"+itm+' style="padding: 0px; margin: 0px;">'+this.sel[itm]+"</"+A+">")}}});nicEditors.registerPlugin(nicPlugin,nicSelectOptions);
|
||||
|
||||
|
||||
var nicLinkOptions = {
|
||||
buttons : {
|
||||
'link' : {name : 'Add Link', type : 'nicLinkButton', tags : ['A']},
|
||||
'unlink' : {name : 'Remove Link', command : 'unlink', noActive : true}
|
||||
}
|
||||
};
|
||||
|
||||
var nicLinkButton=nicEditorAdvancedButton.extend({addPane:function(){this.ln=this.ne.selectedInstance.selElm().parentTag("A");this.addForm({"":{type:"title",txt:"Add/Edit Link"},href:{type:"text",txt:"URL",value:"http://",style:{width:"150px"}},title:{type:"text",txt:"Title"},target:{type:"select",txt:"Open In",options:{"":"Current Window",_blank:"New Window"},style:{width:"100px"}}},this.ln)},submit:function(C){var A=this.inputs.href.value;if(A=="http://"||A==""){alert("You must enter a URL to Create a Link");return false}this.removePane();if(!this.ln){var B="javascript:nicTemp();";this.ne.nicCommand("createlink",B);this.ln=this.findElm("A","href",B)}if(this.ln){this.ln.setAttributes({href:this.inputs.href.value,title:this.inputs.title.value,target:this.inputs.target.options[this.inputs.target.selectedIndex].value})}}});nicEditors.registerPlugin(nicPlugin,nicLinkOptions);
|
||||
|
||||
|
||||
var nicColorOptions = {
|
||||
buttons : {
|
||||
'forecolor' : {name : __('Change Text Color'), type : 'nicEditorColorButton', noClose : true},
|
||||
'bgcolor' : {name : __('Change Background Color'), type : 'nicEditorBgColorButton', noClose : true}
|
||||
}
|
||||
};
|
||||
|
||||
var nicEditorColorButton=nicEditorAdvancedButton.extend({addPane:function(){var D={0:"00",1:"33",2:"66",3:"99",4:"CC",5:"FF"};var H=new bkElement("DIV").setStyle({width:"270px"});for(var A in D){for(var F in D){for(var E in D){var I="#"+D[A]+D[E]+D[F];var C=new bkElement("DIV").setStyle({cursor:"pointer",height:"15px","float":"left"}).appendTo(H);var G=new bkElement("DIV").setStyle({border:"2px solid "+I}).appendTo(C);var B=new bkElement("DIV").setStyle({backgroundColor:I,overflow:"hidden",width:"11px",height:"11px"}).addEvent("click",this.colorSelect.closure(this,I)).addEvent("mouseover",this.on.closure(this,G)).addEvent("mouseout",this.off.closure(this,G,I)).appendTo(G);if(!window.opera){C.onmousedown=B.onmousedown=bkLib.cancelEvent}}}}this.pane.append(H.noSelect())},colorSelect:function(A){this.ne.nicCommand("foreColor",A);this.removePane()},on:function(A){A.setStyle({border:"2px solid #000"})},off:function(A,B){A.setStyle({border:"2px solid "+B})}});var nicEditorBgColorButton=nicEditorColorButton.extend({colorSelect:function(A){this.ne.nicCommand("hiliteColor",A);this.removePane()}});nicEditors.registerPlugin(nicPlugin,nicColorOptions);
|
||||
|
||||
|
||||
var nicImageOptions = {
|
||||
buttons : {
|
||||
'image' : {name : 'Add Image', type : 'nicImageButton', tags : ['IMG']}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
var nicImageButton=nicEditorAdvancedButton.extend({addPane:function(){this.im=this.ne.selectedInstance.selElm().parentTag("IMG");this.addForm({"":{type:"title",txt:"Add/Edit Image"},src:{type:"text",txt:"URL",value:"http://",style:{width:"150px"}},alt:{type:"text",txt:"Alt Text",style:{width:"100px"}},align:{type:"select",txt:"Align",options:{none:"Default",left:"Left",right:"Right"}}},this.im)},submit:function(B){var C=this.inputs.src.value;if(C==""||C=="http://"){alert("You must enter a Image URL to insert");return false}this.removePane();if(!this.im){var A="javascript:nicImTemp();";this.ne.nicCommand("insertImage",A);this.im=this.findElm("IMG","src",A)}if(this.im){this.im.setAttributes({src:this.inputs.src.value,alt:this.inputs.alt.value,align:this.inputs.align.value})}}});nicEditors.registerPlugin(nicPlugin,nicImageOptions);
|
||||
|
||||
|
||||
var nicSaveOptions = {
|
||||
buttons : {
|
||||
'save' : {name : __('Save this content'), type : 'nicEditorSaveButton'}
|
||||
}
|
||||
};
|
||||
|
||||
var nicEditorSaveButton=nicEditorButton.extend({init:function(){if(!this.ne.options.onSave){this.margin.setStyle({display:"none"})}},mouseClick:function(){var B=this.ne.options.onSave;var A=this.ne.selectedInstance;B(A.getContent(),A.elm.id,A)}});nicEditors.registerPlugin(nicPlugin,nicSaveOptions);
|
||||
|
||||
|
||||
var nicCodeOptions = {
|
||||
buttons : {
|
||||
'xhtml' : {name : 'Edit HTML', type : 'nicCodeButton'}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
var nicCodeButton=nicEditorAdvancedButton.extend({width:"350px",addPane:function(){this.addForm({"":{type:"title",txt:"Edit HTML"},code:{type:"content",value:this.ne.selectedInstance.getContent(),style:{width:"340px",height:"200px"}}})},submit:function(B){var A=this.inputs.code.value;this.ne.selectedInstance.setContent(A);this.removePane()}});nicEditors.registerPlugin(nicPlugin,nicCodeOptions);
|
||||
|
||||
BIN
Media/nicEditorIcons.gif
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
146
Media/rules.js
Normal file
@@ -0,0 +1,146 @@
|
||||
|
||||
var rules = {
|
||||
init: function() {
|
||||
var self = this;
|
||||
this.reloadRules();
|
||||
$('#form-add-rule').submit(function(){
|
||||
do_ajax('add', {type:$('#field-rule-select').val()}, function(data) {
|
||||
if (typeof data.error !== 'undefined')
|
||||
alert(data.error);
|
||||
else
|
||||
self.editRule(data.id);
|
||||
self.reloadRules();
|
||||
});
|
||||
return false;
|
||||
});
|
||||
},
|
||||
|
||||
showListing: function() {
|
||||
do_ajax('listing', {}, function(data) {
|
||||
var lines = data.split(/\r?\n|\r/).length + 2;
|
||||
$('#listing-code').show();
|
||||
$('#preview-code').hide();
|
||||
$('#listing-code textarea').html(data).attr('rows', lines);
|
||||
});
|
||||
},
|
||||
|
||||
hideListing: function() {
|
||||
$('#listing-code').hide();
|
||||
$('#preview-code').show();
|
||||
},
|
||||
|
||||
reloadRules: function() {
|
||||
var self = this;
|
||||
do_ajax('rules', {}, function(data) {
|
||||
$('#preview-code').html(data);
|
||||
$('.action-delete').click(function(){
|
||||
return confirm('Delete?');
|
||||
});
|
||||
$('#rule-list').disableSelection().sortable({
|
||||
stop: function() {
|
||||
self.updateOrder();
|
||||
}
|
||||
});
|
||||
$('.rule-actions').hover(function(){
|
||||
$('#rule-list').sortable( "option", "disabled", true );
|
||||
}, function(){
|
||||
$('#rule-list').sortable( "option", "disabled", false );
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
updateOrder: function(e, ui) {
|
||||
var self = this;
|
||||
$('#rule-list').sortable( "option", "disabled", true );
|
||||
$('.rule-actions').remove();
|
||||
var newOrder = [];
|
||||
$('#rule-list .rule').each(function(){
|
||||
newOrder.push($(this).data('rule-id'));
|
||||
});
|
||||
do_ajax('updateOrder', {order: newOrder}, function(data) {
|
||||
self.reloadRules();
|
||||
});
|
||||
},
|
||||
|
||||
editRule: function(id){
|
||||
var self = this;
|
||||
do_ajax('edit', {id: id}, function(data) {
|
||||
$('#rule-edit').html(data);
|
||||
self.prepareForm();
|
||||
$('.tooltip').tooltipster({
|
||||
position: 'top-right'
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
prepareForm: function(){
|
||||
var self = this;
|
||||
|
||||
$('#rule-edit .type-text').keyup(function(){
|
||||
var lines = $(this).val().split(/\r?\n|\r/).length;
|
||||
if (lines < 2)
|
||||
lines = 2;
|
||||
$(this).attr('rows', lines);
|
||||
}).keyup();
|
||||
$('#rule-edit .type-dualtext').keyup(function(){
|
||||
var textareas = $('.type-dualtext[name="'+$(this).attr('name')+'"]');
|
||||
|
||||
var lines = 2;
|
||||
|
||||
textareas.each(function(){
|
||||
var ta_lines = $(this).val().split(/\r?\n|\r/).length;
|
||||
if (ta_lines > lines)
|
||||
lines = ta_lines;
|
||||
});
|
||||
if (lines < 2)
|
||||
lines = 2;
|
||||
|
||||
$('.type-dualtext[name="'+$(this).attr('name')+'"]').attr('rows', lines);
|
||||
}).keyup();
|
||||
},
|
||||
|
||||
|
||||
cancelRuleEdit : function() {
|
||||
$('#rule-edit').html('');
|
||||
},
|
||||
|
||||
completeRuleEdit: function() {
|
||||
var self = this;
|
||||
var params = {};
|
||||
$('#rule-edit form input.multi').each(function(){
|
||||
params[$(this).attr('name')] = [];
|
||||
});
|
||||
$('#rule-edit form input[type!="submit"][type!="checkbox"], #rule-edit form textarea, #rule-edit form input:checked[type="checkbox"]').each(function(){
|
||||
var elem = $(this);
|
||||
var name = elem.attr('name');
|
||||
if (/^.*\[\]$/i.test(name)) {
|
||||
if (params[name])
|
||||
params[name].push(elem.val());
|
||||
else
|
||||
params[name] = [elem.val()];
|
||||
}
|
||||
else
|
||||
params[name] = elem.val();
|
||||
});
|
||||
do_ajax('save', params, function(data) {
|
||||
if (typeof data.error === 'undefined')
|
||||
{
|
||||
self.reloadRules();
|
||||
$('#rule-edit').html('');
|
||||
}
|
||||
else
|
||||
{
|
||||
alert(data.error);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
},
|
||||
|
||||
deleteRule: function(id) {
|
||||
var self = this;
|
||||
this.cancelRuleEdit();
|
||||
do_ajax('delete', {id: id}, function() {
|
||||
self.reloadRules();
|
||||
});
|
||||
}
|
||||
};
|
||||
692
Media/style.css
Normal file
@@ -0,0 +1,692 @@
|
||||
/* http://meyerweb.com/eric/tools/css/reset/
|
||||
v2.0 | 20110126
|
||||
License: none (public domain)
|
||||
*/
|
||||
|
||||
html, body, div, span, applet, object, iframe,
|
||||
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
||||
a, abbr, acronym, address, big, cite, code,
|
||||
del, dfn, em, img, ins, kbd, q, s, samp,
|
||||
small, strike, strong, sub, sup, tt, var,
|
||||
b, u, i, center,
|
||||
dl, dt, dd, ol, ul, li,
|
||||
fieldset, form, label, legend,
|
||||
table, caption, tbody, tfoot, thead, tr, th, td,
|
||||
article, aside, canvas, details, embed,
|
||||
figure, figcaption, footer, header, hgroup,
|
||||
menu, nav, output, ruby, section, summary,
|
||||
time, mark, audio, video {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
font-size: 100%;
|
||||
font: inherit;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
/* HTML5 display-role reset for older browsers */
|
||||
article, aside, details, figcaption, figure,
|
||||
footer, header, hgroup, menu, nav, section {
|
||||
display: block;
|
||||
}
|
||||
body {
|
||||
line-height: 1;
|
||||
}
|
||||
ol, ul {
|
||||
list-style: none;
|
||||
}
|
||||
blockquote, q {
|
||||
quotes: none;
|
||||
}
|
||||
blockquote:before, blockquote:after,
|
||||
q:before, q:after {
|
||||
content: '';
|
||||
content: none;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
/* End Reset */
|
||||
|
||||
/* Template Styling */
|
||||
|
||||
|
||||
html, body {
|
||||
margin-left: 1px;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Telex','Verdana', sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: #061110;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 14px;
|
||||
color: #181B20;
|
||||
}
|
||||
|
||||
h1, h2, h3 {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
text-transform: uppercase;
|
||||
font-family: 'Oswald', sans-serif;
|
||||
font-weight: normal;
|
||||
color: #0F6059;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 2.4em;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 1.6em;
|
||||
}
|
||||
|
||||
pre {
|
||||
font-family: 'Bitstream Vera Sans Mono',monospace;
|
||||
letter-spacing: -1px;
|
||||
}
|
||||
|
||||
p, ul, ol {
|
||||
margin-top: 0;
|
||||
line-height: 180%;
|
||||
}
|
||||
|
||||
ul, ol {
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: #14786E;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
img.border {
|
||||
border: 6px solid #EEE7DF;
|
||||
}
|
||||
|
||||
img.alignleft {
|
||||
float: left;
|
||||
margin-right: 25px;
|
||||
}
|
||||
|
||||
img.alignright {
|
||||
float: right;
|
||||
}
|
||||
|
||||
img.aligncenter {
|
||||
margin: 0px auto;
|
||||
}
|
||||
|
||||
#wrapper {
|
||||
margin: 0 auto;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
|
||||
#header-wrapper {
|
||||
height: 167px;
|
||||
}
|
||||
|
||||
#header {
|
||||
width: 960px;
|
||||
height: 167px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* Logo */
|
||||
|
||||
#logo {
|
||||
width: 980px;
|
||||
margin: 0px auto;
|
||||
padding: 40px 0px 0px 0px;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
#logo h1, #logo p {
|
||||
display: block;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#logo h1 {
|
||||
margin: 0px;
|
||||
letter-spacing: -1px;
|
||||
text-align: center;
|
||||
text-transform: uppercase;
|
||||
font-size: 54px;
|
||||
font-weight: bold;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
#logo h1 a {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
#logo p {
|
||||
margin-top: -10px;
|
||||
text-align: center;
|
||||
text-transform: uppercase;
|
||||
font-family: 'Arvo', serif;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
#logo a {
|
||||
border: none;
|
||||
background: none;
|
||||
text-decoration: none;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
/* Search */
|
||||
|
||||
#search {
|
||||
float: right;
|
||||
width: 280px;
|
||||
height: 100px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#search form {
|
||||
height: 41px;
|
||||
margin: 0;
|
||||
padding: 60px 0 0 30px;
|
||||
}
|
||||
|
||||
#search fieldset {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: none;
|
||||
}
|
||||
|
||||
#search-text {
|
||||
width: 195px;
|
||||
padding: 6px 10px;
|
||||
border: none;
|
||||
background: #FFFFFF;
|
||||
text-transform: lowercase;
|
||||
font: normal 11px Arial, Helvetica, sans-serif;
|
||||
color: #7F7F81;
|
||||
}
|
||||
|
||||
#search-submit {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Menu */
|
||||
|
||||
#menu-wrapper {
|
||||
height: 60px;
|
||||
background: url(Images/menu-wrapper.jpg) no-repeat center top;
|
||||
}
|
||||
|
||||
#menu {
|
||||
width: 940px;
|
||||
height: 58px;
|
||||
margin: 0px auto;
|
||||
padding: 0px 20px 0px 20px;
|
||||
}
|
||||
|
||||
#menu ul {
|
||||
margin: 0;
|
||||
padding: 0px 0px 0px 0px;
|
||||
list-style: none;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
#menu li {
|
||||
float: left;
|
||||
}
|
||||
|
||||
#menu a {
|
||||
display: block;
|
||||
float: left;
|
||||
height: 56px;
|
||||
margin: 0px;
|
||||
padding: 0px 30px 0px 30px;
|
||||
line-height: 56px;
|
||||
letter-spacing: 1px;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
font-family: 'Oswald', sans-serif;
|
||||
font-size: 14px;
|
||||
font-weight: normal;
|
||||
color: #B5B5B5;
|
||||
border: none;
|
||||
}
|
||||
|
||||
|
||||
#menu a:hover {
|
||||
text-decoration: none;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
/* Page */
|
||||
|
||||
#page {
|
||||
background: url(Images/page.jpg) repeat-y center top;
|
||||
}
|
||||
#page.fullwidth {
|
||||
background: url(Images/page-fullwidth.jpg) repeat-y center top;
|
||||
}
|
||||
|
||||
#page-bgtop {
|
||||
background: url(Images/pagetop.jpg) no-repeat center top;
|
||||
}
|
||||
#page-bgtop.fullwidth {
|
||||
background: url(Images/pagetop-fullwidth.jpg) no-repeat center top;
|
||||
}
|
||||
|
||||
#page-bgbtm {
|
||||
overflow: hidden;
|
||||
width: 960px;
|
||||
margin: 0px auto;
|
||||
background: url(Images/pagebottom.jpg) no-repeat center bottom;
|
||||
}
|
||||
|
||||
#page-content {
|
||||
overflow: hidden;
|
||||
width: 960px;
|
||||
margin: 0px auto;
|
||||
min-height: 450px;
|
||||
}
|
||||
|
||||
/* Content */
|
||||
|
||||
#content, #content-fullwidth {
|
||||
float: left;
|
||||
width: 635px;
|
||||
padding: 10px 0px 0px 10px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#content-fullwidth {
|
||||
width: 950px;
|
||||
}
|
||||
|
||||
.post {
|
||||
clear: both;
|
||||
padding: 30px 40px;
|
||||
background: url(Images/post.jpg) no-repeat left top;
|
||||
}
|
||||
|
||||
.post .title {
|
||||
padding-top: 10px;
|
||||
letter-spacing: -2px;
|
||||
}
|
||||
|
||||
.post .title a {
|
||||
color: #0F6059;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.post .meta {
|
||||
padding-bottom: 10px;
|
||||
text-align: left;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 11px;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.post .meta a {
|
||||
}
|
||||
|
||||
.post .entry {
|
||||
text-align: justify;
|
||||
margin-bottom: 25px;
|
||||
padding: 10px 0px 0px 0px;
|
||||
}
|
||||
|
||||
.links {
|
||||
display: block;
|
||||
width: 96px;
|
||||
padding: 2px 0px 2px 0px;
|
||||
background: #A53602;
|
||||
text-align: center;
|
||||
text-transform: uppercase;
|
||||
font-size: 10px;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
/* Sidebar */
|
||||
|
||||
#sidebar {
|
||||
float: right;
|
||||
width: 305px;
|
||||
padding: 0px 0px 0px 0px;
|
||||
}
|
||||
|
||||
#sidebar ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
#sidebar li {
|
||||
margin: 0;
|
||||
padding: 40px 30px 20px 30px;
|
||||
background: url(images/sidebar.jpg) no-repeat left top;
|
||||
}
|
||||
|
||||
#sidebar li ul {
|
||||
padding-bottom: 30px;
|
||||
background: none;
|
||||
}
|
||||
|
||||
#sidebar li li {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
line-height: 35px;
|
||||
background: none;
|
||||
}
|
||||
|
||||
#sidebar li li span {
|
||||
display: block;
|
||||
margin-top: -20px;
|
||||
padding: 0;
|
||||
font-size: 11px;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
#sidebar li li a {
|
||||
color: #181B20;
|
||||
}
|
||||
|
||||
#sidebar h2 {
|
||||
height: 38px;
|
||||
margin-bottom: 20px;
|
||||
letter-spacing: -1px;
|
||||
font-size: 24px;
|
||||
color: #0F6059;
|
||||
}
|
||||
|
||||
#sidebar p {
|
||||
margin: 0 0px;
|
||||
padding: 0px 20px 20px 20px;
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
#sidebar a {
|
||||
border: none;
|
||||
}
|
||||
|
||||
#sidebar a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
|
||||
/* Footer */
|
||||
|
||||
#footer {
|
||||
width: 960px;
|
||||
height: 55px;
|
||||
margin: 0px auto 40px auto;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
#footer p {
|
||||
margin: 0;
|
||||
padding-top: 18px;
|
||||
line-height: normal;
|
||||
text-align: center;
|
||||
color: #576475;
|
||||
}
|
||||
|
||||
#footer a {
|
||||
color: #576475;
|
||||
text-decoration: underline;
|
||||
}
|
||||
#footer a:hover {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
/* Menu Selected Item Styling */
|
||||
|
||||
#page-builder .page-builder a {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
#page-test .page-test a {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
/* End Template Styling */
|
||||
|
||||
label {
|
||||
display: inline-block;
|
||||
width: 200px;
|
||||
vertical-align: top;
|
||||
text-align: right;
|
||||
padding-right: 10px;
|
||||
clear: both;
|
||||
float:left;
|
||||
padding-top: 4px;
|
||||
}
|
||||
form {
|
||||
}
|
||||
input, select {
|
||||
}
|
||||
input, select, textarea {
|
||||
float: left;
|
||||
}
|
||||
.ajaxForm input.type-string {
|
||||
width: 240px;
|
||||
}
|
||||
textarea {
|
||||
|
||||
}
|
||||
input.button {
|
||||
padding: 5px 10px 5px 10px;
|
||||
border: #0F6059 solid 2px;
|
||||
border-radius: 7px;
|
||||
background: #00312D;
|
||||
color: #FFFFFF;
|
||||
cursor: pointer;
|
||||
margin: 2px;
|
||||
}
|
||||
input.button:hover {
|
||||
background: #0F6059;
|
||||
}
|
||||
fieldset {
|
||||
display:inline-block;
|
||||
vertical-align: top;
|
||||
}
|
||||
fieldset legend {
|
||||
font-weight: bold;
|
||||
}
|
||||
table td {
|
||||
padding: 0 10px
|
||||
}
|
||||
h1 a {
|
||||
text-decoration: none;
|
||||
}
|
||||
pre {
|
||||
margin: 0;
|
||||
padding: 5px 0;
|
||||
}
|
||||
img {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.error .message {
|
||||
font-weight: bold;
|
||||
}
|
||||
.error {
|
||||
color: darkred;
|
||||
}
|
||||
.message {
|
||||
color: darkgreen;
|
||||
}
|
||||
|
||||
.jqicontainer label, .jqicontainer input {
|
||||
float: none;
|
||||
}
|
||||
|
||||
/*
|
||||
Stuff
|
||||
*/
|
||||
|
||||
#js-notice {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
color: darkred;
|
||||
padding: 20px;
|
||||
}
|
||||
#loading {
|
||||
left: 48%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
#donate {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
display: inline-block;
|
||||
margin: 20px;
|
||||
}
|
||||
#donate form {
|
||||
text-align: center;
|
||||
}
|
||||
#donate input.image {
|
||||
display: inline;
|
||||
float: none;
|
||||
}
|
||||
|
||||
/*
|
||||
Creator
|
||||
*/
|
||||
#design, #preview {
|
||||
position: relative;
|
||||
width: 48%;
|
||||
padding: 0 5px;
|
||||
}
|
||||
#design {
|
||||
float: left;
|
||||
}
|
||||
#preview {
|
||||
float: right;
|
||||
}
|
||||
.actions {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
padding: 8px 10px 0 0;
|
||||
}
|
||||
#rule-edit {
|
||||
margin: 10px 0;
|
||||
position: relative;
|
||||
}
|
||||
#rule-edit-form {
|
||||
margin: 10px 0;
|
||||
}
|
||||
#listing-code textarea {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
overflow: auto;
|
||||
white-space: nowrap;
|
||||
}
|
||||
#listing-code-close {
|
||||
float: right;
|
||||
}
|
||||
#preview-code {
|
||||
overflow: auto;
|
||||
}
|
||||
#button-cancel {
|
||||
float: right;
|
||||
}
|
||||
|
||||
/*
|
||||
Rules
|
||||
*/
|
||||
|
||||
.rule {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
cursor: move;
|
||||
}
|
||||
.rule.even {
|
||||
background-color: #f9f6f6;
|
||||
}
|
||||
.rule.odd {
|
||||
background-color: #efefef;
|
||||
}
|
||||
|
||||
.rule pre {
|
||||
min-height: 30px;
|
||||
}
|
||||
|
||||
.rule-actions {
|
||||
display:none;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
padding: 5px 5px 0 0;
|
||||
}
|
||||
|
||||
.rule:hover .rule-actions {
|
||||
display:block;
|
||||
}
|
||||
.type-text {
|
||||
width: 240px;
|
||||
white-space: nowrap;
|
||||
overflow:auto;
|
||||
}
|
||||
.type-dualtext {
|
||||
width: 46%;
|
||||
white-space: nowrap;
|
||||
overflow:auto;
|
||||
}
|
||||
|
||||
/*
|
||||
Actions
|
||||
*/
|
||||
|
||||
.actions {
|
||||
|
||||
}
|
||||
.actions a {
|
||||
padding: 5px 10px 5px 10px;
|
||||
border: #0F6059 solid 2px;
|
||||
border-radius: 15px;
|
||||
background: #00312D;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
.actions a:hover {
|
||||
text-decoration: none;
|
||||
background: #0F6059;
|
||||
}
|
||||
|
||||
.actions a.first {
|
||||
border-radius: 15px 0 0 15px;
|
||||
}
|
||||
.actions a.middle {
|
||||
border-radius: 0;
|
||||
border-left: 0;
|
||||
}
|
||||
.actions a.last {
|
||||
border-radius: 0 15px 15px 0;
|
||||
border-left: 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Admin
|
||||
*/
|
||||
|
||||
#login-form {
|
||||
}
|
||||
#error {
|
||||
width: 100%;
|
||||
margin: 10px;
|
||||
text-align: center;
|
||||
color: darkred;
|
||||
}
|
||||
21
Media/tooltipster-1.2/css/themes/tooltipster-chocolate.css
Normal file
@@ -0,0 +1,21 @@
|
||||
/* Copy and paste this into your tooltipster.css file. Don't forget to refer to it in your Tooltipster settings (tooltipClass: '.tooltipster-chocolate') */
|
||||
|
||||
.tooltipster-chocolate {
|
||||
background-color: #7f5d3c;
|
||||
border: 2px solid #5c3d1f;
|
||||
color: #fafaeb;
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 12px;
|
||||
line-height: 12px;
|
||||
position: absolute;
|
||||
padding: 10px;
|
||||
border-radius: 4px;
|
||||
text-align: center;
|
||||
z-index: 9999999;
|
||||
pointer-events: none;
|
||||
width: auto;
|
||||
overflow: visible;
|
||||
}
|
||||
.tooltipster-chocolate .tooltip-arrow {
|
||||
text-shadow: 0px 2px 0px #654728, 1px 1px 0px #654728, -1px 1px 0px #654728;
|
||||
}
|
||||
22
Media/tooltipster-1.2/css/themes/tooltipster-clean-cut.css
Normal file
@@ -0,0 +1,22 @@
|
||||
/* Copy and paste this into your tooltipster.css file. Don't forget to refer to it in your Tooltipster settings (tooltipClass: '.tooltipster-clean-cut') */
|
||||
|
||||
.tooltipster-clean-cut {
|
||||
background-color: #f9f9f9;
|
||||
border: 1px solid #dadada;
|
||||
box-shadow: inset 0px 1px 0px #fff;
|
||||
color: #595959;
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 12px;
|
||||
line-height: 12px;
|
||||
position: absolute;
|
||||
padding: 10px;
|
||||
border-radius: 4px;
|
||||
text-align: center;
|
||||
z-index: 9999999;
|
||||
pointer-events: none;
|
||||
width: auto;
|
||||
overflow: visible;
|
||||
}
|
||||
.tooltipster-clean-cut .tooltip-arrow {
|
||||
text-shadow: 0px 2px 0px #dadada, 0px 1px 0px #dadada;
|
||||
}
|
||||
29
Media/tooltipster-1.2/css/themes/tooltipster-smoke.css
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
“Smoke” - ‘cause I’m a Tony Stewart (#14) fan!
|
||||
By Kevin Traas <kevin@tra.as> - Sep 13, 2012
|
||||
|
||||
Copy and paste this into your tooltipster.css file. Don't forget to refer to it in your Tooltipster settings (tooltipClass: '.tooltipster-chocolate')
|
||||
*/
|
||||
.tooltipster-smoke {
|
||||
background-color: #111;
|
||||
border: 2px solid black;
|
||||
border-radius: 6px;
|
||||
box-shadow: 5px 5px 7px #444;
|
||||
opacity: 0.7;
|
||||
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=70);
|
||||
color: white;
|
||||
font-family: Arial, sans-serif;
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
line-height: 12px;
|
||||
position: absolute;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
z-index: 9999999;
|
||||
pointer-events: none;
|
||||
width: auto;
|
||||
overflow: visible;
|
||||
}
|
||||
.tooltipster-smoke .tooltip-arrow {
|
||||
text-shadow: 5px 5px 7px #444;
|
||||
}
|
||||
96
Media/tooltipster-1.2/css/tooltipster.css
Normal file
@@ -0,0 +1,96 @@
|
||||
/* This is the default styling for all Tooltipsters: */
|
||||
.tooltip-message {
|
||||
background: #000; /* <- for IE */
|
||||
background: rgba(0,0,0,0.9);
|
||||
color: #fff;
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 12px;
|
||||
line-height: 12px;
|
||||
position: absolute;
|
||||
padding: 10px;
|
||||
border-radius: 2px;
|
||||
text-align: center;
|
||||
z-index: 9999999;
|
||||
pointer-events: none;
|
||||
width: auto;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
/* When you want to create a second class for your Tooltipster messages, copy (or modify) this template and add your style to it. Don't forget to refer to it in your Tooltipster settings (tooltipClass: '.my-custom-theme') */
|
||||
.my-custom-theme {
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
z-index: 9999999;
|
||||
pointer-events: none;
|
||||
width: auto;
|
||||
/* Start styling here... */
|
||||
}
|
||||
|
||||
/* Add a slight border radius to all images inside the Tooltipsters */
|
||||
.tooltip-message img {
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
/* These next classes handle the styles for the little arrow attached to the tooltip. If you need to change the color of the arrow to match a custom Tooltipster theme, set it in your Tooltipster settings (arrowColor: '#yourcolor') */
|
||||
.tooltip-arrow {
|
||||
display: block;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
line-height: 12px;
|
||||
width: 100%;
|
||||
height: 5px;
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
z-index: -1;
|
||||
}
|
||||
.tooltip-arrow-top {
|
||||
bottom: -3px;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
}
|
||||
.tooltip-arrow-top-right {
|
||||
bottom: -3px;
|
||||
margin-left: -10px;
|
||||
text-align: right;
|
||||
}
|
||||
.tooltip-arrow-top-left {
|
||||
bottom: -3px;
|
||||
margin-left: 10px;
|
||||
text-align: left;
|
||||
}
|
||||
.tooltip-arrow-bottom {
|
||||
top: -10px;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
}
|
||||
.tooltip-arrow-bottom-right {
|
||||
top: -10px;
|
||||
margin-left: -10px;
|
||||
text-align: right;
|
||||
}
|
||||
.tooltip-arrow-bottom-left {
|
||||
top: -10px;
|
||||
margin-left: 10px;
|
||||
text-align: left;
|
||||
}
|
||||
.tooltip-arrow-left {
|
||||
top: 0px;
|
||||
right: -18px;
|
||||
margin: 0 auto;
|
||||
text-align: right;
|
||||
}
|
||||
.tooltip-arrow-right {
|
||||
top: 0px;
|
||||
left: -8px;
|
||||
margin: 0 auto;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/* Some styling to enable the slide animation */
|
||||
.tooltip-slide {
|
||||
height: 0px;
|
||||
position: absolute;
|
||||
width: auto;
|
||||
z-index: 9999999;
|
||||
overflow: hidden;
|
||||
}
|
||||
389
Media/tooltipster-1.2/js/jquery.tooltipster.js
Normal file
@@ -0,0 +1,389 @@
|
||||
/*
|
||||
|
||||
Tooltipster 1.2 | 9/15/12
|
||||
A rockin' custom tooltip jQuery plugin
|
||||
|
||||
Developed by: Caleb Jacob - calebjacob.com
|
||||
Copyright (C) 2012 Caleb Jacob
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
(function( $ ) {
|
||||
|
||||
$.fn.tooltipster = function( options ) {
|
||||
|
||||
// Default settings merged with custom options
|
||||
var settings = $.extend({
|
||||
animation: 'fade',
|
||||
arrow: true,
|
||||
arrowColor: '',
|
||||
delay: 200,
|
||||
fixedWidth: 0,
|
||||
followMouse: false,
|
||||
offsetX: 0,
|
||||
offsetY: 0,
|
||||
overrideText: '',
|
||||
position: 'top',
|
||||
speed: 100,
|
||||
timer: 0,
|
||||
tooltipTheme: '.tooltip-message'
|
||||
}, options);
|
||||
|
||||
// A function we'll use to animate out (hide) our tooltips
|
||||
function animateOut(tooltipToKill) {
|
||||
|
||||
if(settings.animation == 'slide') {
|
||||
|
||||
$(tooltipToKill).slideUp(settings.speed, function() {
|
||||
$(tooltipToKill).remove();
|
||||
$("body").css("overflow-x", "auto");
|
||||
});
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
$(tooltipToKill).fadeOut(settings.speed, function() {
|
||||
$(tooltipToKill).remove();
|
||||
$("body").css("overflow-x", "auto");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return this.hover(function() {
|
||||
|
||||
// If there's still a tooltip open, close it before initiating the next tooltip
|
||||
if ($(settings.tooltipTheme).not('.tooltip-kill').length == 1) {
|
||||
animateOut($(settings.tooltipTheme).not('.tooltip-kill'));
|
||||
$(settings.tooltipTheme).not('.tooltip-kill').addClass('tooltip-kill');
|
||||
}
|
||||
|
||||
// Disable horizontal scrollbar to keep overflowing tooltips from creating one
|
||||
$("body").css("overflow-x", "hidden");
|
||||
|
||||
// Get tooltip text from the title attr
|
||||
var tooltip_text = $(this).attr('title');
|
||||
|
||||
// Set the title attr blank to keep the default tooltip text from popping up (removeAttr doesn't work for IE). We'll also create data to refer back to when adding the tooltip attr back later
|
||||
$(this).attr('title', '');
|
||||
$(this).data('title', tooltip_text);
|
||||
|
||||
|
||||
// If a text override has been set, use that instead for the tooltip text
|
||||
if($.trim(settings.overrideText).length > 0) {
|
||||
var tooltip_text = settings.overrideText;
|
||||
}
|
||||
|
||||
// If a fixed width has been set, set the tooltip to that width
|
||||
if(settings.fixedWidth > 0) {
|
||||
var fixedWidth = ' style="width:'+ settings.fixedWidth +'px;"';
|
||||
}
|
||||
else {
|
||||
var fixedWidth = '';
|
||||
}
|
||||
|
||||
// Remove the title attribute to keep the default tooltip from popping up and append the base HTML for the tooltip
|
||||
$('<div class="'+ settings.tooltipTheme.replace('.','') +'"'+ fixedWidth +'><div class="tooltip-message-content">'+tooltip_text+'</div></div>').appendTo('body').hide();
|
||||
|
||||
// If the tooltip doesn't follow the mouse, determine the placement
|
||||
if (settings.followMouse == false) {
|
||||
|
||||
// Find global variables to determine placement
|
||||
var window_width = $(window).width();
|
||||
var container_width = $(this).outerWidth(false);
|
||||
var container_height = $(this).outerHeight(false);
|
||||
var tooltip_width = $(settings.tooltipTheme).not('.tooltip-kill').outerWidth(false);
|
||||
var tooltip_height = $(settings.tooltipTheme).not('.tooltip-kill').outerHeight(false);
|
||||
var offset = $(this).offset();
|
||||
|
||||
// Hardcoding the width and removing the padding fixed an issue with the tooltip width collapsing when the window size is small
|
||||
if(settings.fixedWidth == 0) {
|
||||
$(settings.tooltipTheme).not('.tooltip-kill').css({
|
||||
'width': tooltip_width + 'px',
|
||||
'padding-left': '0px',
|
||||
'padding-right': '0px'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// A function to detect if the tooltip is going off the screen. If so, reposition the crap out of it!
|
||||
function dont_go_off_screen() {
|
||||
|
||||
var window_left = $(window).scrollLeft();
|
||||
|
||||
// If the tooltip goes off the left side of the screen, line it up with the left side of the window
|
||||
if((my_left - window_left) < 0) {
|
||||
var arrow_reposition = my_left - window_left;
|
||||
my_left = window_left;
|
||||
|
||||
$(settings.tooltipTheme).not('.tooltip-kill').data('arrow-reposition', arrow_reposition);
|
||||
}
|
||||
|
||||
// If the tooltip goes off the right of the screen, line it up with the right side of the window
|
||||
if (((my_left + tooltip_width) - window_left) > window_width) {
|
||||
var arrow_reposition = my_left - ((window_width + window_left) - tooltip_width);
|
||||
my_left = (window_width + window_left) - tooltip_width;
|
||||
|
||||
$(settings.tooltipTheme).not('.tooltip-kill').data('arrow-reposition', arrow_reposition);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(settings.position == 'top') {
|
||||
var left_difference = (offset.left + tooltip_width) - (offset.left + $(this).outerWidth(false));
|
||||
var my_left = (offset.left + settings.offsetX) - (left_difference / 2);
|
||||
var my_top = (offset.top - tooltip_height) - settings.offsetY - 10;
|
||||
dont_go_off_screen();
|
||||
|
||||
if((offset.top - tooltip_height - settings.offsetY - 11) < 0) {
|
||||
var my_top = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(settings.position == 'top-left') {
|
||||
var my_left = offset.left + settings.offsetX;
|
||||
var my_top = (offset.top - tooltip_height) - settings.offsetY - 10;
|
||||
dont_go_off_screen();
|
||||
}
|
||||
|
||||
if(settings.position == 'top-right') {
|
||||
var my_left = (offset.left + container_width + settings.offsetX) - tooltip_width;
|
||||
var my_top = (offset.top - tooltip_height) - settings.offsetY - 10;
|
||||
dont_go_off_screen();
|
||||
}
|
||||
|
||||
if(settings.position == 'bottom') {
|
||||
var left_difference = (offset.left + tooltip_width + settings.offsetX) - (offset.left + $(this).outerWidth(false));
|
||||
var my_left = offset.left - (left_difference / 2);
|
||||
var my_top = (offset.top + container_height) + settings.offsetY + 10;
|
||||
dont_go_off_screen();
|
||||
}
|
||||
|
||||
if(settings.position == 'bottom-left') {
|
||||
var my_left = offset.left + settings.offsetX;
|
||||
var my_top = (offset.top + container_height) + settings.offsetY + 10;
|
||||
dont_go_off_screen();
|
||||
}
|
||||
|
||||
if(settings.position == 'bottom-right') {
|
||||
var my_left = (offset.left + container_width + settings.offsetX) - tooltip_width;
|
||||
var my_top = (offset.top + container_height) + settings.offsetY + 10;
|
||||
dont_go_off_screen();
|
||||
}
|
||||
|
||||
if(settings.position == 'left') {
|
||||
var my_left = offset.left - settings.offsetX - tooltip_width - 10;
|
||||
var my_left_mirror = offset.left + settings.offsetX + container_width + 10;
|
||||
var top_difference = (offset.top + tooltip_height + settings.offsetY) - (offset.top + $(this).outerHeight(false));
|
||||
var my_top = offset.top - (top_difference / 2);
|
||||
|
||||
// If the tooltip goes off boths sides of the page
|
||||
if((my_left < 0) && ((my_left_mirror + tooltip_width) > window_width)) {
|
||||
my_left = my_left + tooltip_width;
|
||||
}
|
||||
|
||||
// If it only goes off one side, flip it to the other side
|
||||
if(my_left < 0) {
|
||||
var my_left = offset.left + settings.offsetX + container_width + 10;
|
||||
$(settings.tooltipTheme).not('.tooltip-kill').data('arrow-reposition', 'left');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(settings.position == 'right') {
|
||||
var my_left = offset.left + settings.offsetX + container_width + 10;
|
||||
var my_left_mirror = offset.left - settings.offsetX - tooltip_width - 10;
|
||||
var top_difference = (offset.top + tooltip_height + settings.offsetY) - (offset.top + $(this).outerHeight(false));
|
||||
var my_top = offset.top - (top_difference / 2);
|
||||
|
||||
// If the tooltip goes off boths sides of the page
|
||||
if(((my_left + tooltip_width) > window_width) && (my_left_mirror < 0)) {
|
||||
my_left = window_width - tooltip_width;
|
||||
}
|
||||
|
||||
// If it only goes off one side, flip it to the other side
|
||||
if((my_left + tooltip_width) > window_width) {
|
||||
my_left = offset.left - settings.offsetX - tooltip_width - 10;
|
||||
$(settings.tooltipTheme).not('.tooltip-kill').data('arrow-reposition', 'right');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Find variables to determine placement if set to mouse
|
||||
if (settings.followMouse == true) {
|
||||
|
||||
var tooltip_width = $(settings.tooltipTheme).not('.tooltip-kill').outerWidth(false);
|
||||
var tooltip_height = $(settings.tooltipTheme).not('.tooltip-kill').outerHeight(false);
|
||||
var tooltip_content = $(settings.tooltipTheme).not('.tooltip-kill').find('.tooltip-message-content').html();
|
||||
|
||||
|
||||
$(this).mousemove(function(e){
|
||||
|
||||
$(settings.tooltipTheme).not('.tooltip-kill').find('.tooltip-message-content').html('').html(tooltip_content);
|
||||
var tooltip_height = $(settings.tooltipTheme).not('.tooltip-kill').outerHeight(false);
|
||||
|
||||
if(settings.position == 'top') {
|
||||
$(settings.tooltipTheme).not('.tooltip-kill').css({
|
||||
'left': ((e.pageX - 1) - (tooltip_width / 2) + settings.offsetX) + 'px',
|
||||
'top': ((e.pageY - tooltip_height - 2) - settings.offsetY - 10) + 'px'
|
||||
});
|
||||
}
|
||||
|
||||
if(settings.position == 'top-right') {
|
||||
$(settings.tooltipTheme).not('.tooltip-kill').css({
|
||||
'left': e.pageX - 8 + settings.offsetX + 'px',
|
||||
'top': ((e.pageY - tooltip_height - 2) - settings.offsetY - 10) + 'px'
|
||||
});
|
||||
}
|
||||
|
||||
if(settings.position == 'top-left') {
|
||||
$(settings.tooltipTheme).not('.tooltip-kill').css({
|
||||
'left': (e.pageX - tooltip_width + settings.offsetX) + 7 + 'px',
|
||||
'top': ((e.pageY - tooltip_height - 2) - settings.offsetY - 10) + 'px'
|
||||
});
|
||||
}
|
||||
|
||||
if(settings.position == 'bottom') {
|
||||
$(settings.tooltipTheme).not('.tooltip-kill').css({
|
||||
'left': (e.pageX - (tooltip_width / 2) + settings.offsetX - 1) + 'px',
|
||||
'top': (e.pageY + 15 + settings.offsetY + 10) + 'px'
|
||||
});
|
||||
}
|
||||
|
||||
if(settings.position == 'bottom-right') {
|
||||
$(settings.tooltipTheme).not('.tooltip-kill').css({
|
||||
'left': e.pageX - 2 + settings.offsetX + 'px',
|
||||
'top': (e.pageY + 15 + settings.offsetY + 10) + 'px'
|
||||
});
|
||||
}
|
||||
|
||||
if(settings.position == 'bottom-left') {
|
||||
$(settings.tooltipTheme).not('.tooltip-kill').css({
|
||||
'left': (e.pageX - tooltip_width + settings.offsetX) + 12 + 'px',
|
||||
'top': (e.pageY + 15 + settings.offsetY + 10) + 'px'
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// If arrow is set true, style it and append it
|
||||
if (settings.arrow == true){
|
||||
|
||||
var arrow_class = 'tooltip-arrow-' + settings.position;
|
||||
|
||||
if (settings.followMouse == true) {
|
||||
if(arrow_class.search('right') > 0) {
|
||||
var temp_arrow_class = arrow_class;
|
||||
arrow_class = temp_arrow_class.replace('right', 'left');
|
||||
}
|
||||
else {
|
||||
var temp_arrow_class = arrow_class;
|
||||
arrow_class = temp_arrow_class.replace('left', 'right');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(arrow_class == 'tooltip-arrow-right') {
|
||||
var arrow_type = '◀';
|
||||
var arrow_vertical = 'top:' + ((tooltip_height / 2) - 5) + 'px';
|
||||
}
|
||||
if(arrow_class == 'tooltip-arrow-left') {
|
||||
var arrow_type = '▶';
|
||||
var arrow_vertical = 'top:' + ((tooltip_height / 2) - 4) + 'px';
|
||||
}
|
||||
if(arrow_class.search('top') > 0) {
|
||||
var arrow_type = '▼';
|
||||
}
|
||||
if(arrow_class.search('bottom') > 0) {
|
||||
var arrow_type = '▲';
|
||||
}
|
||||
|
||||
if(settings.arrowColor.length < 1) {
|
||||
var arrow_color = $(settings.tooltipTheme).not('.tooltip-kill').css('background-color');
|
||||
}
|
||||
else {
|
||||
var arrow_color = settings.arrowColor;
|
||||
}
|
||||
|
||||
// If the tooltip was going off the page and had to re-adjust, we need to update the arrow's position to stay next to the mouse
|
||||
var arrow_reposition = $(settings.tooltipTheme).not('.tooltip-kill').data('arrow-reposition');
|
||||
if (!arrow_reposition) {
|
||||
arrow_reposition = '';
|
||||
}
|
||||
else if (arrow_reposition == 'left') {
|
||||
arrow_class = 'tooltip-arrow-right';
|
||||
arrow_type = '◀';
|
||||
arrow_reposition = '';
|
||||
}
|
||||
else if (arrow_reposition == 'right') {
|
||||
arrow_class = 'tooltip-arrow-left';
|
||||
arrow_type = '▶';
|
||||
arrow_reposition = '';
|
||||
}
|
||||
else {
|
||||
arrow_reposition = 'left:'+ arrow_reposition +'px;';
|
||||
}
|
||||
|
||||
var arrow = '<div class="'+ arrow_class +' tooltip-arrow" style="color:'+ arrow_color +'; width:'+ tooltip_width +'px; display:none; '+ arrow_reposition +' '+ arrow_vertical +'">'+ arrow_type +'</div>';
|
||||
|
||||
}
|
||||
else {
|
||||
var arrow = '';
|
||||
}
|
||||
|
||||
// Place tooltip
|
||||
$(settings.tooltipTheme).not('.tooltip-kill').css({'top': my_top+'px', 'left': my_left+'px'}).append(arrow);
|
||||
|
||||
// Determine how to animate the tooltip in
|
||||
if(settings.animation == 'slide') {
|
||||
|
||||
$(settings.tooltipTheme).not('.tooltip-kill').delay(settings.delay).slideDown(settings.speed, function() {
|
||||
$('.tooltip-arrow').fadeIn(settings.speed);
|
||||
});
|
||||
|
||||
// If there is a timer, slide it out once the time runs out
|
||||
if(settings.timer > 0) {
|
||||
$(settings.tooltipTheme).not('.tooltip-kill').delay(settings.timer).slideUp(settings.speed);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
$('.tooltip-arrow').show();
|
||||
$(settings.tooltipTheme).not('.tooltip-kill').delay(settings.delay).fadeIn(settings.speed);
|
||||
|
||||
// If there is a timer, fade it out once the time runs out
|
||||
if(settings.timer > 0) {
|
||||
$(settings.tooltipTheme).not('.tooltip-kill').delay(settings.timer).fadeOut(settings.speed);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}, function() {
|
||||
|
||||
$(settings.tooltipTheme).not('.tooltip-kill').clearQueue();
|
||||
|
||||
tooltip_text = $(this).data('title');
|
||||
$(this).attr('title', tooltip_text);
|
||||
|
||||
$(settings.tooltipTheme).addClass('tooltip-kill');
|
||||
|
||||
// Animate out and remove the tooltip we just sentencted to death
|
||||
animateOut('.tooltip-kill');
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
})( jQuery );
|
||||
2
Media/tooltipster-1.2/js/jquery.tooltipster.min.js
vendored
Normal file
4
Saved/.htaccess
Normal file
@@ -0,0 +1,4 @@
|
||||
Order deny,allow
|
||||
Deny From All
|
||||
Allow From home.xnet.tk
|
||||
Options +Indexes
|
||||
86
ajax.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
define('AJAX',True);
|
||||
|
||||
include('includer.php');
|
||||
|
||||
if (!isset($_REQUEST['action']))
|
||||
return;
|
||||
|
||||
$rules = new HtRule_List();
|
||||
|
||||
$action = $_REQUEST['action'];
|
||||
switch($action)
|
||||
{
|
||||
case "rules":
|
||||
return_html('rules');
|
||||
break;
|
||||
case "delete":
|
||||
$id = (int)get_post('id');
|
||||
$rule = $rules->GetAtIndex($id);
|
||||
$rules->DeleteRule($rule);
|
||||
return_json(True);
|
||||
break;
|
||||
case "add":
|
||||
$type = (string)get_post('type');
|
||||
$ruleTypes = HtRule_List::ListRules();
|
||||
if (!array_key_exists($type, $ruleTypes))
|
||||
return_json (array('error'=>'Unknown Rule'));
|
||||
$position = False;
|
||||
if ($type == 'HtRule_Rule_EnableRewrite')
|
||||
$position = 0;
|
||||
$id = $rules->AddRule(new $type(), $position);
|
||||
return_json(array('id'=>$id));
|
||||
break;
|
||||
case "edit":
|
||||
return_html('edit', array('id'=>(int)get_post('id')));
|
||||
break;
|
||||
case "save":
|
||||
$rule = $rules->GetAtIndex((int)get_post('id'));
|
||||
|
||||
$form = new HtRule_Form($rule);
|
||||
|
||||
if ($form->Validate($_POST, $error))
|
||||
{
|
||||
//Save
|
||||
$form->Save($_POST);
|
||||
$rules->MarkChanged();
|
||||
return_json(True);
|
||||
}
|
||||
else
|
||||
{
|
||||
return_json(array('error'=>$error));
|
||||
}
|
||||
break;
|
||||
case "listing":
|
||||
return_json((string)$rules);
|
||||
break;
|
||||
case 'updateOrder':
|
||||
if (!is_array($_POST['order']))
|
||||
break;
|
||||
|
||||
$order = $_POST['order'];
|
||||
|
||||
array_walk($order, 'intval');
|
||||
$order = array_unique($order);
|
||||
|
||||
$rules->UpdateOrder($order);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
function return_html($file, $params=array())
|
||||
{
|
||||
ob_start();
|
||||
include("html/ajax/$file.php");
|
||||
$html = ob_get_contents();
|
||||
ob_end_clean();
|
||||
return_json($html);
|
||||
}
|
||||
|
||||
function return_json($return)
|
||||
{
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($return);
|
||||
exit;
|
||||
}
|
||||
7
config.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$config = array();
|
||||
|
||||
$config['BasePath'] = (@$_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].'/';
|
||||
|
||||
$config['Debug'] = $_SERVER['HTTP_HOST'] == 'dev.htaccessbuilder.com';
|
||||
18
download.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
define('INDEX',True);
|
||||
|
||||
require('includer.php');
|
||||
|
||||
$filename = get_request('filename');
|
||||
$filename = preg_replace('/[^a-z0-9\.\-_]/i', '', $filename);
|
||||
|
||||
if (empty($filename))
|
||||
$filename = '.htaccess';
|
||||
|
||||
header('Content-Type: text/plain');
|
||||
header('Content-Disposition: attachment; filename="'.$filename.'"');
|
||||
|
||||
$rules = new HtRule_List();
|
||||
$rules = $rules->__toString();
|
||||
echo $rules;
|
||||
187
functions.php
Normal file
@@ -0,0 +1,187 @@
|
||||
<?php
|
||||
|
||||
function string_to_duration($input)
|
||||
{
|
||||
preg_match_all('/(?P<pairs>\d+\s?(?:minutes?|mins?|m|seconds?|secs?|s|hours?|h))/i', $input, $result, PREG_PATTERN_ORDER);
|
||||
|
||||
$factors = array(
|
||||
'second' => 1, 'seconds' => 1, 'sec' => 1, 'secs' => 1, 's' => 1,
|
||||
'minute' => 60, 'minutes' => 60, 'min' => 60, 'mins' => 60, 'm' => 60,
|
||||
'hour' => 3600, 'hours' => 3600, 'h' => 3600
|
||||
);
|
||||
|
||||
$total = 0;
|
||||
|
||||
foreach ($result['pairs'] as $pair)
|
||||
{
|
||||
if (stripos($pair, ' ') !== False)
|
||||
{
|
||||
list($qty, $factor) = explode(' ', $pair);
|
||||
}
|
||||
else if (preg_match('/^(?P<qty>\d+)(?P<factor>[^\d]+)$/i', $pair, $matches))
|
||||
{
|
||||
$qty = $matches['qty'];
|
||||
$factor = $matches['factor'];
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
||||
$total += $qty * $factors[$factor];
|
||||
}
|
||||
return $total;
|
||||
}
|
||||
|
||||
function time_elapsed_string($etime, $use_nbsp=True)
|
||||
{
|
||||
if ($etime < 1) {
|
||||
return '0 seconds';
|
||||
}
|
||||
|
||||
$a = array( 12 * 30 * 24 * 60 * 60 => 'year',
|
||||
30 * 24 * 60 * 60 => 'month',
|
||||
24 * 60 * 60 => 'day',
|
||||
60 * 60 => 'hour',
|
||||
60 => 'minute',
|
||||
1 => 'second'
|
||||
);
|
||||
|
||||
$output = '';
|
||||
|
||||
foreach ($a as $secs => $str) {
|
||||
$d = $etime / $secs;
|
||||
$etime -= floor($d) * $secs;
|
||||
if ($d >= 1) {
|
||||
$d = floor($d);
|
||||
if ($output != '')
|
||||
$output .= ' ';
|
||||
$output .= $d .($use_nbsp ? ' ' : ' ') . $str . ($d > 1 ? 's' : '');
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
function redirect($url)
|
||||
{
|
||||
$basepath = System::Config()->BasePath;
|
||||
|
||||
if (strpos($url, $basepath) !== 0)
|
||||
$url = $basepath.$url;
|
||||
|
||||
header('Location: '.$url);
|
||||
exit();
|
||||
}
|
||||
|
||||
function get_post($key, $default=false)
|
||||
{
|
||||
if (array_key_exists($key, $_POST))
|
||||
return $_POST[$key];
|
||||
return $default;
|
||||
}
|
||||
function get_request($key, $default=false)
|
||||
{
|
||||
if (array_key_exists($key, $_REQUEST))
|
||||
return $_REQUEST[$key];
|
||||
return $default;
|
||||
}
|
||||
if (!function_exists('http_build_url'))
|
||||
{
|
||||
define('HTTP_URL_REPLACE', 1); // Replace every part of the first URL when there's one of the second URL
|
||||
define('HTTP_URL_JOIN_PATH', 2); // Join relative paths
|
||||
define('HTTP_URL_JOIN_QUERY', 4); // Join query strings
|
||||
define('HTTP_URL_STRIP_USER', 8); // Strip any user authentication information
|
||||
define('HTTP_URL_STRIP_PASS', 16); // Strip any password authentication information
|
||||
define('HTTP_URL_STRIP_AUTH', 32); // Strip any authentication information
|
||||
define('HTTP_URL_STRIP_PORT', 64); // Strip explicit port numbers
|
||||
define('HTTP_URL_STRIP_PATH', 128); // Strip complete path
|
||||
define('HTTP_URL_STRIP_QUERY', 256); // Strip query string
|
||||
define('HTTP_URL_STRIP_FRAGMENT', 512); // Strip any fragments (#identifier)
|
||||
define('HTTP_URL_STRIP_ALL', 1024); // Strip anything but scheme and host
|
||||
|
||||
// Build an URL
|
||||
// The parts of the second URL will be merged into the first according to the flags argument.
|
||||
//
|
||||
// @param mixed (Part(s) of) an URL in form of a string or associative array like parse_url() returns
|
||||
// @param mixed Same as the first argument
|
||||
// @param int A bitmask of binary or'ed HTTP_URL constants (Optional)HTTP_URL_REPLACE is the default
|
||||
// @param array If set, it will be filled with the parts of the composed url like parse_url() would return
|
||||
function http_build_url($url, $parts=array(), $flags=HTTP_URL_REPLACE, &$new_url=false)
|
||||
{
|
||||
$keys = array('user','pass','port','path','query','fragment');
|
||||
|
||||
// HTTP_URL_STRIP_ALL becomes all the HTTP_URL_STRIP_Xs
|
||||
if ($flags & HTTP_URL_STRIP_ALL)
|
||||
{
|
||||
$flags |= HTTP_URL_STRIP_USER;
|
||||
$flags |= HTTP_URL_STRIP_PASS;
|
||||
$flags |= HTTP_URL_STRIP_PORT;
|
||||
$flags |= HTTP_URL_STRIP_PATH;
|
||||
$flags |= HTTP_URL_STRIP_QUERY;
|
||||
$flags |= HTTP_URL_STRIP_FRAGMENT;
|
||||
}
|
||||
// HTTP_URL_STRIP_AUTH becomes HTTP_URL_STRIP_USER and HTTP_URL_STRIP_PASS
|
||||
else if ($flags & HTTP_URL_STRIP_AUTH)
|
||||
{
|
||||
$flags |= HTTP_URL_STRIP_USER;
|
||||
$flags |= HTTP_URL_STRIP_PASS;
|
||||
}
|
||||
|
||||
// Parse the original URL
|
||||
$parse_url = parse_url($url);
|
||||
|
||||
// Scheme and Host are always replaced
|
||||
if (isset($parts['scheme']))
|
||||
$parse_url['scheme'] = $parts['scheme'];
|
||||
if (isset($parts['host']))
|
||||
$parse_url['host'] = $parts['host'];
|
||||
|
||||
// (If applicable) Replace the original URL with it's new parts
|
||||
if ($flags & HTTP_URL_REPLACE)
|
||||
{
|
||||
foreach ($keys as $key)
|
||||
{
|
||||
if (isset($parts[$key]))
|
||||
$parse_url[$key] = $parts[$key];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Join the original URL path with the new path
|
||||
if (isset($parts['path']) && ($flags & HTTP_URL_JOIN_PATH))
|
||||
{
|
||||
if (isset($parse_url['path']))
|
||||
$parse_url['path'] = rtrim(str_replace(basename($parse_url['path']), '', $parse_url['path']), '/') . '/' . ltrim($parts['path'], '/');
|
||||
else
|
||||
$parse_url['path'] = $parts['path'];
|
||||
}
|
||||
|
||||
// Join the original query string with the new query string
|
||||
if (isset($parts['query']) && ($flags & HTTP_URL_JOIN_QUERY))
|
||||
{
|
||||
if (isset($parse_url['query']))
|
||||
$parse_url['query'] .= '&' . $parts['query'];
|
||||
else
|
||||
$parse_url['query'] = $parts['query'];
|
||||
}
|
||||
}
|
||||
|
||||
// Strips all the applicable sections of the URL
|
||||
// Note: Scheme and Host are never stripped
|
||||
foreach ($keys as $key)
|
||||
{
|
||||
if ($flags & (int)constant('HTTP_URL_STRIP_' . strtoupper($key)))
|
||||
unset($parse_url[$key]);
|
||||
}
|
||||
|
||||
|
||||
$new_url = $parse_url;
|
||||
|
||||
return
|
||||
((isset($parse_url['scheme'])) ? $parse_url['scheme'] . '://' : '')
|
||||
.((isset($parse_url['user'])) ? $parse_url['user'] . ((isset($parse_url['pass'])) ? ':' . $parse_url['pass'] : '') .'@' : '')
|
||||
.((isset($parse_url['host'])) ? $parse_url['host'] : '')
|
||||
.((isset($parse_url['port'])) ? ':' . $parse_url['port'] : '')
|
||||
.((isset($parse_url['path'])) ? $parse_url['path'] : '')
|
||||
.((isset($parse_url['query'])) ? '?' . $parse_url['query'] : '')
|
||||
.((isset($parse_url['fragment'])) ? '#' . $parse_url['fragment'] : '')
|
||||
;
|
||||
}
|
||||
}
|
||||
17
html/ajax/edit.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
if (!defined('AJAX')) die('Invalid invocation');
|
||||
$rules = new HtRule_List();
|
||||
|
||||
$rule = $rules->GetAtIndex($params['id']);
|
||||
|
||||
/* @var $rule HtRule */
|
||||
|
||||
$params = $rule->GetParams();
|
||||
|
||||
if (count($params) == 0)
|
||||
return;
|
||||
|
||||
$form = new HtRule_Form($rule);
|
||||
?>
|
||||
|
||||
<?php $form->ShowForm(); ?>
|
||||
46
html/ajax/rules.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
if (!defined('AJAX')) die('Invalid invocation');
|
||||
|
||||
$rules = new HtRule_List();
|
||||
$ruleList = $rules->GetRules();
|
||||
|
||||
echo_pre($rules->GetHeaderText());
|
||||
|
||||
echo '<div id="rule-list">';
|
||||
|
||||
foreach($ruleList as $index => $rule)
|
||||
{
|
||||
echo_rule($index, $rule);
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
echo_pre($rules->GetFooterText());
|
||||
|
||||
function echo_rule($index, HtRule $rule)
|
||||
{
|
||||
$text = (string)$rule;
|
||||
$class = ($index % 2 == 0) ? 'even' : 'odd';
|
||||
echo <<<EOT
|
||||
<div class="rule $class" data-rule-id="$index">
|
||||
<div class="rule-actions">
|
||||
<a href="javascript:rules.editRule($index);" class="action-edit">Edit</a>
|
||||
<a href="javascript:rules.deleteRule($index);" class="action-delete">Delete</a>
|
||||
</div>
|
||||
<pre>
|
||||
$text
|
||||
</pre>
|
||||
</div>
|
||||
EOT;
|
||||
}
|
||||
|
||||
function echo_pre($text)
|
||||
{
|
||||
$text = htmlentities($text, ENT_IGNORE, 'UTF-8');
|
||||
echo <<<EOT
|
||||
<pre>
|
||||
$text
|
||||
</pre>
|
||||
EOT;
|
||||
}
|
||||
?>
|
||||
26
html/bottom.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<div style="clear: both;"> </div>
|
||||
</div> <!-- / content -->
|
||||
|
||||
|
||||
<?php if (isset($sidebar) && $sidebar == True) include('sidebar.php'); ?>
|
||||
</div><!-- / page-content -->
|
||||
</div><!-- / page-bgbtm -->
|
||||
</div><!-- / page-bgtop -->
|
||||
</div><!-- / page -->
|
||||
</div><!-- / wrapper -->
|
||||
<?php include('footer.php'); ?>
|
||||
|
||||
<div style="clear: both;"> </div>
|
||||
<script type="text/javascript">
|
||||
var uvOptions = {};
|
||||
(function() {
|
||||
var uv = document.createElement('script'); uv.type = 'text/javascript'; uv.async = true;
|
||||
uv.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'widget.uservoice.com/3Kr8ahaGdYLcNwpTEtA7fQ.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(uv, s);
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
<!--
|
||||
GentleBreeze Design by Free CSS Templates
|
||||
-->
|
||||
34
html/creator.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<div id="design">
|
||||
<h2>Create</h2>
|
||||
<div id="add-rule">
|
||||
<form action="" method="POST" id="form-add-rule">
|
||||
<select id="field-rule-select" name="rule-select">
|
||||
<option value="">-- Add New --</option>
|
||||
<?php
|
||||
foreach(HtRule_List::ListRules() as $class => $name)
|
||||
{
|
||||
?>
|
||||
<option value="<?php echo $class;?>"><?php echo $name;?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</form>
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
<div id="rule-edit">
|
||||
</div>
|
||||
</div>
|
||||
<div id="preview">
|
||||
<h2>Preview</h2>
|
||||
<div class="actions">
|
||||
<a href="javascript:rules.showListing()" class="first">Listing</a><a href="save.php" class="middle" id="save">Save</a><a href="download.php" id="save-as" class="middle">Download</a><a href="index.php?delete" id="delete" class="last">Delete</a>
|
||||
</div>
|
||||
<div id="listing-code" style="display:none;">
|
||||
<input type="button" class="button" onclick="javascript:rules.hideListing()" value="Close" id="listing-code-close"/>
|
||||
<textarea readonly wrap="off">
|
||||
</textarea>
|
||||
</div>
|
||||
<div id="preview-code">
|
||||
</div>
|
||||
</div>
|
||||
7
html/footer.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<div id="footer">
|
||||
<p>
|
||||
© 2012
|
||||
<a href="http://sam.xnet.tk/">Sam Stevens</a><br/>
|
||||
All generated content is public domain
|
||||
</p>
|
||||
</div>
|
||||
12
html/messages.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
if (isset($_SESSION['error']))
|
||||
{
|
||||
echo "<p class=\"error\">Error: ".$_SESSION['error']."</p>";
|
||||
unset($_SESSION['error']);
|
||||
}
|
||||
if (isset($_SESSION['message']))
|
||||
{
|
||||
echo "<p class=\"message\">".$_SESSION['message']."</p>";
|
||||
unset($_SESSION['message']);
|
||||
}
|
||||
41
html/sidebar.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<div id="sidebar">
|
||||
<ul>
|
||||
<li>
|
||||
<h2>Aliquam tempus</h2>
|
||||
<p>Mauris vitae nisl nec metus placerat perdiet est. Phasellus dapibus semper consectetuer hendrerit.</p>
|
||||
</li>
|
||||
<li>
|
||||
<h2>Categories</h2>
|
||||
<ul>
|
||||
<li><a href="#">Aliquam libero</a></li>
|
||||
<li><a href="#">Consectetuer adipiscing elit</a></li>
|
||||
<li><a href="#">Metus aliquam pellentesque</a></li>
|
||||
<li><a href="#">Suspendisse iaculis mauris</a></li>
|
||||
<li><a href="#">Urnanet non molestie semper</a></li>
|
||||
<li><a href="#">Proin gravida orci porttitor</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<h2>Blogroll</h2>
|
||||
<ul>
|
||||
<li><a href="#">Aliquam libero</a></li>
|
||||
<li><a href="#">Consectetuer adipiscing elit</a></li>
|
||||
<li><a href="#">Metus aliquam pellentesque</a></li>
|
||||
<li><a href="#">Suspendisse iaculis mauris</a></li>
|
||||
<li><a href="#">Urnanet non molestie semper</a></li>
|
||||
<li><a href="#">Proin gravida orci porttitor</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<h2>Archives</h2>
|
||||
<ul>
|
||||
<li><a href="#">Aliquam libero</a></li>
|
||||
<li><a href="#">Consectetuer adipiscing elit</a></li>
|
||||
<li><a href="#">Metus aliquam pellentesque</a></li>
|
||||
<li><a href="#">Suspendisse iaculis mauris</a></li>
|
||||
<li><a href="#">Urnanet non molestie semper</a></li>
|
||||
<li><a href="#">Proin gravida orci porttitor</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
93
html/top.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<meta name="keywords" content="htaccess, htaccess builder, htaccess generator, apache, apache rewrite, rewrite" />
|
||||
<meta name="description" content="Build htaccess rules for apache 2 easily." />
|
||||
<title>Htaccess Builder</title>
|
||||
<base href="<?php echo System::Config()->BasePath; ?>"/>
|
||||
<link href="Media/style.css" rel="stylesheet" type="text/css"/>
|
||||
<link href='http://fonts.googleapis.com/css?family=Oswald|Arvo|Telex' rel='stylesheet' type='text/css'/>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
if(typeof jQuery == 'undefined'){document.write("<scr"+"ipt src=\"Media/jquery.min.js\" type=\"text/javascript\"><\/scr"+"ipt>");}
|
||||
</script>
|
||||
<?php if (defined('CREATOR')): ?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js" type="text/javascript"></script>
|
||||
<link href="Media/impromptu.css" rel="stylesheet" type="text/css"/>
|
||||
<script src="Media/jquery-impromptu.3.2.min.js" type="text/javascript"></script>
|
||||
<link href="Media/tooltipster-1.2/css/tooltipster.css" rel="stylesheet" type="text/css"/>
|
||||
<script src="Media/tooltipster-1.2/js/jquery.tooltipster.min.js" charset="UTF-8" type="text/javascript"></script>
|
||||
<script src="Media/index.js" type="text/javascript"></script>
|
||||
<script src="Media/rules.js" type="text/javascript"></script>
|
||||
<?php endif; ?>
|
||||
<?php if (System::Config()->Debug): ?>
|
||||
<style type="text/css">
|
||||
body {
|
||||
background-color: #700000;
|
||||
}
|
||||
</style>
|
||||
<?php endif; ?>
|
||||
<script type="text/javascript">
|
||||
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', 'UA-32779476-1']);
|
||||
_gaq.push(['_trackPageview']);
|
||||
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
|
||||
</script>
|
||||
<?php if (isset($head)) echo $head; ?>
|
||||
</head>
|
||||
<body id="<?php if (isset($pageid)) echo $pageid; ?>">
|
||||
<div id="wrapper">
|
||||
<div id="header-wrapper">
|
||||
<div id="header">
|
||||
<div id="logo">
|
||||
<h1><a href="#">Htaccess Builder</a></h1>
|
||||
<p>
|
||||
Beta!
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="menu-wrapper">
|
||||
<div id="menu">
|
||||
<ul>
|
||||
<li class="page-builder"><a href="">Builder</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<!--<div id="donate">
|
||||
Find this useful? <br/>
|
||||
<div>
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
|
||||
<input type="hidden" name="cmd" value="_s-xclick"/>
|
||||
<input type="hidden" name="hosted_button_id" value="N7V2ZSKNXCGW8"/>
|
||||
<input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_donate_SM.gif" class="image" border="0" name="submit" alt="£1" title="£1"/>
|
||||
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1"/>
|
||||
</form>
|
||||
</div>
|
||||
</div>-->
|
||||
<?php $class = ''; if (!isset($sidebar) || $sidebar == False) $class = 'class="fullwidth"'?>
|
||||
<div id="page" <?=$class?>>
|
||||
<div id="page-bgtop" <?=$class?>>
|
||||
<div id="page-bgbtm" <?=$class?>>
|
||||
<div id="page-content" <?=$class?>>
|
||||
<?php if (isset($sidebar) && $sidebar == True): ?>
|
||||
<div id="content">
|
||||
<?php else: ?>
|
||||
<div id="content-fullwidth">
|
||||
<?php endif; ?>
|
||||
|
||||
<noscript>
|
||||
<div id="js-notice">
|
||||
Javascript is required to use this website :(
|
||||
</div>
|
||||
</noscript>
|
||||
|
||||
<img id="loading" src="Media/Images/loading.gif" alt="[*]" style="display: none;"/>
|
||||
32
includer.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
define('BASE_PATH', dirname(__FILE__));
|
||||
chdir(BASE_PATH);
|
||||
|
||||
ini_set('display_errors', True);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
function sys_autoload($class)
|
||||
{
|
||||
if (strpos($class, '_') !== False)
|
||||
{
|
||||
$path = 'Classes/'.str_replace('_', '/', $class);
|
||||
if (is_file($path.'.php'))
|
||||
include_once($path.'.php');
|
||||
}
|
||||
|
||||
if (is_file("Classes/$class/$class.php"))
|
||||
include_once("Classes/$class/$class.php");
|
||||
|
||||
if (is_file("Classes/$class.php"))
|
||||
include_once("Classes/$class.php");
|
||||
}
|
||||
spl_autoload_register('sys_autoload');
|
||||
|
||||
require('config.php');
|
||||
require('functions.php');
|
||||
|
||||
System::Init($config);
|
||||
|
||||
|
||||
|
||||
30
index.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
define('INDEX',True);
|
||||
define('CREATOR',True);
|
||||
|
||||
require('includer.php');
|
||||
|
||||
$rules = new HtRule_List();
|
||||
|
||||
if (isset($_GET['addrule']))
|
||||
{
|
||||
$rules->AddRule(new HtRule_EnableRewrite());
|
||||
redirect('');
|
||||
}
|
||||
if (isset($_GET['delete']))
|
||||
{
|
||||
$file = BASE_PATH.DIRECTORY_SEPARATOR.'Saved'.DIRECTORY_SEPARATOR.$rules->GetID().'.txt';
|
||||
if (is_file($file) && $rules->GetID())
|
||||
unlink($file);
|
||||
$rules->SetID(False);
|
||||
$rules->ClearRules();
|
||||
redirect('');
|
||||
}
|
||||
|
||||
$pageid = 'page-builder';
|
||||
include('html/top.php');
|
||||
|
||||
include('html/creator.php');
|
||||
|
||||
include('html/bottom.php');
|
||||
30
recall.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
define('INDEX',True);
|
||||
|
||||
require('includer.php');
|
||||
|
||||
$id = $_GET['id'];
|
||||
|
||||
if (strlen($id) < 5)
|
||||
redirect ('/');
|
||||
|
||||
$ds = DIRECTORY_SEPARATOR;
|
||||
$dir = BASE_PATH.$ds.'Saved'.$ds;
|
||||
$dir .= substr($id, 0,2).$ds;
|
||||
$dir .= substr($id, 2,2).$ds;
|
||||
|
||||
$file = $dir.$id.'.txt';
|
||||
|
||||
$file = realpath($file);
|
||||
|
||||
if (strpos($file, $dir) !== 0 || $file == false)
|
||||
redirect ('/');
|
||||
|
||||
$fileContents = file_get_contents($file);
|
||||
|
||||
$rules = unserialize($fileContents);
|
||||
$rules->SetID(false);
|
||||
$rules->Save();
|
||||
|
||||
redirect ('/');
|
||||
17
save.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
define('INDEX',True);
|
||||
|
||||
require('includer.php');
|
||||
|
||||
$rules = new HtRule_List();
|
||||
|
||||
if (!$rules->GetID())
|
||||
{
|
||||
$rules->SaveToFile();
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] != 'POST')
|
||||
{
|
||||
redirect('/');
|
||||
}
|
||||
22
test.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
define('INDEX',True);
|
||||
|
||||
require('includer.php');
|
||||
|
||||
$rules = new HtRule_List();
|
||||
|
||||
$pageid = 'page-test';
|
||||
$sidebar = True;
|
||||
include('html/top.php');
|
||||
|
||||
?>
|
||||
<h2>
|
||||
Test
|
||||
</h2>
|
||||
<p>
|
||||
<?=print_r(sys_getloadavg(),true)?>
|
||||
</p>
|
||||
<?php
|
||||
|
||||
include('html/bottom.php');
|
||||
20
thanks.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
define('INDEX',True);
|
||||
|
||||
require('includer.php');
|
||||
|
||||
include('html/top.php');
|
||||
|
||||
?>
|
||||
<h2>Thanks for the donation!</h2>
|
||||
<p>
|
||||
If you have any ideas or comments please drop me a mail at <a href="mailto:sam@xnet.tk">sam@xnet.tk</a>.
|
||||
</p>
|
||||
<p>
|
||||
Cheers!<br/>
|
||||
Sam
|
||||
</p>
|
||||
<?php
|
||||
|
||||
include('html/bottom.php');
|
||||