mirror of
https://gitlab.com/CodeSolutionsProject/CodeShare.git
synced 2026-02-14 17:11:34 +01:00
Add new comments and comment all deletion system
This commit is contained in:
@@ -21,9 +21,9 @@
|
||||
{% endif %}
|
||||
<div class="col-md-3"></div>
|
||||
</div>
|
||||
{% if user.ROLE == 3 %}
|
||||
{#{% if user.ROLE == 3 %}
|
||||
<a href="?page=del&id={{ code.idc }}&lang={{ code.lang }}&version={{ code.version }}" class="btn btn-danger">Delete source</a>
|
||||
{% endif %}
|
||||
{% endif %}#}
|
||||
{% if page.otherV %}
|
||||
<div style='text-align: center; font-size: 22px; '><a href='?page=code&id={{ code.idc }}&lang={{ code.lang }}'>View version's history</a></div>
|
||||
{% endif %}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
@@ -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)){
|
||||
|
||||
@@ -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 = [];
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user