diff --git a/Source/assets/html/code.twig b/Source/assets/html/code.twig index e0132d3..85d90d5 100644 --- a/Source/assets/html/code.twig +++ b/Source/assets/html/code.twig @@ -21,9 +21,9 @@ {% endif %}
- {% if user.ROLE == 3 %} + {#{% if user.ROLE == 3 %} Delete source - {% endif %} + {% endif %}#} {% if page.otherV %}
View version's history
{% endif %} diff --git a/Source/src/app.php b/Source/src/app.php index 45e3f4e..aff2194 100644 --- a/Source/src/app.php +++ b/Source/src/app.php @@ -65,8 +65,8 @@ function run(){ case "user": user(); break; - case "del": - deleteSource(); + /*case "del": + deleteSource();*/ break; default: sendHTTPError(404); @@ -343,7 +343,7 @@ function user(){ } } -function deleteSource(){ +/*function deleteSource(){ global $user; if(array_key_exists('ROLE',$user)){ if($user['ROLE']==3){ @@ -356,4 +356,4 @@ function deleteSource(){ }else{ sendHTTPError(403); } -} \ No newline at end of file +}*/ \ No newline at end of file diff --git a/Source/src/dbToTable.php b/Source/src/dbToTable.php index 05a99ce..1d3f031 100644 --- a/Source/src/dbToTable.php +++ b/Source/src/dbToTable.php @@ -6,6 +6,11 @@ * Time: 11:42 */ + +/* + * Methods to get an array to send to twig + */ + function lastToArray($db,$query,$supported){ $last = array(); while($var = dbw_fetch_array($db->conn,$query)){ diff --git a/Source/src/functions.php b/Source/src/functions.php index 3e14338..d8310f7 100644 --- a/Source/src/functions.php +++ b/Source/src/functions.php @@ -5,6 +5,13 @@ * Date: 6/07/17 * Time: 11:56 */ + +/** + * Generate a RandomString + * + * @param $length length of string + * @return string string generated + */ function RandomString($length) { //https://phpes.wordpress.com/2007/06/12/generador-de-una-cadena-aleatoria/ @@ -23,6 +30,12 @@ function RandomString($length) return $rstr; } +/** + * Parse a file from Keys system object notation (KSON) to Mapped array + * + * @param $path path to file + * @return array array from kson + */ function ksonParse($path){ $file = fopen($path,"r"); $array = []; diff --git a/Source/src/users.php b/Source/src/users.php index 671dac7..8a0a4ca 100644 --- a/Source/src/users.php +++ b/Source/src/users.php @@ -6,6 +6,13 @@ * Time: 19:06 */ +/** + * Check if login is correct + * + * @param $email user's input email + * @param $pass user's input password + * @return bool true if email-password combination is correct, false if not + */ function checklogin($email,$pass){ $db = new DB(); $bool = $db->checkPass($email,$pass); @@ -22,6 +29,14 @@ function checklogin($email,$pass){ return false; } +/** + * Register a new user in platform + * + * @param $email new user's email + * @param $pass new user's password + * @param $nick new user's nickname + * @return bool true if email never exists before, else false + */ function register($email,$pass,$nick){ $db = new DB(); $bool = $db->register($email,$pass,$nick); @@ -35,6 +50,9 @@ function register($email,$pass,$nick){ } +/** + * Logout user + */ function logout(){ setcookie("token","",time()-3600); setcookie("sessionID",0,time()-3600);