Rearrage code! Not tested on a web-server !
This commit is contained in:
parent
2f353a43b5
commit
880b6111f8
|
@ -36,9 +36,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
* @example https://github.com/neitanod/forceutf8
|
* @example https://github.com/neitanod/forceutf8
|
||||||
* @license Revised BSD
|
* @license Revised BSD
|
||||||
*/
|
*/
|
||||||
|
class Encoding
|
||||||
|
{
|
||||||
class Encoding {
|
|
||||||
|
|
||||||
const ICONV_TRANSLIT = "TRANSLIT";
|
const ICONV_TRANSLIT = "TRANSLIT";
|
||||||
const ICONV_IGNORE = "IGNORE";
|
const ICONV_IGNORE = "IGNORE";
|
||||||
|
@ -118,18 +117,18 @@ class Encoding {
|
||||||
"\xe2\x82\xac" => "\x80",
|
"\xe2\x82\xac" => "\x80",
|
||||||
|
|
||||||
"\xe2\x80\x9a" => "\x82",
|
"\xe2\x80\x9a" => "\x82",
|
||||||
"\xc6\x92" => "\x83",
|
"\xc6\x92" => "\x83",
|
||||||
"\xe2\x80\x9e" => "\x84",
|
"\xe2\x80\x9e" => "\x84",
|
||||||
"\xe2\x80\xa6" => "\x85",
|
"\xe2\x80\xa6" => "\x85",
|
||||||
"\xe2\x80\xa0" => "\x86",
|
"\xe2\x80\xa0" => "\x86",
|
||||||
"\xe2\x80\xa1" => "\x87",
|
"\xe2\x80\xa1" => "\x87",
|
||||||
"\xcb\x86" => "\x88",
|
"\xcb\x86" => "\x88",
|
||||||
"\xe2\x80\xb0" => "\x89",
|
"\xe2\x80\xb0" => "\x89",
|
||||||
"\xc5\xa0" => "\x8a",
|
"\xc5\xa0" => "\x8a",
|
||||||
"\xe2\x80\xb9" => "\x8b",
|
"\xe2\x80\xb9" => "\x8b",
|
||||||
"\xc5\x92" => "\x8c",
|
"\xc5\x92" => "\x8c",
|
||||||
|
|
||||||
"\xc5\xbd" => "\x8e",
|
"\xc5\xbd" => "\x8e",
|
||||||
|
|
||||||
|
|
||||||
"\xe2\x80\x98" => "\x91",
|
"\xe2\x80\x98" => "\x91",
|
||||||
|
@ -139,17 +138,49 @@ class Encoding {
|
||||||
"\xe2\x80\xa2" => "\x95",
|
"\xe2\x80\xa2" => "\x95",
|
||||||
"\xe2\x80\x93" => "\x96",
|
"\xe2\x80\x93" => "\x96",
|
||||||
"\xe2\x80\x94" => "\x97",
|
"\xe2\x80\x94" => "\x97",
|
||||||
"\xcb\x9c" => "\x98",
|
"\xcb\x9c" => "\x98",
|
||||||
"\xe2\x84\xa2" => "\x99",
|
"\xe2\x84\xa2" => "\x99",
|
||||||
"\xc5\xa1" => "\x9a",
|
"\xc5\xa1" => "\x9a",
|
||||||
"\xe2\x80\xba" => "\x9b",
|
"\xe2\x80\xba" => "\x9b",
|
||||||
"\xc5\x93" => "\x9c",
|
"\xc5\x93" => "\x9c",
|
||||||
|
|
||||||
"\xc5\xbe" => "\x9e",
|
"\xc5\xbe" => "\x9e",
|
||||||
"\xc5\xb8" => "\x9f"
|
"\xc5\xb8" => "\x9f"
|
||||||
);
|
);
|
||||||
|
|
||||||
static function toUTF8($text){
|
static function toISO8859($text, $option = self::WITHOUT_ICONV)
|
||||||
|
{
|
||||||
|
return self::toWin1252($text, $option);
|
||||||
|
}
|
||||||
|
|
||||||
|
static function toWin1252($text, $option = self::WITHOUT_ICONV)
|
||||||
|
{
|
||||||
|
if (is_array($text)) {
|
||||||
|
foreach ($text as $k => $v) {
|
||||||
|
$text[$k] = self::toWin1252($v, $option);
|
||||||
|
}
|
||||||
|
return $text;
|
||||||
|
} elseif (is_string($text)) {
|
||||||
|
return static::utf8_decode($text, $option);
|
||||||
|
} else {
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static function utf8_decode($text, $option = self::WITHOUT_ICONV)
|
||||||
|
{
|
||||||
|
if ($option == self::WITHOUT_ICONV || !function_exists('iconv')) {
|
||||||
|
$o = utf8_decode(
|
||||||
|
str_replace(array_keys(self::$utf8ToWin1252), array_values(self::$utf8ToWin1252), self::toUTF8($text))
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$o = iconv("UTF-8", "Windows-1252" . ($option == self::ICONV_TRANSLIT ? '//TRANSLIT' : ($option == self::ICONV_IGNORE ? '//IGNORE' : '')), $text);
|
||||||
|
}
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
static function toUTF8($text)
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Function \ForceUTF8\Encoding::toUTF8
|
* Function \ForceUTF8\Encoding::toUTF8
|
||||||
*
|
*
|
||||||
|
@ -170,35 +201,33 @@ class Encoding {
|
||||||
* 3) when any of these: ðñòó are followed by THREE chars from group B.
|
* 3) when any of these: ðñòó are followed by THREE chars from group B.
|
||||||
*
|
*
|
||||||
* @name toUTF8
|
* @name toUTF8
|
||||||
* @param string $text Any string.
|
* @param string $text Any string.
|
||||||
* @return string The same string, UTF8 encoded
|
* @return string The same string, UTF8 encoded
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(is_array($text))
|
if (is_array($text)) {
|
||||||
{
|
foreach ($text as $k => $v) {
|
||||||
foreach($text as $k => $v)
|
|
||||||
{
|
|
||||||
$text[$k] = self::toUTF8($v);
|
$text[$k] = self::toUTF8($v);
|
||||||
}
|
}
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!is_string($text)) {
|
if (!is_string($text)) {
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
$max = self::strlen($text);
|
$max = self::strlen($text);
|
||||||
|
|
||||||
$buf = "";
|
$buf = "";
|
||||||
for($i = 0; $i < $max; $i++){
|
for ($i = 0; $i < $max; $i++) {
|
||||||
$c1 = $text{$i};
|
$c1 = $text{$i};
|
||||||
if($c1>="\xc0"){ //Should be converted to UTF8, if it's not UTF8 already
|
if ($c1 >= "\xc0") { //Should be converted to UTF8, if it's not UTF8 already
|
||||||
$c2 = $i+1 >= $max? "\x00" : $text{$i+1};
|
$c2 = $i + 1 >= $max ? "\x00" : $text{$i + 1};
|
||||||
$c3 = $i+2 >= $max? "\x00" : $text{$i+2};
|
$c3 = $i + 2 >= $max ? "\x00" : $text{$i + 2};
|
||||||
$c4 = $i+3 >= $max? "\x00" : $text{$i+3};
|
$c4 = $i + 3 >= $max ? "\x00" : $text{$i + 3};
|
||||||
if($c1 >= "\xc0" & $c1 <= "\xdf"){ //looks like 2 bytes UTF8
|
if ($c1 >= "\xc0" & $c1 <= "\xdf") { //looks like 2 bytes UTF8
|
||||||
if($c2 >= "\x80" && $c2 <= "\xbf"){ //yeah, almost sure it's UTF8 already
|
if ($c2 >= "\x80" && $c2 <= "\xbf") { //yeah, almost sure it's UTF8 already
|
||||||
$buf .= $c1 . $c2;
|
$buf .= $c1 . $c2;
|
||||||
$i++;
|
$i++;
|
||||||
} else { //not valid UTF8. Convert it.
|
} else { //not valid UTF8. Convert it.
|
||||||
|
@ -206,8 +235,8 @@ class Encoding {
|
||||||
$cc2 = ($c1 & "\x3f") | "\x80";
|
$cc2 = ($c1 & "\x3f") | "\x80";
|
||||||
$buf .= $cc1 . $cc2;
|
$buf .= $cc1 . $cc2;
|
||||||
}
|
}
|
||||||
} elseif($c1 >= "\xe0" & $c1 <= "\xef"){ //looks like 3 bytes UTF8
|
} elseif ($c1 >= "\xe0" & $c1 <= "\xef") { //looks like 3 bytes UTF8
|
||||||
if($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf"){ //yeah, almost sure it's UTF8 already
|
if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf") { //yeah, almost sure it's UTF8 already
|
||||||
$buf .= $c1 . $c2 . $c3;
|
$buf .= $c1 . $c2 . $c3;
|
||||||
$i = $i + 2;
|
$i = $i + 2;
|
||||||
} else { //not valid UTF8. Convert it.
|
} else { //not valid UTF8. Convert it.
|
||||||
|
@ -215,8 +244,8 @@ class Encoding {
|
||||||
$cc2 = ($c1 & "\x3f") | "\x80";
|
$cc2 = ($c1 & "\x3f") | "\x80";
|
||||||
$buf .= $cc1 . $cc2;
|
$buf .= $cc1 . $cc2;
|
||||||
}
|
}
|
||||||
} elseif($c1 >= "\xf0" & $c1 <= "\xf7"){ //looks like 4 bytes UTF8
|
} elseif ($c1 >= "\xf0" & $c1 <= "\xf7") { //looks like 4 bytes UTF8
|
||||||
if($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf" && $c4 >= "\x80" && $c4 <= "\xbf"){ //yeah, almost sure it's UTF8 already
|
if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf" && $c4 >= "\x80" && $c4 <= "\xbf") { //yeah, almost sure it's UTF8 already
|
||||||
$buf .= $c1 . $c2 . $c3 . $c4;
|
$buf .= $c1 . $c2 . $c3 . $c4;
|
||||||
$i = $i + 3;
|
$i = $i + 3;
|
||||||
} else { //not valid UTF8. Convert it.
|
} else { //not valid UTF8. Convert it.
|
||||||
|
@ -229,8 +258,8 @@ class Encoding {
|
||||||
$cc2 = (($c1 & "\x3f") | "\x80");
|
$cc2 = (($c1 & "\x3f") | "\x80");
|
||||||
$buf .= $cc1 . $cc2;
|
$buf .= $cc1 . $cc2;
|
||||||
}
|
}
|
||||||
} elseif(($c1 & "\xc0") == "\x80"){ // needs conversion
|
} elseif (($c1 & "\xc0") == "\x80") { // needs conversion
|
||||||
if(isset(self::$win1252ToUtf8[ord($c1)])) { //found in Windows-1252 special cases
|
if (isset(self::$win1252ToUtf8[ord($c1)])) { //found in Windows-1252 special cases
|
||||||
$buf .= self::$win1252ToUtf8[ord($c1)];
|
$buf .= self::$win1252ToUtf8[ord($c1)];
|
||||||
} else {
|
} else {
|
||||||
$cc1 = (chr(ord($c1) / 64) | "\xc0");
|
$cc1 = (chr(ord($c1) / 64) | "\xc0");
|
||||||
|
@ -244,41 +273,27 @@ class Encoding {
|
||||||
return $buf;
|
return $buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function toWin1252($text, $option = self::WITHOUT_ICONV) {
|
protected static function strlen($text)
|
||||||
if(is_array($text)) {
|
{
|
||||||
foreach($text as $k => $v) {
|
return (function_exists('mb_strlen') && ((int)ini_get('mbstring.func_overload')) & 2) ?
|
||||||
$text[$k] = self::toWin1252($v, $option);
|
mb_strlen($text, '8bit') : strlen($text);
|
||||||
}
|
|
||||||
return $text;
|
|
||||||
} elseif(is_string($text)) {
|
|
||||||
return static::utf8_decode($text, $option);
|
|
||||||
} else {
|
|
||||||
return $text;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static function toISO8859($text, $option = self::WITHOUT_ICONV) {
|
static function fixUTF8($text, $option = self::WITHOUT_ICONV)
|
||||||
return self::toWin1252($text, $option);
|
{
|
||||||
}
|
if (is_array($text)) {
|
||||||
|
foreach ($text as $k => $v) {
|
||||||
static function toLatin1($text, $option = self::WITHOUT_ICONV) {
|
|
||||||
return self::toWin1252($text, $option);
|
|
||||||
}
|
|
||||||
|
|
||||||
static function fixUTF8($text, $option = self::WITHOUT_ICONV){
|
|
||||||
if(is_array($text)) {
|
|
||||||
foreach($text as $k => $v) {
|
|
||||||
$text[$k] = self::fixUTF8($v, $option);
|
$text[$k] = self::fixUTF8($v, $option);
|
||||||
}
|
}
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!is_string($text)) {
|
if (!is_string($text)) {
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
$last = "";
|
$last = "";
|
||||||
while($last <> $text){
|
while ($last <> $text) {
|
||||||
$last = $text;
|
$last = $text;
|
||||||
$text = self::toUTF8(static::utf8_decode($text, $option));
|
$text = self::toUTF8(static::utf8_decode($text, $option));
|
||||||
}
|
}
|
||||||
|
@ -286,7 +301,8 @@ class Encoding {
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function UTF8FixWin1252Chars($text){
|
static function UTF8FixWin1252Chars($text)
|
||||||
|
{
|
||||||
// If you received an UTF-8 string that was converted from Windows-1252 as it was ISO8859-1
|
// If you received an UTF-8 string that was converted from Windows-1252 as it was ISO8859-1
|
||||||
// (ignoring Windows-1252 chars from 80 to 9F) use this function to fix it.
|
// (ignoring Windows-1252 chars from 80 to 9F) use this function to fix it.
|
||||||
// See: http://en.wikipedia.org/wiki/Windows-1252
|
// See: http://en.wikipedia.org/wiki/Windows-1252
|
||||||
|
@ -294,16 +310,19 @@ class Encoding {
|
||||||
return str_replace(array_keys(self::$brokenUtf8ToUtf8), array_values(self::$brokenUtf8ToUtf8), $text);
|
return str_replace(array_keys(self::$brokenUtf8ToUtf8), array_values(self::$brokenUtf8ToUtf8), $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
static function removeBOM($str=""){
|
static function removeBOM($str = "")
|
||||||
if(substr($str, 0,3) == pack("CCC",0xef,0xbb,0xbf)) {
|
{
|
||||||
$str=substr($str, 3);
|
if (substr($str, 0, 3) == pack("CCC", 0xef, 0xbb, 0xbf)) {
|
||||||
|
$str = substr($str, 3);
|
||||||
}
|
}
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function strlen($text){
|
public static function encode($encodingLabel, $text)
|
||||||
return (function_exists('mb_strlen') && ((int) ini_get('mbstring.func_overload')) & 2) ?
|
{
|
||||||
mb_strlen($text,'8bit') : strlen($text);
|
$encodingLabel = self::normalizeEncoding($encodingLabel);
|
||||||
|
if ($encodingLabel == 'ISO-8859-1') return self::toLatin1($text);
|
||||||
|
return self::toUTF8($text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function normalizeEncoding($encodingLabel)
|
public static function normalizeEncoding($encodingLabel)
|
||||||
|
@ -312,59 +331,50 @@ class Encoding {
|
||||||
$encoding = preg_replace('/[^a-zA-Z0-9\s]/', '', $encoding);
|
$encoding = preg_replace('/[^a-zA-Z0-9\s]/', '', $encoding);
|
||||||
$equivalences = array(
|
$equivalences = array(
|
||||||
'ISO88591' => 'ISO-8859-1',
|
'ISO88591' => 'ISO-8859-1',
|
||||||
'ISO8859' => 'ISO-8859-1',
|
'ISO8859' => 'ISO-8859-1',
|
||||||
'ISO' => 'ISO-8859-1',
|
'ISO' => 'ISO-8859-1',
|
||||||
'LATIN1' => 'ISO-8859-1',
|
'LATIN1' => 'ISO-8859-1',
|
||||||
'LATIN' => 'ISO-8859-1',
|
'LATIN' => 'ISO-8859-1',
|
||||||
'UTF8' => 'UTF-8',
|
'UTF8' => 'UTF-8',
|
||||||
'UTF' => 'UTF-8',
|
'UTF' => 'UTF-8',
|
||||||
'WIN1252' => 'ISO-8859-1',
|
'WIN1252' => 'ISO-8859-1',
|
||||||
'WINDOWS1252' => 'ISO-8859-1'
|
'WINDOWS1252' => 'ISO-8859-1'
|
||||||
);
|
);
|
||||||
|
|
||||||
if(empty($equivalences[$encoding])){
|
if (empty($equivalences[$encoding])) {
|
||||||
return 'UTF-8';
|
return 'UTF-8';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $equivalences[$encoding];
|
return $equivalences[$encoding];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encode($encodingLabel, $text)
|
static function toLatin1($text, $option = self::WITHOUT_ICONV)
|
||||||
{
|
{
|
||||||
$encodingLabel = self::normalizeEncoding($encodingLabel);
|
return self::toWin1252($text, $option);
|
||||||
if($encodingLabel == 'ISO-8859-1') return self::toLatin1($text);
|
|
||||||
return self::toUTF8($text);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static function utf8_decode($text, $option = self::WITHOUT_ICONV)
|
|
||||||
{
|
|
||||||
if ($option == self::WITHOUT_ICONV || !function_exists('iconv')) {
|
|
||||||
$o = utf8_decode(
|
|
||||||
str_replace(array_keys(self::$utf8ToWin1252), array_values(self::$utf8ToWin1252), self::toUTF8($text))
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$o = iconv("UTF-8", "Windows-1252" . ($option == self::ICONV_TRANSLIT ? '//TRANSLIT' : ($option == self::ICONV_IGNORE ? '//IGNORE' : '')), $text);
|
|
||||||
}
|
|
||||||
return $o;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****/
|
/****/
|
||||||
|
|
||||||
public static function destructionH4x0RChaine($chaine){
|
public static function destructionH4x0RChaine($chaine)
|
||||||
|
{
|
||||||
return preg_replace('#[\x00-\x1F\x7F-\x9F/\\\\]#', '', $chaine);
|
return preg_replace('#[\x00-\x1F\x7F-\x9F/\\\\]#', '', $chaine);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function protectionDoubleQuote($chaine){
|
public static function protectionDoubleQuote($chaine)
|
||||||
|
{
|
||||||
$chaine = preg_replace('/"(\w+)"/', '« ${1} »', $chaine);
|
$chaine = preg_replace('/"(\w+)"/', '« ${1} »', $chaine);
|
||||||
$chaine = preg_replace('#"#', '_', $chaine);
|
$chaine = preg_replace('#"#', '_', $chaine);
|
||||||
return $chaine;
|
return $chaine;
|
||||||
}
|
}
|
||||||
public static function protectionSimpleQuote($chaine){
|
|
||||||
|
public static function protectionSimpleQuote($chaine)
|
||||||
|
{
|
||||||
$chaine = preg_replace("#'#", '_', $chaine);
|
$chaine = preg_replace("#'#", '_', $chaine);
|
||||||
return $chaine;
|
return $chaine;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function myUrlEncode($string) {
|
public static function myUrlEncode($string)
|
||||||
|
{
|
||||||
$replacements = array('%21', '%2A', '%27', '%28', '%29', '%3B', '%3A', '%40', '%26', '%3D'/*, '%2B'*/, '%24', '%2C', '%2F', '%3F', '%25', '%23', '%5B', '%5D');
|
$replacements = array('%21', '%2A', '%27', '%28', '%29', '%3B', '%3A', '%40', '%26', '%3D'/*, '%2B'*/, '%24', '%2C', '%2F', '%3F', '%25', '%23', '%5B', '%5D');
|
||||||
$entities = array('!', '*', "'", "(", ")", ";", ":", "@", "&", "="/*, "+"*/, "$", ",", "/", "?", "%", "#", "[", "]");
|
$entities = array('!', '*', "'", "(", ")", ";", ":", "@", "&", "="/*, "+"*/, "$", ",", "/", "?", "%", "#", "[", "]");
|
||||||
$string = urlencode($string);
|
$string = urlencode($string);
|
||||||
|
@ -372,7 +382,8 @@ class Encoding {
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function myUrlDecode($string) {
|
public static function myUrlDecode($string)
|
||||||
|
{
|
||||||
$entities = array('%21', '%2A', '%27', '%28', '%29', '%3B', '%3A', '%40', '%26', '%3D'/*, '%2B'*/, '%24', '%2C', '%2F', '%3F', '%25', '%23', '%5B', '%5D');
|
$entities = array('%21', '%2A', '%27', '%28', '%29', '%3B', '%3A', '%40', '%26', '%3D'/*, '%2B'*/, '%24', '%2C', '%2F', '%3F', '%25', '%23', '%5B', '%5D');
|
||||||
$replacements = array('!', '*', "'", "(", ")", ";", ":", "@", "&", "="/*, "+"*/, "$", ",", "/", "?", "%", "#", "[", "]");
|
$replacements = array('!', '*', "'", "(", ")", ";", ":", "@", "&", "="/*, "+"*/, "$", ",", "/", "?", "%", "#", "[", "]");
|
||||||
$string = str_replace($entities, $replacements, $string);
|
$string = str_replace($entities, $replacements, $string);
|
||||||
|
|
|
@ -27,18 +27,19 @@ namespace {
|
||||||
* Hash the password using the specified algorithm
|
* Hash the password using the specified algorithm
|
||||||
*
|
*
|
||||||
* @param string $password The password to hash
|
* @param string $password The password to hash
|
||||||
* @param int $algo The algorithm to use (Defined by PASSWORD_* constants)
|
* @param int $algo The algorithm to use (Defined by PASSWORD_* constants)
|
||||||
* @param array $options The options for the algorithm to use
|
* @param array $options The options for the algorithm to use
|
||||||
*
|
*
|
||||||
* @return string|false The hashed password, or false on error.
|
* @return string|false The hashed password, or false on error.
|
||||||
*/
|
*/
|
||||||
function password_hash($password, $algo, array $options = array()) {
|
function password_hash($password, $algo, array $options = array())
|
||||||
|
{
|
||||||
if (!function_exists('crypt')) {
|
if (!function_exists('crypt')) {
|
||||||
trigger_error("Crypt must be loaded for password_hash to function", E_USER_WARNING);
|
trigger_error("Crypt must be loaded for password_hash to function", E_USER_WARNING);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (is_null($password) || is_int($password)) {
|
if (is_null($password) || is_int($password)) {
|
||||||
$password = (string) $password;
|
$password = (string)$password;
|
||||||
}
|
}
|
||||||
if (!is_string($password)) {
|
if (!is_string($password)) {
|
||||||
trigger_error("password_hash(): Password must be a string", E_USER_WARNING);
|
trigger_error("password_hash(): Password must be a string", E_USER_WARNING);
|
||||||
|
@ -53,7 +54,7 @@ namespace {
|
||||||
case PASSWORD_BCRYPT:
|
case PASSWORD_BCRYPT:
|
||||||
$cost = PASSWORD_BCRYPT_DEFAULT_COST;
|
$cost = PASSWORD_BCRYPT_DEFAULT_COST;
|
||||||
if (isset($options['cost'])) {
|
if (isset($options['cost'])) {
|
||||||
$cost = (int) $options['cost'];
|
$cost = (int)$options['cost'];
|
||||||
if ($cost < 4 || $cost > 31) {
|
if ($cost < 4 || $cost > 31) {
|
||||||
trigger_error(sprintf("password_hash(): Invalid bcrypt cost parameter specified: %d", $cost), E_USER_WARNING);
|
trigger_error(sprintf("password_hash(): Invalid bcrypt cost parameter specified: %d", $cost), E_USER_WARNING);
|
||||||
return null;
|
return null;
|
||||||
|
@ -79,11 +80,11 @@ namespace {
|
||||||
case 'integer':
|
case 'integer':
|
||||||
case 'double':
|
case 'double':
|
||||||
case 'string':
|
case 'string':
|
||||||
$salt = (string) $options['salt'];
|
$salt = (string)$options['salt'];
|
||||||
break;
|
break;
|
||||||
case 'object':
|
case 'object':
|
||||||
if (method_exists($options['salt'], '__tostring')) {
|
if (method_exists($options['salt'], '__tostring')) {
|
||||||
$salt = (string) $options['salt'];
|
$salt = (string)$options['salt'];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'array':
|
case 'array':
|
||||||
|
@ -180,7 +181,8 @@ namespace {
|
||||||
*
|
*
|
||||||
* @return array The array of information about the hash.
|
* @return array The array of information about the hash.
|
||||||
*/
|
*/
|
||||||
function password_get_info($hash) {
|
function password_get_info($hash)
|
||||||
|
{
|
||||||
$return = array(
|
$return = array(
|
||||||
'algo' => 0,
|
'algo' => 0,
|
||||||
'algoName' => 'unknown',
|
'algoName' => 'unknown',
|
||||||
|
@ -200,20 +202,21 @@ namespace {
|
||||||
*
|
*
|
||||||
* If the answer is true, after validating the password using password_verify, rehash it.
|
* If the answer is true, after validating the password using password_verify, rehash it.
|
||||||
*
|
*
|
||||||
* @param string $hash The hash to test
|
* @param string $hash The hash to test
|
||||||
* @param int $algo The algorithm used for new password hashes
|
* @param int $algo The algorithm used for new password hashes
|
||||||
* @param array $options The options array passed to password_hash
|
* @param array $options The options array passed to password_hash
|
||||||
*
|
*
|
||||||
* @return boolean True if the password needs to be rehashed.
|
* @return boolean True if the password needs to be rehashed.
|
||||||
*/
|
*/
|
||||||
function password_needs_rehash($hash, $algo, array $options = array()) {
|
function password_needs_rehash($hash, $algo, array $options = array())
|
||||||
|
{
|
||||||
$info = password_get_info($hash);
|
$info = password_get_info($hash);
|
||||||
if ($info['algo'] !== (int) $algo) {
|
if ($info['algo'] !== (int)$algo) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
switch ($algo) {
|
switch ($algo) {
|
||||||
case PASSWORD_BCRYPT:
|
case PASSWORD_BCRYPT:
|
||||||
$cost = isset($options['cost']) ? (int) $options['cost'] : PASSWORD_BCRYPT_DEFAULT_COST;
|
$cost = isset($options['cost']) ? (int)$options['cost'] : PASSWORD_BCRYPT_DEFAULT_COST;
|
||||||
if ($cost !== $info['options']['cost']) {
|
if ($cost !== $info['options']['cost']) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -226,11 +229,12 @@ namespace {
|
||||||
* Verify a password against a hash using a timing attack resistant approach
|
* Verify a password against a hash using a timing attack resistant approach
|
||||||
*
|
*
|
||||||
* @param string $password The password to verify
|
* @param string $password The password to verify
|
||||||
* @param string $hash The hash to verify against
|
* @param string $hash The hash to verify against
|
||||||
*
|
*
|
||||||
* @return boolean If the password matches the hash
|
* @return boolean If the password matches the hash
|
||||||
*/
|
*/
|
||||||
function password_verify($password, $hash) {
|
function password_verify($password, $hash)
|
||||||
|
{
|
||||||
if (!function_exists('crypt')) {
|
if (!function_exists('crypt')) {
|
||||||
trigger_error("Crypt must be loaded for password_verify to function", E_USER_WARNING);
|
trigger_error("Crypt must be loaded for password_verify to function", E_USER_WARNING);
|
||||||
return false;
|
return false;
|
||||||
|
@ -264,10 +268,11 @@ namespace PasswordCompat\binary {
|
||||||
*
|
*
|
||||||
* @param string $binary_string The input string
|
* @param string $binary_string The input string
|
||||||
*
|
*
|
||||||
* @internal
|
|
||||||
* @return int The number of bytes
|
* @return int The number of bytes
|
||||||
|
* @internal
|
||||||
*/
|
*/
|
||||||
function _strlen($binary_string) {
|
function _strlen($binary_string)
|
||||||
|
{
|
||||||
if (function_exists('mb_strlen')) {
|
if (function_exists('mb_strlen')) {
|
||||||
return mb_strlen($binary_string, '8bit');
|
return mb_strlen($binary_string, '8bit');
|
||||||
}
|
}
|
||||||
|
@ -277,16 +282,17 @@ namespace PasswordCompat\binary {
|
||||||
/**
|
/**
|
||||||
* Get a substring based on byte limits
|
* Get a substring based on byte limits
|
||||||
*
|
*
|
||||||
|
* @param string $binary_string The input string
|
||||||
|
* @param int $start
|
||||||
|
* @param int $length
|
||||||
|
*
|
||||||
|
* @return string The substring
|
||||||
|
* @internal
|
||||||
* @see _strlen()
|
* @see _strlen()
|
||||||
*
|
*
|
||||||
* @param string $binary_string The input string
|
|
||||||
* @param int $start
|
|
||||||
* @param int $length
|
|
||||||
*
|
|
||||||
* @internal
|
|
||||||
* @return string The substring
|
|
||||||
*/
|
*/
|
||||||
function _substr($binary_string, $start, $length) {
|
function _substr($binary_string, $start, $length)
|
||||||
|
{
|
||||||
if (function_exists('mb_substr')) {
|
if (function_exists('mb_substr')) {
|
||||||
return mb_substr($binary_string, $start, $length, '8bit');
|
return mb_substr($binary_string, $start, $length, '8bit');
|
||||||
}
|
}
|
||||||
|
@ -298,7 +304,8 @@ namespace PasswordCompat\binary {
|
||||||
*
|
*
|
||||||
* @return boolean the check result
|
* @return boolean the check result
|
||||||
*/
|
*/
|
||||||
function check() {
|
function check()
|
||||||
|
{
|
||||||
static $pass = NULL;
|
static $pass = NULL;
|
||||||
|
|
||||||
if (is_null($pass)) {
|
if (is_null($pass)) {
|
||||||
|
|
|
@ -1,24 +1,27 @@
|
||||||
|
<footer>
|
||||||
<footer>
|
<p>© Unachieved <a href="http://www.evolutis.fr/">Evolutis</a> & <a href="http://www.ip-formation.com/">IP-formation</a>
|
||||||
<p>© Unachieved <a href="http://www.evolutis.fr/">Evolutis</a> & <a href="http://www.ip-formation.com/">IP-formation</a> 2011 - develloped by Emmanuel ROY on an Debian dev2 original totally reindexed by sadness</p>
|
2011 - develloped by Emmanuel ROY on an Debian dev2 original totally reindexed by sadness</p>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
|
||||||
<!-- JavaScript at the bottom for fast page loading -->
|
|
||||||
|
|
||||||
|
|
||||||
<script src="js/markdown.js"></script>
|
<!-- JavaScript at the bottom for fast page loading -->
|
||||||
<script>
|
|
||||||
function Editor(input, preview) {
|
|
||||||
this.update = function () {
|
<script src="js/markdown.js"></script>
|
||||||
preview.innerHTML = markdown.toHTML(input.value);
|
<script>
|
||||||
};
|
function Editor(input, preview) {
|
||||||
input.editor = this;
|
this.update = function () {
|
||||||
this.update();
|
preview.innerHTML = markdown.toHTML(input.value);
|
||||||
}
|
};
|
||||||
var $ = function (id) { return document.getElementById(id); };
|
input.editor = this;
|
||||||
new Editor($("text-input"), $("preview"));
|
this.update();
|
||||||
</script>
|
}
|
||||||
|
|
||||||
|
var $ = function (id) {
|
||||||
|
return document.getElementById(id);
|
||||||
|
};
|
||||||
|
new Editor($("text-input"), $("preview"));
|
||||||
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,72 +1,80 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
|
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
|
||||||
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
|
<!--[if lt IE 7]>
|
||||||
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
|
<html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
|
||||||
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
|
<!--[if IE 7]>
|
||||||
|
<html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
|
||||||
|
<!--[if IE 8]>
|
||||||
|
<html class="no-js lt-ie9" lang="en"> <![endif]-->
|
||||||
<!-- Consider adding a manifest.appcache: h5bp.com/d/Offline -->
|
<!-- Consider adding a manifest.appcache: h5bp.com/d/Offline -->
|
||||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="fr"> <!--<![endif]-->
|
<!--[if gt IE 8]><!-->
|
||||||
|
<html class="no-js" lang="fr"> <!--<![endif]-->
|
||||||
<head>
|
<head>
|
||||||
<META charset="utf-8">
|
<META charset="utf-8">
|
||||||
|
|
||||||
<META NAME="Category" CONTENT=""/>
|
<META NAME="Category" CONTENT=""/>
|
||||||
<META NAME="Publisher" CONTENT="Emmanuel ROY"/>
|
<META NAME="Publisher" CONTENT="Emmanuel ROY"/>
|
||||||
<META NAME="Copyright" CONTENT="© - 2015 - Acksop"/>
|
<META NAME="Copyright" CONTENT="© - 2015 - Acksop"/>
|
||||||
<META NAME="Expires" CONTENT="Never Maybe!"/>
|
<META NAME="Expires" CONTENT="Never Maybe!"/>
|
||||||
<META NAME="Distribution" CONTENT="Global"/>
|
<META NAME="Distribution" CONTENT="Global"/>
|
||||||
<META NAME='Description' lang='<?php echo $lang; ?>' CONTENT="<?php echo $metaDesc ?>"/>
|
<META NAME='Description' lang='<?php echo $lang; ?>' CONTENT="<?php echo $metaDesc ?>"/>
|
||||||
<META NAME='Identifier-URL' CONTENT="new.emmanuelroy.name/<?php echo $page['name'] ?>"/>
|
<META NAME='Identifier-URL' CONTENT="new.emmanuelroy.name/<?php echo $page['name'] ?>"/>
|
||||||
<?php
|
<?php
|
||||||
/*Rich META from google
|
/*Rich META from google
|
||||||
<meta name="department" content="legal" />
|
<meta name="department" content="legal" />
|
||||||
<meta name="audience" content="all" />
|
<meta name="audience" content="all" />
|
||||||
<meta name="doc_status" content="draft" />
|
<meta name="doc_status" content="draft" />
|
||||||
//a utiliser avec un syteme de classement utilisateur
|
//a utiliser avec un syteme de classement utilisateur
|
||||||
<meta name="rating" content="5" />
|
<meta name="rating" content="5" />
|
||||||
//link: http://en.wikipedia.org/wiki/Smart_tag_%28Microsoft%29
|
//link: http://en.wikipedia.org/wiki/Smart_tag_%28Microsoft%29
|
||||||
<meta name="mssmarttagspreventparsing" content="..." />
|
<meta name="mssmarttagspreventparsing" content="..." />
|
||||||
//link: https://support.google.com/customsearch/answer/2595557?hl=fr
|
//link: https://support.google.com/customsearch/answer/2595557?hl=fr
|
||||||
<meta name="verify-v1" content="..." />
|
<meta name="verify-v1" content="..." />
|
||||||
*/
|
*/
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<META NAME='Keywords' lang='fr' CONTENT="Art, Programming, Languages, Personnal Website, Curriculum Vitae Multimédia"/>
|
|
||||||
<META NAME="Author" CONTENT="<?php if(isset($auteur)){ echo $auteur; }else {echo 'Emmanuel ROY And More'; } ?>"/>
|
|
||||||
<META NAME="Reply-to" CONTENT="contact@emmanuelroy.name"/>
|
|
||||||
<META NAME="Date-Creation-yyyymmdd" CONTENT="<?php echo $dateCreation ?>"/>
|
|
||||||
<META NAME="Date-Revision-yyyymmdd" CONTENT="<?php echo $dateRevision ?>"/>
|
|
||||||
<META NAME="Revisit-After" CONTENT="365,333333333333333333333333333... - 1 days"/>
|
|
||||||
<META NAME="Robots" CONTENT="index, nofollow"/>
|
|
||||||
<META NAME="GOOGLEBOT" CONTENT="NOARCHIVE"/>
|
|
||||||
<META NAME="the-WAYBACK-MACHINE" CONTENT="ARCHIVE"/>
|
|
||||||
|
|
||||||
<!-- Use the .htaccess and remove these lines to avoid edge case issues.
|
<META NAME='Keywords' lang='fr'
|
||||||
More info: h5bp.com/i/378 -->
|
CONTENT="Art, Programming, Languages, Personnal Website, Curriculum Vitae Multimédia"/>
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<META NAME="Author" CONTENT="<?php if (isset($auteur)) {
|
||||||
|
echo $auteur;
|
||||||
|
} else {
|
||||||
|
echo 'Emmanuel ROY And More';
|
||||||
|
} ?>"/>
|
||||||
|
<META NAME="Reply-to" CONTENT="contact@emmanuelroy.name"/>
|
||||||
|
<META NAME="Date-Creation-yyyymmdd" CONTENT="<?php echo $dateCreation ?>"/>
|
||||||
|
<META NAME="Date-Revision-yyyymmdd" CONTENT="<?php echo $dateRevision ?>"/>
|
||||||
|
<META NAME="Revisit-After" CONTENT="365,333333333333333333333333333... - 1 days"/>
|
||||||
|
<META NAME="Robots" CONTENT="index, nofollow"/>
|
||||||
|
<META NAME="GOOGLEBOT" CONTENT="NOARCHIVE"/>
|
||||||
|
<META NAME="the-WAYBACK-MACHINE" CONTENT="ARCHIVE"/>
|
||||||
|
|
||||||
<title><?php echo $title ?></title>
|
<!-- Use the .htaccess and remove these lines to avoid edge case issues.
|
||||||
|
More info: h5bp.com/i/378 -->
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
|
||||||
<!-- Mobile viewport optimized: h5bp.com/viewport -->
|
<title><?php echo $title ?></title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
|
|
||||||
<!-- Place favicon.ico and apple-touch-icon.png in the root directory: mathiasbynens.be/notes/touch-icons -->
|
<!-- Mobile viewport optimized: h5bp.com/viewport -->
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
<!--<link rel="stylesheet" href="/css/style.css" />-->
|
<!-- Place favicon.ico and apple-touch-icon.png in the root directory: mathiasbynens.be/notes/touch-icons -->
|
||||||
|
|
||||||
<!-- More ideas for your <head> here: h5bp.com/d/head-Tips -->
|
<!--<link rel="stylesheet" href="/css/style.css" />-->
|
||||||
|
|
||||||
|
<!-- More ideas for your <head> here: h5bp.com/d/head-Tips -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- All JavaScript at the bottom, except this Modernizr build.
|
||||||
|
Modernizr enables HTML5 elements & feature detects for optimal performance.
|
||||||
<!-- All JavaScript at the bottom, except this Modernizr build.
|
Create your own custom Modernizr build: www.modernizr.com/download/ -->
|
||||||
Modernizr enables HTML5 elements & feature detects for optimal performance.
|
<!-- <script src="/js/libs/modernizr-2.5.3.min.js"></script>-->
|
||||||
Create your own custom Modernizr build: www.modernizr.com/download/ -->
|
|
||||||
<!-- <script src="/js/libs/modernizr-2.5.3.min.js"></script>-->
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<!-- Prompt IE 6 users to install Chrome Frame. Remove this if you support IE 6.
|
<!-- Prompt IE 6 users to install Chrome Frame. Remove this if you support IE 6.
|
||||||
chromium.org/developers/how-tos/chrome-frame-getting-started -->
|
chromium.org/developers/how-tos/chrome-frame-getting-started -->
|
||||||
<!--[if lt IE 7]><p class=chromeframe>Your browser is <em>ancient!</em> <a href="http://browsehappy.com/">Upgrade to a different browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to experience this site.</p><![endif]-->
|
<!--[if lt IE 7]><p class=chromeframe>Your browser is <em>ancient!</em> <a href="http://browsehappy.com/">Upgrade to a
|
||||||
|
different browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a>
|
||||||
|
to experience this site.</p><![endif]-->
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
<?php include LAYOUT_PATH . DIRECTORY_SEPARATOR .'header.php';?>
|
<?php include LAYOUT_PATH . DIRECTORY_SEPARATOR . 'header.php'; ?>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<header>
|
<header>
|
||||||
<h2>Ceci est le header de la page <?php echo $page['name'] ?></h2>
|
<h2>Ceci est le header de la page <?php echo $page['name'] ?></h2>
|
||||||
</header>
|
</header>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<br /><br /><br />
|
<br/><br/><br/>
|
||||||
<?php echo $content ?>
|
<?php echo $content ?>
|
||||||
<br /><br /><br />
|
<br/><br/><br/>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<footer>
|
<footer>
|
||||||
<h2>Ceci est le footer de la page <?php echo $page['name'] ?></h2>
|
<h2>Ceci est le footer de la page <?php echo $page['name'] ?></h2>
|
||||||
</footer>
|
</footer>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|
||||||
<?php include LAYOUT_PATH . DIRECTORY_SEPARATOR .'footer.php';?>
|
<?php include LAYOUT_PATH . DIRECTORY_SEPARATOR . 'footer.php'; ?>
|
||||||
|
|
||||||
|
|
|
@ -2,26 +2,29 @@
|
||||||
|
|
||||||
<textarea id="text-input" oninput="this.editor.update()"
|
<textarea id="text-input" oninput="this.editor.update()"
|
||||||
rows="6" cols="60">Type **Markdown** here.</textarea>
|
rows="6" cols="60">Type **Markdown** here.</textarea>
|
||||||
<div id="preview"> </div>
|
<div id="preview"></div>
|
||||||
|
|
||||||
<textarea class='span8' name=message id=message tabindex="1" cols="80" rows="5" required><?php if(isset($_GET['message'])){echo Encoding::myUrlDecode($_GET['message']);}?></textarea>
|
<textarea class='span8' name=message id=message tabindex="1" cols="80" rows="5"
|
||||||
|
required><?php if (isset($_GET['message'])) {
|
||||||
|
echo Encoding::myUrlDecode($_GET['message']);
|
||||||
|
} ?></textarea>
|
||||||
|
|
||||||
<div class="clearfix" style="padding: 14px 200px;">
|
<div class="clearfix" style="padding: 14px 200px;">
|
||||||
<input class="btn primary" name="password" type="password" id="password" tabindex="2" required />
|
<input class="btn primary" name="password" type="password" id="password" tabindex="2" required/>
|
||||||
</div>
|
</div>
|
||||||
<div class="clearfix" style="padding: 14px 200px;">
|
<div class="clearfix" style="padding: 14px 200px;">
|
||||||
<input class="btn primary" name="submit" type="submit" id="submit" tabindex="3" value="Envoyer" />
|
<input class="btn primary" name="submit" type="submit" id="submit" tabindex="3" value="Envoyer"/>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<br /><br />
|
<br/><br/>
|
||||||
|
|
||||||
<div id='mattermostform_success'></div>
|
<div id='mattermostform_success'></div>
|
||||||
<?php
|
<?php
|
||||||
if(isset($_GET['envoiDuMessage'])){
|
if (isset($_GET['envoiDuMessage'])) {
|
||||||
if($_GET['envoiDuMessage'] == 'oui'){
|
if ($_GET['envoiDuMessage'] == 'oui') {
|
||||||
echo "<p>La veille Mattermost as été correctement transmis.</p>";
|
echo "<p>La veille Mattermost as été correctement transmis.</p>";
|
||||||
}else{
|
} else {
|
||||||
echo "<p>La veille Mattermost n'as pas été transmis. Veuillez vérifiez les informations que vous avez saisies ...</p>";
|
echo "<p>La veille Mattermost n'as pas été transmis. Veuillez vérifiez les informations que vous avez saisies ...</p>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
$title = 'Error';
|
$title = 'Error';
|
||||||
$metaDesc = 'Description d\'une page de sécurité nécessaire dans ce monde de brute ';
|
$metaDesc = 'Description d\'une page de sécurité nécessaire dans ce monde de brute ';
|
||||||
$dateCreation = '20191107';
|
$dateCreation = '20191107';
|
||||||
$dateRevision = '20191107';
|
$dateRevision = '20191107';
|
||||||
|
|
|
@ -1,28 +1,32 @@
|
||||||
<h2><?php echo $title?></h2>
|
<h2><?php echo $title ?></h2>
|
||||||
<h1>What You will is Not found <span>:(</span></h1>
|
<h1>What You will is Not found <span>:(</span></h1>
|
||||||
<p>Désolé, mais ce que vous venez de faire ne semble pas exister.</p>
|
<p>Désolé, mais ce que vous venez de faire ne semble pas exister.</p>
|
||||||
<p>Il semblerait que ce soit:</p>
|
<p>Il semblerait que ce soit:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>un acte malveillant <br />
|
<li>un acte malveillant <br/>
|
||||||
<i>( entendez par là qu'il faudrais revoir la mentalité avec laquelle vous abordez l'immensité de la toile Internet )</i>
|
<i>( entendez par là qu'il faudrais revoir la mentalité avec laquelle vous abordez l'immensité de la toile
|
||||||
</li>
|
Internet )</i>
|
||||||
<li>un test de sécurité <br />
|
</li>
|
||||||
<i>( entendez par là que vous pouvez m'envoyer un <a href='<?php echo Url::link_rewrite_slashParam('contact'); ?>'>courriel</a> afin de me le notifier ), dites vous aussi que je reponds aux courriels au moins la première fois et que j'essaye de ne pas laissez une question sans réponse ( on ne peut pas tout savoir sur tout, c'est tout! )</i>
|
<li>un test de sécurité <br/>
|
||||||
</li>
|
<i>( entendez par là que vous pouvez m'envoyer un <a
|
||||||
<li>une succession d'erreur de mot de passe <br />
|
href='<?php echo Url::link_rewrite_slashParam('contact'); ?>'>courriel</a> afin de me le notifier ),
|
||||||
<i>( entendez par là : « La Mémoire est <u>la</u> grande des connaissances actuelles« )</i>
|
dites vous aussi que je reponds aux courriels au moins la première fois et que j'essaye de ne pas laissez
|
||||||
</li>
|
une question sans réponse ( on ne peut pas tout savoir sur tout, c'est tout! )</i>
|
||||||
</ul>
|
</li>
|
||||||
<form action="<?php echo Url::link_rewrite_slashParam('Gougou-search-results'); ?>" id="cse-search-box">
|
<li>une succession d'erreur de mot de passe <br/>
|
||||||
|
<i>( entendez par là : « La Mémoire est <u>la</u> grande des connaissances actuelles« )</i>
|
||||||
<div>
|
</li>
|
||||||
<input type="hidden" name="cx" value="partner-pub-3240142213869705:7035975563" />
|
</ul>
|
||||||
<input type="hidden" name="cof" value="FORID:10" />
|
<form action="<?php echo Url::link_rewrite_slashParam('Gougou-search-results'); ?>" id="cse-search-box">
|
||||||
<input type="hidden" name="ie" value="UTF-8" />
|
|
||||||
<input type="text" name="q" size="96" />
|
|
||||||
<input type="submit" name="sa" value="Rechercher sur ce site et d'autres" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</form>
|
<div>
|
||||||
|
<input type="hidden" name="cx" value="partner-pub-3240142213869705:7035975563"/>
|
||||||
|
<input type="hidden" name="cof" value="FORID:10"/>
|
||||||
|
<input type="hidden" name="ie" value="UTF-8"/>
|
||||||
|
<input type="text" name="q" size="96"/>
|
||||||
|
<input type="submit" name="sa" value="Rechercher sur ce site et d'autres"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
<script type="text/javascript" src="http://www.google.fr/coop/cse/brand?form=cse-search-box&lang=fr"></script>
|
<script type="text/javascript" src="http://www.google.fr/coop/cse/brand?form=cse-search-box&lang=fr"></script>
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
$title = 'Erreur';
|
$title = 'Erreur';
|
||||||
$metaDesc = 'Description de la page erreur';
|
$metaDesc = 'Description de la page erreur';
|
||||||
$dateCreation = '20120810';
|
$dateCreation = '20120810';
|
||||||
$dateRevision = '20150517';
|
$dateRevision = '20150517';
|
||||||
|
|
|
@ -1,43 +1,48 @@
|
||||||
<h2><?php echo $title?></h2>
|
<h2><?php echo $title ?></h2>
|
||||||
<h1>Not found <span>:(</span></h1>
|
<h1>Not found <span>:(</span></h1>
|
||||||
<p>Désolé, mais la page que vous recherchez ne semble pas exister.</p>
|
<p>Désolé, mais la page que vous recherchez ne semble pas exister.</p>
|
||||||
<p>Il semblerait que ce soit:</p>
|
<p>Il semblerait que ce soit:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>un identifiant d'URL mal tapé <br />
|
<li>un identifiant d'URL mal tapé <br/>
|
||||||
<i>( entendez par là qu'il faudrais revoir l'adresse que vous avez pianoté dasn la barre de votre butineur )</i>
|
<i>( entendez par là qu'il faudrais revoir l'adresse que vous avez pianoté dasn la barre de votre butineur )</i>
|
||||||
</li>
|
</li>
|
||||||
<li>un lien dont la source n'existe plus <br />
|
<li>un lien dont la source n'existe plus <br/>
|
||||||
<i>( entendez par là que vous pouvez m'envoyer un <a href='<?php echo Url::link_rewrite_slashParam('contact'); ?>'>courriel</a> afin de me le notifier ), dites vous aussi que je reponds aux courriels au moins la première fois et que j'essaye de ne pas laissez une question sans réponse ( on ne peut pas tout savoir sur tout, c'est tout! )</i>
|
<i>( entendez par là que vous pouvez m'envoyer un <a
|
||||||
</li>
|
href='<?php echo Url::link_rewrite_slashParam('contact'); ?>'>courriel</a> afin de me le notifier ),
|
||||||
<li>une page que j'aurais dû déjà créer <br />
|
dites vous aussi que je reponds aux courriels au moins la première fois et que j'essaye de ne pas laissez
|
||||||
<i>( entendez par là : « La Patience est <u>une</u> mère de sureté« )</i>
|
une question sans réponse ( on ne peut pas tout savoir sur tout, c'est tout! )</i>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
<li>une page que j'aurais dû déjà créer <br/>
|
||||||
<form action="<?php echo Url::link_rewrite_slashParam('Gougou-search-results'); ?>" id="cse-search-box">
|
<i>( entendez par là : « La Patience est <u>une</u> mère de sureté« )</i>
|
||||||
|
</li>
|
||||||
<div>
|
</ul>
|
||||||
<input type="hidden" name="cx" value="partner-pub-3240142213869705:7035975563" />
|
<form action="<?php echo Url::link_rewrite_slashParam('Gougou-search-results'); ?>" id="cse-search-box">
|
||||||
<input type="hidden" name="cof" value="FORID:10" />
|
|
||||||
<input type="hidden" name="ie" value="UTF-8" />
|
|
||||||
<input type="text" name="q" size="96" />
|
|
||||||
<input type="submit" name="sa" value="Rechercher sur ce site et d'autres" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</form>
|
<div>
|
||||||
|
<input type="hidden" name="cx" value="partner-pub-3240142213869705:7035975563"/>
|
||||||
|
<input type="hidden" name="cof" value="FORID:10"/>
|
||||||
|
<input type="hidden" name="ie" value="UTF-8"/>
|
||||||
|
<input type="text" name="q" size="96"/>
|
||||||
|
<input type="submit" name="sa" value="Rechercher sur ce site et d'autres"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
<script type="text/javascript" src="http://www.google.fr/coop/cse/brand?form=cse-search-box&lang=fr"></script>
|
<script type="text/javascript" src="http://www.google.fr/coop/cse/brand?form=cse-search-box&lang=fr"></script>
|
||||||
|
|
||||||
<p>Voici quand même les quelques pages qui sont valables d'être cherchées</p>
|
<p>Voici quand même les quelques pages qui sont valables d'être cherchées</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href='/NORMES-unicode'>La norme unicode</a></li>
|
<li><a href='/NORMES-unicode'>La norme unicode</a></li>
|
||||||
<li><a href='/NORMES-iso_8859_15'>La norme iso-8859-15</a></li>
|
<li><a href='/NORMES-iso_8859_15'>La norme iso-8859-15</a></li>
|
||||||
<li><a href='/NORMES-iso_8859_1'>La norme iso-8859-1</a></li>
|
<li><a href='/NORMES-iso_8859_1'>La norme iso-8859-1</a></li>
|
||||||
<li><a href='/NORMES-ascii'>La norme ASCII</a></li>
|
<li><a href='/NORMES-ascii'>La norme ASCII</a></li>
|
||||||
<li><a href='/JS-keyCodes'>Les codes de caractères clavier reçu par JAVASCRIPT</a></li>
|
<li><a href='/JS-keyCodes'>Les codes de caractères clavier reçu par JAVASCRIPT</a></li>
|
||||||
<li><a href='/CSS-webcolors'>Les Couleurs Web HTML et CSS</a></li>
|
<li><a href='/CSS-webcolors'>Les Couleurs Web HTML et CSS</a></li>
|
||||||
<li><a href='/CSS-webfonts'>Quelques correspondances de Polices de Caractères</a></li>
|
<li><a href='/CSS-webfonts'>Quelques correspondances de Polices de Caractères</a></li>
|
||||||
<li><a href='/CSS-cursors'>La liste des curseurs de souris</a></li>
|
<li><a href='/CSS-cursors'>La liste des curseurs de souris</a></li>
|
||||||
<li><a href='/HTML-fontStyle'>Les balise de style prééditées en HTML</a></li>
|
<li><a href='/HTML-fontStyle'>Les balise de style prééditées en HTML</a></li>
|
||||||
<li><a href='/HTML-specialsChar'>LA liste des caractères spéciaux en HTML</a></li>
|
<li><a href='/HTML-specialsChar'>LA liste des caractères spéciaux en HTML</a></li>
|
||||||
<li><a href='/PHP-url_path_evolved/date/2016/version/1.00/doc-root?page=version2/path-folder?page=1/itx/x/recursive/no/simple--%3Eedit'>Un exemple de variables que l'on peut passer dans l'url</a></li>
|
<li>
|
||||||
|
<a href='/PHP-url_path_evolved/date/2016/version/1.00/doc-root?page=version2/path-folder?page=1/itx/x/recursive/no/simple--%3Eedit'>Un
|
||||||
|
exemple de variables que l'on peut passer dans l'url</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
define(HASH_ALGORITHM, PASSWORD_BCRYPT);
|
define(HASH_ALGORITHM, PASSWORD_BCRYPT);
|
||||||
define(HASH,password_hash('xxxx-0000', HASH_ALGORITHM));
|
define(HASH, password_hash('xxxx-0000', HASH_ALGORITHM));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@ session_start();
|
||||||
/*RESTRICTION D'USAGE DU SITE PERSONNEL AU BLACK HAT HACKER */
|
/*RESTRICTION D'USAGE DU SITE PERSONNEL AU BLACK HAT HACKER */
|
||||||
|
|
||||||
//chargement en mémoire des anciennes attaques
|
//chargement en mémoire des anciennes attaques
|
||||||
$attempts = simplexml_load_file( APPLICATION_PATH . DIRECTORY_SEPARATOR ."bruteforce-logger.xml" , "SimpleXMLElement" , LIBXML_NOCDATA );
|
$attempts = simplexml_load_file(APPLICATION_PATH . DIRECTORY_SEPARATOR . "bruteforce-logger.xml", "SimpleXMLElement", LIBXML_NOCDATA);
|
||||||
if($attempts->xpath("/brute-force-attack/attempt/from")) {
|
if ($attempts->xpath("/brute-force-attack/attempt/from")) {
|
||||||
foreach ($attempts->xpath("/brute-force-attack/attempt/from") as $attempt) {
|
foreach ($attempts->xpath("/brute-force-attack/attempt/from") as $attempt) {
|
||||||
// Récupération des ip et test de corrélation actuelle
|
// Récupération des ip et test de corrélation actuelle
|
||||||
if ($attempt['from'] == $_SERVER['REMOTE_ADDR']) {
|
if ($attempt['from'] == $_SERVER['REMOTE_ADDR']) {
|
||||||
|
@ -18,48 +18,48 @@ if($attempts->xpath("/brute-force-attack/attempt/from")) {
|
||||||
/**/
|
/**/
|
||||||
/* ITERATION D'UNE POSSIBLE ATTAQUE BRUTE FORCE SUR UNE PAGE DE TRAITEMENT */
|
/* ITERATION D'UNE POSSIBLE ATTAQUE BRUTE FORCE SUR UNE PAGE DE TRAITEMENT */
|
||||||
|
|
||||||
if(isset($_SESSION['brute-force-attempt'])) {
|
if (isset($_SESSION['brute-force-attempt'])) {
|
||||||
$_SESSION['brute-force-attempt']++;
|
$_SESSION['brute-force-attempt']++;
|
||||||
}else{
|
} else {
|
||||||
$_SESSION['brute-force-attempt']=1;
|
$_SESSION['brute-force-attempt'] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
/* TESTS PERMETTANT DE DEFINIR CERTAINS CAS COMME ETANT DANGEREUX*/
|
/* TESTS PERMETTANT DE DEFINIR CERTAINS CAS COMME ETANT DANGEREUX*/
|
||||||
|
|
||||||
if ( !isset($_SESSION['current-ip'])
|
if (!isset($_SESSION['current-ip'])
|
||||||
|| !isset($_SESSION['current-time']) ){
|
|| !isset($_SESSION['current-time'])) {
|
||||||
|
|
||||||
//Ce test permet d'identifier ceux qui veulent faire un traitement sans provenir d'une page de formulaire
|
//Ce test permet d'identifier ceux qui veulent faire un traitement sans provenir d'une page de formulaire
|
||||||
ob_start();
|
ob_start();
|
||||||
require_once PAGES_PATH . DIRECTORY_SEPARATOR . 'error.php' ;
|
require_once PAGES_PATH . DIRECTORY_SEPARATOR . 'error.php';
|
||||||
require_once PAGES_PATH . DIRECTORY_SEPARATOR . 'error.phtml' ;
|
require_once PAGES_PATH . DIRECTORY_SEPARATOR . 'error.phtml';
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
require_once LAYOUT_PATH . DIRECTORY_SEPARATOR . 'layout-codage.phtml';
|
require_once LAYOUT_PATH . DIRECTORY_SEPARATOR . 'layout-codage.phtml';
|
||||||
die();
|
die();
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
|
|
||||||
if( $_SESSION['last-ip'] !== $_SERVER['REMOTE_ADDR']
|
|
||||||
|| $_SESSION['last-time'] > $_SERVER['REQUEST_TIME'] ){
|
|
||||||
|
|
||||||
//ce test permet de verifier que le demandeur est bien le meme que celui qui provient d'un formulaire
|
if ($_SESSION['last-ip'] !== $_SERVER['REMOTE_ADDR']
|
||||||
|
|| $_SESSION['last-time'] > $_SERVER['REQUEST_TIME']) {
|
||||||
|
|
||||||
|
//ce test permet de verifier que le demandeur est bien le meme que celui qui provient d'un formulaire
|
||||||
ob_start();
|
ob_start();
|
||||||
require_once PAGES_PATH . DIRECTORY_SEPARATOR . 'error.php' ;
|
require_once PAGES_PATH . DIRECTORY_SEPARATOR . 'error.php';
|
||||||
require_once PAGES_PATH . DIRECTORY_SEPARATOR . 'error.phtml' ;
|
require_once PAGES_PATH . DIRECTORY_SEPARATOR . 'error.phtml';
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
require_once LAYOUT_PATH . DIRECTORY_SEPARATOR . 'layout-codage.phtml';
|
require_once LAYOUT_PATH . DIRECTORY_SEPARATOR . 'layout-codage.phtml';
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $_SESSION['brute-force-attempt'] > 5 ){
|
if ($_SESSION['brute-force-attempt'] > 5) {
|
||||||
|
|
||||||
//ce test permet de logger une attaque brute force sur un formulaire
|
//ce test permet de logger une attaque brute force sur un formulaire
|
||||||
|
|
||||||
$dom = new DOMDocument;
|
$dom = new DOMDocument;
|
||||||
$dom->load(APPLICATION_PATH . DIRECTORY_SEPARATOR ."bruteforce-logger.xml");
|
$dom->load(APPLICATION_PATH . DIRECTORY_SEPARATOR . "bruteforce-logger.xml");
|
||||||
|
|
||||||
$noeudBruteForce = $dom->getElementsByTagName("brute-force-attack")->item(0);
|
$noeudBruteForce = $dom->getElementsByTagName("brute-force-attack")->item(0);
|
||||||
|
|
||||||
|
@ -76,12 +76,12 @@ if ( !isset($_SESSION['current-ip'])
|
||||||
$attemptNode->appendChild($ipNode);
|
$attemptNode->appendChild($ipNode);
|
||||||
|
|
||||||
$noeudBruteForce->appendChild($attemptNode);
|
$noeudBruteForce->appendChild($attemptNode);
|
||||||
$dom->save(APPLICATION_PATH . DIRECTORY_SEPARATOR ."bruteforce-logger.xml");
|
$dom->save(APPLICATION_PATH . DIRECTORY_SEPARATOR . "bruteforce-logger.xml");
|
||||||
|
|
||||||
//pour chaque page et mise en tampon
|
//pour chaque page et mise en tampon
|
||||||
ob_start();
|
ob_start();
|
||||||
require_once PAGES_PATH . DIRECTORY_SEPARATOR . 'error-brute-force-attack.php' ;
|
require_once PAGES_PATH . DIRECTORY_SEPARATOR . 'error-brute-force-attack.php';
|
||||||
require_once PAGES_PATH . DIRECTORY_SEPARATOR . 'error-brute-force-attack.phtml' ;
|
require_once PAGES_PATH . DIRECTORY_SEPARATOR . 'error-brute-force-attack.phtml';
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
require_once LAYOUT_PATH . DIRECTORY_SEPARATOR . 'layout-codage.phtml';
|
require_once LAYOUT_PATH . DIRECTORY_SEPARATOR . 'layout-codage.phtml';
|
||||||
|
@ -89,9 +89,9 @@ if ( !isset($_SESSION['current-ip'])
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//mise en tampon des données courante de combat
|
//mise en tampon des données courante de combat
|
||||||
$_SESSION['last-ip'] = $_SESSION['current-ip'];
|
$_SESSION['last-ip'] = $_SESSION['current-ip'];
|
||||||
$_SESSION['last-time'] = $_SESSION['current-time'];
|
$_SESSION['last-time'] = $_SESSION['current-time'];
|
||||||
}
|
}
|
||||||
/**/
|
/**/
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('PUBLIC_PATH' , dirname(__FILE__) );
|
define('PUBLIC_PATH', dirname(__FILE__));
|
||||||
define('APPLICATION_PATH' , dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "app" );
|
define('APPLICATION_PATH', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "app");
|
||||||
define('CLASS_PATH' , APPLICATION_PATH . DIRECTORY_SEPARATOR . "class" );
|
define('CLASS_PATH', APPLICATION_PATH . DIRECTORY_SEPARATOR . "class");
|
||||||
define('PAGES_PATH' , APPLICATION_PATH . DIRECTORY_SEPARATOR . "page" );
|
define('PAGES_PATH', APPLICATION_PATH . DIRECTORY_SEPARATOR . "page");
|
||||||
define('LAYOUT_PATH' , APPLICATION_PATH . DIRECTORY_SEPARATOR . "layout" );
|
define('LAYOUT_PATH', APPLICATION_PATH . DIRECTORY_SEPARATOR . "layout");
|
||||||
|
|
||||||
require_once CLASS_PATH . DIRECTORY_SEPARATOR . 'password.class.php';
|
require_once CLASS_PATH . DIRECTORY_SEPARATOR . 'password.class.php';
|
||||||
require_once CLASS_PATH . DIRECTORY_SEPARATOR . 'encoding.class.php';
|
require_once CLASS_PATH . DIRECTORY_SEPARATOR . 'encoding.class.php';
|
||||||
require APPLICATION_PATH . DIRECTORY_SEPARATOR . 'session.php';
|
require APPLICATION_PATH . DIRECTORY_SEPARATOR . 'session.php';
|
||||||
|
|
||||||
|
|
||||||
//pour chaque page et mise en tampon
|
//pour chaque page et mise en tampon
|
||||||
ob_start();
|
ob_start();
|
||||||
require_once PAGES_PATH . DIRECTORY_SEPARATOR . 'TINTERNET-chatbot.php' ;
|
require_once PAGES_PATH . DIRECTORY_SEPARATOR . 'TINTERNET-chatbot.php';
|
||||||
require_once PAGES_PATH . DIRECTORY_SEPARATOR . 'TINTERNET-chatbot.phtml' ;
|
require_once PAGES_PATH . DIRECTORY_SEPARATOR . 'TINTERNET-chatbot.phtml';
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,65 +1,68 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('PUBLIC_PATH' , dirname(__FILE__));
|
define('PUBLIC_PATH', dirname(__FILE__));
|
||||||
define('APPLICATION_PATH' , dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "app" );
|
define('APPLICATION_PATH', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "app");
|
||||||
define('CLASS_PATH' , APPLICATION_PATH . DIRECTORY_SEPARATOR . "class" );
|
define('CLASS_PATH', APPLICATION_PATH . DIRECTORY_SEPARATOR . "class");
|
||||||
|
|
||||||
require APPLICATION_PATH . DIRECTORY_SEPARATOR . "parameters.php";
|
require APPLICATION_PATH . DIRECTORY_SEPARATOR . "parameters.php";
|
||||||
require APPLICATION_PATH . DIRECTORY_SEPARATOR . 'session.php';
|
require APPLICATION_PATH . DIRECTORY_SEPARATOR . 'session.php';
|
||||||
require_once CLASS_PATH . DIRECTORY_SEPARATOR . 'password.class.php';
|
require_once CLASS_PATH . DIRECTORY_SEPARATOR . 'password.class.php';
|
||||||
require_once CLASS_PATH . DIRECTORY_SEPARATOR . 'encoding.class.php';
|
require_once CLASS_PATH . DIRECTORY_SEPARATOR . 'encoding.class.php';
|
||||||
|
|
||||||
error_reporting(-1);
|
error_reporting(-1);
|
||||||
ini_set('display_errors', 1);
|
ini_set('display_errors', 1);
|
||||||
|
|
||||||
function passValide($password){
|
function passValide($password)
|
||||||
|
{
|
||||||
|
|
||||||
//password_hash('tototo', HASH_ALGORITHM)
|
//password_hash('tototo', HASH_ALGORITHM)
|
||||||
|
|
||||||
if (password_verify($password, HASH)) {
|
if (password_verify($password, HASH)) {
|
||||||
if (password_needs_rehash(HASH, HASH_ALGORITHM)) {
|
if (password_needs_rehash(HASH, HASH_ALGORITHM)) {
|
||||||
$hash = password_hash($password, HASH_ALGORITHM);
|
$hash = password_hash($password, HASH_ALGORITHM);
|
||||||
|
|
||||||
$file = "";
|
$file = "";
|
||||||
$lines = file(APPLICATION_PATH . DIRECTORY_SEPARATOR . "parameters.php");
|
$lines = file(APPLICATION_PATH . DIRECTORY_SEPARATOR . "parameters.php");
|
||||||
foreach ($lines as $line_num => $line) {
|
foreach ($lines as $line_num => $line) {
|
||||||
if(preg_match("#define\(HASH,(.*)\)#",$line,$matches)){
|
if (preg_match("#define\(HASH,(.*)\)#", $line, $matches)) {
|
||||||
$newline = preg_replace("#define\(HASH,(.*)\)#","define(HASH,'$hash')",$line);
|
$newline = preg_replace("#define\(HASH,(.*)\)#", "define(HASH,'$hash')", $line);
|
||||||
}else{
|
} else {
|
||||||
$newline = $line;
|
$newline = $line;
|
||||||
}
|
}
|
||||||
if ($newline != "") {
|
if ($newline != "") {
|
||||||
$file .= $newline . "\n";
|
$file .= $newline . "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Store new hash in parameters file */
|
/* Store new hash in parameters file */
|
||||||
file_put_contents(APPLICATION_PATH . DIRECTORY_SEPARATOR . "parameters.php",$file);
|
file_put_contents(APPLICATION_PATH . DIRECTORY_SEPARATOR . "parameters.php", $file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//try fallback passengers
|
//try fallback passengers
|
||||||
if (password_verify($password,HASH)) {
|
if (password_verify($password, HASH)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//https://code.tutsplus.com/tutorials/8-regular-expressions-you-should-know--net-6149
|
//https://code.tutsplus.com/tutorials/8-regular-expressions-you-should-know--net-6149
|
||||||
|
|
||||||
function extractLink($message){
|
function extractLink($message)
|
||||||
preg_match_all("#((?:https?:\/\/)?(?:[\da-z\.-]+)\.(?:[a-z\.]{2,6})(?:[\/\w \.-]*)*\/?)#",$message,$matches);
|
{
|
||||||
return $matches;
|
preg_match_all("#((?:https?:\/\/)?(?:[\da-z\.-]+)\.(?:[a-z\.]{2,6})(?:[\/\w \.-]*)*\/?)#", $message, $matches);
|
||||||
|
return $matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
function extractText($message){
|
function extractText($message)
|
||||||
$links = extractLink($message);
|
{
|
||||||
array_shift($links);
|
$links = extractLink($message);
|
||||||
foreach ($links as $link) {
|
array_shift($links);
|
||||||
if ($link != "") {
|
foreach ($links as $link) {
|
||||||
$message = preg_replace("#$link[0]#"," ... ",$message);
|
if ($link != "") {
|
||||||
}
|
$message = preg_replace("#$link[0]#", " ... ", $message);
|
||||||
}
|
}
|
||||||
return $message;
|
}
|
||||||
|
return $message;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************************************************/
|
/**************************************************************************************************************/
|
||||||
|
@ -67,11 +70,11 @@ function extractText($message){
|
||||||
|
|
||||||
$message = Encoding::fixUTF8(Encoding::protectionDoubleQuote(Encoding::protectionSimpleQuote($_POST['message'])));
|
$message = Encoding::fixUTF8(Encoding::protectionDoubleQuote(Encoding::protectionSimpleQuote($_POST['message'])));
|
||||||
|
|
||||||
if (passValide($_POST['password']) && $_POST['message'] != ""){
|
if (passValide($_POST['password']) && $_POST['message'] != "") {
|
||||||
|
|
||||||
$hookMattermost = "http://{your-mattermost-site}/hooks/xxx-generatedkey-xxx";
|
$hookMattermost = "http://{your-mattermost-site}/hooks/xxx-generatedkey-xxx";
|
||||||
|
|
||||||
$payload = <<<EOD
|
$payload = <<<EOD
|
||||||
payload={
|
payload={
|
||||||
"channel": "bot-tests",
|
"channel": "bot-tests",
|
||||||
"username": "acksop",
|
"username": "acksop",
|
||||||
|
@ -79,7 +82,7 @@ payload={
|
||||||
}
|
}
|
||||||
EOD;
|
EOD;
|
||||||
|
|
||||||
$json = <<<EOD
|
$json = <<<EOD
|
||||||
{
|
{
|
||||||
"channel": "bot-tests",
|
"channel": "bot-tests",
|
||||||
"username": "acksop",
|
"username": "acksop",
|
||||||
|
@ -88,36 +91,36 @@ EOD;
|
||||||
EOD;
|
EOD;
|
||||||
|
|
||||||
|
|
||||||
$commandURL = "curl -i -X POST --data-urlencode '$payload' $hookMattermost";
|
$commandURL = "curl -i -X POST --data-urlencode '$payload' $hookMattermost";
|
||||||
$commandJSON = "curl -i -X POST -H 'Content-Type: application/json' -d '$json' $hookMattermost";
|
$commandJSON = "curl -i -X POST -H 'Content-Type: application/json' -d '$json' $hookMattermost";
|
||||||
|
|
||||||
echo "<pre>";
|
echo "<pre>";
|
||||||
print_r($commandJSON);
|
print_r($commandJSON);
|
||||||
echo "</pre><pre>";
|
echo "</pre><pre>";
|
||||||
print_r($commandURL);
|
print_r($commandURL);
|
||||||
|
|
||||||
$dom = new DOMDocument;
|
$dom = new DOMDocument;
|
||||||
$dom->load(PUBLIC_PATH . DIRECTORY_SEPARATOR ."veilleTinternet.xml");
|
$dom->load(PUBLIC_PATH . DIRECTORY_SEPARATOR . "veilleTinternet.xml");
|
||||||
|
|
||||||
$noeudVeille = $dom->getElementsByTagName("veille")->item(0);
|
$noeudVeille = $dom->getElementsByTagName("veille")->item(0);
|
||||||
|
|
||||||
$messageNode = $dom->createElement("message");
|
$messageNode = $dom->createElement("message");
|
||||||
|
|
||||||
$myOriginalTextNode = $dom->createElement("originel");
|
$myOriginalTextNode = $dom->createElement("originel");
|
||||||
$textNode = $dom->createTextNode(htmlentities($message));
|
$textNode = $dom->createTextNode(htmlentities($message));
|
||||||
$myOriginalTextNode->appendChild($textNode);
|
$myOriginalTextNode->appendChild($textNode);
|
||||||
$messageNode->appendChild($myOriginalTextNode);
|
$messageNode->appendChild($myOriginalTextNode);
|
||||||
|
|
||||||
$myTextNode = $dom->createElement("text");
|
$myTextNode = $dom->createElement("text");
|
||||||
$textNode = $dom->createTextNode(htmlentities(extractText($message)));
|
$textNode = $dom->createTextNode(htmlentities(extractText($message)));
|
||||||
$myTextNode->appendChild($textNode);
|
$myTextNode->appendChild($textNode);
|
||||||
$messageNode->appendChild($myTextNode);
|
$messageNode->appendChild($myTextNode);
|
||||||
|
|
||||||
$myLinksNode = $dom->createElement("links");
|
$myLinksNode = $dom->createElement("links");
|
||||||
$links = extractLink($message);
|
$links = extractLink($message);
|
||||||
array_shift($links);
|
array_shift($links);
|
||||||
foreach($links as $link) {
|
foreach ($links as $link) {
|
||||||
if($link != "") {
|
if ($link != "") {
|
||||||
$myLinkNode = $dom->createElement("link");
|
$myLinkNode = $dom->createElement("link");
|
||||||
$textNode = $dom->createTextNode(htmlentities($link[0]));
|
$textNode = $dom->createTextNode(htmlentities($link[0]));
|
||||||
$myLinkNode->appendChild($textNode);
|
$myLinkNode->appendChild($textNode);
|
||||||
|
@ -129,21 +132,21 @@ EOD;
|
||||||
//$dom->insertBefore( $messageNode, $noeudVeille );
|
//$dom->insertBefore( $messageNode, $noeudVeille );
|
||||||
$noeudVeille->appendChild($messageNode);
|
$noeudVeille->appendChild($messageNode);
|
||||||
|
|
||||||
$dom->save(PUBLIC_PATH . DIRECTORY_SEPARATOR ."veilleTinternet.xml");
|
$dom->save(PUBLIC_PATH . DIRECTORY_SEPARATOR . "veilleTinternet.xml");
|
||||||
|
|
||||||
shell_exec($commandJSON);
|
shell_exec($commandJSON);
|
||||||
shell_exec($commandURL);
|
shell_exec($commandURL);
|
||||||
die();
|
die();
|
||||||
if(isset($_POST['ajax'])){
|
if (isset($_POST['ajax'])) {
|
||||||
echo "Votre Lien as été correctement transmis. Vous receverez une réponse dans les prochains jours.";
|
echo "Votre Lien as été correctement transmis. Vous receverez une réponse dans les prochains jours.";
|
||||||
}else{
|
} else {
|
||||||
header("Location: /index.php?envoiDuMessage=oui");
|
header("Location: /index.php?envoiDuMessage=oui");
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
if(isset($_POST['ajax'])){
|
if (isset($_POST['ajax'])) {
|
||||||
echo "Votre Lien n'as pas été transmis. Veuillez vérifiez les informations que vous avez saisies ...";
|
echo "Votre Lien n'as pas été transmis. Veuillez vérifiez les informations que vous avez saisies ...";
|
||||||
}else{
|
} else {
|
||||||
header("Location: /index.php?envoiDuMessage=non&message=".Encoding::myUrlEncode($message));
|
header("Location: /index.php?envoiDuMessage=non&message=" . Encoding::myUrlEncode($message));
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue