From 8b622d430db9ab860aee156a32086507669243fd Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Mon, 20 Mar 2017 18:28:12 +0100 Subject: [PATCH] MAJ 1.8.2 --- conf/app.src | 4 +- manifest.json | 13 +- scripts/_common.sh | 7 + scripts/install | 11 - scripts/upgrade | 7 - sources/ajouts/Functions.class.php | 378 ----------------------------- sources/ajouts/Update.class.php | 113 --------- 7 files changed, 11 insertions(+), 522 deletions(-) delete mode 100644 sources/ajouts/Functions.class.php delete mode 100644 sources/ajouts/Update.class.php diff --git a/conf/app.src b/conf/app.src index d5af0a3..d5d002f 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,2 +1,2 @@ -SOURCE_URL>https://github.com/ldleman/Leed/archive/v1.7.tar.gz -SOURCE_SUM=f54a18cef71704be85e7b963cff19357 +SOURCE_URL>https://github.com/LeedRSS/Leed/archive/v1.8.2.tar.gz +SOURCE_SUM=e0558125f8c76d399beb0cfc6d168b04 diff --git a/manifest.json b/manifest.json index ccbd9d7..4dfa969 100644 --- a/manifest.json +++ b/manifest.json @@ -9,9 +9,9 @@ "en": "Leed is a minimalistic RSS feed aggregator which allows quick and non-intrusive reading of feeds.", "fr": "Leed est un agrégateur RSS minimaliste qui permet la consultation de flux RSS de manière rapide et non intrusive." }, - "version": "1.7", + "version": "1.8.2", "url": "http://leed.idleman.fr/", - "license": "CC by-nc-sa", + "license": "AGPL-3.0", "maintainer": { "name": "Maniack Crudelis", "email": "maniackc_dev@crudelis.fr" @@ -70,15 +70,6 @@ "choices" : ["en", "fr", "es"], "default" : "en" }, - { - "name": "market", - "type": "boolean", - "ask": { - "en": "Do you want to activate the Leed Market?", - "fr": "Voulez-vous activer le Leed Market ?" - }, - "default": true - }, { "name": "is_public", "type": "boolean", diff --git a/scripts/_common.sh b/scripts/_common.sh index 2243dd2..de90777 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -224,6 +224,13 @@ CHECK_MD5_CONFIG () { # Créé un backup du fichier de config si il a été modi fi } +#================================================= +# PACKAGE CHECK BYPASSING... +#================================================= + +IS_PACKAGE_CHECK () { # Détermine une exécution en conteneur (Non testé) + return $(uname -n | grep -c 'pchecker_lxc') +} #================================================= #================================================= diff --git a/scripts/install b/scripts/install index fd772a8..b26641c 100644 --- a/scripts/install +++ b/scripts/install @@ -24,7 +24,6 @@ path_url=$YNH_APP_ARG_PATH admin=$YNH_APP_ARG_ADMIN user_pwd=$YNH_APP_ARG_PASSWORD language=$YNH_APP_ARG_LANGUAGE -market=$YNH_APP_ARG_MARKET is_public=$YNH_APP_ARG_IS_PUBLIC app=$YNH_APP_INSTANCE_NAME @@ -105,16 +104,6 @@ sudo systemctl reload nginx # Leed installation via curl YNH_CURL "install_changeLngLeed=$language&root=$domain$path_url&mysqlHost=localhost&mysqlLogin=$db_name&mysqlMdp=$db_pwd&mysqlBase=$db_name&mysqlPrefix=leed_&login=$admin&password=$user_pwd" "/install.php?installButton" -#================================================= -# ACTIVATE LEED MARKET -#================================================= -ynh_app_setting_set $app market "$market" -if [ $market -eq 1 ] -then - sudo rm -R $final_path/plugins - sudo git clone https://github.com/ldleman/Leed-market.git "$final_path/plugins" -fi - #================================================= # RETRIEVE SYNCHRONISATION CODE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 524a8bd..5a5dc87 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -55,13 +55,6 @@ else fi fi -market=$(ynh_app_setting_get $app market) -if [ "$market" = "Yes" ]; then - ynh_app_setting_set $app market 1 # Fixe market en booléen -elif [ "$market" = "No" ]; then - ynh_app_setting_set $app market 0 -fi - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= diff --git a/sources/ajouts/Functions.class.php b/sources/ajouts/Functions.class.php deleted file mode 100644 index 26c761b..0000000 --- a/sources/ajouts/Functions.class.php +++ /dev/null @@ -1,378 +0,0 @@ - variable a sécuriser - * @param niveau de securisation - * @return variable securisée - */ - - public static function secure($var,$level = 1){ - $var = htmlspecialchars($var, ENT_QUOTES, "UTF-8"); - if($level<1)$var = mysqli_real_escape_string($var); - if($level<2)$var = addslashes($var); - return $var; - } - - - /** - * Return l'environnement/serveur sur lequel on se situe, permet de changer les - * connexions bdd en fonction de la dev, la préprod ou la prod - */ - public static function whereImI(){ - - $maps = array ( - 'LOCAL'=>array('localhost','127.0.0.1','0.0.0.1','::0.0.0.0'), - 'LAN'=>array('192.168.10.','valentin'), - 'PWAN'=>array('test.sys1.fr'), - 'WAN'=>array('www.sys1.fr'), - ); - - - $return = 'UNKNOWN'; - foreach($maps as $map=>$values){ - - foreach($values as $ip){ - $pos = strpos(strtolower($_SERVER['HTTP_HOST']),$ip); - if ($pos!==false){ - $return = $map; - } - } - } - return $return; - } - - public static function isLocal($perimeter='LOCAL'){ - $return = false; - - $localTab = array('localhost','127.0.0.1','0.0.0.1','::0.0.0.0'); - $lanTab = array('192.168.10.','valentin'); - - switch($perimeter){ - case 'LOCAL': - foreach($localTab as $ip){ - $pos = strpos(strtolower($_SERVER['HTTP_HOST']),$ip); - if ($pos!==false){ - $return = true; - } - } - break; - case 'LAN': - foreach($lanTab as $ip){ - $pos = strpos(strtolower($_SERVER['HTTP_HOST']),$ip); - if ($pos!==false){ - $return = true; - } - } - break; - case 'ALL': - foreach($localTab as $ip){ - $pos = strpos(strtolower($_SERVER['HTTP_HOST']),$ip); - if ($pos!==false){ - $return = true; - } - } - foreach($lanTab as $ip){ - $pos = strpos(strtolower($_SERVER['HTTP_HOST']),$ip); - if ($pos!==false){ - $return = true; - } - } - break; - } - - return $return; - } - - - /** - * Convertis la chaine passée en timestamp quel que soit sont format - * (prend en charge les formats type dd-mm-yyy , dd/mm/yyy, yyyy/mm/ddd...) - */ - public static function toTime($string){ - $string = str_replace('/','-',$string); - $string = str_replace('\\','-',$string); - - $string = str_replace('Janvier','Jan',$string); - $string = str_replace('Fevrier','Feb',$string); - $string = str_replace('Mars','Mar',$string); - $string = str_replace('Avril','Apr',$string); - $string = str_replace('Mai','May',$string); - $string = str_replace('Juin','Jun',$string); - $string = str_replace('Juillet','Jul',$string); - $string = str_replace('Aout','Aug',$string); - $string = str_replace('Septembre','Sept',$string); - $string = str_replace('Octobre','Oct',$string); - $string = str_replace('Novembre','Nov',$string); - $string = str_replace('Decembre','Dec',$string); - return strtotime($string); - } - - /** - * Recupere l'ip de l'internaute courant - * @author Valentin - * @return ip de l'utilisateur - */ - - public static function getIP(){ - if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])){ - $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];} - elseif(isset($_SERVER['HTTP_CLIENT_IP'])){ - $ip = $_SERVER['HTTP_CLIENT_IP'];} - else{ $ip = $_SERVER['REMOTE_ADDR'];} - return $ip; - } - - /** - * Retourne une version tronquée au bout de $limit caracteres de la chaine fournie - * @author Valentin - * @param message a tronquer - * @param limite de caracteres - * @return chaine tronquée - */ - public static function truncate($msg,$limit){ - if(mb_strlen($msg)>$limit){ - $fin='…' ; - $nb=$limit-mb_strlen($fin) ; - }else{ - $nb=mb_strlen($msg); - $fin=''; - } - return mb_substr($msg, 0, $nb).$fin; - } - - - function getExtension($fileName){ - $dot = explode('.',$fileName); - return $dot[sizeof($dot)-1]; - } - - /** - * Definis si la chaine fournie est existante dans la reference fournie ou non - * @param unknown_type $string - * @param unknown_type $reference - * @return false si aucune occurence du string, true dans le cas contraire - */ - public static function contain($string,$reference){ - $return = true; - $pos = strpos($reference,$string); - if ($pos === false) { - $return = false; - } - return strtolower($return); - } - - /** - * Définis si la chaine passée en parametre est une url ou non - */ - public static function isUrl($url){ - $return =false; - if (preg_match('/^(http|https|ftp)://([A-Z0-9][A-Z0-9_-]*(?:.[A-Z0-9][A-Z0-9_-]*)+):?(d+)?/?/i', $url)) { - $return =true; - } - return $return; - } - - /** - * Définis si la chaine passée en parametre est une couleur héxadécimale ou non - */ - public static function isColor($color){ - $return =false; - if (preg_match('/^#(?:(?:[a-fd]{3}){1,2})$/i', $color)) { - $return =true; - } - return $return; - } - - /** - * Définis si la chaine passée en parametre est un mail ou non - */ - public static function isMail($mail){ - $return =false; - if (filter_var($mail, FILTER_VALIDATE_EMAIL)) { - $return =true; - } - return $return; - } - - /** - * Définis si la chaine passée en parametre est une IP ou non - */ - public static function isIp($ip){ - $return =false; - if (preg_match('^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:[.](?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$',$ip)) { - $return =true; - } - return $return; - } - - public static function sourceName($string){ - $name = strtolower($string); - $name = str_replace(' ','-',$name); - $name = str_replace(''','-',$name); - $name = str_replace('\'','-',$name); - $name = str_replace(',','-',$name); - $name = str_replace(':','-',$name); - $name = str_replace('à','a',$name); - $name = trim($name); - $name = html_entity_decode($name,null,'UTF-8'); - return $name; - } - - public static function makeCookie($name, $value, $expire='') { - if($expire == '') { - setcookie($name, $value, mktime(0,0,0, date("d"), - date("m"), (date("Y")+1)),'/'); - }else { - setcookie($name, '', mktime(0,0,0, date("d"), - date("m"), (date("Y")-1)),'/'); - } - } - - public static function destroyCookie($name){ - Fonction::makeCookie($name,'',time()-3600); - unset($_COOKIE[$name]); - } - - public static function wordwrap($str, $width = 75, $break = "\n", $cut = false) - { - $str = html_entity_decode($str); - $str = htmlentities (wordwrap($str,$width,$break,$cut)); - $str = str_replace('<br/>','
',$str); - $str = str_replace('&','&',$str); - return $str; - } - - public static function createFile($filePath,$content){ - $fichier = fopen($filePath,"w+"); - $fwriteResult = fwrite($fichier,$content); - fclose($fichier); - } - - - - public static function convertFileSize($bytes) - { - if($bytes<1024){ - return round(($bytes / 1024), 2).' o'; - }elseif(1024<$bytes && $bytes<1048576){ - return round(($bytes / 1024), 2).' ko'; - }elseif(1048576<$bytes && $bytes<1073741824){ - return round(($bytes / 1024)/1024, 2).' Mo'; - }elseif(1073741824<$bytes){ - return round(($bytes / 1024)/1024/1024, 2).' Go'; - } - } - - - public static function hexaValue($str){ - $code = dechex(crc32($str)); - $code = substr($code, 0, 6); - return $code; - } - - public static function scanRecursiveDir($dir){ - $files = scandir($dir); - $allFiles = array(); - foreach($files as $file){ - if($file!='.' && $file!='..'){ - if(is_dir($dir.$file)){ - $allFiles = array_merge($allFiles,Fonction::scanRecursiveDir($dir.$file)); - }else{ - $allFiles[]=str_replace('//','/',$dir.'/'.$file); - } - } - } - return $allFiles; - } - - /** Permet la sortie directe de texte à l'écran, sans tampon. - Source : http://php.net/manual/fr/function.flush.php - */ - public static function triggerDirectOutput() { - // La ligne de commande n'en a pas besoin. - if ('cli'==php_sapi_name()) return; - if (function_exists('apache_setenv')) { - /* Selon l'hébergeur la fonction peut être désactivée. Alors Php - arrête le programme avec l'erreur : - "PHP Fatal error: Call to undefined function apache_setenv()". - */ - @apache_setenv('no-gzip', 1); - } - @ini_set('zlib.output_compression', 0); - @ini_set('implicit_flush', 1); - for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); } - ob_implicit_flush(1); - } - - public static function relativePath($from, $to, $ps = '/') { - $arFrom = explode($ps, rtrim($from, $ps)); - $arTo = explode($ps, rtrim($to, $ps)); - while(count($arFrom) && count($arTo) && ($arFrom[0] == $arTo[0])) { - array_shift($arFrom); - array_shift($arTo); - } - return str_pad("", count($arFrom) * 3, '..'.$ps).implode($ps, $arTo); - } - - - // Nettoyage de l'url avant la mise en base - public static function clean_url( $url ) { - $url = str_replace('&', '&', $url); - return $url; - } - - - - /** - * Méthode de test de connexion. - * @return true si ok - * @param server - * @param login - * @param pass - * @param db facultatif, si précisé alors tente de la séléctionner - */ - public static function testDb($server, $login, $pass, $db=null) { - /* Méthode hors des classes dédiées aux BDD afin de supporter le moins - de dépendances possibles. En particulier, pas besoin que le fichier - de configuration existe. */ - $link = mysqli_connect($server, $login, $pass, $db); - if (false===$link) return false; - mysqli_close($link); - return true; - } - - /** - * @return les langues acceptées par le navigateur - */ - public static function getBrowserLanguages() { - /* http://www.w3.org/International/questions/qa-lang-priorities.en.php - * ex: da, en-gb;q=0.8,en;q=0.7 --> array('da','en'); - */ - if (!array_key_exists('HTTP_ACCEPT_LANGUAGE', $_SERVER)) return array(); - $languages = array(); - $chunks = preg_split('/,\s*/', $_SERVER['HTTP_ACCEPT_LANGUAGE']); - foreach($chunks as $chunk) $languages []= substr($chunk, 0, 2); - return array_unique($languages); - } - - /** - * @return boolean - */ - public static function isAjaxCall() { - return !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'; - } -} -?> diff --git a/sources/ajouts/Update.class.php b/sources/ajouts/Update.class.php deleted file mode 100644 index 2340506..0000000 --- a/sources/ajouts/Update.class.php +++ /dev/null @@ -1,113 +0,0 @@ -connection; - //on sépare chaque requête par les ; - $sql_array = explode (";",$sql); - foreach ($sql_array as $val) { - $val = preg_replace('#([-].*)|(\n)#','',$val); - if ($val != '') { - //remplacement des préfixes de table - $val = str_replace('##MYSQL_PREFIX##',MYSQL_PREFIX,$val); - $result = $conn->query($val); - $ficlog = dirname(__FILE__).Update::FOLDER.'/'.substr($file,0,strlen($file)-3).'log'; - if (false===$result) { - file_put_contents($ficlog, date('d/m/Y H:i:s').' : SQL : '.$val."\n", FILE_APPEND); - file_put_contents($ficlog, date('d/m/Y H:i:s').' : '.$conn->error."\n", FILE_APPEND); - } else { - file_put_contents($ficlog, date('d/m/Y H:i:s').' : SQL : '.$val."\n", FILE_APPEND); - file_put_contents($ficlog, date('d/m/Y H:i:s').' : '.$conn->affected_rows.' rows affected'."\n", FILE_APPEND); - } - } - } - unset($conn); - } - $_SESSION = array(); - session_unset(); - session_destroy(); - } - // quand toutes les requêtes ont été executées, on insert le sql dans le json - Update::addUpdateFile(array($newFilesForUpdate)); - - return true; - } - -} - -?> \ No newline at end of file