Rearrage code! Not tested on a web-server !

This commit is contained in:
Emmanuel ROY 2019-11-09 11:10:17 +01:00
parent 2f353a43b5
commit 880b6111f8
15 changed files with 2018 additions and 1983 deletions

View file

@ -36,9 +36,8 @@ POSSIBILITY OF SUCH DAMAGE.
* @example https://github.com/neitanod/forceutf8
* @license Revised BSD
*/
class Encoding {
class Encoding
{
const ICONV_TRANSLIT = "TRANSLIT";
const ICONV_IGNORE = "IGNORE";
@ -118,18 +117,18 @@ class Encoding {
"\xe2\x82\xac" => "\x80",
"\xe2\x80\x9a" => "\x82",
"\xc6\x92" => "\x83",
"\xc6\x92" => "\x83",
"\xe2\x80\x9e" => "\x84",
"\xe2\x80\xa6" => "\x85",
"\xe2\x80\xa0" => "\x86",
"\xe2\x80\xa1" => "\x87",
"\xcb\x86" => "\x88",
"\xcb\x86" => "\x88",
"\xe2\x80\xb0" => "\x89",
"\xc5\xa0" => "\x8a",
"\xc5\xa0" => "\x8a",
"\xe2\x80\xb9" => "\x8b",
"\xc5\x92" => "\x8c",
"\xc5\x92" => "\x8c",
"\xc5\xbd" => "\x8e",
"\xc5\xbd" => "\x8e",
"\xe2\x80\x98" => "\x91",
@ -139,17 +138,49 @@ class Encoding {
"\xe2\x80\xa2" => "\x95",
"\xe2\x80\x93" => "\x96",
"\xe2\x80\x94" => "\x97",
"\xcb\x9c" => "\x98",
"\xcb\x9c" => "\x98",
"\xe2\x84\xa2" => "\x99",
"\xc5\xa1" => "\x9a",
"\xc5\xa1" => "\x9a",
"\xe2\x80\xba" => "\x9b",
"\xc5\x93" => "\x9c",
"\xc5\x93" => "\x9c",
"\xc5\xbe" => "\x9e",
"\xc5\xb8" => "\x9f"
"\xc5\xbe" => "\x9e",
"\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
*
@ -170,35 +201,33 @@ class Encoding {
* 3) when any of these: ðñòó are followed by THREE chars from group B.
*
* @name toUTF8
* @param string $text Any string.
* @param string $text Any string.
* @return string The same string, UTF8 encoded
*
*/
if(is_array($text))
{
foreach($text as $k => $v)
{
if (is_array($text)) {
foreach ($text as $k => $v) {
$text[$k] = self::toUTF8($v);
}
return $text;
}
if(!is_string($text)) {
if (!is_string($text)) {
return $text;
}
$max = self::strlen($text);
$buf = "";
for($i = 0; $i < $max; $i++){
for ($i = 0; $i < $max; $i++) {
$c1 = $text{$i};
if($c1>="\xc0"){ //Should be converted to UTF8, if it's not UTF8 already
$c2 = $i+1 >= $max? "\x00" : $text{$i+1};
$c3 = $i+2 >= $max? "\x00" : $text{$i+2};
$c4 = $i+3 >= $max? "\x00" : $text{$i+3};
if($c1 >= "\xc0" & $c1 <= "\xdf"){ //looks like 2 bytes UTF8
if($c2 >= "\x80" && $c2 <= "\xbf"){ //yeah, almost sure it's UTF8 already
if ($c1 >= "\xc0") { //Should be converted to UTF8, if it's not UTF8 already
$c2 = $i + 1 >= $max ? "\x00" : $text{$i + 1};
$c3 = $i + 2 >= $max ? "\x00" : $text{$i + 2};
$c4 = $i + 3 >= $max ? "\x00" : $text{$i + 3};
if ($c1 >= "\xc0" & $c1 <= "\xdf") { //looks like 2 bytes UTF8
if ($c2 >= "\x80" && $c2 <= "\xbf") { //yeah, almost sure it's UTF8 already
$buf .= $c1 . $c2;
$i++;
} else { //not valid UTF8. Convert it.
@ -206,8 +235,8 @@ class Encoding {
$cc2 = ($c1 & "\x3f") | "\x80";
$buf .= $cc1 . $cc2;
}
} 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
} 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
$buf .= $c1 . $c2 . $c3;
$i = $i + 2;
} else { //not valid UTF8. Convert it.
@ -215,8 +244,8 @@ class Encoding {
$cc2 = ($c1 & "\x3f") | "\x80";
$buf .= $cc1 . $cc2;
}
} 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
} 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
$buf .= $c1 . $c2 . $c3 . $c4;
$i = $i + 3;
} else { //not valid UTF8. Convert it.
@ -229,8 +258,8 @@ class Encoding {
$cc2 = (($c1 & "\x3f") | "\x80");
$buf .= $cc1 . $cc2;
}
} elseif(($c1 & "\xc0") == "\x80"){ // needs conversion
if(isset(self::$win1252ToUtf8[ord($c1)])) { //found in Windows-1252 special cases
} elseif (($c1 & "\xc0") == "\x80") { // needs conversion
if (isset(self::$win1252ToUtf8[ord($c1)])) { //found in Windows-1252 special cases
$buf .= self::$win1252ToUtf8[ord($c1)];
} else {
$cc1 = (chr(ord($c1) / 64) | "\xc0");
@ -244,41 +273,27 @@ class Encoding {
return $buf;
}
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 strlen($text)
{
return (function_exists('mb_strlen') && ((int)ini_get('mbstring.func_overload')) & 2) ?
mb_strlen($text, '8bit') : strlen($text);
}
static function toISO8859($text, $option = self::WITHOUT_ICONV) {
return self::toWin1252($text, $option);
}
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) {
static function fixUTF8($text, $option = self::WITHOUT_ICONV)
{
if (is_array($text)) {
foreach ($text as $k => $v) {
$text[$k] = self::fixUTF8($v, $option);
}
return $text;
}
if(!is_string($text)) {
if (!is_string($text)) {
return $text;
}
$last = "";
while($last <> $text){
while ($last <> $text) {
$last = $text;
$text = self::toUTF8(static::utf8_decode($text, $option));
}
@ -286,7 +301,8 @@ class Encoding {
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
// (ignoring Windows-1252 chars from 80 to 9F) use this function to fix it.
// 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);
}
static function removeBOM($str=""){
if(substr($str, 0,3) == pack("CCC",0xef,0xbb,0xbf)) {
$str=substr($str, 3);
static function removeBOM($str = "")
{
if (substr($str, 0, 3) == pack("CCC", 0xef, 0xbb, 0xbf)) {
$str = substr($str, 3);
}
return $str;
}
protected static function strlen($text){
return (function_exists('mb_strlen') && ((int) ini_get('mbstring.func_overload')) & 2) ?
mb_strlen($text,'8bit') : strlen($text);
public static function encode($encodingLabel, $text)
{
$encodingLabel = self::normalizeEncoding($encodingLabel);
if ($encodingLabel == 'ISO-8859-1') return self::toLatin1($text);
return self::toUTF8($text);
}
public static function normalizeEncoding($encodingLabel)
@ -312,59 +331,50 @@ class Encoding {
$encoding = preg_replace('/[^a-zA-Z0-9\s]/', '', $encoding);
$equivalences = array(
'ISO88591' => 'ISO-8859-1',
'ISO8859' => 'ISO-8859-1',
'ISO' => 'ISO-8859-1',
'LATIN1' => 'ISO-8859-1',
'LATIN' => 'ISO-8859-1',
'UTF8' => 'UTF-8',
'UTF' => 'UTF-8',
'WIN1252' => 'ISO-8859-1',
'ISO8859' => 'ISO-8859-1',
'ISO' => 'ISO-8859-1',
'LATIN1' => 'ISO-8859-1',
'LATIN' => 'ISO-8859-1',
'UTF8' => 'UTF-8',
'UTF' => 'UTF-8',
'WIN1252' => 'ISO-8859-1',
'WINDOWS1252' => 'ISO-8859-1'
);
if(empty($equivalences[$encoding])){
if (empty($equivalences[$encoding])) {
return 'UTF-8';
}
return $equivalences[$encoding];
}
public static function encode($encodingLabel, $text)
static function toLatin1($text, $option = self::WITHOUT_ICONV)
{
$encodingLabel = self::normalizeEncoding($encodingLabel);
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;
return self::toWin1252($text, $option);
}
/****/
public static function destructionH4x0RChaine($chaine){
public static function destructionH4x0RChaine($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('#"#', '_', $chaine);
return $chaine;
}
public static function protectionSimpleQuote($chaine){
public static function protectionSimpleQuote($chaine)
{
$chaine = preg_replace("#'#", '_', $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');
$entities = array('!', '*', "'", "(", ")", ";", ":", "@", "&", "="/*, "+"*/, "$", ",", "/", "?", "%", "#", "[", "]");
$string = urlencode($string);
@ -372,7 +382,8 @@ class Encoding {
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');
$replacements = array('!', '*', "'", "(", ")", ";", ":", "@", "&", "="/*, "+"*/, "$", ",", "/", "?", "%", "#", "[", "]");
$string = str_replace($entities, $replacements, $string);

View file

@ -27,18 +27,19 @@ namespace {
* Hash the password using the specified algorithm
*
* @param string $password The password to hash
* @param int $algo The algorithm to use (Defined by PASSWORD_* constants)
* @param array $options The options for the algorithm to use
* @param int $algo The algorithm to use (Defined by PASSWORD_* constants)
* @param array $options The options for the algorithm to use
*
* @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')) {
trigger_error("Crypt must be loaded for password_hash to function", E_USER_WARNING);
return null;
}
if (is_null($password) || is_int($password)) {
$password = (string) $password;
$password = (string)$password;
}
if (!is_string($password)) {
trigger_error("password_hash(): Password must be a string", E_USER_WARNING);
@ -53,7 +54,7 @@ namespace {
case PASSWORD_BCRYPT:
$cost = PASSWORD_BCRYPT_DEFAULT_COST;
if (isset($options['cost'])) {
$cost = (int) $options['cost'];
$cost = (int)$options['cost'];
if ($cost < 4 || $cost > 31) {
trigger_error(sprintf("password_hash(): Invalid bcrypt cost parameter specified: %d", $cost), E_USER_WARNING);
return null;
@ -79,11 +80,11 @@ namespace {
case 'integer':
case 'double':
case 'string':
$salt = (string) $options['salt'];
$salt = (string)$options['salt'];
break;
case 'object':
if (method_exists($options['salt'], '__tostring')) {
$salt = (string) $options['salt'];
$salt = (string)$options['salt'];
break;
}
case 'array':
@ -180,7 +181,8 @@ namespace {
*
* @return array The array of information about the hash.
*/
function password_get_info($hash) {
function password_get_info($hash)
{
$return = array(
'algo' => 0,
'algoName' => 'unknown',
@ -200,20 +202,21 @@ namespace {
*
* If the answer is true, after validating the password using password_verify, rehash it.
*
* @param string $hash The hash to test
* @param int $algo The algorithm used for new password hashes
* @param array $options The options array passed to password_hash
* @param string $hash The hash to test
* @param int $algo The algorithm used for new password hashes
* @param array $options The options array passed to password_hash
*
* @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);
if ($info['algo'] !== (int) $algo) {
if ($info['algo'] !== (int)$algo) {
return true;
}
switch ($algo) {
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']) {
return true;
}
@ -226,11 +229,12 @@ namespace {
* Verify a password against a hash using a timing attack resistant approach
*
* @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
*/
function password_verify($password, $hash) {
function password_verify($password, $hash)
{
if (!function_exists('crypt')) {
trigger_error("Crypt must be loaded for password_verify to function", E_USER_WARNING);
return false;
@ -264,10 +268,11 @@ namespace PasswordCompat\binary {
*
* @param string $binary_string The input string
*
* @internal
* @return int The number of bytes
* @internal
*/
function _strlen($binary_string) {
function _strlen($binary_string)
{
if (function_exists('mb_strlen')) {
return mb_strlen($binary_string, '8bit');
}
@ -277,16 +282,17 @@ namespace PasswordCompat\binary {
/**
* 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()
*
* @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')) {
return mb_substr($binary_string, $start, $length, '8bit');
}
@ -298,7 +304,8 @@ namespace PasswordCompat\binary {
*
* @return boolean the check result
*/
function check() {
function check()
{
static $pass = NULL;
if (is_null($pass)) {

View file

@ -1,24 +1,27 @@
<footer>
<p>&copy; 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>
</footer>
<!-- JavaScript at the bottom for fast page loading -->
<footer>
<p>&copy; 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>
</footer>
<script src="js/markdown.js"></script>
<script>
function Editor(input, preview) {
this.update = function () {
preview.innerHTML = markdown.toHTML(input.value);
};
input.editor = this;
this.update();
}
var $ = function (id) { return document.getElementById(id); };
new Editor($("text-input"), $("preview"));
</script>
<!-- JavaScript at the bottom for fast page loading -->
<script src="js/markdown.js"></script>
<script>
function Editor(input, preview) {
this.update = function () {
preview.innerHTML = markdown.toHTML(input.value);
};
input.editor = this;
this.update();
}
var $ = function (id) {
return document.getElementById(id);
};
new Editor($("text-input"), $("preview"));
</script>
</body>
</html>

View file

@ -1,72 +1,80 @@
<!DOCTYPE html>
<!-- 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 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]-->
<!--[if lt IE 7]>
<html class="no-js lt-ie9 lt-ie8 lt-ie7" 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 -->
<!--[if gt IE 8]><!--> <html class="no-js" lang="fr"> <!--<![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="fr"> <!--<![endif]-->
<head>
<META charset="utf-8">
<META charset="utf-8">
<META NAME="Category" CONTENT=""/>
<META NAME="Publisher" CONTENT="Emmanuel ROY"/>
<META NAME="Copyright" CONTENT="© - 2015 - Acksop"/>
<META NAME="Expires" CONTENT="Never Maybe!"/>
<META NAME="Distribution" CONTENT="Global"/>
<META NAME='Description' lang='<?php echo $lang; ?>' CONTENT="<?php echo $metaDesc ?>"/>
<META NAME='Identifier-URL' CONTENT="new.emmanuelroy.name/<?php echo $page['name'] ?>"/>
<?php
/*Rich META from google
<meta name="department" content="legal" />
<meta name="audience" content="all" />
<meta name="doc_status" content="draft" />
//a utiliser avec un syteme de classement utilisateur
<meta name="rating" content="5" />
//link: http://en.wikipedia.org/wiki/Smart_tag_%28Microsoft%29
<meta name="mssmarttagspreventparsing" content="..." />
//link: https://support.google.com/customsearch/answer/2595557?hl=fr
<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"/>
<META NAME="Category" CONTENT=""/>
<META NAME="Publisher" CONTENT="Emmanuel ROY"/>
<META NAME="Copyright" CONTENT="© - 2015 - Acksop"/>
<META NAME="Expires" CONTENT="Never Maybe!"/>
<META NAME="Distribution" CONTENT="Global"/>
<META NAME='Description' lang='<?php echo $lang; ?>' CONTENT="<?php echo $metaDesc ?>"/>
<META NAME='Identifier-URL' CONTENT="new.emmanuelroy.name/<?php echo $page['name'] ?>"/>
<?php
/*Rich META from google
<meta name="department" content="legal" />
<meta name="audience" content="all" />
<meta name="doc_status" content="draft" />
//a utiliser avec un syteme de classement utilisateur
<meta name="rating" content="5" />
//link: http://en.wikipedia.org/wiki/Smart_tag_%28Microsoft%29
<meta name="mssmarttagspreventparsing" content="..." />
//link: https://support.google.com/customsearch/answer/2595557?hl=fr
<meta name="verify-v1" content="..." />
*/
?>
<!-- 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">
<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"/>
<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 -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php echo $title ?></title>
<!-- 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.
Create your own custom Modernizr build: www.modernizr.com/download/ -->
<!-- <script src="/js/libs/modernizr-2.5.3.min.js"></script>-->
<!-- All JavaScript at the bottom, except this Modernizr build.
Modernizr enables HTML5 elements & feature detects for optimal performance.
Create your own custom Modernizr build: www.modernizr.com/download/ -->
<!-- <script src="/js/libs/modernizr-2.5.3.min.js"></script>-->
</head>
<body>
<!-- Prompt IE 6 users to install Chrome Frame. Remove this if you support IE 6.
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]-->
<!-- Prompt IE 6 users to install Chrome Frame. Remove this if you support IE 6.
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]-->

View file

@ -1,21 +1,21 @@
<?php include LAYOUT_PATH . DIRECTORY_SEPARATOR .'header.php';?>
<!--
<?php include LAYOUT_PATH . DIRECTORY_SEPARATOR . 'header.php'; ?>
<!--
<header>
<h2>Ceci est le header de la page <?php echo $page['name'] ?></h2>
</header>
-->
<br /><br /><br />
<?php echo $content ?>
<br /><br /><br />
<!--
<br/><br/><br/>
<?php echo $content ?>
<br/><br/><br/>
<!--
<footer>
<h2>Ceci est le footer de la page <?php echo $page['name'] ?></h2>
</footer>
-->
<?php include LAYOUT_PATH . DIRECTORY_SEPARATOR .'footer.php';?>
<?php include LAYOUT_PATH . DIRECTORY_SEPARATOR . 'footer.php'; ?>

View file

@ -2,26 +2,29 @@
<textarea id="text-input" oninput="this.editor.update()"
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;">
<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 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>
</form>
<br /><br />
<br/><br/>
<div id='mattermostform_success'></div>
<?php
if(isset($_GET['envoiDuMessage'])){
if($_GET['envoiDuMessage'] == 'oui'){
if (isset($_GET['envoiDuMessage'])) {
if ($_GET['envoiDuMessage'] == 'oui') {
echo "<p>La veille Mattermost as &eacute;t&eacute; correctement transmis.</p>";
}else{
} else {
echo "<p>La veille Mattermost n'as pas &eacute;t&eacute; transmis. Veuillez v&eacute;rifiez les informations que vous avez saisies ...</p>";
}
}

View file

@ -1,5 +1,5 @@
<?php
$title = 'Error';
$metaDesc = 'Description d\'une page de sécurité nécessaire dans ce monde de brute ';
$dateCreation = '20191107';
$dateRevision = '20191107';
$title = 'Error';
$metaDesc = 'Description d\'une page de sécurité nécessaire dans ce monde de brute ';
$dateCreation = '20191107';
$dateRevision = '20191107';

View file

@ -1,28 +1,32 @@
<h2><?php echo $title?></h2>
<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>Il semblerait que ce soit:</p>
<ul>
<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>
</li>
<li>un test de sécurité <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>
</li>
<li>une succession d'erreur de mot de passe <br />
<i>( entendez par là : &laquo; La Mémoire est <u>la</u> grande des connaissances actuelles&laquo; )</i>
</li>
</ul>
<form action="<?php echo Url::link_rewrite_slashParam('Gougou-search-results'); ?>" id="cse-search-box">
<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>
<h2><?php echo $title ?></h2>
<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>Il semblerait que ce soit:</p>
<ul>
<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>
</li>
<li>un test de sécurité <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>
</li>
<li>une succession d'erreur de mot de passe <br/>
<i>( entendez par là : &laquo; La Mémoire est <u>la</u> grande des connaissances actuelles&laquo; )</i>
</li>
</ul>
<form action="<?php echo Url::link_rewrite_slashParam('Gougou-search-results'); ?>" id="cse-search-box">
</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&amp;lang=fr"></script>

View file

@ -1,5 +1,5 @@
<?php
$title = 'Erreur';
$metaDesc = 'Description de la page erreur';
$dateCreation = '20120810';
$dateRevision = '20150517';
$title = 'Erreur';
$metaDesc = 'Description de la page erreur';
$dateCreation = '20120810';
$dateRevision = '20150517';

View file

@ -1,43 +1,48 @@
<h2><?php echo $title?></h2>
<h1>Not found <span>:(</span></h1>
<p>Désolé, mais la page que vous recherchez ne semble pas exister.</p>
<p>Il semblerait que ce soit:</p>
<ul>
<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>
</li>
<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>
</li>
<li>une page que j'aurais dû déjà créer <br />
<i>( entendez par là : &laquo; La Patience est <u>une</u> mère de sureté&laquo; )</i>
</li>
</ul>
<form action="<?php echo Url::link_rewrite_slashParam('Gougou-search-results'); ?>" id="cse-search-box">
<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>
<h2><?php echo $title ?></h2>
<h1>Not found <span>:(</span></h1>
<p>Désolé, mais la page que vous recherchez ne semble pas exister.</p>
<p>Il semblerait que ce soit:</p>
<ul>
<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>
</li>
<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>
</li>
<li>une page que j'aurais dû déjà créer <br/>
<i>( entendez par là : &laquo; La Patience est <u>une</u> mère de sureté&laquo; )</i>
</li>
</ul>
<form action="<?php echo Url::link_rewrite_slashParam('Gougou-search-results'); ?>" id="cse-search-box">
</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&amp;lang=fr"></script>
<p>Voici quand même les quelques pages qui sont valables d'être cherchées</p>
<ul>
<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_1'>La norme iso-8859-1</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='/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-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-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='/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_1'>La norme iso-8859-1</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='/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-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-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>
</ul>

View file

@ -1,6 +1,6 @@
<?php
define(HASH_ALGORITHM, PASSWORD_BCRYPT);
define(HASH,password_hash('xxxx-0000', HASH_ALGORITHM));
define(HASH, password_hash('xxxx-0000', HASH_ALGORITHM));

View file

@ -4,8 +4,8 @@ session_start();
/*RESTRICTION D'USAGE DU SITE PERSONNEL AU BLACK HAT HACKER */
//chargement en mémoire des anciennes attaques
$attempts = simplexml_load_file( APPLICATION_PATH . DIRECTORY_SEPARATOR ."bruteforce-logger.xml" , "SimpleXMLElement" , LIBXML_NOCDATA );
if($attempts->xpath("/brute-force-attack/attempt/from")) {
$attempts = simplexml_load_file(APPLICATION_PATH . DIRECTORY_SEPARATOR . "bruteforce-logger.xml", "SimpleXMLElement", LIBXML_NOCDATA);
if ($attempts->xpath("/brute-force-attack/attempt/from")) {
foreach ($attempts->xpath("/brute-force-attack/attempt/from") as $attempt) {
// Récupération des ip et test de corrélation actuelle
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 */
if(isset($_SESSION['brute-force-attempt'])) {
$_SESSION['brute-force-attempt']++;
}else{
$_SESSION['brute-force-attempt']=1;
}
if (isset($_SESSION['brute-force-attempt'])) {
$_SESSION['brute-force-attempt']++;
} else {
$_SESSION['brute-force-attempt'] = 1;
}
/**/
/* TESTS PERMETTANT DE DEFINIR CERTAINS CAS COMME ETANT DANGEREUX*/
if ( !isset($_SESSION['current-ip'])
|| !isset($_SESSION['current-time']) ){
if (!isset($_SESSION['current-ip'])
|| !isset($_SESSION['current-time'])) {
//Ce test permet d'identifier ceux qui veulent faire un traitement sans provenir d'une page de formulaire
ob_start();
require_once PAGES_PATH . DIRECTORY_SEPARATOR . 'error.php' ;
require_once PAGES_PATH . DIRECTORY_SEPARATOR . 'error.phtml' ;
require_once PAGES_PATH . DIRECTORY_SEPARATOR . 'error.php';
require_once PAGES_PATH . DIRECTORY_SEPARATOR . 'error.phtml';
$content = ob_get_contents();
ob_end_clean();
require_once LAYOUT_PATH . DIRECTORY_SEPARATOR . 'layout-codage.phtml';
die();
}else{
if( $_SESSION['last-ip'] !== $_SERVER['REMOTE_ADDR']
|| $_SESSION['last-time'] > $_SERVER['REQUEST_TIME'] ){
} else {
//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();
require_once PAGES_PATH . DIRECTORY_SEPARATOR . 'error.php' ;
require_once PAGES_PATH . DIRECTORY_SEPARATOR . 'error.phtml' ;
require_once PAGES_PATH . DIRECTORY_SEPARATOR . 'error.php';
require_once PAGES_PATH . DIRECTORY_SEPARATOR . 'error.phtml';
$content = ob_get_contents();
ob_end_clean();
require_once LAYOUT_PATH . DIRECTORY_SEPARATOR . 'layout-codage.phtml';
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->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);
@ -76,12 +76,12 @@ if ( !isset($_SESSION['current-ip'])
$attemptNode->appendChild($ipNode);
$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
ob_start();
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.php';
require_once PAGES_PATH . DIRECTORY_SEPARATOR . 'error-brute-force-attack.phtml';
$content = ob_get_contents();
ob_end_clean();
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
$_SESSION['last-ip'] = $_SESSION['current-ip'];
$_SESSION['last-time'] = $_SESSION['current-time'];
//mise en tampon des données courante de combat
$_SESSION['last-ip'] = $_SESSION['current-ip'];
$_SESSION['last-time'] = $_SESSION['current-time'];
}
/**/

View file

@ -1,20 +1,20 @@
<?php
define('PUBLIC_PATH' , dirname(__FILE__) );
define('APPLICATION_PATH' , dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "app" );
define('CLASS_PATH' , APPLICATION_PATH . DIRECTORY_SEPARATOR . "class" );
define('PAGES_PATH' , APPLICATION_PATH . DIRECTORY_SEPARATOR . "page" );
define('LAYOUT_PATH' , APPLICATION_PATH . DIRECTORY_SEPARATOR . "layout" );
define('PUBLIC_PATH', dirname(__FILE__));
define('APPLICATION_PATH', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "app");
define('CLASS_PATH', APPLICATION_PATH . DIRECTORY_SEPARATOR . "class");
define('PAGES_PATH', APPLICATION_PATH . DIRECTORY_SEPARATOR . "page");
define('LAYOUT_PATH', APPLICATION_PATH . DIRECTORY_SEPARATOR . "layout");
require_once CLASS_PATH . DIRECTORY_SEPARATOR . 'password.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
ob_start();
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.php';
require_once PAGES_PATH . DIRECTORY_SEPARATOR . 'TINTERNET-chatbot.phtml';
$content = ob_get_contents();
ob_end_clean();

File diff suppressed because it is too large Load diff

View file

@ -1,65 +1,68 @@
<?php
define('PUBLIC_PATH' , dirname(__FILE__));
define('APPLICATION_PATH' , dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "app" );
define('CLASS_PATH' , APPLICATION_PATH . DIRECTORY_SEPARATOR . "class" );
define('PUBLIC_PATH', dirname(__FILE__));
define('APPLICATION_PATH', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "app");
define('CLASS_PATH', APPLICATION_PATH . DIRECTORY_SEPARATOR . "class");
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 . 'encoding.class.php';
error_reporting(-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_needs_rehash(HASH, HASH_ALGORITHM)) {
$hash = password_hash($password, HASH_ALGORITHM);
if (password_verify($password, HASH)) {
if (password_needs_rehash(HASH, HASH_ALGORITHM)) {
$hash = password_hash($password, HASH_ALGORITHM);
$file = "";
$lines = file(APPLICATION_PATH . DIRECTORY_SEPARATOR . "parameters.php");
foreach ($lines as $line_num => $line) {
if(preg_match("#define\(HASH,(.*)\)#",$line,$matches)){
$newline = preg_replace("#define\(HASH,(.*)\)#","define(HASH,'$hash')",$line);
}else{
$newline = $line;
}
if ($newline != "") {
$file = "";
$lines = file(APPLICATION_PATH . DIRECTORY_SEPARATOR . "parameters.php");
foreach ($lines as $line_num => $line) {
if (preg_match("#define\(HASH,(.*)\)#", $line, $matches)) {
$newline = preg_replace("#define\(HASH,(.*)\)#", "define(HASH,'$hash')", $line);
} else {
$newline = $line;
}
if ($newline != "") {
$file .= $newline . "\n";
}
}
/* Store new hash in parameters file */
file_put_contents(APPLICATION_PATH . DIRECTORY_SEPARATOR . "parameters.php",$file);
}
}
//try fallback passengers
if (password_verify($password,HASH)) {
return true;
} else {
return false;
}
}
/* Store new hash in parameters file */
file_put_contents(APPLICATION_PATH . DIRECTORY_SEPARATOR . "parameters.php", $file);
}
}
//try fallback passengers
if (password_verify($password, HASH)) {
return true;
} else {
return false;
}
}
//https://code.tutsplus.com/tutorials/8-regular-expressions-you-should-know--net-6149
function extractLink($message){
preg_match_all("#((?:https?:\/\/)?(?:[\da-z\.-]+)\.(?:[a-z\.]{2,6})(?:[\/\w \.-]*)*\/?)#",$message,$matches);
return $matches;
function extractLink($message)
{
preg_match_all("#((?:https?:\/\/)?(?:[\da-z\.-]+)\.(?:[a-z\.]{2,6})(?:[\/\w \.-]*)*\/?)#", $message, $matches);
return $matches;
}
function extractText($message){
$links = extractLink($message);
array_shift($links);
foreach ($links as $link) {
if ($link != "") {
$message = preg_replace("#$link[0]#"," ... ",$message);
}
}
return $message;
function extractText($message)
{
$links = extractLink($message);
array_shift($links);
foreach ($links as $link) {
if ($link != "") {
$message = preg_replace("#$link[0]#", " ... ", $message);
}
}
return $message;
}
/**************************************************************************************************************/
@ -67,11 +70,11 @@ function extractText($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={
"channel": "bot-tests",
"username": "acksop",
@ -79,7 +82,7 @@ payload={
}
EOD;
$json = <<<EOD
$json = <<<EOD
{
"channel": "bot-tests",
"username": "acksop",
@ -88,36 +91,36 @@ EOD;
EOD;
$commandURL = "curl -i -X POST --data-urlencode '$payload' $hookMattermost";
$commandJSON = "curl -i -X POST -H 'Content-Type: application/json' -d '$json' $hookMattermost";
$commandURL = "curl -i -X POST --data-urlencode '$payload' $hookMattermost";
$commandJSON = "curl -i -X POST -H 'Content-Type: application/json' -d '$json' $hookMattermost";
echo "<pre>";
print_r($commandJSON);
echo "</pre><pre>";
print_r($commandURL);
echo "<pre>";
print_r($commandJSON);
echo "</pre><pre>";
print_r($commandURL);
$dom = new DOMDocument;
$dom->load(PUBLIC_PATH . DIRECTORY_SEPARATOR ."veilleTinternet.xml");
$dom = new DOMDocument;
$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");
$textNode = $dom->createTextNode(htmlentities($message));
$myOriginalTextNode->appendChild($textNode);
$messageNode->appendChild($myOriginalTextNode);
$myTextNode = $dom->createElement("text");
$textNode = $dom->createTextNode(htmlentities(extractText($message)));
$myTextNode->appendChild($textNode);
$myTextNode = $dom->createElement("text");
$textNode = $dom->createTextNode(htmlentities(extractText($message)));
$myTextNode->appendChild($textNode);
$messageNode->appendChild($myTextNode);
$myLinksNode = $dom->createElement("links");
$links = extractLink($message);
$links = extractLink($message);
array_shift($links);
foreach($links as $link) {
if($link != "") {
foreach ($links as $link) {
if ($link != "") {
$myLinkNode = $dom->createElement("link");
$textNode = $dom->createTextNode(htmlentities($link[0]));
$myLinkNode->appendChild($textNode);
@ -129,21 +132,21 @@ EOD;
//$dom->insertBefore( $messageNode, $noeudVeille );
$noeudVeille->appendChild($messageNode);
$dom->save(PUBLIC_PATH . DIRECTORY_SEPARATOR ."veilleTinternet.xml");
$dom->save(PUBLIC_PATH . DIRECTORY_SEPARATOR . "veilleTinternet.xml");
shell_exec($commandJSON);
shell_exec($commandURL);
die();
if(isset($_POST['ajax'])){
echo "Votre Lien as &eacute;t&eacute; correctement transmis. Vous receverez une r&eacute;ponse dans les prochains jours.";
}else{
header("Location: /index.php?envoiDuMessage=oui");
}
if (isset($_POST['ajax'])) {
echo "Votre Lien as &eacute;t&eacute; correctement transmis. Vous receverez une r&eacute;ponse dans les prochains jours.";
} else {
header("Location: /index.php?envoiDuMessage=oui");
}
}else{
if(isset($_POST['ajax'])){
echo "Votre Lien n'as pas &eacute;t&eacute; transmis. Veuillez v&eacute;rifiez les informations que vous avez saisies ...";
}else{
header("Location: /index.php?envoiDuMessage=non&message=".Encoding::myUrlEncode($message));
}
} else {
if (isset($_POST['ajax'])) {
echo "Votre Lien n'as pas &eacute;t&eacute; transmis. Veuillez v&eacute;rifiez les informations que vous avez saisies ...";
} else {
header("Location: /index.php?envoiDuMessage=non&message=" . Encoding::myUrlEncode($message));
}
}