usermanager.lib.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. <?php
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004 Dokeos S.A.
  6. Copyright (c) 2003 Ghent University (UGent)
  7. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  8. Copyright (c) various contributors
  9. Copyright (c) Bart Mollet, Hogeschool Gent
  10. For a full list of contributors, see "credits.txt".
  11. The full license can be read in "license.txt".
  12. This program is free software; you can redistribute it and/or
  13. modify it under the terms of the GNU General Public License
  14. as published by the Free Software Foundation; either version 2
  15. of the License, or (at your option) any later version.
  16. See the GNU General Public License for more details.
  17. Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
  18. ==============================================================================
  19. */
  20. /**
  21. ==============================================================================
  22. * This library provides functions for user management.
  23. * Include/require it in your code to use its functionality.
  24. *
  25. * @package dokeos.library
  26. ==============================================================================
  27. */
  28. class UserManager
  29. {
  30. /**
  31. * Creates a new user for the platform
  32. * @author Hugues Peeters <peeters@ipm.ucl.ac.be>,
  33. * Roan Embrechts <roan_embrechts@yahoo.com>
  34. *
  35. * @param string $firstName
  36. * string $lastName
  37. * int $status
  38. * string $email
  39. * string $loginName
  40. * string $password
  41. * string $official_code (optional)
  42. * string $phone (optional)
  43. * string $picture_uri (optional)
  44. * string $auth_source (optional)
  45. *
  46. * @return int new user id - if the new user creation succeeds
  47. * boolean false otherwise
  48. *
  49. * @desc The function tries to retrieve $_user['user_id'] from the global space.
  50. * if it exists, $_user['user_id'] is the creator id If a problem arises,
  51. * it stores the error message in global $api_failureList
  52. *
  53. * @todo Add the user language to the parameters
  54. */
  55. function create_user($firstName, $lastName, $status, $email, $loginName, $password, $official_code = '', $language='', $phone = '', $picture_uri = '', $auth_source = PLATFORM_AUTH_SOURCE, $expiration_date = '0000-00-00 00:00:00', $active = 1, $hr_dept_id=0)
  56. {
  57. global $_user, $userPasswordCrypted;
  58. // database table definition
  59. $table_user = Database::get_main_table(TABLE_MAIN_USER);
  60. // default langauge
  61. if ($language=='')
  62. {
  63. $language = api_get_setting('platformLanguage');
  64. }
  65. if ($_user['user_id'])
  66. {
  67. $creator_id = $_user['user_id'];
  68. }
  69. else
  70. {
  71. $creator_id = '';
  72. }
  73. // First check wether the login already exists
  74. if (! UserManager::is_username_available($loginName))
  75. return api_set_failure('login-pass already taken');
  76. //$password = "PLACEHOLDER";
  77. $password = ($userPasswordCrypted ? md5($password) : $password);
  78. $sql = "INSERT INTO $table_user
  79. SET lastname = '".Database::escape_string($lastName)."',
  80. firstname = '".Database::escape_string($firstName)."',
  81. username = '".Database::escape_string($loginName)."',
  82. status = '".Database::escape_string($status)."',
  83. password = '".Database::escape_string($password)."',
  84. email = '".Database::escape_string($email)."',
  85. official_code = '".Database::escape_string($official_code)."',
  86. picture_uri = '".Database::escape_string($picture_uri)."',
  87. creator_id = '".Database::escape_string($creator_id)."',
  88. auth_source = '".Database::escape_string($auth_source)."',
  89. phone = '".Database::escape_string($phone)."',
  90. language = '".Database::escape_string($language)."',
  91. registration_date = now(),
  92. expiration_date = '".Database::escape_string($expiration_date)."',
  93. hr_dept_id = '".Database::escape_string($hr_dept_id)."',
  94. active = '".Database::escape_string($active)."'";
  95. $result = api_sql_query($sql);
  96. if ($result)
  97. {
  98. //echo "id returned";
  99. return Database::get_last_insert_id();
  100. }
  101. else
  102. {
  103. //echo "false - failed" ;
  104. return false;
  105. }
  106. }
  107. /**
  108. * Can user be deleted?
  109. * This functions checks if there's a course in which the given user is the
  110. * only course administrator. If that is the case, the user can't be
  111. * deleted because the course would remain without a course admin.
  112. * @param int $user_id The user id
  113. * @return boolean true if user can be deleted
  114. */
  115. function can_delete_user($user_id)
  116. {
  117. $table_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
  118. $sql = "SELECT * FROM $table_course_user WHERE status = '1' AND user_id = '".$user_id."'";
  119. $res = api_sql_query($sql,__FILE__,__LINE__);
  120. while ($course = Database::fetch_object($res))
  121. {
  122. $sql = "SELECT user_id FROM $table_course_user WHERE status='1' AND course_code ='".$course->course_code."'";
  123. $res2 = api_sql_query($sql,__FILE__,__LINE__);
  124. if (Database::num_rows($res2) == 1)
  125. {
  126. return false;
  127. }
  128. }
  129. return true;
  130. }
  131. /**
  132. * Delete a user from the platform
  133. * @param int $user_id The user id
  134. * @return boolean true if user is succesfully deleted, false otherwise
  135. */
  136. function delete_user($user_id)
  137. {
  138. if (!UserManager :: can_delete_user($user_id))
  139. {
  140. return false;
  141. }
  142. $table_user = Database :: get_main_table(TABLE_MAIN_USER);
  143. $table_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
  144. $table_class_user = Database :: get_main_table(TABLE_MAIN_CLASS_USER);
  145. $table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
  146. $table_admin = Database :: get_main_table(TABLE_MAIN_ADMIN);
  147. $table_session_user = Database :: get_main_table(TABLE_MAIN_SESSION_USER);
  148. $table_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
  149. // Unsubscribe the user from all groups in all his courses
  150. $sql = "SELECT * FROM $table_course c, $table_course_user cu WHERE cu.user_id = '".$user_id."' AND c.code = cu.course_code";
  151. $res = api_sql_query($sql,__FILE__,__LINE__);
  152. while ($course = Database::fetch_object($res))
  153. {
  154. $table_group = Database :: get_course_table(TABLE_GROUP_USER, $course->db_name);
  155. $sql = "DELETE FROM $table_group WHERE user_id = '".$user_id."'";
  156. api_sql_query($sql,__FILE__,__LINE__);
  157. }
  158. // Unsubscribe user from all classes
  159. $sql = "DELETE FROM $table_class_user WHERE user_id = '".$user_id."'";
  160. api_sql_query($sql,__FILE__,__LINE__);
  161. // Unsubscribe user from all courses
  162. $sql = "DELETE FROM $table_course_user WHERE user_id = '".$user_id."'";
  163. api_sql_query($sql,__FILE__,__LINE__);
  164. // Unsubscribe user from all courses in sessions
  165. $sql = "DELETE FROM $table_session_course_user WHERE id_user = '".$user_id."'";
  166. api_sql_query($sql,__FILE__,__LINE__);
  167. // Unsubscribe user from all sessions
  168. $sql = "DELETE FROM $table_session_user WHERE id_user = '".$user_id."'";
  169. api_sql_query($sql,__FILE__,__LINE__);
  170. // Delete user picture
  171. $user_info = api_get_user_info($user_id);
  172. if(strlen($user_info['picture_uri']) > 0)
  173. {
  174. $img_path = api_get_path(SYS_CODE_PATH).'upload/users/'.$user_info['picture_uri'];
  175. unlink($img_path);
  176. }
  177. // Delete the personal course categories
  178. $course_cat_table = Database::get_user_personal_table(TABLE_USER_COURSE_CATEGORY);
  179. $sql = "DELETE FROM $course_cat_table WHERE user_id = '".$user_id."'";
  180. api_sql_query($sql,__FILE__,__LINE__);
  181. // Delete user from database
  182. $sql = "DELETE FROM $table_user WHERE user_id = '".$user_id."'";
  183. api_sql_query($sql,__FILE__,__LINE__);
  184. // Delete user from the admin table
  185. $sql = "DELETE FROM $table_admin WHERE user_id = '".$user_id."'";
  186. api_sql_query($sql,__FILE__,__LINE__);
  187. // Delete the personal agenda-items from this user
  188. $agenda_table = Database :: get_user_personal_table(TABLE_PERSONAL_AGENDA);
  189. $sql = "DELETE FROM $agenda_table WHERE user = '".$user_id."'";
  190. api_sql_query($sql,__FILE__,__LINE__);
  191. $gradebook_results_table = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
  192. $sql = 'DELETE FROM '.$gradebook_results_table.' WHERE user_id = '.$user_id;
  193. api_sql_query($sql, __FILE__, __LINE__);
  194. return true;
  195. }
  196. /**
  197. * Update user information with new openid
  198. * @param int $user_id
  199. * @param string $openid
  200. * @return boolean true if the user information was updated
  201. */
  202. function update_openid($user_id, $openid)
  203. {
  204. $table_user = Database :: get_main_table(TABLE_MAIN_USER);
  205. $sql = "UPDATE $table_user SET
  206. openid='".Database::escape_string($openid)."'";
  207. $sql .= " WHERE user_id='$user_id'";
  208. return api_sql_query($sql,__FILE__,__LINE__);
  209. }
  210. /**
  211. * Update user information
  212. * @param int $user_id
  213. * @param string $firstname
  214. * @param string $lastname
  215. * @param string $username
  216. * @param string $password
  217. * @param string $auth_source
  218. * @param string $email
  219. * @param int $status
  220. * @param string $official_code
  221. * @param string $phone
  222. * @param string $picture_uri
  223. * @param int $creator_id
  224. * @return boolean true if the user information was updated
  225. */
  226. function update_user($user_id, $firstname, $lastname, $username, $password = null, $auth_source = null, $email, $status, $official_code, $phone, $picture_uri, $expiration_date, $active, $creator_id= null, $hr_dept_id=0)
  227. {
  228. global $userPasswordCrypted;
  229. $table_user = Database :: get_main_table(TABLE_MAIN_USER);
  230. $sql = "UPDATE $table_user SET
  231. lastname='".Database::escape_string($lastname)."',
  232. firstname='".Database::escape_string($firstname)."',
  233. username='".Database::escape_string($username)."',";
  234. if(!is_null($password))
  235. {
  236. $password = $userPasswordCrypted ? md5($password) : $password;
  237. $sql .= " password='".Database::escape_string($password)."',";
  238. }
  239. if(!is_null($auth_source))
  240. {
  241. $sql .= " auth_source='".Database::escape_string($auth_source)."',";
  242. }
  243. $sql .= "
  244. email='".Database::escape_string($email)."',
  245. status='".Database::escape_string($status)."',
  246. official_code='".Database::escape_string($official_code)."',
  247. phone='".Database::escape_string($phone)."',
  248. picture_uri='".Database::escape_string($picture_uri)."',
  249. expiration_date='".Database::escape_string($expiration_date)."',
  250. active='".Database::escape_string($active)."',
  251. hr_dept_id=".intval($hr_dept_id);
  252. if(!is_null($creator_id))
  253. {
  254. $sql .= ", creator_id='".Database::escape_string($creator_id)."'";
  255. }
  256. $sql .= " WHERE user_id='$user_id'";
  257. return api_sql_query($sql,__FILE__,__LINE__);
  258. }
  259. /**
  260. * Check if a username is available
  261. * @param string the wanted username
  262. * @return boolean true if the wanted username is available
  263. */
  264. function is_username_available($username)
  265. {
  266. $table_user = Database :: get_main_table(TABLE_MAIN_USER);
  267. $sql = "SELECT username FROM $table_user WHERE username = '".addslashes($username)."'";
  268. $res = api_sql_query($sql,__FILE__,__LINE__);
  269. return Database::num_rows($res) == 0;
  270. }
  271. /**
  272. * @param array $conditions a list of condition (exemple : status=>STUDENT)
  273. * @param array $order_by a list of fields on which sort
  274. * @return an array with all users of the platform.
  275. * @todo optional course code parameter, optional sorting parameters...
  276. */
  277. function get_user_list($conditions = array(), $order_by = array())
  278. {
  279. $user_table = Database :: get_main_table(TABLE_MAIN_USER);
  280. $sql_query = "SELECT * FROM $user_table";
  281. if(count($conditions)>0)
  282. {
  283. $sql_query .= ' WHERE ';
  284. foreach($conditions as $field=>$value)
  285. {
  286. $sql_query .= $field.' = '.$value;
  287. }
  288. }
  289. if(count($order_by)>0)
  290. {
  291. $sql_query .= ' ORDER BY '.implode(',',$order_by);
  292. }
  293. $sql_result = api_sql_query($sql_query,__FILE__,__LINE__);
  294. while ($result = Database::fetch_array($sql_result))
  295. {
  296. $return_array[] = $result;
  297. }
  298. return $return_array;
  299. }
  300. /**
  301. * Get user information
  302. * @param string $username The username
  303. * @return array All user information as an associative array
  304. */
  305. function get_user_info($username)
  306. {
  307. $user_table = Database :: get_main_table(TABLE_MAIN_USER);
  308. $sql = "SELECT * FROM $user_table WHERE username='".$username."'";
  309. $res = api_sql_query($sql,__FILE__,__LINE__);
  310. if(Database::num_rows($res)>0)
  311. {
  312. $user = Database::fetch_array($res);
  313. }
  314. else
  315. {
  316. $user = false;
  317. }
  318. return $user;
  319. }
  320. /**
  321. * Get user information
  322. * @param string $id The id
  323. * @return array All user information as an associative array
  324. */
  325. function get_user_info_by_id($user_id)
  326. {
  327. $user_id = intval($user_id);
  328. $user_table = Database :: get_main_table(TABLE_MAIN_USER);
  329. $sql = "SELECT * FROM $user_table WHERE user_id=".$user_id;
  330. $res = api_sql_query($sql,__FILE__,__LINE__);
  331. if(Database::num_rows($res)>0)
  332. {
  333. $user = Database::fetch_array($res);
  334. }
  335. else
  336. {
  337. $user = false;
  338. }
  339. return $user;
  340. }
  341. //for survey
  342. function get_teacher_list($course_id, $sel_teacher='')
  343. {
  344. $user_course_table = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
  345. $user_table = Database :: get_main_table(TABLE_MAIN_USER);
  346. $sql_query = "SELECT * FROM $user_table a, $user_course_table b where a.user_id=b.user_id AND b.status=1 AND b.course_code='$course_id'";
  347. $sql_result = api_sql_query($sql_query,__FILE__,__LINE__);
  348. echo "<select name=\"author\">";
  349. while ($result = Database::fetch_array($sql_result))
  350. {
  351. if($sel_teacher==$result['user_id']) $selected ="selected";
  352. echo "\n<option value=\"".$result['user_id']."\" $selected>".$result['firstname']."</option>";
  353. }
  354. echo "</select>";
  355. }
  356. /**
  357. * Get user picture URL or path from user ID (returns an array).
  358. * The return format is a complete path, enabling recovery of the directory
  359. * with dirname() or the file with basename(). This also works for the
  360. * functions dealing with the user's productions, as they are located in
  361. * the same directory.
  362. * @param integer User ID
  363. * @param string Type of path to return (can be 'none','system','rel','web')
  364. * @param bool Whether we want to have the directory name returned 'as if' there was a file or not (in the case we want to know which directory to create - otherwise no file means no split subdir)
  365. * @param bool If we want that the function returns the /main/img/unknown.jpg image set it at true
  366. * @return array Array of 2 elements: 'dir' and 'file' which contain the dir and file as the name implies if image does not exist it will return the unknow image if anonymous parameter is true if not it returns an empty array
  367. */
  368. function get_user_picture_path_by_id($id,$type='none',$preview=false,$anonymous=false)
  369. {
  370. if(empty($id) or empty($type))
  371. {
  372. if ($anonymous)
  373. {
  374. $dir='';
  375. switch($type)
  376. {
  377. case 'system': //return the complete path to the file, from root
  378. $dir = api_get_path(SYS_CODE_PATH).'img/';
  379. break;
  380. case 'rel': //return the relative path to the file, from the Dokeos base dir
  381. $dir = api_get_path(REL_CODE_PATH).'img/';
  382. break;
  383. case 'web': //return the complete web URL to the file
  384. $dir = api_get_path(WEB_CODE_PATH).'img/';
  385. break;
  386. case 'none': //return only the picture_uri (as is, without subdir)
  387. default:
  388. break;
  389. }
  390. $file_anonymous='unknown.jpg';
  391. return array('dir'=>$dir,'file'=>$file_anonymous);
  392. }
  393. else
  394. {
  395. return array('dir'=>'','file'=>'');
  396. }
  397. }
  398. $user_id = intval($id);
  399. $user_table = Database :: get_main_table(TABLE_MAIN_USER);
  400. $sql = "SELECT picture_uri FROM $user_table WHERE user_id=".$user_id;
  401. $res = api_sql_query($sql,__FILE__,__LINE__);
  402. $user=array();
  403. if(Database::num_rows($res)>0)
  404. {
  405. $user = Database::fetch_array($res);
  406. }
  407. else
  408. {
  409. if ($anonymous)
  410. {
  411. $dir='';
  412. switch($type)
  413. {
  414. case 'system': //return the complete path to the file, from root
  415. $dir = api_get_path(SYS_CODE_PATH).'img/';
  416. break;
  417. case 'rel': //return the relative path to the file, from the Dokeos base dir
  418. $dir = api_get_path(REL_CODE_PATH).'img/';
  419. break;
  420. case 'web': //return the complete web URL to the file
  421. $dir = api_get_path(WEB_CODE_PATH).'img/';
  422. break;
  423. case 'none': //return only the picture_uri (as is, without subdir)
  424. default:
  425. break;
  426. }
  427. $file_anonymous='unknown.jpg';
  428. return array('dir'=>$dir,'file'=>$file_anonymous);
  429. }
  430. else
  431. {
  432. return array('dir'=>'','file'=>'');
  433. }
  434. }
  435. $path = trim($user['picture_uri']);
  436. if (empty($path))
  437. {
  438. if ($anonymous)
  439. {
  440. switch($type)
  441. {
  442. case 'system': //return the complete path to the file, from root
  443. $dir = api_get_path(SYS_CODE_PATH).'img/';
  444. break;
  445. case 'rel': //return the relative path to the file, from the Dokeos base dir
  446. $dir = api_get_path(REL_CODE_PATH).'img/';
  447. break;
  448. case 'web': //return the complete web URL to the file
  449. $dir = api_get_path(WEB_CODE_PATH).'img/';
  450. break;
  451. case 'none': //return only the picture_uri (as is, without subdir)
  452. default:
  453. break;
  454. }
  455. $file_anonymous='unknown.jpg';
  456. return array('dir'=>$dir,'file'=>$file_anonymous);
  457. }
  458. }
  459. $dir = '';
  460. $first = '';
  461. if(api_get_setting('split_users_upload_directory') === 'true')
  462. {
  463. if(!empty($path))
  464. {
  465. $first = substr($path,0,1).'/';
  466. }
  467. elseif($preview==true)
  468. {
  469. $first = substr(''.$user_id,0,1).'/';
  470. }
  471. }
  472. else
  473. {
  474. $first = $user_id.'/';
  475. }
  476. switch($type)
  477. {
  478. case 'system': //return the complete path to the file, from root
  479. $dir = api_get_path(SYS_CODE_PATH).'upload/users/'.$first;
  480. break;
  481. case 'rel': //return the relative path to the file, from the Dokeos base dir
  482. $dir = api_get_path(REL_CODE_PATH).'upload/users/'.$first;
  483. break;
  484. case 'web': //return the complete web URL to the file
  485. $dir = api_get_path(WEB_CODE_PATH).'upload/users/'.$first;
  486. break;
  487. case 'none': //return only the picture_uri (as is, without subdir)
  488. default:
  489. break;
  490. }
  491. return array('dir'=>$dir,'file'=>$path);
  492. }
  493. /*
  494. -----------------------------------------------------------
  495. PRODUCTIONS FUNCTIONS
  496. -----------------------------------------------------------
  497. */
  498. /**
  499. * Returns an XHTML formatted list of productions for a user, or FALSE if he
  500. * doesn't have any.
  501. *
  502. * If there has been a request to remove a production, the function will return
  503. * without building the list unless forced to do so by the optional second
  504. * parameter. This increases performance by avoiding to read through the
  505. * productions on the filesystem before the removal request has been carried
  506. * out because they'll have to be re-read afterwards anyway.
  507. *
  508. * @param $user_id User id
  509. * @param $force Optional parameter to force building after a removal request
  510. * @return A string containing the XHTML code to dipslay the production list, or FALSE
  511. */
  512. function build_production_list($user_id, $force = false, $showdelete=false)
  513. {
  514. if (!$force && $_POST['remove_production'])
  515. return true; // postpone reading from the filesystem
  516. $productions = UserManager::get_user_productions($user_id);
  517. if (empty($productions))
  518. return false;
  519. $production_path = UserManager::get_user_picture_path_by_id($user_id,'web',true);
  520. $production_dir = $production_path['dir'].$user_id.'/';
  521. $del_image = api_get_path(WEB_CODE_PATH).'img/delete.gif';
  522. $del_text = get_lang('Delete');
  523. $production_list = '<ul id="productions">';
  524. foreach ($productions as $file)
  525. {
  526. $production_list .= '<li><a href="'.$production_dir.urlencode($file).'" target="_blank">'.htmlentities($file).'</a>';
  527. if ($showdelete)
  528. {
  529. $production_list .= '<input type="image" name="remove_production['.urlencode($file).']" src="'.$del_image.'" alt="'.$del_text.'" title="'.$del_text.' '.htmlentities($file).'" onclick="return confirmation(\''.htmlentities($file).'\');" /></li>';
  530. }
  531. }
  532. $production_list .= '</ul>';
  533. return $production_list;
  534. }
  535. /**
  536. * Returns an array with the user's productions.
  537. *
  538. * @param $user_id User id
  539. * @return An array containing the user's productions
  540. */
  541. function get_user_productions($user_id)
  542. {
  543. $production_path = UserManager::get_user_picture_path_by_id($user_id,'system',true);
  544. $production_repository = $production_path['dir'].$user_id.'/';
  545. $productions = array();
  546. if (is_dir($production_repository))
  547. {
  548. $handle = opendir($production_repository);
  549. while ($file = readdir($handle))
  550. {
  551. if ($file == '.' || $file == '..' || $file == '.htaccess')
  552. continue; // skip current/parent directory and .htaccess
  553. $productions[] = $file;
  554. }
  555. }
  556. return $productions; // can be an empty array
  557. }
  558. /**
  559. * Remove a user production.
  560. *
  561. * @param $user_id User id
  562. * @param $production The production to remove
  563. */
  564. function remove_user_production($user_id, $production)
  565. {
  566. $production_path = UserManager::get_user_picture_path_by_id($user_id,'system',true);
  567. unlink($production_path['dir'].$user_id.'/'.$production);
  568. }
  569. }
  570. ?>