Compare commits
161 Commits
master
...
feature/la
Author | SHA1 | Date |
---|---|---|
Sven Slootweg | 5b630dbead | 11 years ago |
Sven Slootweg | 1eb1427de4 | 11 years ago |
Sven Slootweg | 08994e1d40 | 11 years ago |
Sven Slootweg | 4eacdbf612 | 11 years ago |
Sven Slootweg | 4e45466d9e | 11 years ago |
Sven Slootweg | 7cdb3507af | 11 years ago |
Sven Slootweg | eaadadded0 | 11 years ago |
Sven Slootweg | 138bf9949e | 11 years ago |
Sven Slootweg | 6822c353c3 | 11 years ago |
Sven Slootweg | 161dd60fd7 | 11 years ago |
Sven Slootweg | f6d92110dd | 11 years ago |
Sven Slootweg | 03cf41519f | 11 years ago |
Sven Slootweg | c8566e4822 | 11 years ago |
Sven Slootweg | c7c2e252b9 | 11 years ago |
Sven Slootweg | ce13fa4f29 | 11 years ago |
Sven Slootweg | ca82a9e0c8 | 11 years ago |
Sven Slootweg | 6bfe6ccb4d | 11 years ago |
Sven Slootweg | c2ea87c4af | 11 years ago |
Sven Slootweg | 68964d3022 | 11 years ago |
Sven Slootweg | bded80405e | 11 years ago |
Sven Slootweg | 5f343edfcd | 11 years ago |
Sven Slootweg | 238195c19a | 11 years ago |
Sven Slootweg | 9ec934e8c7 | 11 years ago |
Sven Slootweg | 21f3cea18f | 11 years ago |
Sven Slootweg | a90ffa590d | 11 years ago |
Sven Slootweg | 58cfffd3d8 | 11 years ago |
Sven Slootweg | d42eecad3d | 11 years ago |
Sven Slootweg | 539f54eac1 | 11 years ago |
Sven Slootweg | dbe5662a85 | 11 years ago |
Sven Slootweg | ca171e8275 | 11 years ago |
Sven Slootweg | 4b02357739 | 11 years ago |
Sven Slootweg | bfadf150b4 | 11 years ago |
Sven Slootweg | 2680c4538c | 11 years ago |
Sven Slootweg | a80368e7c2 | 11 years ago |
Sven Slootweg | 113404d563 | 11 years ago |
Sven Slootweg | 3fbfad8656 | 11 years ago |
Sven Slootweg | 7db7d5a60a | 11 years ago |
Sven Slootweg | 4aa82d0a86 | 11 years ago |
Sven Slootweg | da6ed16c34 | 11 years ago |
Sven Slootweg | 5729adac81 | 11 years ago |
Sven Slootweg | d2b511d9b3 | 11 years ago |
Sven Slootweg | 85371b3394 | 11 years ago |
Sven Slootweg | 6e923629e0 | 11 years ago |
Sven Slootweg | 249284e488 | 12 years ago |
Sven Slootweg | 4efacc178b | 12 years ago |
Sven Slootweg | 9aac04d33e | 12 years ago |
Sven Slootweg | 55de2ba21c | 12 years ago |
Sven Slootweg | ee8c40ebe1 | 12 years ago |
Sven Slootweg | 8e75ee9ee7 | 12 years ago |
Sven Slootweg | 75a5f0b7e7 | 12 years ago |
Sven Slootweg | f54722d1a7 | 12 years ago |
Sven Slootweg | 52497d05b4 | 12 years ago |
Sven Slootweg | c7ee85eab1 | 12 years ago |
Sven Slootweg | 442a180f1e | 12 years ago |
Sven Slootweg | a56c06a76e | 12 years ago |
Sven Slootweg | 9d85fb8bc9 | 12 years ago |
Sven Slootweg | 061516281a | 12 years ago |
Sven Slootweg | 38112ba6e3 | 12 years ago |
Sven Slootweg | aa6bb1fc85 | 12 years ago |
Sven Slootweg | a55ce3778d | 12 years ago |
Sven Slootweg | fa8aa24e1b | 12 years ago |
Sven Slootweg | 29ea38ebc9 | 12 years ago |
Sven Slootweg | db4d084163 | 12 years ago |
Sven Slootweg | 5212ae353e | 12 years ago |
Sven Slootweg | 3bf5d768cb | 12 years ago |
Sven Slootweg | 533148edb1 | 12 years ago |
Sven Slootweg | c62d6a9cec | 12 years ago |
Sven Slootweg | cb050ebdca | 12 years ago |
Sven Slootweg | 46ea50e6b0 | 12 years ago |
Sven Slootweg | 9d08020a8d | 12 years ago |
Sven Slootweg | 4c6f46efe6 | 12 years ago |
Sven Slootweg | 18cd2f8066 | 12 years ago |
Sven Slootweg | 5417ccd5f6 | 12 years ago |
Sven Slootweg | 95f9d81288 | 12 years ago |
Sven Slootweg | 7b4b4231db | 12 years ago |
Sven Slootweg | f14f916017 | 12 years ago |
Sven Slootweg | d80a4e487b | 12 years ago |
Sven Slootweg | c59aad3be6 | 12 years ago |
Sven Slootweg | 224769ebb4 | 12 years ago |
Sven Slootweg | d3d094a474 | 12 years ago |
Sven Slootweg | 98f2145938 | 12 years ago |
Sven Slootweg | abb0712c97 | 12 years ago |
Sven Slootweg | 4385243b9c | 12 years ago |
Sven Slootweg | 4bbeffbd57 | 12 years ago |
Sven Slootweg | cc25349d30 | 12 years ago |
Sven Slootweg | c53ffd9afb | 12 years ago |
Sven Slootweg | d6ddb80b04 | 12 years ago |
Sven Slootweg | b3218ed1c3 | 12 years ago |
Sven Slootweg | 0dd070a809 | 12 years ago |
Sven Slootweg | 1f45289ea3 | 12 years ago |
Sven Slootweg | c6b00de70b | 12 years ago |
Sven Slootweg | 81fd2500ea | 12 years ago |
Sven Slootweg | 63bb67a108 | 12 years ago |
Sven Slootweg | 855d39c038 | 12 years ago |
Sven Slootweg | 52b6216054 | 12 years ago |
Sven Slootweg | 2e5590ddeb | 12 years ago |
Sven Slootweg | 1a07c64d17 | 12 years ago |
Sven Slootweg | 956933fe9b | 12 years ago |
Sven Slootweg | 2a629d63d3 | 12 years ago |
Sven Slootweg | 6dbbfb4ebd | 12 years ago |
Sven Slootweg | 5a3bacf2e7 | 12 years ago |
Sven Slootweg | a5f2e14a6d | 12 years ago |
Sven Slootweg | 8a46f5d630 | 12 years ago |
Sven Slootweg | 4caf68e6ff | 12 years ago |
Sven Slootweg | d3c970a551 | 12 years ago |
Sven Slootweg | a8937630e3 | 12 years ago |
Sven Slootweg | c0a40b2bd4 | 12 years ago |
Sven Slootweg | 110ba159d2 | 12 years ago |
Sven Slootweg | ecb95ca151 | 12 years ago |
Sven Slootweg | 7034837966 | 12 years ago |
Sven Slootweg | 890296f25e | 12 years ago |
Sven Slootweg | bc68bf8969 | 12 years ago |
Sven Slootweg | a1efe9b400 | 12 years ago |
Sven Slootweg | ca9808f9e2 | 12 years ago |
Sven Slootweg | 67c2b55ab6 | 12 years ago |
Sven Slootweg | 7a933cd60d | 12 years ago |
Sven Slootweg | bd3db37ea5 | 12 years ago |
Sven Slootweg | d27086aca7 | 12 years ago |
Sven Slootweg | 56b741bbee | 12 years ago |
Sven Slootweg | 7b625f6965 | 12 years ago |
Sven Slootweg | 641a5fe43e | 12 years ago |
Sven Slootweg | 8b437c6a4b | 12 years ago |
Sven Slootweg | 42bdba7ce0 | 12 years ago |
Sven Slootweg | 589dbae474 | 12 years ago |
Sven Slootweg | 4245c1f206 | 12 years ago |
Sven Slootweg | b87ee4671b | 12 years ago |
Sven Slootweg | 7c230224f9 | 12 years ago |
Sven Slootweg | 62064095ad | 12 years ago |
Sven Slootweg | 69c4c67927 | 12 years ago |
Sven Slootweg | 56001c5b95 | 12 years ago |
Sven Slootweg | fe096eac5c | 12 years ago |
Sven Slootweg | f42d47d454 | 12 years ago |
Sven Slootweg | d749e53352 | 12 years ago |
Sven Slootweg | e9c46d4182 | 12 years ago |
Sven Slootweg | e864e912d0 | 12 years ago |
Sven Slootweg | f4f15d9cd1 | 12 years ago |
Sven Slootweg | 35aad80cdc | 12 years ago |
Sven Slootweg | 5842bf2b72 | 12 years ago |
Sven Slootweg | 44196de152 | 12 years ago |
Sven Slootweg | d990ffaed4 | 12 years ago |
Sven Slootweg | 63702fc9db | 12 years ago |
Sven Slootweg | 98d7e64771 | 12 years ago |
Sven Slootweg | 2b91a34206 | 12 years ago |
Sven Slootweg | d36d283b7b | 12 years ago |
Sven Slootweg | 2d634b14d7 | 12 years ago |
Sven Slootweg | c66efa4bae | 12 years ago |
Sven Slootweg | 9b0058d199 | 12 years ago |
Sven Slootweg | 597d8d0e56 | 12 years ago |
Sven Slootweg | f910045417 | 12 years ago |
Sven Slootweg | 70baf0b182 | 12 years ago |
Sven Slootweg | 0e027f73bd | 12 years ago |
Sven Slootweg | da9e963602 | 12 years ago |
Sven Slootweg | 93e7510cc5 | 12 years ago |
Sven Slootweg | 261ea3b8b4 | 12 years ago |
Sven Slootweg | 2b575d4f0e | 12 years ago |
Sven Slootweg | d254d77c27 | 12 years ago |
Sven Slootweg | 1cfd53deb4 | 12 years ago |
Sven Slootweg | 61a435863d | 12 years ago |
Sven Slootweg | 9254b0594b | 12 years ago |
Sven Slootweg | b40139d102 | 12 years ago |
Sven Slootweg | 7aee896ebc | 12 years ago |
@ -0,0 +1,2 @@
|
|||||||
|
config.php
|
||||||
|
config.mysql.php
|
File diff suppressed because it is too large
Load Diff
@ -1,319 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* CPHP is more free software. It is licensed under the WTFPL, which
|
|
||||||
* allows you to do pretty much anything with it, without having to
|
|
||||||
* ask permission. Commercial use is allowed, and no attribution is
|
|
||||||
* required. We do politely request that you share your modifications
|
|
||||||
* to benefit other developers, but you are under no enforced
|
|
||||||
* obligation to do so :)
|
|
||||||
*
|
|
||||||
* Please read the accompanying LICENSE document for the full WTFPL
|
|
||||||
* licensing text.
|
|
||||||
*/
|
|
||||||
|
|
||||||
cphp_dependency_provides("cphp_formbuilder", "1.0");
|
|
||||||
|
|
||||||
$cphp_formbuilder_increment = 0;
|
|
||||||
|
|
||||||
abstract class CPHPFormBuilderBaseClass
|
|
||||||
{
|
|
||||||
public $parameters = array();
|
|
||||||
|
|
||||||
public function AddParameter($key, $value)
|
|
||||||
{
|
|
||||||
$this->parameters[$key] = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function RenderParameters($parameters)
|
|
||||||
{
|
|
||||||
if(empty($parameters))
|
|
||||||
{
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
$rendered = array();
|
|
||||||
|
|
||||||
foreach($parameters as $key => $value)
|
|
||||||
{
|
|
||||||
$value = utf8entities($value);
|
|
||||||
$rendered[] = "{$key}=\"{$value}\"";
|
|
||||||
}
|
|
||||||
|
|
||||||
return " " . implode(" ", $rendered);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function RenderNote()
|
|
||||||
{
|
|
||||||
if(!empty($this->note))
|
|
||||||
{
|
|
||||||
return "<div class=\"cphp_fbd_note\">{$this->note}</div>";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class CPHPFormBuilderContainer extends CPHPFormBuilderBaseClass
|
|
||||||
{
|
|
||||||
public $elements = array();
|
|
||||||
|
|
||||||
public function AddElement($element)
|
|
||||||
{
|
|
||||||
$this->elements[] = $element;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class CPHPFormBuilder extends CPHPFormBuilderContainer
|
|
||||||
{
|
|
||||||
public $method = "";
|
|
||||||
public $action = "";
|
|
||||||
|
|
||||||
public function __construct($method, $target)
|
|
||||||
{
|
|
||||||
$this->method = strtolower($method);
|
|
||||||
$this->action = $target;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function Render()
|
|
||||||
{
|
|
||||||
$rendered_elements = "";
|
|
||||||
|
|
||||||
foreach($this->elements as $element)
|
|
||||||
{
|
|
||||||
$rendered_elements .= $element->Render();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->AddParameter("method", $this->method);
|
|
||||||
$this->AddParameter("action", $this->action);
|
|
||||||
|
|
||||||
$rendered_parameters = $this->RenderParameters($this->parameters);
|
|
||||||
|
|
||||||
return "<form{$rendered_parameters}>{$rendered_elements}</form>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class CPHPFormSection extends CPHPFormBuilderContainer
|
|
||||||
{
|
|
||||||
public $label = "";
|
|
||||||
public $fieldset = true;
|
|
||||||
public $classname = "";
|
|
||||||
|
|
||||||
public function __construct($fieldset = true, $label = "")
|
|
||||||
{
|
|
||||||
if(!empty($label))
|
|
||||||
{
|
|
||||||
$this->label = $label;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->fieldset = $fieldset;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function Render()
|
|
||||||
{
|
|
||||||
if(!empty($this->label))
|
|
||||||
{
|
|
||||||
$legend = "<legend>{$this->label}</legend>";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$legend = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
if($this->fieldset === true)
|
|
||||||
{
|
|
||||||
$this->classname = trim("{$this->classname} cphp_fbd_fieldset");
|
|
||||||
}
|
|
||||||
|
|
||||||
$rendered_elements = "";
|
|
||||||
|
|
||||||
foreach($this->elements as $element)
|
|
||||||
{
|
|
||||||
$rendered_elements .= $element->Render();
|
|
||||||
}
|
|
||||||
|
|
||||||
if($this->fieldset === true)
|
|
||||||
{
|
|
||||||
$this->AddParameter("class", $this->classname);
|
|
||||||
$rendered_parameters = $this->RenderParameters($this->parameters);
|
|
||||||
return "<fieldset{$rendered_parameters}>{$legend}<div class=\"cphp_fbd_form\">{$rendered_elements}</div></fieldset>";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return "<div class=\"cphp_fbd_form\"{$rendered_parameters}>{$rendered_elements}</div>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class CPHPFormInputElement extends CPHPFormBuilderBaseClass
|
|
||||||
{
|
|
||||||
public $id = "";
|
|
||||||
public $name = "";
|
|
||||||
public $value = "";
|
|
||||||
public $label = "";
|
|
||||||
|
|
||||||
public function __construct($label, $name, $value = "", $note = "", $id = "")
|
|
||||||
{
|
|
||||||
global $cphp_formbuilder_increment;
|
|
||||||
|
|
||||||
$this->name = $name;
|
|
||||||
$this->value = $value;
|
|
||||||
$this->label = $label;
|
|
||||||
$this->note = $note;
|
|
||||||
|
|
||||||
if(empty($id))
|
|
||||||
{
|
|
||||||
$this->id = "cphp_fbd_{$cphp_formbuilder_increment}";
|
|
||||||
$cphp_formbuilder_increment += 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->id = $id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class CPHPFormInput extends CPHPFormInputElement
|
|
||||||
{
|
|
||||||
public function Render()
|
|
||||||
{
|
|
||||||
$this->AddParameter("id", $this->id);
|
|
||||||
$this->AddParameter("type", $this->type);
|
|
||||||
$this->AddParameter("name", $this->name);
|
|
||||||
$this->AddParameter("value", $this->value);
|
|
||||||
|
|
||||||
$rendered_parameters = $this->RenderParameters($this->parameters);
|
|
||||||
$rendered_note = $this->RenderNote();
|
|
||||||
|
|
||||||
return "<div class=\"cphp_fbd_row\"><div class=\"cphp_fbd_label\">{$this->label}{$rendered_note}</div><div class=\"cphp_fbd_field\"><input{$rendered_parameters}></div></div>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class CPHPFormTextInput extends CPHPFormInput
|
|
||||||
{
|
|
||||||
public $type = "text";
|
|
||||||
}
|
|
||||||
|
|
||||||
class CPHPFormPasswordInput extends CPHPFormInput
|
|
||||||
{
|
|
||||||
public $type = "password";
|
|
||||||
}
|
|
||||||
|
|
||||||
class CPHPFormDateInput extends CPHPFormInput
|
|
||||||
{
|
|
||||||
public $type = "date";
|
|
||||||
}
|
|
||||||
|
|
||||||
class CPHPFormTimeInput extends CPHPFormInput
|
|
||||||
{
|
|
||||||
public $type = "time";
|
|
||||||
}
|
|
||||||
|
|
||||||
class CPHPFormEmailInput extends CPHPFormInput
|
|
||||||
{
|
|
||||||
public $type = "email";
|
|
||||||
}
|
|
||||||
|
|
||||||
class CPHPFormUrlInput extends CPHPFormInput
|
|
||||||
{
|
|
||||||
public $type = "url";
|
|
||||||
}
|
|
||||||
|
|
||||||
class CPHPFormRangeInput extends CPHPFormInput
|
|
||||||
{
|
|
||||||
public $type = "range";
|
|
||||||
}
|
|
||||||
|
|
||||||
class CPHPFormColorInput extends CPHPFormInput
|
|
||||||
{
|
|
||||||
public $type = "color";
|
|
||||||
}
|
|
||||||
|
|
||||||
class CPHPFormSearchInput extends CPHPFormInput
|
|
||||||
{
|
|
||||||
public $type = "search";
|
|
||||||
}
|
|
||||||
|
|
||||||
class CPHPFormCheckboxGroup extends CPHPFormBuilderContainer
|
|
||||||
{
|
|
||||||
public function __construct($label, $note = "")
|
|
||||||
{
|
|
||||||
global $cphp_formbuilder_increment;
|
|
||||||
|
|
||||||
$this->label = $label;
|
|
||||||
$this->note = $note;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function Render()
|
|
||||||
{
|
|
||||||
$rendered_note = $this->RenderNote();
|
|
||||||
|
|
||||||
$rendered_elements = "";
|
|
||||||
|
|
||||||
foreach($this->elements as $element)
|
|
||||||
{
|
|
||||||
$rendered_elements .= $element->Render();
|
|
||||||
}
|
|
||||||
|
|
||||||
return "<div class=\"cphp_fbd_row\"><div class=\"cphp_fbd_label\">{$this->label}{$rendered_note}</div><div class=\"cphp_fbd_field\">{$rendered_elements}</div></div>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class CPHPFormCheckbox extends CPHPFormInputElement
|
|
||||||
{
|
|
||||||
|
|
||||||
public function Render()
|
|
||||||
{
|
|
||||||
$this->AddParameter("id", $this->id);
|
|
||||||
$this->AddParameter("type", "checkbox");
|
|
||||||
$this->AddParameter("name", $this->name);
|
|
||||||
|
|
||||||
if($this->value === true)
|
|
||||||
{
|
|
||||||
$this->AddParameter("checked", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
$rendered_parameters = $this->RenderParameters($this->parameters);
|
|
||||||
$rendered_note = $this->RenderNote();
|
|
||||||
return "<div class=\"cphp_fbd_cblabel\"><input{$rendered_parameters}><label for=\"{$this->id}\">{$this->label}{$rendered_note}</label></div>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class CPHPFormRadioButton extends CPHPFormInput
|
|
||||||
{
|
|
||||||
public $type = "radio";
|
|
||||||
}
|
|
||||||
|
|
||||||
class CPHPFormButton extends CPHPFormInputElement
|
|
||||||
{
|
|
||||||
public $type = "button";
|
|
||||||
|
|
||||||
public function Render()
|
|
||||||
{
|
|
||||||
$this->AddParameter("type", $this->type);
|
|
||||||
$this->AddParameter("name", $this->name);
|
|
||||||
$this->AddParameter("value", $this->value);
|
|
||||||
|
|
||||||
$rendered_parameters = $this->RenderParameters($this->parameters);
|
|
||||||
|
|
||||||
return "<div class=\"cphp_fbd_row\"><div class=\"cphp_fbd_label\"></div><div class=\"cphp_fbd_field\"><button{$rendered_parameters}>{$this->label}</button></div></div>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class CPHPFormSubmitButton extends CPHPFormButton
|
|
||||||
{
|
|
||||||
public $type = "submit";
|
|
||||||
}
|
|
||||||
|
|
||||||
class CPHPFormResetButton extends CPHPFormButton
|
|
||||||
{
|
|
||||||
public $type = "reset";
|
|
||||||
}
|
|
||||||
|
|
||||||
class CPHPFormSelect extends CPHPFormInputElement
|
|
||||||
{
|
|
||||||
public $options = array();
|
|
||||||
}
|
|
||||||
?>
|
|
@ -1,42 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* CPHP is more free software. It is licensed under the WTFPL, which
|
|
||||||
* allows you to do pretty much anything with it, without having to
|
|
||||||
* ask permission. Commercial use is allowed, and no attribution is
|
|
||||||
* required. We do politely request that you share your modifications
|
|
||||||
* to benefit other developers, but you are under no enforced
|
|
||||||
* obligation to do so :)
|
|
||||||
*
|
|
||||||
* Please read the accompanying LICENSE document for the full WTFPL
|
|
||||||
* licensing text.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if($_CPHP !== true) { die(); }
|
|
||||||
|
|
||||||
$cphp_class_map = array(
|
|
||||||
'classa' => "ClassA",
|
|
||||||
'classb' => "ClassB"
|
|
||||||
);
|
|
||||||
|
|
||||||
$cphp_locale_name = "english";
|
|
||||||
$cphp_locale_path = "locales";
|
|
||||||
$cphp_locale_ext = "lng";
|
|
||||||
|
|
||||||
$cphp_usersettings[CPHP_SETTING_TIMEZONE] = "Europe/Amsterdam";
|
|
||||||
|
|
||||||
/* These are the memcache settings. You will need to have memcache set
|
|
||||||
* up on your server to use these. Compression requires zlib. */
|
|
||||||
$cphp_memcache_enabled = true; // Whether to user memcache.
|
|
||||||
$cphp_memcache_server = "localhost"; // The hostname of the memcached
|
|
||||||
$cphp_memcache_port = 11211; // The port number of memcached
|
|
||||||
$cphp_memcache_compressed = true; // Whether to compress memcache objects
|
|
||||||
|
|
||||||
$cphp_mysql_enabled = true;
|
|
||||||
|
|
||||||
require("config.mysql.php");
|
|
||||||
|
|
||||||
$cphp_components = array(
|
|
||||||
"router",
|
|
||||||
"errorhandler",
|
|
||||||
"formbuilder"
|
|
||||||
);
|
|
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* CPHP is more free software. It is licensed under the WTFPL, which
|
||||||
|
* allows you to do pretty much anything with it, without having to
|
||||||
|
* ask permission. Commercial use is allowed, and no attribution is
|
||||||
|
* required. We do politely request that you share your modifications
|
||||||
|
* to benefit other developers, but you are under no enforced
|
||||||
|
* obligation to do so :)
|
||||||
|
*
|
||||||
|
* Please read the accompanying LICENSE document for the full WTFPL
|
||||||
|
* licensing text.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if($_CPHP !== true) { die(); }
|
||||||
|
|
||||||
|
if(empty($_CPHP_CONFIG))
|
||||||
|
{
|
||||||
|
die("No valid CPHP configuration path was specified. Refer to the CPHP manual for instructions.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$confdata = @file_get_contents($_CPHP_CONFIG);
|
||||||
|
|
||||||
|
if($confdata === false)
|
||||||
|
{
|
||||||
|
die("The specified CPHP configuration path was not found. Refer to the CPHP manual for instructions.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$cphp_config = @json_decode($confdata);
|
||||||
|
|
||||||
|
if(json_last_error() != JSON_ERROR_NONE)
|
||||||
|
{
|
||||||
|
die("Failed to parse CPHP configuration. Refer to the CPHP manual for instructions.");
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* CPHP is more free software. It is licensed under the WTFPL, which
|
||||||
|
* allows you to do pretty much anything with it, without having to
|
||||||
|
* ask permission. Commercial use is allowed, and no attribution is
|
||||||
|
* required. We do politely request that you share your modifications
|
||||||
|
* to benefit other developers, but you are under no enforced
|
||||||
|
* obligation to do so :)
|
||||||
|
*
|
||||||
|
* Please read the accompanying LICENSE document for the full WTFPL
|
||||||
|
* licensing text.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if($_CPHP !== true) { die(); }
|
||||||
|
|
||||||
|
class CSRF
|
||||||
|
{
|
||||||
|
public static function GenerateToken()
|
||||||
|
{
|
||||||
|
$key = random_string(12);
|
||||||
|
$token = random_string(25);
|
||||||
|
|
||||||
|
if(!isset($_SESSION['_CPHP_CSRF_KEYS']))
|
||||||
|
{
|
||||||
|
$_SESSION['_CPHP_CSRF_KEYS'] = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
$_SESSION['_CPHP_CSRF_KEYS'][$key] = $token;
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'key' => $key,
|
||||||
|
'token' => $token
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GenerateReplacement($matches)
|
||||||
|
{
|
||||||
|
$pair = CSRF::GenerateToken();
|
||||||
|
|
||||||
|
return $matches[0] . "
|
||||||
|
<input name=\"_CPHP_CSRF_KEY\" type=\"hidden\" value=\"{$pair['key']}\">
|
||||||
|
<input name=\"_CPHP_CSRF_TOKEN\" type=\"hidden\" value=\"{$pair['token']}\">";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function InsertTokens($input)
|
||||||
|
{
|
||||||
|
return preg_replace_callback("/<form[^>]*>(?!\s*<input name=\"_CPHP_CSRF)/i", "CSRF::GenerateReplacement", $input);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function VerifyToken()
|
||||||
|
{
|
||||||
|
if(!empty($_POST['_CPHP_CSRF_KEY']) && !empty($_POST['_CPHP_CSRF_TOKEN']))
|
||||||
|
{
|
||||||
|
$key = $_POST['_CPHP_CSRF_KEY'];
|
||||||
|
$token = $_POST['_CPHP_CSRF_TOKEN'];
|
||||||
|
|
||||||
|
if(empty($_SESSION['_CPHP_CSRF_KEYS'][$key]) || $_SESSION['_CPHP_CSRF_KEYS'][$key] != $token)
|
||||||
|
{
|
||||||
|
throw new CsrfException("The given CSRF token does not match the given CSRF key.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new CsrfException("No CSRF token present in submitted data.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class CsrfException extends Exception {}
|
@ -0,0 +1,388 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$cphp_debug_start = microtime(true);
|
||||||
|
$cphp_debug_log = array();
|
||||||
|
$cphp_debug_enabled = false;
|
||||||
|
|
||||||
|
function cphp_debug_enable()
|
||||||
|
{
|
||||||
|
global $cphp_debug_enabled;
|
||||||
|
|
||||||
|
$cphp_debug_enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function cphp_debug_disable()
|
||||||
|
{
|
||||||
|
global $cphp_debug_enabled;
|
||||||
|
|
||||||
|
$cphp_debug_enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function cphp_debug_snapshot($data)
|
||||||
|
{
|
||||||
|
global $cphp_debug_start, $cphp_debug_log, $cphp_debug_enabled;
|
||||||
|
|
||||||
|
if($cphp_debug_enabled === true)
|
||||||
|
{
|
||||||
|
$timestamp = microtime(true) - $cphp_debug_start;
|
||||||
|
|
||||||
|
$cphp_debug_log[] = array(
|
||||||
|
'timestamp' => $timestamp,
|
||||||
|
'data' => $data
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function cphp_debug_dump()
|
||||||
|
{
|
||||||
|
global $cphp_debug_log;
|
||||||
|
|
||||||
|
return json_encode($cphp_debug_log);
|
||||||
|
}
|
||||||
|
|
||||||
|
function cphp_debug_display($data)
|
||||||
|
{
|
||||||
|
/* We can't use the templater for this, because that would make this function unusable if the
|
||||||
|
* templater itself were to ever be the subject of the debugging. */
|
||||||
|
?>
|
||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>CPHP Debuglog Viewer</title>
|
||||||
|
<style>
|
||||||
|
body
|
||||||
|
{
|
||||||
|
font-family: monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
#slider
|
||||||
|
{
|
||||||
|
background-color: #DDDDDD;
|
||||||
|
position: absolute;
|
||||||
|
left: 0px;
|
||||||
|
right: 0px;
|
||||||
|
top: 0px;
|
||||||
|
height: 100px;
|
||||||
|
user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#slider_bar
|
||||||
|
{
|
||||||
|
background-color: #C8C8C8;
|
||||||
|
height: 24px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
#slider_handle
|
||||||
|
{
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
position: absolute;
|
||||||
|
left: 0px;
|
||||||
|
top: 0px;
|
||||||
|
background-color: #6F6F6F;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
#slider_handle.dragging
|
||||||
|
{
|
||||||
|
background-color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#datapoint_info
|
||||||
|
{
|
||||||
|
padding: 7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#details
|
||||||
|
{
|
||||||
|
position: absolute;
|
||||||
|
left: 0px;
|
||||||
|
right: 0px;
|
||||||
|
bottom: 0px;
|
||||||
|
top: 100px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.variable
|
||||||
|
{
|
||||||
|
padding-left: 48px;
|
||||||
|
border-top: 1px solid silver;
|
||||||
|
}
|
||||||
|
|
||||||
|
.variable .name
|
||||||
|
{
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-right: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.variable .data
|
||||||
|
{
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.expander
|
||||||
|
{
|
||||||
|
text-decoration: none;
|
||||||
|
color: blue;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data.undefined
|
||||||
|
{
|
||||||
|
color: silver;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data.text
|
||||||
|
{
|
||||||
|
color: #A000B2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data.numeric
|
||||||
|
{
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
|
||||||
|
<script>
|
||||||
|
var data_points = <?php echo($data); ?>;
|
||||||
|
|
||||||
|
var total_data_points = data_points.length;
|
||||||
|
|
||||||
|
var current_point = 0;
|
||||||
|
|
||||||
|
function sliderUpdate()
|
||||||
|
{
|
||||||
|
total_width = $('#slider_bar').width() - $('#slider_handle').width();
|
||||||
|
current_position = $('#slider_handle').offset().left;
|
||||||
|
|
||||||
|
point_width = total_width / (total_data_points - 1);
|
||||||
|
closest_data_point = Math.round(current_position / point_width);
|
||||||
|
current_point = closest_data_point;
|
||||||
|
|
||||||
|
real_position = closest_data_point * point_width;
|
||||||
|
$('#slider_handle').css({'left': real_position});
|
||||||
|
|
||||||
|
relevant_data_point = data_points[closest_data_point];
|
||||||
|
|
||||||
|
$('#datapoint_info').html("<strong>Data point:</strong> " + closest_data_point + "<br><strong>Timestamp:</strong> " + relevant_data_point['timestamp'])
|
||||||
|
|
||||||
|
updateTree(relevant_data_point['data']);
|
||||||
|
}
|
||||||
|
|
||||||
|
function switchDataPoint(i)
|
||||||
|
{
|
||||||
|
total_width = $('#slider_bar').width() - $('#slider_handle').width();
|
||||||
|
point_width = total_width / (total_data_points - 2);
|
||||||
|
real_position = i * point_width;
|
||||||
|
$('#slider_handle').css({'left': real_position});
|
||||||
|
|
||||||
|
current_point = i;
|
||||||
|
|
||||||
|
$('#datapoint_info').html("<strong>Data point:</strong> " + i + "<br><strong>Timestamp:</strong> " + data_points[i]['timestamp'])
|
||||||
|
|
||||||
|
updateTree(data_points[i]['data']);
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateTree(data)
|
||||||
|
{
|
||||||
|
$('.variable.array').children('.variable').remove();
|
||||||
|
$('.data.text, .data.numeric').html("undefined").addClass("undefined").removeClass("text").removeClass("numeric");
|
||||||
|
updateElements(data, "root", "item");
|
||||||
|
|
||||||
|
$('a.expander').each(function(){
|
||||||
|
if($(this).text() == "[+]")
|
||||||
|
{
|
||||||
|
$(this).parent().children('.variable').hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
hookExpanders();
|
||||||
|
}
|
||||||
|
|
||||||
|
function initializeElements()
|
||||||
|
{
|
||||||
|
/* Build a prototype for display, out of all the available datapoints. */
|
||||||
|
prototype = {};
|
||||||
|
|
||||||
|
for(x in data_points)
|
||||||
|
{
|
||||||
|
prototype = $.extend(true, prototype, data_points[x]);
|
||||||
|
}
|
||||||
|
|
||||||
|
createElements(prototype['data'], "root", "item").appendTo('#details');
|
||||||
|
}
|
||||||
|
|
||||||
|
function createElements(source, key, hierarchy)
|
||||||
|
{
|
||||||
|
var item;
|
||||||
|
var id = hierarchy + "_" + key.replace(/[^a-z0-9_]/gi,'');
|
||||||
|
|
||||||
|
if($.isArray(source))
|
||||||
|
{
|
||||||
|
/* Array. */
|
||||||
|
var me = $('<div class="variable array" id="' + id + '"><a class="expander" href="javascript:void(0);">[-]</a><span class="name">' + key + '</span><span class="data undefined">Array</span></div>');
|
||||||
|
}
|
||||||
|
else if($.isPlainObject(source))
|
||||||
|
{
|
||||||
|
/* Object. */
|
||||||
|
var me = $('<div class="variable object" id="' + id + '"><a class="expander" href="javascript:void(0);">[-]</a><span class="name">' + key + '</span><span class="data undefined">Object</span></div>');
|
||||||
|
|
||||||
|
for(item in source)
|
||||||
|
{
|
||||||
|
me.append(createElements(source[item], item, id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Value. */
|
||||||
|
var me = $('<div class="variable value" id="' + id + '"><span class="name">' + key + '</span><span class="data undefined">undefined</span></div>');
|
||||||
|
}
|
||||||
|
|
||||||
|
return me;
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateElements(source, key, hierarchy)
|
||||||
|
{
|
||||||
|
var item;
|
||||||
|
var id = hierarchy + "_" + key.replace(/[^a-z0-9_]/gi,'');
|
||||||
|
|
||||||
|
if($.isArray(source))
|
||||||
|
{
|
||||||
|
/* Array. */
|
||||||
|
//$('#' + id).children('.variable').remove();
|
||||||
|
|
||||||
|
for(item in source)
|
||||||
|
{
|
||||||
|
$('#' + id).append(createElements(source[item], item, id));
|
||||||
|
updateElements(source[item], item, id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if($.isPlainObject(source))
|
||||||
|
{
|
||||||
|
/* Object. */
|
||||||
|
|
||||||
|
for(item in source)
|
||||||
|
{
|
||||||
|
updateElements(source[item], item, id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Value. */
|
||||||
|
var target = $('#' + id).children('.data');
|
||||||
|
|
||||||
|
target.html(source);
|
||||||
|
target.removeClass("undefined");
|
||||||
|
|
||||||
|
if(typeof(source) == "number")
|
||||||
|
{
|
||||||
|
target.addClass("numeric");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
target.addClass("text");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function hookExpanders()
|
||||||
|
{
|
||||||
|
$('a.expander').click(function(){
|
||||||
|
if($(this).text() == "[-]")
|
||||||
|
{
|
||||||
|
/* Collapse */
|
||||||
|
$(this).text("[+]");
|
||||||
|
$(this).parent().children(".variable").hide();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Expand */
|
||||||
|
$(this).text("[-]");
|
||||||
|
$(this).parent().children(".variable").show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$(function(){
|
||||||
|
var drag_start_x = 0;
|
||||||
|
var drag_start_y = 0;
|
||||||
|
var dragging_slider = false;
|
||||||
|
|
||||||
|
$('#slider_handle').mousedown(function(e){
|
||||||
|
dragging_slider = true;
|
||||||
|
parent_offset = $(this).offset();
|
||||||
|
drag_start_x = e.pageX - parent_offset.left;
|
||||||
|
$('#slider_handle').addClass("dragging");
|
||||||
|
});
|
||||||
|
|
||||||
|
$('body').mouseup(function(e){
|
||||||
|
if(dragging_slider == true)
|
||||||
|
{
|
||||||
|
dragging_slider = false;
|
||||||
|
$('#slider_handle').removeClass("dragging");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('body').mousemove(function(e){
|
||||||
|
//$('#details').html("Dragging: "+dragging_slider+", drag_start_x: "+drag_start_x+", pageX: "+e.pageX);
|
||||||
|
if(dragging_slider == true)
|
||||||
|
{
|
||||||
|
newpos = e.pageX - drag_start_x;
|
||||||
|
|
||||||
|
if(newpos > 0 && newpos < (total_width))
|
||||||
|
{
|
||||||
|
$('#slider_handle').css({'left': newpos});
|
||||||
|
}
|
||||||
|
else if(newpos < 0)
|
||||||
|
{
|
||||||
|
$('#slider_handle').css({'left': 0});
|
||||||
|
}
|
||||||
|
else if(newpos > (total_width))
|
||||||
|
{
|
||||||
|
$('#slider_handle').css({'left': total_width});
|
||||||
|
}
|
||||||
|
|
||||||
|
sliderUpdate();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).keydown(function(e){
|
||||||
|
if(e.keyCode == 37 && current_point > 0)
|
||||||
|
{
|
||||||
|
switchDataPoint(current_point - 1);
|
||||||
|
}
|
||||||
|
else if(e.keyCode == 39 && current_point < total_data_points - 2)
|
||||||
|
{
|
||||||
|
switchDataPoint(current_point + 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var total_width = $('#slider_bar').width() - $('#slider_handle').width();
|
||||||
|
|
||||||
|
initializeElements();
|
||||||
|
sliderUpdate();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="slider">
|
||||||
|
<div id="slider_bar">
|
||||||
|
<div id="slider_handle"></div>
|
||||||
|
</div>
|
||||||
|
<div id="datapoint_info">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="details">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
<?php
|
||||||
|
}
|
@ -0,0 +1,99 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* CPHP is more free software. It is licensed under the WTFPL, which
|
||||||
|
* allows you to do pretty much anything with it, without having to
|
||||||
|
* ask permission. Commercial use is allowed, and no attribution is
|
||||||
|
* required. We do politely request that you share your modifications
|
||||||
|
* to benefit other developers, but you are under no enforced
|
||||||
|
* obligation to do so :)
|
||||||
|
*
|
||||||
|
* Please read the accompanying LICENSE document for the full WTFPL
|
||||||
|
* licensing text.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if($_CPHP !== true) { die(); }
|
||||||
|
|
||||||
|
if(!isset($cphp_config->libraries))
|
||||||
|
{
|
||||||
|
/* No library configuration has been specified. We don't need to
|
||||||
|
* execute the rest of this file. */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Some libraries want to have a cache directory. Instead of storing all
|
||||||
|
* this stuff in the document root, we'll put it into /tmp (or any other
|
||||||
|
* config-specified directory). We should probably make sure the needed
|
||||||
|
* directories exist, though... */
|
||||||
|
|
||||||
|
$tmp_dir = (isset($cphp_config->tmp_dir)) ? $cphp_config->tmp_dir : "/tmp";
|
||||||
|
|
||||||
|
if(!file_exists("{$tmp_dir}/cphp"))
|
||||||
|
{
|
||||||
|
mkdir("{$tmp_dir}/cphp", 0700);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!file_exists("{$tmp_dir}/cphp/cache"))
|
||||||
|
{
|
||||||
|
mkdir("{$tmp_dir}/cphp/cache", 0700);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We'll set up HTMLPurifier here if so desired. */
|
||||||
|
if(isset($cphp_config->libraries->htmlpurifier))
|
||||||
|
{
|
||||||
|
if(!is_dir("{$tmp_dir}/cphp/cache/htmlpurifier"))
|
||||||
|
{
|
||||||
|
mkdir("{$tmp_dir}/cphp/cache/htmlpurifier", 0700);
|
||||||
|
}
|
||||||
|
|
||||||
|
$library_config = $cphp_config->libraries->htmlpurifier;
|
||||||
|
$library_path = (isset($library_config->path)) ? $library_config->path : "lib/htmlpurifier/HTMLPurifier.auto.php";
|
||||||
|
|
||||||
|
require_once($library_path);
|
||||||
|
|
||||||
|
$purifier_config = HTMLPurifier_Config::createDefault();
|
||||||
|
|
||||||
|
if(isset($library_config->doctype))
|
||||||
|
{
|
||||||
|
$purifier_config->set("HTML.Doctype", $library_config->doctype);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($library_config->encoding))
|
||||||
|
{
|
||||||
|
$purifier_config->set("Core.Encoding", $library_config->encoding);
|
||||||
|
}
|
||||||
|
|
||||||
|
$purifier_config->set("Cache.SerializerPath", "{$tmp_dir}/cphp/cache/htmlpurifier");
|
||||||
|
|
||||||
|
$cphp_purifier = new HTMLPurifier($purifier_config);
|
||||||
|
$cphp_hash_purifier_config = md5(serialize($purifier_config));
|
||||||
|
|
||||||
|
function purify_html($input, $cache_duration = 3600, $config = null)
|
||||||
|
{
|
||||||
|
if(isset($config))
|
||||||
|
{
|
||||||
|
$config->set("Cache.SerializerPath", "{$tmp_dir}/cphp/cache/htmlpurifier");
|
||||||
|
$cphp_purifier = new HTMLPurifier($config);
|
||||||
|
$hash_config = md5(serialize($config));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
global $cphp_purifier;
|
||||||
|
global $cphp_hash_purifier_config;
|
||||||
|
$hash_config = $cphp_hash_purifier_config;
|
||||||
|
}
|
||||||
|
|
||||||
|
$hash_input = md5($input) . md5($input . "x");
|
||||||
|
$memcache_key = "purify_{$hash_config}_{$hash_input}";
|
||||||
|
|
||||||
|
if($result = mc_get($memcache_key))
|
||||||
|
{
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$result = $cphp_purifier->purify($input);
|
||||||
|
mc_set($memcache_key, $result, $cache_duration);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue