Hacked By AnonymousFox
agenda.php 0000644 00000015102 15200256543 0006475 0 ustar 00 <?php
/* For licensing terms, see /license.txt */
/**
* Fonctions CRUD for agenda in cooperation
* @author Batiste Roger <batiste.roger@live.fr>
* @package chamilo.couple
*/
require_once '../inc/global.inc.php';
require_once(api_get_path(SYS_PATH) . 'main/couple/model.php');
require_once(api_get_path(SYS_PATH) . 'main/couple/tool.php');
require_once(api_get_path(SYS_PATH) . 'main/couple/error.php');
require_once(api_get_path(SYS_PATH) . 'main/couple/logs.php');
define('TABLE_TOOL_AGENDA', 'couple_tool_agenda');
function agenda_is_valid_date ($date) {
return preg_match( '`^\d{1,2}-\d{1,2}-\d{4}$`' , $date) || empty($date);
}
function agenda_is_valid_time ($time) {
return preg_match( '`^\d{1,2}:\d{1,2}$`' , $time) || empty($time);
}
function agenda_are_dates_and_types_valid ($date1, $time1, $date2, $time2) {
return agenda_is_valid_date($date1) && agenda_is_valid_date($date2) && agenda_is_valid_time($time1) && agenda_is_valid_time($time2);
}
function agenda_create ($couple_id, $couple_type, $title, $description, $author_user_id,
$is_deleted = null, $is_ok = null, $date_debut = null, $date_fin = null) {
try {
// Create a tool
tool_create($couple_id, $couple_type, $title, $description, $author_user_id, $is_deleted, $is_ok);
// Create the action item
$tool_id = tool_get_max_id();
$sql = "INSERT INTO " . TABLE_TOOL_AGENDA . " SET tool_id = '$tool_id'";
if (!empty($date_debut)) {
$sql .= ", date_deb = '$date_debut'";
}
if (!empty($date_fin)) {
$sql .= ", date_fin = '$date_fin'";
}
} catch (Exception $e) {
return error_log($e->getMessage());
}
$ret = Database::query($sql);
// Create a log accordingly
log_generate($couple_id, $couple_type, $author_user_id, $tool_id, 'crée', "(du $date_debut au $date_fin)",
"confirmer votre présence", 'validate', "proposer un autre créneau", 'edit');
return $ret;
}
function agenda_read($couple_id, $couple_type) {
// Note : to display month name, simply change %m to %M. And many other examples can be found in the doc.
// Don't do these conversions in php unless you need to do so
$select = ", DATE_FORMAT(date_deb, '%d-%m-%Y') AS date_deb, DATE_FORMAT(date_deb, '%H:%i') AS time_deb, " .
"DATE_FORMAT(date_fin, '%d-%m-%Y') AS date_fin, DATE_FORMAT(date_fin, '%H:%i') AS time_fin";
return tool_get_tool_for_couple('agenda', $couple_id, $couple_type, $select);
}
function agenda_create_form() {
// First, try to read all parameters
$title = read_param('title');
$description = read_param('description');
$date_debut = read_param('date_debut');
$time_debut = read_param('time_debut');
$date_fin = read_param('date_fin', 'POST', null, false);
$time_fin = read_param('time_fin', 'POST', null, false);
// Check that dates and times are ok
if (!agenda_are_dates_and_types_valid($date_debut, $time_debut, $date_fin, $time_fin)) return false;
// Convert dates into timestamps
$timestamp_debut = (!empty($date_debut) && !empty($time_debut) ? date('Y-m-d H:i:s', strtotime("$date_debut $time_debut")) : null);
$timestamp_fin = (!empty($date_fin) && !empty($time_fin) ? date('Y-m-d H:i:s', strtotime("$date_fin $time_fin")) : null);
// Test that these params are correct
if ($title && $date_debut) {
// React
$my_user_id = api_get_user_id();
$couple = couple_get_coop_partner($my_user_id);
return agenda_create(
$couple['couple_id'],
strtoupper($couple['type']),
$title,
$description,
$my_user_id,
false,
false,
$timestamp_debut,
$timestamp_fin
);
}
error_throw("Echec de la création. Params : $title, $description, $date_debut, $time_debut, $date_fin, $time_fin");
return false;
}
/**
* Deletes a date
* @return boolean : true if the item was actually deleted
*/
function agenda_delete_form () {
$tool_id = read_param('id', false);
$tool_was_deleted = tool_delete($tool_id);
if ($tool_was_deleted) {
// The tool item was deleted, delete the date
$sql = "DELETE FROM " . TABLE_TOOL_AGENDA . " WHERE tool_id = '$tool_id'";
Database::query($sql);
return true;
}
return false;
}
function agenda_update_form($couple_id, $couple_type) {
// First, try to read all parameters
$now = date("Y-m-d H:i:s");
$title = read_param('title');
$description = read_param('description');
$date_debut = read_param('date_debut', 'POST', $now, false);
$time_debut = read_param('time_debut', 'POST', '12:00', false);
$date_fin = read_param('date_fin', 'POST', $now, false);
$time_fin = read_param('time_fin', 'POST', '12:00', false);
$id = read_param('id');
// Check that dates and times are ok
if (!agenda_are_dates_and_types_valid($date_debut, $time_debut, $date_fin, $time_fin)) return false;
// Convert dates into timestamps
$timestamp_debut = ($date_debut && $time_debut ? date('Y-m-d H:i:s', strtotime("$date_debut $time_debut")) : null);
$timestamp_fin = ($date_fin && $time_fin ? date('Y-m-d H:i:s', strtotime("$date_fin $time_fin")) : null);
// Test that these params are correct
if ($title && $description && $timestamp_debut) {
// Update tool's columns
$table = TABLE_TOOL;
$sql = "UPDATE $table SET title = '" . Database::escape_string(trim($title)) . "', description = '" .
Database::escape_string(trim($description)) . "' WHERE id = '$id'";
Database::query($sql);
// Update tool_action's columns
$deb = "date_deb = '$timestamp_debut'";
if ($timestamp_fin) $fin = "date_fin = '$timestamp_fin'";
$table_agenda = TABLE_TOOL_AGENDA;
$sql = "UPDATE $table_agenda SET $deb" . ($timestamp_fin ? ", $fin" : "") . " WHERE tool_id = '$id'";
$ret = Database::query($sql);
// Create a log accordingly
log_generate($couple_id, $couple_type, api_get_user_id(), $id, 'modifié', "",
"confirmer votre présence", 'validate', "proposer un autre créneau", 'edit');
// Updating causes the is_ok column to be set to false
tool_unvalidate($id);
return $ret;
}
error_throw("Echec de la création. Params : $title, $description, $id");
return false;
} action.php 0000644 00000016053 15200256543 0006541 0 ustar 00 <?php
/* For licensing terms, see /license.txt */
/**
* Model CRUD for couple_tool_action
* @author Batiste Roger <batiste.roger@live.fr>
* @package chamilo.couple
*/
require_once(api_get_path(SYS_PATH) . 'main/couple/tool.php');
define('TABLE_TOOL_ACTION', 'couple_tool_action');
/**
* Create an action item
* @param type $couple_id
* @param type $couple_type
* @param type $title
* @param type $description
* @param type $author_user_id
* @param type $is_deleted
* @param type $is_ok
* @param type $assigned_to_hp
* @param type $assigned_to_su
* @return Databse::query if params are ok, else array with params errors
*/
function action_create ($couple_id, $couple_type, $title, $description, $author_user_id,
$is_deleted = null, $is_ok = null, $assigned_to_hp = null, $assigned_to_su = null) {
// Check that booleans are booleans
try {
error_test_param (is_bool($assigned_to_hp)|| empty($assigned_to_hp), "Boolean $assigned_to_hp is not a boolean.");
error_test_param (is_bool($assigned_to_su)|| empty($assigned_to_su), "Boolean $assigned_to_su is not a boolean.");
} catch (Exception $e) {
return error_log($e->getMessage());
}
// Create a tool
try {
tool_create($couple_id, $couple_type, $title, $description, $author_user_id, $is_deleted, $is_ok);
} catch (Exception $e) {
return error_log($e->getMessage());
}
// Create the action item
$tool_id = tool_get_max_id();
$sql = "INSERT INTO " . TABLE_TOOL_ACTION . " SET tool_id = '$tool_id'";
if (!empty($assigned_to_hp)) {
$sql .= ", assigned_to_hp = '$assigned_to_hp'";
}
if (!empty($assigned_to_su)) {
$sql .= ", assigned_to_su = '$assigned_to_su'";
}
$ret = Database::query($sql);
// Create a log accordingly
$names = couple_get_firstnames($couple_id, $couple_type);
if ($assigned_to_hp && $assigned_to_su) {
$end = "affectée à " . Database::escape_string(trim($names['hp'])) . " et " . Database::escape_string(trim($names['pa']));
} else if ($assigned_to_hp) {
$end = "affectée à " . Database::escape_string(trim($names['hp']));
} else if ($assigned_to_su) {
$end = "affectée à " . Database::escape_string(trim($names['pa']));
} else {
$end = "qui n'est pas encore affectée";
}
log_generate($couple_id, $couple_type, $author_user_id, $tool_id, 'crée', $end,
"confirmer l'affectation", 'validate', "proposer une alternative", 'edit');
return $ret;
}
function action_read ($couple_id, $couple_type) {
// Get couple info for user_id
$couple = couple_get_from_id($couple_id, $couple_type);
if (empty($couple)) return null;
$couple_type = strtoupper($couple['type']);
$couple_id = $couple['couple_id'];
// Get the tool
$tool = tool_get_tool_for_couple('action', $couple_id, $couple_type);
return $tool;
}
function action_read_and_format ($couple_id, $couple_type) {
$read = action_read($couple_id, $couple_type);
if (empty($read)) return $read;
foreach ($read as $key => $action) {
$to_hp = $action['assigned_to_hp'];
$to_su = $action['assigned_to_su'];
// Get names
$couple = couple_get_from_id($couple_id, $couple_type);
$hp_name = ucfirst(subrole_id_to_user_fullname($couple['hp_id'], HP));
$su_name = ucfirst(subrole_id_to_user_fullname($couple['su_id'], STARTUP));
// acteurs
if ($to_hp && $to_su) {
$read[$key]['acteurs'] = "$hp_name et $su_name";
} else if ($to_hp) {
$read[$key]['acteurs'] = $hp_name;
} else if ($to_su) {
$read[$key]['acteurs'] = $su_name;
} else {
$read[$key]['acteurs'] = null;
}
// format me_checked and pa_checked [TODO REGLER CA]
$read[$key]['hp_checked'] = $to_hp ;
$read[$key]['su_checked'] = $to_su ;
}
return $read;
}
/** Create an action based on the info sent by POST or return errors
*
*/
function action_create_form() {
// First, try to read all parameters
$title = read_param('title');
$description = read_param('description');
$assigned_to_hp = read_param('assigned_to_hp', 'POST', false, false);
$assigned_to_su = read_param('assigned_to_su', 'POST', false, false);
// Test that these params are correct
if ($title && $description) {
// React
$my_user_id = api_get_user_id();
$couple = couple_get_coop_partner($my_user_id);
return action_create($couple['couple_id'], strtoupper($couple['type']), $title, $description, $my_user_id, null, null, (bool)$assigned_to_hp, (bool)$assigned_to_su);
}
error_throw("Echec de la création. Params : $title, $description, $assigned_to_hp, $assigned_to_su", "action.php/action_create_form");
return false;
}
/**
* Deletes an action
* @return boolean : true if the item was actually deleted
*/
function action_delete_form () {
$id = read_param('id', false);
$tool_was_deleted = tool_delete($id);
if ($tool_was_deleted) {
// The tool item was deleted, delete the action
$sql = "DELETE FROM " . TABLE_TOOL_ACTION . " WHERE tool_id = '$id'";
Database::query($sql);
return true;
}
return false;
}
function action_update_form($couple_id, $couple_type) {
// First, try to read all parameters
$title = read_param('title');
$description = read_param('description');
$assigned_to_me = read_param('assigned_to_me', 'POST', false, false);
$assigned_to_pa = read_param('assigned_to_pa', 'POST', false, false);
$id = read_param('id');
// Test that these params are correct
if ($title && $description && $id) {
// Update tool's columns
$my_user_id = api_get_user_id();
$i_am_hp = user_has_subrole($my_user_id, HP);
$assigned_to_hp = intval((bool)($i_am_hp ? $assigned_to_me : $assigned_to_pa));
$assigned_to_su = intval((bool)($i_am_hp ? $assigned_to_pa : $assigned_to_me));
$table = TABLE_TOOL;
$sql = "UPDATE $table SET title = '" . Database::escape_string(trim($title)) . "', description = '" . Database::escape_string(trim($description)) . "' WHERE id = '$id'";
Database::query($sql);
// Update tool_action's columns
$hp = "assigned_to_hp = '$assigned_to_hp'";
$su = "assigned_to_su = '$assigned_to_su'";
$table = TABLE_TOOL_ACTION;
$sql = "UPDATE $table SET $hp, $su WHERE tool_id = '$id'";
// Create a log accordingly
log_generate($couple_id, $couple_type, api_get_user_id(), $id, 'modifié', "",
"confirmer l'affectation", 'validate', "proposer une alternative", 'edit');
// Updating causes the is_ok column to be set to false
tool_unvalidate($id);
return Database::query($sql);
}
error_throw("Echec de la création. Params : $title, $description, $id", "action.php/action_update_form");
return false;
} doc.php 0000644 00000011326 15200256543 0006027 0 ustar 00 <?php
/* For licensing terms, see /license.txt */
/**
* Fonctions CRUD for documents in cooperation
* @author Batiste Roger <batiste.roger@live.fr>
* @package chamilo.couple
*/
require_once '../inc/global.inc.php';
require_once(api_get_path(SYS_PATH) . 'main/couple/model.php');
require_once(api_get_path(SYS_PATH) . 'main/couple/tool.php');
require_once(api_get_path(SYS_PATH) . 'main/couple/error.php');
require_once(api_get_path(SYS_PATH) . 'main/couple/logs.php');
require_once(api_get_path(SYS_PATH) . 'main/couple/doc_system.php');
define('TABLE_TOOL_DOC', 'couple_tool_document');
/**
* Create a file. Expects isset($_FILES["file"]) obviously
* @param type $couple_id
* @param type $couple_type
* @return type
*/
function doc_create ($couple_id, $couple_type) {
// Validate
if (!isset($_FILES["file"]) || empty($_FILES["file"])) {
return error_throw('Empty file');
}
if ($_FILES["file"]["error"] > 0) {
return error_throw(codeToMessage($_FILES["file"]["error"]));
}
if (!couple_id_is_valid($couple_id, $couple_type)) {
return error_throw("Couple id not valid : $couple_id, $couple_type");
}
$filename = $_FILES["file"]["name"];
// Before doing anything, check that this filename does not already exist
// (for that couple, obviously)
error_test_param(!doc_exists($couple_id, $couple_type, doc_convert_filename($filename)), "File $filename already exists in $couple_id, $couple_type");
// First, Create file
doc_upload_file($couple_id, $couple_type);
// Then, create items in DB
// Create tool
tool_create($couple_id, $couple_type, $filename, '', api_get_user_id());
$tool_id = tool_get_max_id();
$sql = "INSERT INTO " . TABLE_TOOL_DOC . " SET tool_id = '$tool_id'";
$ret = Database::query($sql);
// Create a log accordingly
log_generate($couple_id, $couple_type, api_get_user_id(), $tool_id, 'crée', "");
// Create doc
return $ret;
}
/**
* Lists all files shared by this couple
* @param type $couple_id
* @param type $couple_type
* @return type
*/
function doc_read ($couple_id, $couple_type) {
$tool = tool_get_tool_for_couple('document', $couple_id, $couple_type);
foreach ($tool as $item) {
$filename = doc_convert_filename($item['title']);
$exists = doc_exists($couple_id, $couple_type, $filename);
if ($exists == false) {
error_throw("No such file : $filename for couple $couple_id, $couple_type.");
}
}
return $tool;
}
function doc_delete ($tool_id, $couple_id, $couple_type, $force = null) {
$tool = tool_read($tool_id);
$filename = $tool[0]['title'];
if (empty($filename)) {
error_log("doc_delete : end (filename is empty)");
exit;
}
$item_was_deleted = tool_delete($tool_id, $couple_id, $couple_type, $force);
error_log("doc_delete : $couple_id, $couple_type => item $filename was_deleted = " . ($item_was_deleted ? 'yes' : 'no'));
if ($item_was_deleted) {
// Delete from table doc
doc_delete_from_table_doc_only($tool_id);
// Delete the file from the system
doc_system_delete($couple_id, $couple_type, doc_convert_filename($filename));
}
}
function doc_delete_from_table_doc_only ($id) {
// Delete from table doc
$sql = "DELETE FROM " . TABLE_TOOL_ACTION . " WHERE tool_id = '$id'";
return Database::query($sql);
}
/**
* Code copied from http://php.net/manual/fr/features.file-upload.errors.php
* EDIT BY danbrown AT php DOT net: This code is a fixed version of a note originally submitted by (Thalent, Michiel Thalen) on 04-Mar-2009.
* Thank you guys
* @param type $code
* @return string
*/
function codeToMessage($code)
{
switch ($code) {
case UPLOAD_ERR_INI_SIZE:
$message = "The uploaded file exceeds the upload_max_filesize directive in php.ini";
break;
case UPLOAD_ERR_FORM_SIZE:
$message = "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form";
break;
case UPLOAD_ERR_PARTIAL:
$message = "The uploaded file was only partially uploaded";
break;
case UPLOAD_ERR_NO_FILE:
$message = "No file was uploaded";
break;
case UPLOAD_ERR_NO_TMP_DIR:
$message = "Missing a temporary folder";
break;
case UPLOAD_ERR_CANT_WRITE:
$message = "Failed to write file to disk";
break;
case UPLOAD_ERR_EXTENSION:
$message = "File upload stopped by extension";
break;
default:
$message = "Unknown upload error";
break;
}
return $message;
} doc_system.php 0000644 00000010220 15200256543 0007423 0 ustar 00 <?php
/* For licensing terms, see /license.txt */
/**
* Fonctions d'écriture / lecture des fichiers sur le disque
* @author Batiste Roger <batiste.roger@live.fr>
* @package chamilo.couple
*/
require_once '../inc/global.inc.php';
require_once(api_get_path(SYS_PATH) . 'main/couple/model.php');
require_once(api_get_path(SYS_PATH) . 'main/couple/tool.php');
require_once(api_get_path(SYS_PATH) . 'main/couple/error.php');
define('DIRECTORY_FOR_UPLOAD', api_get_path(SYS_PATH) . 'main/cooperation/files/');
function doc_get_blacklist() {
return array("php", "js", "exe", "");
}
function doc_get_maxsize() {
return 1 * 1024 * 1024;
}
function doc_convert_filename ($filename) {
$replace="_";
$pattern="/[^a-zA-Z0-9\.]/";
$filename1 = preg_replace($pattern,$replace,$filename);
$filename2 = str_replace($replace,'',$filename1);
return $filename2;
}
/**
* Upload a file for this couple
* @param type $couple_id
* @param type $couple_type
* @return success boolean
*/
function doc_upload_file($couple_id, $couple_type) {
$file_name = $_FILES["file"]["name"];
$blacklist = doc_get_blacklist();
$extension = end(explode(".", $file_name));
$max_size = doc_get_maxsize();
if (in_array($extension, $blacklist)) error_throw("Le fichier ne peux être téléchargé car son extention ($extension) n'est pas authorisée");
if ($_FILES["file"]["size"] > $max_size) error_throw("Le fichier est trop gros. Taille : " . $_FILES["file"]["size"] . ". Maximum : " . $max_size);
$full_path = doc_get_path($couple_id, $couple_type);
if (!file_exists($full_path)) mkdir($full_path, 0777, true);
// Convert filename to a valid format
$valid_file_name = doc_convert_filename($file_name);
if (file_exists($full_path . $valid_file_name)) {
return error_throw ($valid_file_name . " already exists. ");
} else {
$success = move_uploaded_file($_FILES["file"]["tmp_name"], $full_path . $valid_file_name);
error_test_param($success, 'Error in move_uploaded file');
return true;
}
}
/**
* Checks that this file exists
* @param type $couple_id
* @param type $couple_type
* @param type $filename
* @return type
*/
function doc_exists ($couple_id, $couple_type, $filename) {
$system_files = doc_system_read($couple_id, strtoupper($couple_type));
if (empty($system_files)) return false;
return in_array($filename, $system_files);
}
/**
* Lists all files for this couple
* @param type $couple_id
* @param type $couple_type
* @return null
*/
function doc_system_read ($couple_id, $couple_type) {
try {
$full_path = doc_get_path($couple_id, $couple_type);
} catch (Exception $e) {
return null;
}
if (!file_exists($full_path)) return null;
$dir_list = scandir($full_path);
return $dir_list;
}
function doc_get_path ($couple_id, $couple_type) {
if (!couple_id_is_valid($couple_id, $couple_type)) {
error_throw('Invalid couple');
} else {
$type = strtolower($couple_type);
$path_to_couple = "$couple_id/$type/";
return DIRECTORY_FOR_UPLOAD . $path_to_couple;
}
}
/**
*
* @param type $couple_id
* @param type $couple_type
* @param type $converted_filename
* @return boolean
*/
function doc_system_delete($couple_id, $couple_type, $converted_filename) {
$filename = $converted_filename; // This is to emphasis on the fact that filename has to be converted into filesystem format before
if (!doc_exists($couple_id, $couple_type, $filename)) {
error_log("doc system delete : !doc_exists($couple_id, $couple_type, $filename)");
return false;
}
try {
$path = doc_get_path($couple_id, $couple_type);
} catch (Exception $e) {
error_log("doc system delete : doc_get_path($couple_id, $couple_type) => " . $e->getMessage());
return false;
}
if (is_readable($path . $filename)) {
$result = unlink($path . $filename);
// error_log("doc system delete : unlinking $path$filename => $result");
return $result;
} else {
error_log("doc system delete : can't read $path$filename");
return false;
}
} error.php 0000644 00000005562 15200256543 0006420 0 ustar 00 <?php
/* For licensing terms, see /license.txt */
/**
* Model CRUD for couple_tool_action
* @author Batiste Roger <batiste.roger@live.fr>
* @package chamilo.couple
*/
function error_throw ($message, $context = null) {
if (!empty($context)) {
throw new Exception("$context : $message");
} else {
throw new Exception("$message");
}
return false;
}
function error_test_param($param, $error, $context = null) {
if (!$param) {
error_throw($error, $context);
}
}
/**
* Read a param in POST or GET
* @param string $name
* @param bool $method_is_POST
* @param any $default default value to return
* @param bool $error_is_not_exists if true, an error is logged when variable can't be found
* @return value, any type
*/
function read_param ($name, $method_is_POST = true, $default = false, $error_is_not_exists = true) {
if ($method_is_POST) {
if (isset($_POST[$name])) {
return $_POST[$name];
}
} else {
if (isset($_GET[$name])) {
return $_GET[$name];
}
}
if ($error_is_not_exists) {
error_throw("Variable $name is not set in " . ($method_is_POST ? 'POST' : 'GET'));
}
return $default;
}
/**
* My own method to error_log
* Easy to disable
* @param type $message
* @param type $echo
*/
function error_display($message, $echo = false) {
if ($echo) {
echo $message;
} else {
error_log($message);
}
}
/**
* My own method to query
* @param string $sql
* @param bool $return as array (set to true if you want an array, false if you want a Database::result object).
* @return array one line per row
*/
function db_query($sql, $return_as_array = true) {
if ($return_as_array) {
return result_to_array(Database::query($sql));
} else {
return Database::query($sql);
}
}
/**
* Converts a result from Database::query into an array
* @param type $result
* @return type
*/
function result_to_array($result) {
$array = array();
if (Database::num_rows($result) < 1) {
// error_display ('0 lignes dans $result');
return null;
} else {
while($row = Database::fetch_assoc($result)) {
$array[] = $row;
}
return $array;
}
}
/****************** Utils for refresh_tchats ************/
function log_and_tchat($logs, $messages) {
if (!is_array($logs)) $logs = array();
if (!is_array($messages)) $messages = array();
$log_and_tchat = array_merge($logs, $messages);
$sort = usort($log_and_tchat, "is_before");
if (!$sort) error_throw ('Erreur dans le tri du tchat', 'refresh_tchat.php');
return $log_and_tchat;
}
function is_before ($item1, $item2) {
$date1 = $item1['date_creation'];
$date2 = $item2['date_creation'];
$timestamp1 = new DateTime($date1);
$timestamp2 = new DateTime($date2);
return $timestamp1 < $timestamp2;
} eval.php 0000644 00000006475 15200256543 0006222 0 ustar 00 <?php
/* For licensing terms, see /license.txt */
/**
* Model CRUD for couple_tool_eval
* @author Batiste Roger <batiste.roger@live.fr>
* @package chamilo.couple
*/
require_once(api_get_path(SYS_PATH) . 'main/couple/tool.php');
define('TABLE_TUTOR_EVAL', 'couple_tutor_eval');
define('TABLE_TUTOR_EVAL_QUESTION', 'couple_tutor_eval_question');
function eval_create_form ($user_id) {
$subrole_prefix = get_subrole($user_id);
$questions = eval_read_questions($subrole_prefix);
$answers = array();
foreach ($questions as $question) {
$id = $question['id'];
if (!isset($_GET[$id])) return false; // All questions should be answered
$answers[$id] = intval($_GET[$id]);
}
return eval_create($user_id, $answers);
}
function eval_create ($user_id, $question_array) {
// Check that booleans are booleans
try {
error_test_param (UserManager::is_user_id_valid($user_id), "Id $user_id is not a valid user id.");
} catch (Exception $e) {
return error_log($e->getMessage());
}
foreach ($question_array as $question_id => $question_eval) {
$sql = "INSERT INTO " . TABLE_TUTOR_EVAL . " SET question_id = '$question_id', user_id = '$user_id', eval = '$question_eval'";
Database::query($sql);
}
// Create the action item
$tool_id = tool_get_max_id();
$sql = "INSERT INTO " . TABLE_TOOL_ACTION . " SET tool_id = '$tool_id'";
$ret = Database::query($sql);
return $ret;
}
function eval_read ($user_id) {
if (!UserManager::is_user_id_valid($user_id)) return null;
$sql = "SELECT question_id, eval, date_creation FROM " . TABLE_TUTOR_EVAL . " WHERE user_id = '$user_id'";
$result = Database::query($sql);
$result_array = array();
while ($row = Database::fetch_assoc($result)) {
$q_id = $row['question_id'];
$date = new DateTime($row['date_creation']);
if (!isset($result_array[$q_id]) || $result_array[$q_id]['date'] < $date) {
$result_array[$q_id] = $row;
$result_array[$q_id]['date'] = $date;
}
}
return $result_array;
}
function eval_read_all ($user_id) {
$sql = "SELECT *, eval as evaluation, " .
"MINUTE (date_creation) AS minute, " .
"HOUR (date_creation) AS hour, " .
"DAY (date_creation) AS day, " .
"MONTH(date_creation) AS month, " .
"YEAR (date_creation) AS year " .
"FROM " . TABLE_TUTOR_EVAL . " evals JOIN " . TABLE_TUTOR_EVAL_QUESTION .
" questions ON evals.question_id = questions.id WHERE user_id = '$user_id' ORDER BY date_creation";
$res = Database::query($sql);
$array = array();
while ($row = Database::fetch_assoc($res)) {
$array[$row['question_id']][] = $row; // Ajout de la ligne dans array[question_id]
}
return $array;
}
/**
* Lists questions for the given subrole
* @param type $subrole
* @return array(SELECT*)
*/
function eval_read_questions ($subrole) {
$subrole_prefix = subrole_to_prefix($subrole);
$sql = "SELECT * FROM " . TABLE_TUTOR_EVAL_QUESTION . " WHERE subrole = '$subrole_prefix' ORDER BY id";
$result = Database::query($sql);
$result_array = array();
while ($row = Database::fetch_array($result)) {
$result_array[] = $row;
}
return $result_array;
}
form.php 0000644 00000015625 15200256543 0006233 0 ustar 00 <?php
/* For licensing terms, see /license.txt */
/**
* Model CRUD for couple_tutor_form and related tables
* @author Batiste Roger <batiste.roger@live.fr>
* @package chamilo.tuteur
*/
require_once(api_get_path(SYS_PATH) . 'main/couple/tool.php');
define('TABLE_TUTOR_FORM', 'couple_tutor_form'); // Name of each form
define('TABLE_TUTOR_FORM_QUESTION', 'couple_tutor_form_question'); // Questions / form
define('TABLE_TUTOR_FORM_STATE', 'couple_tutor_form_user'); // Has user answered the form? Should it be displayed to him?
define('TABLE_TUTOR_FORM_ANSWER', 'couple_tutor_form_question_user'); // Answers to questions
/**
* Read forms to display to user
* @param type $student_user_id (if not sent, all user ids are considered)
* @return type
*/
function form_read($student_user_id = null) {
// Chercher dans _form_status les elements à afficher
/*
$sql = "SELECT form.id as id, state.form_id as form_id, form.title as title, state.state as state FROM " .
TABLE_TUTOR_FORM_STATE . " state JOIN " . TABLE_TUTOR_FORM .
" form WHERE state.form_id = form.id AND user_id = '$student_user_id' " .
"ORDER BY state.state DESC";
*/
$sql = "SELECT id, title FROM " . TABLE_TUTOR_FORM;
$result = Database::query($sql);
$forms = array();
while ($row = Database::fetch_assoc($result)) {
$form_id = $row['id'];
$sql = "SELECT * FROM " . TABLE_TUTOR_FORM_STATE .
" WHERE form_id = $form_id ";
if (!empty($student_user_id)) {
$sql .= "AND user_id = '$student_user_id'";
}
$sql .= " ORDER BY state DESC";
$res_state = db_query($sql);
$state = isset($res_state[0]['state']) ? $res_state[0]['state'] : 0;
$row['id'] = $form_id;
$row['state'] = $state;
$forms[] = $row;
}
return $forms;
}
function form_read_with_questions ($student_user_id = null) {
$forms = form_read($student_user_id);
foreach ($forms as $key => $form) {
$form_id = $form['id'];
$sql = "SELECT * FROM " . TABLE_TUTOR_FORM_QUESTION . " WHERE form_id = $form_id";
$result = db_query($sql);
$forms[$key]['questions'] = $result;
}
return $forms;
}
/**
* Read answers to questions
* @param type $user_id
* @param type $form_id
* @return type
*/
function form_read_form ($user_id, $form_id) {
$sql = "SELECT * FROM " . TABLE_TUTOR_FORM_QUESTION . " WHERE form_id = $form_id";
$result_1 = Database::query($sql);
$questions = array();
while ($row = Database::fetch_assoc($result_1)) {
$question_id = $row['id'];
$question_question = $row['question'];
$sql = "SELECT answer FROM " . TABLE_TUTOR_FORM_ANSWER . " WHERE question_id = '$question_id' AND user_id = '$user_id'";
$result = Database::query($sql);
$question_row_one = Database::fetch_assoc($result);
$questions[$question_id] = array(
'id' => $question_id,
'question' => $question_question,
'answer' => isset($question_row_one['answer']) ? trim($question_row_one['answer']) : ''
);
}
return $questions;
}
/** Submit a form
* Method POST used, be careful!!!
* @param type $user_id
* @param type $form_id
* @param type $boolean_submit
*/
function form_save ($user_id, $form_id, $boolean_submit = false) {
$questions = form_read_form($user_id, $form_id);
foreach ($questions as $id => $question) {
if (!isset($_POST[$id])) error_throw("Id '$id' is not set. Maybe the question isn't answered", "couple/form.php:form_read_form");
// Try to find the row with that question's answer
$sql = "SELECT id FROM " . TABLE_TUTOR_FORM_ANSWER . " WHERE user_id = '$user_id' AND question_id = '$id'";
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
// Update
$row = Database::fetch_assoc($result);
$row_id = $row['id'];
$sql = "UPDATE " . TABLE_TUTOR_FORM_ANSWER . " SET answer = '" . trim(Database::escape_string($_POST[$id])) . "' WHERE id = '$row_id'";
Database::query($sql);
} else {
// Create
$row = Database::fetch_assoc($result);
$row_id = $row['id'];
$sql = "INSERT INTO " . TABLE_TUTOR_FORM_ANSWER . " SET answer = '" . trim(Database::escape_string($_POST[$id])) . "', user_id = '$user_id', question_id='$id'";
Database::query($sql);
}
// Finally, if submit, change state for user / form
if ($boolean_submit) form_set_state($user_id, $form_id, 2);
}
}
/**
* Setteur pour TABLE_TUTOR_FORM_STATE.state
* @param type $user_id
* @param type $form_id
* @param type $state
*/
function form_set_state ($user_id, $form_id, $state) {
$sql = "SELECT * FROM " . TABLE_TUTOR_FORM_STATE . " WHERE user_id = '$user_id' AND form_id = '$form_id'";
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
$sql = "UPDATE " . TABLE_TUTOR_FORM_STATE . " SET state = '$state' WHERE user_id = '$user_id' AND form_id = '$form_id'";
return Database::query($sql);
} else {
$sql = "INSERT INTO " . TABLE_TUTOR_FORM_STATE . " SET state = '$state', user_id = '$user_id', form_id = '$form_id'";
return Database::query($sql);
}
}
/**
* Create a form (Only tutors and admins should be able to call this method)
* @param type $title
* @param type $questions
*/
function form_create ($title, $questions) {
// Check params
if (empty($title) || empty($questions) || sizeof($questions) < 1) error_throw ("Wrong paramters : $title, " . print_r($questions, true), "form.php:form_create");
// Insert title
$sql_form = "INSERT INTO " . TABLE_TUTOR_FORM . " SET title = '" . Database::escape_string(trim($title)) . "';";
$result_form = db_query($sql_form, false);
$form_id = mysql_insert_id();
if ($result_form) {
// Insert all questions
$sql_questions = "INSERT INTO " . TABLE_TUTOR_FORM_QUESTION . " (form_id, question) VALUES ";
foreach ($questions as $nb => $question) {
if ($nb != 1) $sql_questions .= ', ';
$sql_questions .= "('$form_id', '" . Database::escape_string(trim($question)) . "')";
}
$sql_questions .= ";";
return db_query($sql_questions, false);
}
error_throw("Error in $sql_form, query did not end properly", "form.php:form_create");
}
/**
* Deletes a form and all its related tables
* @param type $id
*/
function form_delete_form ($id) {
// Delete in form, questions, answers and state
$sql = "DELETE FROM " . TABLE_TUTOR_FORM . " WHERE id = '$id'";
Database::query($sql);
$tables = array(TABLE_TUTOR_FORM_QUESTION, TABLE_TUTOR_FORM_STATE);
foreach ($tables as $table) {
$sql = "DELETE FROM $table WHERE form_id = '$id'";
Database::query($sql);
}
} logs.php 0000644 00000017665 15200256543 0006242 0 ustar 00 <?php
/* For licensing terms, see /license.txt */
/**
* Fonctions d'affichage des evènements passés sour forme de logs
* @author Batiste Roger <batiste.roger@live.fr>
* @package chamilo.couple
*/
require_once '../inc/global.inc.php';
require_once(api_get_path(SYS_PATH) . 'main/subrole/subrole.php');
require_once(api_get_path(SYS_PATH) . 'main/couple/model.php');
require_once(api_get_path(SYS_PATH) . 'main/couple/action.php');
require_once(api_get_path(SYS_PATH) . 'main/couple/agenda.php');
require_once(api_get_path(SYS_PATH) . 'main/couple/tchat.php');
require_once(api_get_path(SYS_PATH) . 'main/couple/doc.php');
require_once(api_get_path(SYS_PATH) . 'main/couple/doc_system.php');
define ('TABLE_LOGS', 'couple_log');
/**
* Read function for logs. The recipient can want the logs for coop or for tutor couple, that is why a boolean is required.
* @param type $recipient_user_id
* @param type $couple_type_is_tutor
* @return null
*/
function log_read ($recipient_user_id, $student = null) {
try {
$table_logs = TABLE_LOGS;
if (!empty($student)) {
$sql = "SELECT *, " .
"MINUTE (date_creation) AS minute, " .
"HOUR (date_creation) AS hour, " .
"DAY (date_creation) AS day, " .
"MONTH(date_creation) AS month, " .
"YEAR (date_creation) AS year " .
"FROM $table_logs WHERE recipient_user_id = '$recipient_user_id' AND couple_type_is_tutor = '1' " .
"AND author_user_id = $student";
} else {
$sql = "SELECT *, " .
"MINUTE (date_creation) AS minute, " .
"HOUR (date_creation) AS hour, " .
"DAY (date_creation) AS day, " .
"MONTH(date_creation) AS month, " .
"YEAR (date_creation) AS year " .
"FROM $table_logs WHERE recipient_user_id = '$recipient_user_id' AND couple_type_is_tutor = '0'";
}
// error_display("logs.php:log_read, sql = $sql");
$res = Database::query($sql);
$logs = array();
if (Database::num_rows($res) <= 0) return null;
} catch (Exception $e) {
return null;
}
while ($row = Database::fetch_assoc($res)) {
$user_info = UserManager::get_user_info_by_id($row['author_user_id']);
$row['subject'] = ucfirst($user_info['firstname']);
$logs[] = $row;
}
return $logs;
}
/**
* Generates a log for given couple. Optionally, you can specify options. If so, all of them are required.
* @param type $couple_id
* @param type $couple_type
* @param type $author_user_id
* @param type $tool_id
* @param type $verb
* @param type $end
* @param type $o1 option 1 : exemple, delete this item
* @param type $a1 action 1
* @param type $o2 option 2 : exemple, restore this item
* @param type $a2 action 2
* @return type
*/
function log_generate ($couple_id, $couple_type, $author_user_id, $tool_id, $verb, $end, $o1 = null, $a1 = null, $o2 = null, $a2 = null) {
$couple_type = strtoupper($couple_type); // Guarantees the uppur case.
$recipients = array();
$author_subrole = get_subrole($author_user_id);
error_display("logs.php:log_generate ($couple_id, $couple_type, $author_user_id, $tool_id, $verb, '$end')");
error_display("logs.php:log_generate, couple_type = $couple_type");
// Determine recipients
if ($couple_type == TU) {
$pa = couple_get_partner($author_user_id, $couple_type);
$pa_user_id = $author_subrole == TUTOR ? $pa['student_user_id'] : $pa['tu_user_id'];
$recipients[] = array('id' => $pa_user_id, 'options' => true); // true -> take options into account
} else {
$couple = couple_get($couple_id, $couple_type);
$hp_user_id = subrole_id_to_user_id($couple['hp_id'], HP);
$su_user_id = subrole_id_to_user_id($couple['su_id'], STARTUP);
if ($author_subrole != TUTOR) {
// Send to partner and tutor
$recipients[] = array('id' => ($author_user_id == $hp_user_id ? $su_user_id : $hp_user_id), 'options' => true); // true -> take options into account
$tutor = couple_get_tutor($author_user_id);
$tutor_user_id = $tutor['tu_id'];
$recipients[] = array('id' => $tutor_user_id, 'options' => false); // true -> take options into account
} else {
// Send to both hp and su
$recipients[] = array('id' => $hp_user_id, 'options' => true); // true -> take options into account
$recipients[] = array('id' => $su_user_id, 'options' => true); // true -> take options into account
}
}
error_display("logs.php:log_generate, recipients = " . print_r($recipients, true));
// Create logs
foreach ($recipients as $recipient) {
$tool_description = log_get_object_as_string($tool_id);
if ($recipient['id'] == 0) {
error_log("Id nul and log_generate. Params : $couple_id, $couple_type, $author_user_id, $tool_id, $verb, $end <br/> This user : " . api_get_user_id());
}
if ($recipient['options']) {
log_create_db($author_user_id, $tool_id, $tool_description, $verb, $end, $recipient['id'], $couple_type, $o1, $a1, $o2, $a2);
} else {
log_create_db($author_user_id, $tool_id, $tool_description, $verb, $end, $recipient['id'], $couple_type);
}
}
}
/**
* NEVER USE THAT FUNCTION - SHOULD BE PRIVATE
* @param type $author_user_id
* @param type $tool_id
* @param type $tool_desctiption
* @param type $verb
* @param type $end
* @param type $recipient_user_id
* @param type $o1 option 1 : exemple, delete this item
* @param type $a1 action 1
* @param type $o2 option 2 : exemple, restore this item
* @param type $a2 action 2
*/
function log_create_db ($author_user_id, $tool_id, $tool_description, $verb, $end, $recipient_user_id, $couple_type, $o1 = null, $a1 = null, $o2 = null, $a2 = null) {
if ($tool_id == 0) error_log("Found tool_id = $tool_id in log_create_db (logs.php)");
$o1 = Database::escape_string(trim($o1));
$o2 = Database::escape_string(trim($o2));
$a1 = Database::escape_string(trim($a1));
$a2 = Database::escape_string(trim($a2));
$sql = "INSERT INTO " . TABLE_LOGS . " SET " .
"author_user_id = '$author_user_id', " .
"tool_id = '$tool_id', " .
"tool_description = '" . Database::escape_string(trim($tool_description)) . "', " .
"verb = '$verb', " .
"end = '" . Database::escape_string(trim($end)) . "', " .
"recipient_user_id = '$recipient_user_id', " .
"couple_type_is_tutor = " . ($couple_type == TU ? 1 : 0) . "";
if ($o1 && $a1 && $o2 && $a2) {
$sql .= ", option1 = '$o1', action1 = '$a1', option2 = '$o2', action2 = '$a2'";
}
error_display("logs.php:log_create_db, sql = $sql");
return Database::query($sql);
}
/**
* Warning : this is 100% unsafe
* @param int $id id of the log
* @return query
*/
function log_delete ($log_id) {
error_display("Suppression du log $log_id");
$sql = "UPDATE " . TABLE_LOGS . " SET is_deleted = true WHERE id = '$log_id'";
Database::query($sql);
return $sql;
}
function log_get_object_as_string($tool_id) {
$tool = tool_get_by_id($tool_id);
$name = $tool['title'];
switch (log_get_type($tool_id)) {
case DOCUMENT :
return "le document $name";
break;
case AGENDA :
return "la date $name";
break;
case ACTION :
return "l'action $name";
break;
default :
return error_throw('Wrong log type for tool ' . $name);
}
}
function log_get_type($tool_id) {
$types = tool_get_all_tool_types();
foreach($types as $type) {
$table = tool_get_table_for_type($type);
$sql = "SELECT * FROM $table WHERE tool_id = '$tool_id'";
$res = Database::query($sql);
if (Database::num_rows($res) > 0) return $type;
}
return error_throw('Tool with no type, id = ' . $tool_id);
} model.php 0000644 00000047070 15200256543 0006367 0 ustar 00 <?php
/* For licensing terms, see /license.txt */
/**
* Model CRUD for hp_startup table, which links HP and STARTUPS for cooperation purposes
* @author Batiste Roger <batiste.roger@live.fr>
* @package chamilo.couple
*/
/* Table columns
* id ---
* hp_id id of an hp in table hp
* stratup_id same in strartup
* couple_type type of the couple. Can be 0 (DS) or 1 (CE)
*/
// Require subrole functions
require_once(api_get_path(SYS_PATH) . 'main/subrole/subrole.php');
require_once(api_get_path(SYS_PATH) . 'main/couple/error.php');
require_once(api_get_path(SYS_PATH) . 'main/couple/notification.php');
// Couple Types
define ('DS', 'DS');
define ('CE', 'CE');
define ('TU', 'TU');
/**
* Checks that this couple_type is valid. True is valid.
* @param string $type
* @return ($type == DS || $type == CE || $type == TU)
*/
function couple_type_is_valid ($type) {
return ($type == DS || $type == CE || $type == TU);
}
/**
* Get table name for this couple type
* @param string $type
* @return string table_name
*/
function couple_type_to_table ($type) {
assert(couple_type_is_valid($type));
return 'couple_' . strtolower($type);
}
/**
* Shortcut for coop_gt_partner if you only need the id
* @param type $user_id
* @param type $couple_type
* @return type
*/
function couple_get_partner_id ($user_id, $couple_type) {
$tmp = couple_get_partner($user_id, $couple_type);
return $tmp['user_id'];
}
/** Get your partner's info
* @param int $user_id my user id. I can be a hp, a su,a tutor. Whatever.
* @param int $couple_type one of the possible couple type (DS, CE, TU) defined in model.php
* @return array something like {user_id : 12, couple_id : 2}
*/
function couple_get_partner ($user_id, $couple_type) {
assert(UserManager::is_user_id_valid($user_id));
assert(couple_type_is_valid($couple_type));
if ($couple_type == TU) {
return couple_get_tutor($user_id);
} else {
return couple_get_coop_partner($user_id);
}
}
function couple_get_coop_partner_aux($user_id, $couple_type) {
assert(UserManager::is_user_id_valid($user_id));
// Determin type
$table_couple = couple_type_to_table($couple_type);
// Get useful info / user_id
$my_subrole = get_subrole($user_id);
if ($my_subrole == ADMIN) {
return null;
}
$my_subrole_id = user_id_to_subrole_id($user_id, $my_subrole);
$i_am_hp = user_has_subrole($user_id, HP);
$my_subrole_prefix = ($i_am_hp ? 'hp' : 'su');
// echo "<b>id?$user_id subrole?$my_subrole subid?$my_subrole_id prefix?$my_subrole_prefix</b><br/>";
// Partner (tu / su)
$partner_subrole = ($i_am_hp ? STARTUP : HP );
$partner_prefix = ($i_am_hp ? 'su' : 'hp');
$table_partner = subrole_to_table($partner_subrole);
// SQL
$sql = "SELECT *, couple.id as couple_id ";
$sql .= "FROM $table_couple couple ";
$sql .= "JOIN $table_partner partner ";
$sql .= "ON partner.id = couple." . $partner_prefix . "_id ";
$sql .= "WHERE couple." . $my_subrole_prefix . "_id = $my_subrole_id ";
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
$row = Database::fetch_array($result, 'ASSOC');
$row['type'] = strtolower($couple_type);
$row['hp_id'] = ($i_am_hp ? $user_id : $row['user_id']);
$row['pa_id'] = ($i_am_hp ? $row['user_id'] : $user_id);
$row['info'] = api_get_user_info($row['user_id']);
return $row;
}
}
function couple_get_with ($tu_user_id, $student_user_id) {
$tutor_subrole_id = user_id_to_subrole_id($tu_user_id, TUTOR);
$student_subrole = get_subrole($student_user_id);
$student_subrole_id = user_id_to_subrole_id($student_user_id, $student_subrole);
$student_prefix = ($student_subrole == HP ? 'hp' : 'su');
$sql = "SELECT * FROM couple_tu WHERE tu_id = '$tutor_subrole_id' AND user_id = '$student_subrole_id' AND user_type = '$student_prefix'";
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
$row = Database::fetch_array($result, 'ASSOC');
$row[$student_prefix . '_id'] = $student_user_id;
$row['student_user_id'] = $student_user_id;
$row['tu_user_id'] = $tu_user_id;
$row['couple_id'] = $row['id'];
$row['type'] = 'tu';
$row['info'] = api_get_user_info($student_user_id);
return $row;
}
}
function couple_get_from_id ($couple_id, $couple_type) {
$table = couple_type_to_table($couple_type);
$sql = "SELECT * FROM $table WHERE id = '$couple_id'";
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
$row = Database::fetch_array($result, 'ASSOC');
$row['couple_id'] = $couple_id;
$row['type'] = $couple_type;
return $row;
}
}
/**
* Find the tutor of a given user (user_id)
* @param int $user_id
* @return array tutor
*/
function couple_get_tutor($user_id) {
// Get useful info / user_id
$my_subrole = get_subrole($user_id);
if ($my_subrole == ADMIN) {
return null;
}
$my_subrole_id = user_id_to_subrole_id($user_id, $my_subrole);
$subrole = get_subrole($user_id);
$my_subrole_prefix = ($subrole == HP ? 'hp' : 'su');
// SQL
$sql = "SELECT *, id as couple_id ";
$sql .= "FROM couple_tu ";
$sql .= "WHERE user_id = $my_subrole_id AND user_type = '$my_subrole_prefix'";
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
$row = Database::fetch_array($result, 'ASSOC');
$tutor_subrole_id = subrole_id_to_user_id($row['tu_id'], TUTOR);
$row['type'] = 'tu';
$row['student_user_id'] = subrole_id_to_user_id($row['user_id'], $row['user_type'] == 'hp' ? HP : STARTUP);
$row[$my_subrole_prefix . '_id'] = $user_id;
$row['pa_id'] = $tutor_subrole_id;
$row['tu_id'] = $tutor_subrole_id;
$row['tu_user_id'] = $row['tu_id'];
$row['info'] = api_get_user_info($tutor_subrole_id);
return $row;
} else {
// Assign a tutor for this user and call the function again
error_log('Warning : no tutor assigned to ' + $my_subrole_prefix + ' ' + $my_subrole_id);
couple_set_tutor (couple_get_tutor_default_id(), $my_subrole_id, $my_subrole_prefix);
return couple_get_tutor($user_id);
}
}
/**
* Set tutor_id for startup to the tu_id of its partner (the hp)
* After this method is called, both su and hp will share the same tutor
* @param int $su_user_id
*/
function couple_merge_tutor ($su_user_id) {
// Make sure
// This is a startup
// It has a coop
// Who has a tutor
if (user_has_subrole($su_user_id, STARTUP)) {
$su_id = user_id_to_subrole_id($su_user_id, STARTUP);
$partner = couple_get_coop_partner($su_user_id);
if (!empty($partner)) {
$partner_user_id = $partner['user_id'];
$tutor = couple_get_tutor($partner_user_id);
$tutor_id = $tutor['tu_id'];
// Make sure the already is such a row in the table
$sql = "SELECT * FROM couple_tu WHERE user_id = '$su_user_id' AND user_type = 'su'";
if (Database::num_rows(Database::query($sql)) == 0) {
$sql = "INSERT INTO couple_tu SET tu_id = '$tutor_id', user_id = '$su_id', user_type = 'su'";
Database::query($sql);
} else {
$sql = "UPDATE couple_tu SET tu_id = '$tutor_id' WHERE user_id = '$su_id' AND user_type = 'su'";
Database::query($sql);
}
}
}
}
function couple_set_tutor ($tu_user_id, $user_id, $user_type) {
$tu_id = user_id_to_subrole_id($tu_user_id, TUTOR);
$sql = "SELECT * FROM couple_tu WHERE user_id = '$user_id' AND user_type = '$user_type'";
if (Database::num_rows(Database::query($sql)) == 0) {
$sql = "INSERT INTO couple_tu SET tu_id = '$tu_id', user_id = '$user_id', user_type = '$user_type'";
Database::query($sql);
} else {
error_throw("Couple already exists, user $user_id, type $user_type", 'model.php:couple_get_tutor');
}
}
function couple_get_tutor_default_id() {
$sql = "SELECT user_id FROM tutor";
$res = db_query($sql);
return $res[0]['user_id'];
}
/**
* Shortcut to getting the right coop type.
* CE is tested first.
* @return coop_get_partner ($user_id, (DE ou CE selon))
*/
function couple_get_coop_partner ($user_id = null) {
if (empty($user_id)) $user_id = api_get_user_id();
assert(UserManager::is_user_id_valid($user_id));
$ce = couple_get_coop_partner_aux($user_id, CE);
if (empty($ce)) {
$ds = couple_get_coop_partner_aux($user_id, DS);
return $ds;
}
return $ce;
}
/**
* Read all couples in all couple_xx tables
* @return array : {{hp_id, su_id, type}, {hp_id, su_id, type}, ...}
*/
function couple_get_all($show_names = false) {
$types = array(TU, CE, DS);
$couples = array();
foreach ($types as $type) {
couple_get_by_type ($type, &$couples, $show_names = false);
}
return $couples;
}
function couple_get_by_type ($type, &$couples, $show_names_ce = false) {
$table = couple_type_to_table($type);
$sql = "SELECT * FROM $table";
$res = Database::query($sql);
if (Database::num_rows($res) > 0) {
while ($row = Database::fetch_array($res, 'ASSOC')) {
if (isset($row['hp_id'])) {
$row['hp_id'] = subrole_id_to_user_id($row['hp_id'], HP);
} else {
$row['user_id'] = subrole_id_to_user_id($row['user_id'], ($row['user_type'] == 'hp' ? HP : STARTUP));
}
if ($type != TU) {
$row['pa_id'] = subrole_id_to_user_id($row['su_id'], STARTUP);
} else {
$row['pa_id'] = subrole_id_to_user_id($row['tu_id'], TUTOR);
}
if ($show_names_ce) {
if ($type != CE) error_throw ("Type CE expected when 'show_names_ce'", "model.php : couple_get_by_type");
$hp_info = UserManager::get_user_info_by_id($row['hp_id']);
$su_info = UserManager::get_user_info_by_id($row['pa_id']);
$row['hp_firstname'] = $hp_info['firstname'];
$row['hp_lastname'] = $hp_info['lastname'];
$row['su_firstname'] = $su_info['firstname'];
$row['su_lastname'] = $su_info['lastname'];
}
$row['type'] = $type;
array_push($couples, $row);
}
}
return $couples; // Only used as shortcut when not called from couple_get_all
}
/**
* Create an entry in couple_xx
* @param type $couple_type xx = TU / CE / DS
* @param type $hp_user_id
* @param type $partner_user_id
*/
function couple_create ($couple_type_string, $hp_user_id, $partner_user_id) {
$couple_type = strtoupper($couple_type_string);
// Test that these user_ids exist
try {
error_test_param (UserManager::is_user_id_valid($hp_user_id), "User id (hp) $hp_user_id does not exist");
error_test_param (UserManager::is_user_id_valid($partner_user_id), "User id (pa) $partner_user_id does not exist");
} catch (Exception $e) {
return false;
}
// Test that the couple type is valid
try {
error_test_param (couple_type_is_valid($couple_type), "Couple type $couple_type is not valid");
} catch (Exception $e) {
return false;
}
try {
// Test that they have that subroles
error_test_param (user_has_subrole($hp_user_id, HP), "User $hp_user_id is not a " . HP);
$partner_subrole = ($couple_type == TU ? TUTOR : STARTUP);
error_test_param (user_has_subrole($partner_user_id, $partner_subrole), "User $hp_user_id is not a $partner_subrole");
} catch (Exception $e) {
return null;
}
// Test that this creation won't generate a double-coop or double-tutor for the hp / su
$hp_subrole_id = user_id_to_subrole_id($hp_user_id, HP);
if ($couple_type == TU) {
$table = couple_type_to_table($couple_type);
$sql = "SELECT * FROM $table WHERE hp_id = $hp_subrole_id";
$res = Database::query($sql);
error_test_param (Database::num_rows($res) == 0, "Such a couple already exist");
} else {
foreach (array(DS, CE) as $type) {
$partner_prefix = ($couple_type == TU ? 'tu' : 'su');
$partner_subrole_id = user_id_to_subrole_id($partner_user_id, $partner_subrole);
$table = couple_type_to_table($type);
$sql_hp = "SELECT * FROM $table WHERE hp_id = $hp_subrole_id";
$sql_ps = "SELECT * FROM $table WHERE " . $partner_prefix . "_id = $partner_subrole_id";
foreach (array($sql_hp, $sql_ps) as $sql_query) {
$res = db_query($sql_query, false);
error_test_param (Database::num_rows($res) == 0, "Such a couple already exist : $sql_query");
}
}
}
// Call unsafe method
return array(couple_create_unsafe($couple_type, $hp_user_id, $partner_user_id));
}
function couple_create_unsafe ($couple_type, $hp_user_id, $partner_user_id) {
// Get variables
$table = couple_type_to_table($couple_type);
$hp_subrole_id = user_id_to_subrole_id($hp_user_id, HP);
$partner_subrole = ($couple_type == TU ? TUTOR : STARTUP);
$partner_prefix = ($couple_type == TU ? 'tu' : 'su');
$partner_subrole_id = user_id_to_subrole_id($partner_user_id, $partner_subrole);
$sql = "INSERT INTO $table SET hp_id = $hp_subrole_id, " . $partner_prefix . "_id = $partner_subrole_id";
Database::query($sql);
$info_pa = UserManager::get_user_info_by_id($partner_user_id);
$info_hp = UserManager::get_user_info_by_id($hp_user_id);
// Send notifications (TODO : TEXT)
// TO HP
notification_create(
$hp_user_id,
"Votre Mission Startup commence!",
"Vous travaillez désormais avec " . $info_pa['firstname'] . " " . $info_pa['lastname'] . " de la société \"" . $info_pa['company'] . "\". L'aventure commence dans la section 'Coopération'!",
api_get_path(WEB_PATH) . 'main/cooperation/index.php');
// TO STARTUP
if ($partner_subrole == STARTUP) notification_create(
$partner_user_id,
"Votre Coopération commence!",
"Vous travaillez désormais avec " . $info_hp['firstname'] . " " . $info_hp['lastname'] . ". L'aventure commence dans la section \"Coopération\"!",
api_get_path(WEB_PATH) . 'main/cooperation/index.php');
return "Couple created : $sql";
}
// Delete any couple with this user_id and with same type
function couple_delete ($couple_id, $couple_type) {
error_log("couple_delete : $couple_id, $couple_type");
error_test_param(couple_type_is_valid($couple_type), "Invalid couple type in couple_delete");
$table = couple_type_to_table($couple_type);
$safe_id = Database::escape_string(trim($couple_id));
$sql = "DELETE FROM $table WHERE id = '$safe_id';";
db_query($sql, false);
}
/**
* Tests that the given couple_id exists
* @param type $couple_id
* @param type $type
* @return boolean
*/
function couple_id_is_valid ($couple_id, $type) {
// Reject empty params
if (empty($couple_id) || empty($type)) return false;
// Reject wrong types
if (!couple_type_is_valid($type)) return false;
$table = couple_type_to_table($type);
$id = intval($couple_id);
$sql = "SELECT id FROM $table WHERE id = '$id'";
return (Database::num_rows(Database::query($sql)) > 0);
}
function couple_get ($couple_id, $type) {
// Reject empty params
if (empty($couple_id) || empty($type)) return false;
// Reject wrong types
if (!couple_type_is_valid($type)) return false;
$table = couple_type_to_table($type);
$sql = "SELECT * FROM $table WHERE id = '$couple_id'";
return Database::fetch_assoc(Database::query($sql));
}
function couple_get_hp ($couple_id, $type) {
$couple = couple_get($couple_id, $type);
if ($couple) return $couple['hp_id'];
}
function couple_get_firstname_of($user_id) {
$info = UserManager::get_user_info_by_id($user_id);
return $info['firstname'];
}
function couple_get_firstnames ($couple_id, $type) {
$hp_id = couple_get_hp ($couple_id, $type);
$hp_user_id = subrole_id_to_user_id($hp_id, HP);
$pa = couple_get_partner ($hp_user_id, $type);
$pa_user_id = $pa['user_id'];
return array('hp' => couple_get_firstname_of($hp_user_id), 'pa' => couple_get_firstname_of($pa_user_id));
}
function couple_tutor_get_coops ($user_id) {
// Read all couples / HP.tutor.id = $user_id
$ce = couple_tutor_get_coop($user_id, CE);
$ds = couple_tutor_get_coop($user_id, DS);
return array_merge($ce, $ds);
}
/** Don't use this outside from get_coops
* Params are unchecked
* @param type $user_id
* @param type $type
*/
function couple_tutor_get_coop ($user_id, $type) {
$tutor_id = user_id_to_subrole_id($user_id, TUTOR);
$table = couple_type_to_table($type);
$sql = "SELECT ctu.user_id as hp_id, cce.su_id as su_id, ctu.tu_id as tu_id, cce.id as couple_id " .
"FROM $table cce " .
"JOIN couple_tu ctu ON cce.hp_id = ctu.user_id " .
"WHERE ctu.user_type = 'hp' AND ctu.tu_id = '$tutor_id'";
$result = Database::query($sql);
$coops_array = array();
while ($row = Database::fetch_assoc($result)) {
// Some useful 'artificial' columns are added
$row['couple_type'] = $type;
$row['hp_info'] = UserManager::get_user_info_by_id(subrole_id_to_user_id($row['hp_id'], HP));
$row['su_info'] = UserManager::get_user_info_by_id(subrole_id_to_user_id($row['su_id'], STARTUP));
$coops_array[] = $row;
}
return $coops_array;
}
function couple_tutor_get_students ($user_id) {
$tu_id = user_id_to_subrole_id($user_id, TUTOR);
$sql = "SELECT * FROM couple_tu WHERE tu_id = '$tu_id'";
$result = Database::query($sql);
$students_array = array();
while ($row = Database::fetch_assoc($result)) {
$subrole = $row['user_type'] == 'hp' ? HP : STARTUP;
$row['name'] = subrole_id_to_user_fullname($row['user_id'], $subrole);
$row['user_id'] = subrole_id_to_user_id($row['user_id'], $subrole);
// $row['info'] = print_r(UserManager::get_user_info_by_id($row['user_id']), true);
$students_array[] = $row;
}
return $students_array;
}
function couple_get_unmatched ($type = HP) {
$table = subrole_to_table($type);
$prefix = $type == HP ? 'hp' : 'su';
$prefix_id = $prefix . '_id';
$ce = couple_type_to_table(CE);
$ds = couple_type_to_table(DS);
$sql = "SELECT * " .
"FROM $table " .
"JOIN user ON $table.user_id = user.user_id " .
"WHERE " .
"NOT EXISTS (SELECT * FROM $ce WHERE $ce.$prefix_id = $table.id) " .
"AND " .
"NOT EXISTS (SELECT * FROM $ds WHERE $ds.$prefix_id = $table.id);";
$result = db_query($sql);
// var_dump($result); exit;
return $result;
}
function couple_includes_user($couple_id, $couple_type, $user_id) {
$user_subrole = get_subrole($user_id);
$subrole_id = user_id_to_subrole_id($user_id, $user_subrole);
$couple = couple_get_from_id($couple_id, $couple_type);
if ($couple_type == TU) {
if ($user_subrole == TUTOR) {
return $couple['tu_id'] == $subrole_id;
} else {
return $couple['user_id'] == $subrole_id;
}
} else {
$subrole_prefix = subrole_to_prefix($user_subrole);
return $couple[$subrole_prefix . '_id'] == $subrole_id || $user_subrole == TUTOR; // TODO $user_subrole == TUTOR fast fix, returns true too often
}
} notification.php 0000644 00000004211 15200256543 0007743 0 ustar 00 <?php
/* For licensing terms, see /license.txt */
/**
* Modèle des notifications
* @author Batiste Roger <batiste.roger@live.fr>
* @package chamilo.couple
*/
require_once '../inc/global.inc.php';
require_once(api_get_path(SYS_PATH) . 'main/couple/model.php');
define ('TABLE_NOTIFICATION_MM', 'plateform_notification');
/**
* Create a notification. Notifications are plateform_wide notifications.
* @param type $recipient_user_id
* @param type $title
* @param type $text
* @param type $url
*/
function notification_create ($recipient_user_id, $title, $text = null, $url = null) {
// Test & Check
$context = "couple/notifications.php:notification_create";
error_test_param(UserManager::is_user_id_valid($recipient_user_id), "Invalid user id ($recipient_user_id)", $context);
error_test_param(is_string($title), "title should be a string", $context);
error_test_param(strlen($title) < 80, "title should be shorter", $context);
error_test_param(empty($text) || is_string($text), "text should be a string", $context);
error_test_param(empty($url) || is_string($url), "url should be a string", $context);
// Query
$sql = "INSERT INTO " . TABLE_NOTIFICATION_MM . " SET recipient_user_id = $recipient_user_id, title = '" . trim(Database::escape_string($title)) . "'";
if (!empty($text)) $sql .= ", text = '" . trim(Database::escape_string($text)) . "'";
if (!empty($url)) $sql .= ", url = '" . trim(Database::escape_string($url)) . "'";
Database::query($sql);
}
/**
* Read all notifications that user_id should receive. Status should be used to determin rather or not is will be displayed in the view.
* @param type $user_id
* @return type
*/
function notification_read ($user_id) {
error_test_param(
UserManager::is_user_id_valid($user_id),
"Invalid user id ($user_id)",
"couple/notifications.php:notification_read");
$sql = "SELECT * FROM " . TABLE_NOTIFICATION_MM . " WHERE recipient_user_id = $user_id";
return db_query($sql);
}
function notification_delete ($id) {
db_query("DELETE FROM " . TABLE_NOTIFICATION_MM . " WHERE id = '$id'", false);
}
tchat.php 0000644 00000004546 15200256543 0006373 0 ustar 00 <?php
/* For licensing terms, see /license.txt */
/**
* Model CRUD for couple_tool_tchat
* @author Batiste Roger <batiste.roger@live.fr>
* @package chamilo.couple
*/
require_once(api_get_path(SYS_PATH) . 'main/couple/tool.php');
require_once(api_get_path(SYS_PATH) . 'main/couple/model.php');
define('TABLE_TOOL_TCHAT', 'couple_tool_tchat');
/**
* Create a tchat entry
* @param type $couple_id
* @param type $couple_type
* @param type $title
* @param type $description
* @param type $author_user_id
* @param type $is_deleted
* @param type $is_ok
* @return boolean
*/
function tchat_create ($couple_id, $couple_type, $title, $description, $author_user_id, $is_deleted = null, $is_ok = null) {
// Check that booleans are booleans
// Create a tool
tool_create($couple_id, $couple_type, $title, $description, $author_user_id, $is_deleted, $is_ok);
// Create the tchat item
$tool_id = tool_get_max_id();
$sql = "INSERT INTO " . TABLE_TOOL_TCHAT . " SET tool_id = '$tool_id'";
return Database::query($sql);
}
/**
* Read tchat entries
* @param type $user_id
* @return array
*/
function tchat_read ($user_id, $couple = null) {
if (!UserManager::is_user_id_valid($user_id)) return null;
// Get couple info for user_id
if (empty($couple)) $couple = couple_get_coop_partner($user_id); // Bad fix. TODO : apply the change everywhere so that couple is never set to null, true, false...
if (empty($couple)) return null;
$couple_type = strtoupper($couple['type']);
$couple_id = $couple['couple_id'];
// Get the tool
$tool = tool_get_tool_for_couple('tchat', $couple_id, $couple_type);
foreach ($tool as $key => $t) {
$author_info = UserManager::get_user_info_by_id($t['author_user_id']);
$tool[$key]['author_name'] = ucfirst($author_info['firstname']);
}
return $tool;
}
function tchat_create_form($couple) {
// First, try to read all parameters
$description = read_param('description');
// Test that these params are correct
if ($description) {
// React
$my_user_id = api_get_user_id();
$title = "type_is_tchat";
return tchat_create($couple['couple_id'], strtoupper($couple['type']), $title, $description, $my_user_id, null, null);
}
error_throw("Echec de la création. Params : $description");
return false;
} tool.php 0000644 00000023631 15200256543 0006241 0 ustar 00 <?php
/* For licensing terms, see /license.txt */
/**
* Model CRUD for couple_tool
* @author Batiste Roger <batiste.roger@live.fr>
* @package chamilo.couple
*/
require_once(api_get_path(SYS_PATH) . 'main/couple/error.php');
require_once(api_get_path(SYS_PATH) . 'main/couple/model.php');
define('ACTION', 'action');
define('AGENDA', 'agenda');
define('DOCUMENT', 'document');
define('TCHAT', 'tchat');
define('TABLE_TOOL', 'couple_tool');
/**
* Get an array with all valid tool types
* @return array with all tool_types (AGENDA, ACTION, DOCUMENT)
*/
function tool_get_all_tool_types () {
return array(ACTION, AGENDA, DOCUMENT, TCHAT);
}
/**
* Tests if this tool type is valid
* @param type $tool_type
* @return boolean
*/
function tool_type_is_valid ($tool_type) {
return in_array($tool_type, tool_get_all_tool_types());
}
/**
* Get the db table associated this tool type
* @param type $tool_type
* @return table
*/
function tool_get_table_for_type ($tool_type) {
if (tool_type_is_valid($tool_type)) return 'couple_tool_' . $tool_type;
return false;
}
/**
* Get the id of a tool for a couple
* @param type $couple_id
* @return array resulting of fetch ASSOC on the joined tables tool and tool_<tool_type>
*/
function tool_get_tool_for_couple ($tool_type, $couple_id, $couple_type, $select = '') {
// Check that these parameters are correct
$table = tool_get_table_for_type($tool_type);
if (!couple_id_is_valid($couple_id, $couple_type)) throw new Exception("Couple id is wrong : $couple_id, $couple_type");
$sql = "SELECT *$select, " .
"MINUTE (date_creation) AS minute, " .
"HOUR (date_creation) AS hour, " .
"DAY (date_creation) AS day, " .
"MONTH(date_creation) AS month, " .
"YEAR (date_creation) AS year " .
"FROM $table tab JOIN " . TABLE_TOOL .
" tool ON tool.id = tab.tool_id WHERE tool.couple_id = '$couple_id' AND tool.couple_type = '$couple_type'";
$res = Database::query($sql);
$all_rows = array();
while ($row = Database::fetch_array($res, 'ASSOC')) {
$all_rows[] = $row;
}
return $all_rows;
}
/**
* Create an entry in couple_tool after having secured the parameters
* @param type $couple_id
* @param type $couple_type
* @param type $title
* @param type $description
* @param type $author_user_id
* @param type $is_deleted
* @param type $is_ok
* @return error_array (cf couple/error.php)
*/
function tool_create ($couple_id, $couple_type, $title, $description, $author_user_id, $is_deleted = null, $is_ok = null) {
// Test all parameters
try {
error_test_param (couple_id_is_valid($couple_id, $couple_type), "Couple id is wrong : $couple_id, $couple_type");
} catch (Exception $e) {
return false;
}
error_test_param (is_string($title), "Title should be a string. Found $title.");
error_test_param (is_string($description), "Description should be a string. Found $title.");
error_test_param (UserManager::is_user_id_valid($author_user_id), "Invalid user_id for author");
// TODO include tutor in authorised authors for couple ce / ds error_test_param (tool_author_in_couple ($couple_id, $couple_type, $author_user_id), "Invalid tool_author id ($author_user_id) : not part of the couple ($couple_id, $couple_type)");
return tool_create_unsafe($couple_id, $couple_type, $title, $description, $author_user_id, $is_deleted, $is_ok);
}
/**
* Tests that the author_id is one of the members of the couple
* @param type $couple_id
* @param type $couple_type
* @param type $author_user_id
* @return boolean
*/
function tool_author_in_couple ($couple_id, $couple_type, $author_user_id) {
if (!couple_id_is_valid($couple_id, $couple_type)) return false;
$table = couple_type_to_table($couple_type);
// Get the right id / subrole
$subrole = get_subrole($author_user_id);
$subrole_id = user_id_to_subrole_id($author_user_id, $subrole);
if ($couple_type == TU) {
$sql = "SELECT * FROM $table WHERE id = $couple_id AND (user_id = '$subrole_id' OR tu_id = '$subrole_id')";
} else {
$sql = "SELECT * FROM $table WHERE id = $couple_id AND (hp_id = '$subrole_id' OR su_id = '$subrole_id')";
}
return Database::num_rows(Database::query($sql)) > 0;
}
/**
* Unsafe creation method for couple_tool. Please use tool_create
* @param type $couple_id
* @param type $type
* @param type $title
* @param type $description
* @param type $author_user_id
* @param type $is_deleted
* @param type $is_ok
*/
function tool_create_unsafe ($couple_id, $couple_type, $title, $description, $author_user_id, $is_deleted = null, $is_ok = null) {
$sql = "INSERT INTO couple_tool SET couple_id = '$couple_id', couple_type = '$couple_type'," .
" title = '" . Database::escape_string(trim($title)) . "', description = '" . Database::escape_string(trim($description)) . "', author_user_id = '$author_user_id'";
if (!empty($is_deleted)) $sql .= ", is_deleted = '$is_deleted'";
if (!empty($is_ok)) $sql .= ", is_ok = '$is_ok'";
return Database::query($sql);
}
/**
* Get the maximum id in tool table. mysqli_insert_id should be used but there is no way I can make it work.
* @return max_id (int)
*/
function tool_get_max_id () {
// TODO - Dirty coding : use mysqli_insert_id in lieu of this query
$sql = "SELECT MAX(id) as max_id FROM couple_tool";
$tmp = Database::fetch_array(Database::query($sql), 'ASSOC');
return $tmp['max_id'];
}
function tool_get_by_id ($tool_id) {
// TODO - Dirty coding : use mysqli_insert_id in lieu of this query
$sql = "SELECT * FROM " . TABLE_TOOL . " WHERE id = $tool_id";
$res = Database::query($sql);
if (Database::num_rows($res) > 0) {
return Database::fetch_array($res, 'ASSOC');
}
return error_throw('No tool with id ' . $tool_id . ".");
}
function tool_delete_tool ($tool_id, $couple_id, $couple_type, $force = null) {
$tab_id = tool_get_tab_for_id($tool_id);
switch ($tab_id) {
case 0 :
return doc_delete($tool_id, $couple_id, $couple_type, $force);
break;
case 1 :
case 2 :
return tool_delete ($tool_id, $couple_id, $couple_type, $force);
default :
error_throw('NOT IMPLEMENTED YET', 'tool.php:tool_delete_tool / tab_id != 1');
}
return false;
}
/**
* Delete a tool item (deletion from table tool
* @param type $id of the tool
* @return boolean was the item actually deleted?
*/
function tool_delete ($id, $couple_id, $couple_type, $force = null) {
$table = TABLE_TOOL;
// Check if is_deleted is true
$sql = "SELECT is_deleted FROM $table WHERE id = '".Database::escape_string(trim($id))."'";
$res = Database::query($sql);
$row_1 = Database::fetch_assoc($res);
$is_deleted = $row_1['is_deleted'];
$my_id = api_get_user_id();
$my_subrole = get_subrole($my_id);
if (!empty($force)) {
$action = $force;
} else {
if ($is_deleted == $my_subrole) {
$action = 'restore';
} elseif (empty($is_deleted)) {
$action = 'update';
} else {
$action = 'delete';
}
}
switch ($action) {
case 'restore' :
// I want to restore the image
$sql = "UPDATE $table SET is_deleted = NULL WHERE id = '$id'";
Database::query($sql);
$real_delete = false;
// Create a log accordingly
log_generate($couple_id, $couple_type, api_get_user_id(), $id, 'rétabli', "");
break;
case 'update' :
// I want to delete this item
$sql = "UPDATE $table SET is_deleted = '$my_subrole' WHERE id = '$id'";
Database::query($sql);
$real_delete = false;
// Create a log accordingly
log_generate($couple_id, $couple_type, api_get_user_id(), $id, 'proposé de supprimer', "",
"le supprimer définitivement", 'force_delete', "le restaurer", 'restore');
break;
case 'delete' :
// Create a log accordingly
log_generate($couple_id, $couple_type, api_get_user_id(), $id, 'supprimé', "");
// I confirm the choice of my mate, so I delete this item
$sql = "DELETE FROM $table WHERE id = '" . Database::escape_string(trim($id)) . "'";
Database::query($sql);
$real_delete = true;
break;
default :
error_throw("Unknown action : $action");
}
error_display("tool.php:doc_delete => $sql");
return $real_delete;
}
function tool_read ($tool_id) {
$sql = "SELECT * FROM " . TABLE_TOOL . " WHERE id = '$tool_id'";
return db_query($sql);
}
function tool_validate ($id, $couple_id, $couple_type) {
$table = TABLE_TOOL;
$sql = "UPDATE $table SET is_ok = NOT is_ok WHERE id = '$id'";
$ret = Database::query($sql);
// Create a log accordingly
$tool_get = tool_get_by_id($id);
log_generate($couple_id, $couple_type, api_get_user_id(), $id, $tool_get['is_ok'] ? 'validé' : 'retiré la mention "validé"', "");
return $ret;
}
function tool_unvalidate ($id) {
$table = TABLE_TOOL;
$sql = "UPDATE $table SET is_ok = 0 WHERE id = '$id'";
return Database::query($sql);
}
/* Find the type of the tool (action / agenda / date)
* return the number of the tab
*/
function tool_get_tab_for_id ($tool_id) {
foreach (tool_get_all_tool_types() as $type) {
// error_log("$tool_id, $type");
$type_table = tool_get_table_for_type($type);
$sql = "SELECT * FROM $type_table WHERE tool_id = '$tool_id'";
$res = Database::query($sql);
if (Database::num_rows($res) > 0) {
return tool_get_tab_nb($type);
}
}
return -1;
}
function tool_get_tab_nb ($type) {
$convert = array_flip (array (DOCUMENT, AGENDA, ACTION));
return $convert[$type];
} error_log 0000644 00000126720 15200256543 0006473 0 ustar 00 [06-May-2026 11:42:05 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1483
[06-May-2026 11:42:05 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1500
[06-May-2026 11:42:05 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1506
[06-May-2026 11:42:05 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1529
[06-May-2026 11:42:05 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1532
[06-May-2026 11:42:05 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1532
[06-May-2026 11:42:05 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[06-May-2026 11:42:05 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[06-May-2026 11:42:05 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[06-May-2026 11:42:05 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[06-May-2026 11:42:05 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[06-May-2026 11:42:05 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[06-May-2026 11:42:05 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[06-May-2026 11:42:05 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[06-May-2026 11:42:05 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[06-May-2026 11:42:05 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[06-May-2026 11:42:05 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[06-May-2026 11:42:05 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[06-May-2026 11:42:05 Europe/Paris] PHP Warning: require_once(/var/www/restricted/ssh/missm/www/main/inc/lib/database.lib.php): failed to open stream: No such file or directory in /home/missmand/public_html/learning/old/main/inc/global.inc.php on line 101
[06-May-2026 11:42:05 Europe/Paris] PHP Fatal error: require_once(): Failed opening required '/var/www/restricted/ssh/missm/www/main/inc/lib/database.lib.php' (include_path='.:/var/www/restricted/ssh/missm/www/main/inc/lib/pear:/opt/cpanel/ea-php74/root/usr/share/pear') in /home/missmand/public_html/learning/old/main/inc/global.inc.php on line 101
[07-May-2026 10:39:34 Europe/Paris] PHP Parse error: syntax error, unexpected '&', expecting ')' in /home/missmand/public_html/learning/old/main/couple/model.php on line 264
[07-May-2026 10:39:49 Europe/Paris] PHP Fatal error: Uncaught Error: Call to undefined function api_get_path() in /home/missmand/public_html/learning/old/main/couple/eval.php:12
Stack trace:
#0 {main}
thrown in /home/missmand/public_html/learning/old/main/couple/eval.php on line 12
[07-May-2026 13:48:56 Europe/Paris] PHP Fatal error: Uncaught Error: Call to undefined function api_get_path() in /home/missmand/public_html/learning/old/main/couple/tool.php:11
Stack trace:
#0 {main}
thrown in /home/missmand/public_html/learning/old/main/couple/tool.php on line 11
[07-May-2026 13:48:58 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1483
[07-May-2026 13:48:58 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1500
[07-May-2026 13:48:58 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1506
[07-May-2026 13:48:58 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1529
[07-May-2026 13:48:58 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1532
[07-May-2026 13:48:58 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1532
[07-May-2026 13:48:58 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[07-May-2026 13:48:58 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[07-May-2026 13:48:58 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[07-May-2026 13:48:58 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[07-May-2026 13:48:58 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[07-May-2026 13:48:58 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[07-May-2026 13:48:58 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[07-May-2026 13:48:58 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[07-May-2026 13:48:58 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[07-May-2026 13:48:58 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[07-May-2026 13:48:58 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[07-May-2026 13:48:58 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[07-May-2026 13:48:58 Europe/Paris] PHP Warning: require_once(/var/www/restricted/ssh/missm/www/main/inc/lib/database.lib.php): failed to open stream: No such file or directory in /home/missmand/public_html/learning/old/main/inc/global.inc.php on line 101
[07-May-2026 13:48:58 Europe/Paris] PHP Fatal error: require_once(): Failed opening required '/var/www/restricted/ssh/missm/www/main/inc/lib/database.lib.php' (include_path='.:/var/www/restricted/ssh/missm/www/main/inc/lib/pear:/opt/cpanel/ea-php74/root/usr/share/pear') in /home/missmand/public_html/learning/old/main/inc/global.inc.php on line 101
[07-May-2026 15:31:35 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1483
[07-May-2026 15:31:35 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1500
[07-May-2026 15:31:35 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1506
[07-May-2026 15:31:35 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1529
[07-May-2026 15:31:35 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1532
[07-May-2026 15:31:35 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1532
[07-May-2026 15:31:35 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[07-May-2026 15:31:35 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[07-May-2026 15:31:35 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[07-May-2026 15:31:35 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[07-May-2026 15:31:35 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[07-May-2026 15:31:35 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[07-May-2026 15:31:35 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[07-May-2026 15:31:35 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[07-May-2026 15:31:35 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[07-May-2026 15:31:35 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[07-May-2026 15:31:35 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[07-May-2026 15:31:35 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[07-May-2026 15:31:35 Europe/Paris] PHP Warning: require_once(/var/www/restricted/ssh/missm/www/main/inc/lib/database.lib.php): failed to open stream: No such file or directory in /home/missmand/public_html/learning/old/main/inc/global.inc.php on line 101
[07-May-2026 15:31:35 Europe/Paris] PHP Fatal error: require_once(): Failed opening required '/var/www/restricted/ssh/missm/www/main/inc/lib/database.lib.php' (include_path='.:/var/www/restricted/ssh/missm/www/main/inc/lib/pear:/opt/cpanel/ea-php74/root/usr/share/pear') in /home/missmand/public_html/learning/old/main/inc/global.inc.php on line 101
[07-May-2026 15:31:38 Europe/Paris] PHP Fatal error: Uncaught Error: Call to undefined function api_get_path() in /home/missmand/public_html/learning/old/main/couple/action.php:12
Stack trace:
#0 {main}
thrown in /home/missmand/public_html/learning/old/main/couple/action.php on line 12
[07-May-2026 15:31:42 Europe/Paris] PHP Fatal error: Uncaught Error: Call to undefined function api_get_path() in /home/missmand/public_html/learning/old/main/couple/form.php:12
Stack trace:
#0 {main}
thrown in /home/missmand/public_html/learning/old/main/couple/form.php on line 12
[07-May-2026 15:31:43 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1483
[07-May-2026 15:31:43 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1500
[07-May-2026 15:31:43 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1506
[07-May-2026 15:31:43 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1529
[07-May-2026 15:31:43 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1532
[07-May-2026 15:31:43 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1532
[07-May-2026 15:31:43 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[07-May-2026 15:31:43 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[07-May-2026 15:31:43 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[07-May-2026 15:31:43 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[07-May-2026 15:31:43 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[07-May-2026 15:31:43 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[07-May-2026 15:31:43 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[07-May-2026 15:31:43 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[07-May-2026 15:31:43 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[07-May-2026 15:31:43 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[07-May-2026 15:31:43 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[07-May-2026 15:31:43 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[07-May-2026 15:31:43 Europe/Paris] PHP Warning: require_once(/var/www/restricted/ssh/missm/www/main/inc/lib/database.lib.php): failed to open stream: No such file or directory in /home/missmand/public_html/learning/old/main/inc/global.inc.php on line 101
[07-May-2026 15:31:43 Europe/Paris] PHP Fatal error: require_once(): Failed opening required '/var/www/restricted/ssh/missm/www/main/inc/lib/database.lib.php' (include_path='.:/var/www/restricted/ssh/missm/www/main/inc/lib/pear:/opt/cpanel/ea-php74/root/usr/share/pear') in /home/missmand/public_html/learning/old/main/inc/global.inc.php on line 101
[08-May-2026 02:48:48 Europe/Paris] PHP Fatal error: Uncaught Error: Call to undefined function api_get_path() in /home/missmand/public_html/learning/old/main/couple/tchat.php:12
Stack trace:
#0 {main}
thrown in /home/missmand/public_html/learning/old/main/couple/tchat.php on line 12
[08-May-2026 02:48:55 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1483
[08-May-2026 02:48:55 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1500
[08-May-2026 02:48:55 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1506
[08-May-2026 02:48:55 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1529
[08-May-2026 02:48:55 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1532
[08-May-2026 02:48:55 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1532
[08-May-2026 02:48:55 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[08-May-2026 02:48:55 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[08-May-2026 02:48:55 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[08-May-2026 02:48:55 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[08-May-2026 02:48:55 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[08-May-2026 02:48:55 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[08-May-2026 02:48:55 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[08-May-2026 02:48:55 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[08-May-2026 02:48:55 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[08-May-2026 02:48:55 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[08-May-2026 02:48:55 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[08-May-2026 02:48:55 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[08-May-2026 02:48:55 Europe/Paris] PHP Warning: require_once(/var/www/restricted/ssh/missm/www/main/inc/lib/database.lib.php): failed to open stream: No such file or directory in /home/missmand/public_html/learning/old/main/inc/global.inc.php on line 101
[08-May-2026 02:48:55 Europe/Paris] PHP Fatal error: require_once(): Failed opening required '/var/www/restricted/ssh/missm/www/main/inc/lib/database.lib.php' (include_path='.:/var/www/restricted/ssh/missm/www/main/inc/lib/pear:/opt/cpanel/ea-php74/root/usr/share/pear') in /home/missmand/public_html/learning/old/main/inc/global.inc.php on line 101
[09-May-2026 12:26:23 Europe/Paris] PHP Fatal error: Uncaught Error: Call to undefined function api_get_path() in /home/missmand/public_html/learning/old/main/couple/form.php:12
Stack trace:
#0 {main}
thrown in /home/missmand/public_html/learning/old/main/couple/form.php on line 12
[09-May-2026 12:26:23 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1483
[09-May-2026 12:26:23 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1500
[09-May-2026 12:26:23 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1506
[09-May-2026 12:26:23 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1529
[09-May-2026 12:26:23 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1532
[09-May-2026 12:26:23 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1532
[09-May-2026 12:26:23 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[09-May-2026 12:26:23 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[09-May-2026 12:26:23 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[09-May-2026 12:26:23 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[09-May-2026 12:26:23 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[09-May-2026 12:26:23 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[09-May-2026 12:26:23 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[09-May-2026 12:26:23 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[09-May-2026 12:26:23 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[09-May-2026 12:26:23 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[09-May-2026 12:26:23 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[09-May-2026 12:26:23 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[09-May-2026 12:26:23 Europe/Paris] PHP Warning: require_once(/var/www/restricted/ssh/missm/www/main/inc/lib/database.lib.php): failed to open stream: No such file or directory in /home/missmand/public_html/learning/old/main/inc/global.inc.php on line 101
[09-May-2026 12:26:23 Europe/Paris] PHP Fatal error: require_once(): Failed opening required '/var/www/restricted/ssh/missm/www/main/inc/lib/database.lib.php' (include_path='.:/var/www/restricted/ssh/missm/www/main/inc/lib/pear:/opt/cpanel/ea-php74/root/usr/share/pear') in /home/missmand/public_html/learning/old/main/inc/global.inc.php on line 101
[09-May-2026 12:26:38 Europe/Paris] PHP Fatal error: Uncaught Error: Call to undefined function api_get_path() in /home/missmand/public_html/learning/old/main/couple/tool.php:11
Stack trace:
#0 {main}
thrown in /home/missmand/public_html/learning/old/main/couple/tool.php on line 11
[09-May-2026 12:26:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1483
[09-May-2026 12:26:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1500
[09-May-2026 12:26:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1506
[09-May-2026 12:26:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1529
[09-May-2026 12:26:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1532
[09-May-2026 12:26:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1532
[09-May-2026 12:26:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[09-May-2026 12:26:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[09-May-2026 12:26:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[09-May-2026 12:26:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[09-May-2026 12:26:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[09-May-2026 12:26:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[09-May-2026 12:26:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[09-May-2026 12:26:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[09-May-2026 12:26:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[09-May-2026 12:26:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[09-May-2026 12:26:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[09-May-2026 12:26:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[09-May-2026 12:26:45 Europe/Paris] PHP Warning: require_once(/var/www/restricted/ssh/missm/www/main/inc/lib/database.lib.php): failed to open stream: No such file or directory in /home/missmand/public_html/learning/old/main/inc/global.inc.php on line 101
[09-May-2026 12:26:45 Europe/Paris] PHP Fatal error: require_once(): Failed opening required '/var/www/restricted/ssh/missm/www/main/inc/lib/database.lib.php' (include_path='.:/var/www/restricted/ssh/missm/www/main/inc/lib/pear:/opt/cpanel/ea-php74/root/usr/share/pear') in /home/missmand/public_html/learning/old/main/inc/global.inc.php on line 101
[09-May-2026 19:17:47 Europe/Paris] PHP Parse error: syntax error, unexpected '&', expecting ')' in /home/missmand/public_html/learning/old/main/couple/model.php on line 264
[09-May-2026 19:17:49 Europe/Paris] PHP Fatal error: Uncaught Error: Call to undefined function api_get_path() in /home/missmand/public_html/learning/old/main/couple/eval.php:12
Stack trace:
#0 {main}
thrown in /home/missmand/public_html/learning/old/main/couple/eval.php on line 12
[09-May-2026 23:09:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1483
[09-May-2026 23:09:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1500
[09-May-2026 23:09:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1506
[09-May-2026 23:09:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1529
[09-May-2026 23:09:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1532
[09-May-2026 23:09:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1532
[09-May-2026 23:09:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[09-May-2026 23:09:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[09-May-2026 23:09:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[09-May-2026 23:09:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[09-May-2026 23:09:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[09-May-2026 23:09:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[09-May-2026 23:09:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[09-May-2026 23:09:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[09-May-2026 23:09:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[09-May-2026 23:09:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[09-May-2026 23:09:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[09-May-2026 23:09:45 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[09-May-2026 23:09:45 Europe/Paris] PHP Warning: require_once(/var/www/restricted/ssh/missm/www/main/inc/lib/database.lib.php): failed to open stream: No such file or directory in /home/missmand/public_html/learning/old/main/inc/global.inc.php on line 101
[09-May-2026 23:09:45 Europe/Paris] PHP Fatal error: require_once(): Failed opening required '/var/www/restricted/ssh/missm/www/main/inc/lib/database.lib.php' (include_path='.:/var/www/restricted/ssh/missm/www/main/inc/lib/pear:/opt/cpanel/ea-php74/root/usr/share/pear') in /home/missmand/public_html/learning/old/main/inc/global.inc.php on line 101
[10-May-2026 13:41:47 Europe/Paris] PHP Fatal error: Uncaught Error: Call to undefined function api_get_path() in /home/missmand/public_html/learning/old/main/couple/tchat.php:12
Stack trace:
#0 {main}
thrown in /home/missmand/public_html/learning/old/main/couple/tchat.php on line 12
[10-May-2026 13:41:48 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1483
[10-May-2026 13:41:48 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1500
[10-May-2026 13:41:48 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1506
[10-May-2026 13:41:48 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1529
[10-May-2026 13:41:48 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1532
[10-May-2026 13:41:48 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1532
[10-May-2026 13:41:48 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[10-May-2026 13:41:48 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[10-May-2026 13:41:48 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1535
[10-May-2026 13:41:48 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[10-May-2026 13:41:48 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[10-May-2026 13:41:48 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[10-May-2026 13:41:48 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1538
[10-May-2026 13:41:48 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[10-May-2026 13:41:48 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[10-May-2026 13:41:48 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[10-May-2026 13:41:48 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[10-May-2026 13:41:48 Europe/Paris] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/missmand/public_html/learning/old/main/inc/lib/internationalization.lib.php on line 1541
[10-May-2026 13:41:48 Europe/Paris] PHP Warning: require_once(/var/www/restricted/ssh/missm/www/main/inc/lib/database.lib.php): failed to open stream: No such file or directory in /home/missmand/public_html/learning/old/main/inc/global.inc.php on line 101
[10-May-2026 13:41:48 Europe/Paris] PHP Fatal error: require_once(): Failed opening required '/var/www/restricted/ssh/missm/www/main/inc/lib/database.lib.php' (include_path='.:/var/www/restricted/ssh/missm/www/main/inc/lib/pear:/opt/cpanel/ea-php74/root/usr/share/pear') in /home/missmand/public_html/learning/old/main/inc/global.inc.php on line 101
[10-May-2026 13:41:48 Europe/Paris] PHP Fatal error: Uncaught Error: Call to undefined function api_get_path() in /home/missmand/public_html/learning/old/main/couple/action.php:12
Stack trace:
#0 {main}
thrown in /home/missmand/public_html/learning/old/main/couple/action.php on line 12
Hacked By AnonymousFox1.0, Coded By AnonymousFox