Advertisement
Guest User

Untitled

a guest
Nov 9th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 39.93 KB | None | 0 0
  1. <?php
  2. /************************************************************
  3. UsersManagement.class.php
  4. Product : Digital Asset
  5. Version : 1.0
  6. Release : 0
  7. Date Created : Fri Mar 12 16:09:28 EET 2010
  8. Developed By : Kamil Baderddine PHP Department LayoutLTD
  9. All Rights Reserved , Layout LTD COPYRIGHT 2010
  10.  
  11. Page Description :
  12.  
  13. ************************************************************/
  14.  
  15. if( is_file( '../../backup/base_src.php' ) || is_file( '../../../backup/base_src.php' ) )
  16. {
  17. if( is_file( '../../backup/base_src.php' ) )
  18. {
  19. require_once( '../../backup/base_src.php');
  20. }
  21. else
  22. {
  23. require_once( '../../../backup/base_src.php');
  24. }
  25.  
  26. require_once( $basedir . 'includes/library.php');
  27. }
  28. else if(is_file('../../../../../backup/base_src.php'))
  29. {
  30.  
  31. }
  32. else
  33. {
  34. require_once( DA_BASE_SRC . 'app/includes/library.php');
  35. }
  36.  
  37. class UsersManagement extends request{
  38.  
  39. /**
  40. * Class Constructor
  41. *
  42. * @return UsersManagement
  43. */
  44. function UsersManagement ()
  45. {
  46.  
  47. }
  48.  
  49. /**
  50. * Get Users
  51. *
  52. * @param unknown_type $query_more
  53. */
  54. function GetUsers( $query_more = "" )
  55. {
  56. global $strings, $MY_DBH, $row, $databaseType,$tableCollab;
  57.  
  58. parent::PrepareQuery();
  59.  
  60. $this->query_sql .= ' FROM ' . $tableCollab["users"] . ' users ';
  61.  
  62. $count = count( $this->query_joins_array );
  63.  
  64. for( $index = 0 ; $index < $count ; $index++ )
  65. {
  66. switch ( $this->query_joins_array[ $index ] )
  67. {
  68. case "roles":
  69. $this->query_sql .= " LEFT JOIN " . $tableCollab["roles"] . " roles ON roles.r_id = users.u_role_id ";
  70. break;
  71.  
  72. case "user_group":
  73. $this->query_sql .= " LEFT JOIN " . $tableCollab["user_group"] . " ug ON ug.fk_users_u_id = users.u_id ";
  74. break;
  75.  
  76. case "approval_user_group":
  77. $this->query_sql .= " LEFT JOIN " . $tableCollab["approval_user_group"] . " aug ON aug.fk_u_id = users.u_id ";
  78. break;
  79.  
  80. case "ad_host":
  81. $this->query_sql .= " LEFT JOIN " . $tableCollab["ad_host"] . " adh ON users.fk_adh_id = adh.adh_id ";
  82. break;
  83. }
  84. }
  85.  
  86. $this->query_sql .= $query_more;
  87. parent::GetSql();
  88. }
  89.  
  90.  
  91. /**
  92. * Get Users
  93. *
  94. * @param unknown_type $query_more
  95. */
  96. function GetUserGroups( $query_more = "" )
  97. {
  98. global $strings, $MY_DBH, $row, $databaseType,$tableCollab;
  99. parent::PrepareQuery();
  100. $this->query_sql .= ' FROM ' . $tableCollab["user_group"] . ' ug ';
  101. $count = count( $this->query_joins_array );
  102. $this->query_sql .= $query_more;
  103. parent::GetSql();
  104. }
  105.  
  106. function CheckAllowedIP()
  107. {
  108. $ip = $_SERVER['REMOTE_ADDR'];
  109.  
  110. $ip_ad_permissions_obj = new IPAddressPermissions();
  111.  
  112. $query_more = " WHERE 1";
  113.  
  114. $ip_ad_permissions_obj->members_array = array( "iap.iap_id" );
  115. $ip_ad_permissions_obj->query_joins_array = array("setting");
  116. $ip_ad_permissions_obj->GetIPAddressPermissions( $query_more );
  117.  
  118. $totla_count = $ip_ad_permissions_obj->count;
  119.  
  120. $ip_ad_permissions_obj = new IPAddressPermissions();
  121.  
  122. $query_more = " WHERE ( iaps.iaps_user_group_id = '" . $this->data["users_u_id"][0] . "' AND iaps.iaps_type = 'user' )";
  123.  
  124. if( $this->data["ug_fk_groups_g_id"][0] > 0 )
  125. {
  126. $query_more .= "OR ( iaps.iaps_user_group_id IN( " . implode( ",", $this->data["ug_fk_groups_g_id"] ) . ") AND iaps.iaps_type = 'group' )";
  127. }
  128.  
  129. $ip_ad_permissions_obj->members_array = array( "iap.iap_id","iap.iap_ip", "iaps.iaps_type", "iaps.iaps_user_group_id" );
  130. $ip_ad_permissions_obj->query_joins_array = array("setting");
  131. $ip_ad_permissions_obj->GetIPAddressPermissions( $query_more );
  132.  
  133. if( $ip_ad_permissions_obj->count > 0 )
  134. {
  135. for( $i = 0 ; $i < $ip_ad_permissions_obj->count ; $i++ )
  136. {
  137. $permission_ip = $ip_ad_permissions_obj->data["iap_iap_ip"][$i];
  138.  
  139. if( substr( $ip, 0, strlen( $permission_ip ) ) == $permission_ip )
  140. {
  141. return true;
  142. }
  143. }
  144.  
  145. return false;
  146. }
  147. else
  148. {
  149. if( $this->data["users_u_allow_external_access"][0] == 0 && $totla_count > 0 )
  150. {
  151. return false;
  152. }
  153. else
  154. {
  155. return true;
  156. }
  157. }
  158. }
  159.  
  160. /**
  161. * Retrieve User Info and check if login success
  162. *
  163. * @param String $username
  164. * @param String $password
  165. * @return unknown
  166. */
  167. function AuthenticateUser( $array_data, $np_data )
  168. {
  169. //giving a little delay for the mass requests
  170. sleep(1);
  171. $username = $array_data['auto_user_name'];
  172. $password = $array_data['auto_user_password'];
  173. $auto_login = $array_data['auto_login_user'];
  174.  
  175. {/** Check if user exists */
  176.  
  177. $query_cond = " WHERE users.u_name = '$username' and u_is_deleted='0' and u_is_disabled=0";
  178. $this->query_joins_array = array("user_group");
  179.  
  180. $this->members_array = array( "users.u_id","users.u_profil", "users.u_password", "users.u_name", "users.u_role_id", "users.u_first_name", "users.u_last_name", "users.u_lan", "users.u_displayed_records", "users.u_theme_id", "ug.fk_groups_g_id", "users.fk_adh_id", "users.u_color", "users.u_sort_by", "users.fk_sl_id", "users.u_default_page", "users.u_default_search_type", "users.u_default_view", "users.fk_filters_f_id", "users.u_default_file_open", "users.u_email", "users.u_path_home_page", "users.u_is_cache_deleted", "users.u_auto_pagination", "users.u_sl_default_search" ,"users.u_visible_menu_items","users.u_default_search_keywords", "users.u_is_approver", "users.u_allow_external_access" );
  181. $this->GetUsers( $query_cond );
  182. }
  183.  
  184.  
  185. if( !$this->count || $this->count == 0 )
  186. {
  187. /** Username does not exist */
  188. $return_array['success'] = 0;
  189. //$return_array['msg'] = "The user name you entered is invalid.";
  190. $return_array['msg'] = "Username or Password are wrong.";
  191. $return_array['class'] = "error errorborder";
  192. return $return_array;
  193. }
  194. elseif ( $this->CheckAllowedIP() == false )
  195. {
  196. $return_array['success'] = 0;
  197. $return_array['msg'] = text('you_dont_have_access_from_this_ip');
  198. $return_array['class'] = "error errorborder";
  199. return $return_array;
  200. }
  201. else
  202. {
  203. //check for brute force
  204. define('LOGIN_FAILED_ATTEMPTS', 3);
  205. define('LOGIN_FAILED_LOCK_TIME', 3*60);
  206. $logs = new Logs();
  207. $logs->members_array = array("li.li_id","li.li_user_id","li.li_ip","li.li_time","li.li_type");
  208. $logs->GetLoginLogs("where li_user_id='".$this->data["users_u_id"][0]."' order by li_id desc limit ".LOGIN_FAILED_ATTEMPTS);
  209.  
  210. $brute_force = false;
  211. if($logs->count >= LOGIN_FAILED_ATTEMPTS ){
  212. $brute_force = true;
  213. for($i=0; $i<$logs->count;$i++){
  214. if($logs->data['li_li_type'][$i]=='login' || strtotime($logs->data['li_li_time'][$i]) < (time() - LOGIN_FAILED_LOCK_TIME)){
  215. $brute_force = false;
  216. break;
  217. }
  218. }
  219.  
  220. if($brute_force){
  221. /** Password is invalid. */
  222. $return_array['success'] = 0;
  223. //$return_array['msg'] = "The password you entered is invalid.";
  224. $return_array['msg'] = "Your account is locked. Try again later. ";
  225. $return_array['class'] = "error errorborder";
  226. return $return_array;
  227. }
  228. }
  229.  
  230. $return_array['sl_id'] = $this->data["users_fk_sl_id"][0];
  231.  
  232. if( $this->data["users_fk_adh_id"][0] > 0 )
  233. {
  234. $variable_intialization_array = array();
  235. $variable_intialization_array['host_db_id'] = $this->data["users_fk_adh_id"][0];
  236.  
  237. $active_directory_management = new ActiveDirectoryManagement( $variable_intialization_array );
  238.  
  239. if( $active_directory_management->ConnectToHost() )
  240. {
  241. if( $active_directory_management->BindToHost() )
  242. {
  243. if ( $active_directory_management->LoginAppUserToHost( $username, $password ) )
  244. {
  245. foreach ( $array_data as $key => $value )
  246. {
  247. if( $key != 'auto_user_name' && $key != 'auto_user_password' && $key != 'auto_login_user' )
  248. {
  249. $_SESSION[ $key ] = $value;
  250. }
  251. }
  252.  
  253. $_SESSION['np_data'] = $np_data;
  254. $this->FillArrayData();
  255.  
  256. $return_array['success'] = 1;
  257. }
  258. else
  259. {
  260. $return_array['success'] = 0;
  261. $return_array['msg'] = implode( ", ", $active_directory_management->GetExecError() );
  262. $return_array['class'] = "error errorborder";
  263. }
  264. }
  265. else
  266. {
  267. $return_array['success'] = 0;
  268. $return_array['msg'] = implode( ", ", $active_directory_management->GetExecError() );
  269. $return_array['class'] = "error errorborder";
  270. }
  271. }
  272. else
  273. {
  274. $return_array['success'] = 0;
  275. $return_array['msg'] = implode( ", ", $active_directory_management->GetExecError() );
  276. $return_array['class'] = "error errorborder";
  277. }
  278.  
  279. $active_directory_management->Destruct();
  280. return $return_array;
  281. }
  282. else
  283. {
  284. $password = CryptManagement::CheckIfNeedEncodeAndReturnString( $password );
  285.  
  286. /** Username exists, check if password matches */
  287. if( $this->data["users_u_password"][0] == $password )
  288. {
  289. foreach ( $array_data as $key => $value )
  290. {
  291. if( $key != 'auto_user_name' && $key != 'auto_user_password' && $key != 'auto_login_user' )
  292. {
  293. $_SESSION[ $key ] = $value;
  294. }
  295. }
  296. $_SESSION['np_data'] = $np_data;
  297.  
  298. $this->FillArrayData();
  299. $return_array['success'] = 1;
  300. return $return_array;
  301. }
  302. else
  303. {
  304. /** Password is invalid. */
  305. $return_array['success'] = 0;
  306. //$return_array['msg'] = "The password you entered is invalid.";
  307. $return_array['msg'] = "Username or Password are wrong.";
  308. $return_array['class'] = "error errorborder";
  309. return $return_array;
  310. }
  311. }
  312. }
  313. }
  314.  
  315.  
  316. /**
  317. * Fill Data to array
  318. *
  319. */
  320. function FillArrayData()
  321. {
  322. /** Login is valid */
  323. $this->digital_asset_user_id = $this->data["users_u_id"][0];
  324. $this->user_name = $this->data["users_u_name"][0];
  325. $this->user_password = $this->data["users_u_password"][0];
  326. $this->user_email = $this->data["users_u_email"][0];
  327. $this->user_fname = $this->data["users_u_first_name"][0];
  328. $this->user_lname = $this->data["users_u_last_name"][0];
  329. $this->user_profil = $this->data["users_u_profil"][0];
  330. $this->user_role = $this->data["users_u_role_id"][0];
  331. $this->user_role_profile = $this->data["users_u_profil"][0];
  332. $this->user_language = $this->data["users_u_lan"][0];
  333. $this->user_displayed_records = $this->data["users_u_displayed_records"][0];
  334. $this->user_theme_id = $this->data["users_u_theme_id"][0];
  335. $this->user_group_id = implode( ",", $this->data["ug_fk_groups_g_id"] );
  336. $this->user_color = $this->data["users_u_color"][0];
  337. $this->u_sort_by = $this->data["users_u_sort_by"][0];
  338. $this->user_default_page = $this->data["users_u_default_page"][0];
  339. $this->default_search_type = $this->data["users_u_default_search_type"][0];
  340. $this->user_default_sl_id = $this->data["users_fk_sl_id"][0];
  341. $this->user_default_view = $this->data["users_u_default_view"][0];
  342. $this->user_default_filter = $this->data["users_fk_filters_f_id"][0];
  343. $this->u_default_file_open = $this->data["users_u_default_file_open"][0];
  344. $this->u_path_home_page = $this->data["users_u_path_home_page"][0];
  345. $this->u_is_cache_deleted = $this->data["users_u_is_cache_deleted"][0];
  346. $this->u_auto_pagination = $this->data["users_u_auto_pagination"][0];
  347. $this->u_sl_deafult_search = $this->data["users_u_sl_default_search"][0];
  348. $this->u_visible_menu_items = $this->data["users_u_visible_menu_items"][0];
  349. $this->u_default_search_keywords = $this->data["users_u_default_search_keywords"][0];
  350. $this->u_is_approver = $this->data["users_u_is_approver"][0];
  351. $this->u_allow_external_access = $this->data["users_u_allow_external_access"][0];
  352.  
  353. /** Register Session Variables */
  354. $this->LoginAuthenticatedUser();
  355. }
  356.  
  357. /**
  358. * Register session variables and login an authenticated user.
  359. *
  360. * @param int $user_id
  361. * @param String $username
  362. * @param int $user_level
  363. */
  364. function LoginAuthenticatedUser()
  365. {
  366. /**
  367. * Getting data about the language from the language_management table
  368. */
  369. {
  370. $language_management = new LanguageManagement();
  371. $language_management->members_array = array( "lm_lang_name", "lm.lm_align", "lm.lm_dir", "lm.lm_type", "lm.lm_main_type");
  372.  
  373. $query_more = "";
  374.  
  375. $language_management->GetLanguages( $query_more );
  376. }
  377.  
  378. $_SESSION['digital_asset_user_id'] = $this->digital_asset_user_id;
  379. $_SESSION['user_name'] = $this->user_name;
  380. $_SESSION['user_password'] = $this->user_password;
  381. $_SESSION['user_email'] = $this->user_email;
  382. $_SESSION['user_fname'] = $this->user_fname;
  383. $_SESSION['user_lname'] = $this->user_lname;
  384. $_SESSION['user_profil'] = $this->user_profil;
  385. $_SESSION['user_role'] = $this->user_role;
  386. $_SESSION['user_role_profile'] = $this->user_role_profile;
  387. $_SESSION['user_language'] = $this->user_language;
  388. $_SESSION['user_displayed_records'] = $this->user_displayed_records;
  389. $_SESSION['user_theme_id'] = $this->user_theme_id;
  390. $_SESSION['user_color'] = $this->user_color;
  391. $_SESSION['user_sort_by'] = $this->u_sort_by;
  392. $_SESSION['u_branche_id'] = $this->u_branche_id;
  393. $_SESSION['user_default_page'] = $this->user_default_page;
  394. $_SESSION['default_search_type'] = $this->default_search_type;
  395. $_SESSION['user_default_sl_id'] = $this->user_default_sl_id;
  396. $_SESSION['user_default_view'] = $this->user_default_view;
  397. $_SESSION['user_default_filter'] = $this->user_default_filter;
  398. $_SESSION['u_default_file_open'] = $this->u_default_file_open;
  399. $_SESSION['time_of_login'] = time();
  400. $_SESSION['auto_pagination'] = $this->u_auto_pagination;
  401. $_SESSION['u_is_approver'] = $this->u_is_approver;
  402. $_SESSION['u_allow_external_access'] = $this->u_allow_external_access;
  403. $_SESSION['sl_default_search'] = $this->u_sl_deafult_search;
  404. $_SESSION['visible_menu_items'] = $this->u_visible_menu_items;
  405. $_SESSION['u_default_search_keywords'] = explode("|",$this->u_default_search_keywords);
  406.  
  407. $_SESSION['user_group_id'] = ( strlen( trim( $this->user_group_id ) ) > 0 ? $this->user_group_id : 0 ) ;
  408.  
  409. $lang_index = array_search( $_SESSION['user_language'], $language_management->data["lm_lm_main_type"] ) ;
  410.  
  411. {
  412. $_SESSION[$_SESSION['user_language']]['align'] = $language_management->data["lm_lm_align"][$lang_index];
  413. $_SESSION[$_SESSION['user_language']]['dir'] = $language_management->data["lm_lm_dir"][$lang_index];
  414. $_SESSION[$_SESSION['user_language']]['type'] = $language_management->data["lm_lm_type"][$lang_index];
  415. }
  416.  
  417. if( $this->user_default_sl_id > 0 && strlen( trim( $this->u_path_home_page ) ) > 0 )
  418. {
  419. $_SESSION['user_home_page'][ $this->digital_asset_user_id ][ $this->user_default_sl_id ] = $this->u_path_home_page;
  420. }
  421.  
  422. {
  423. $search_keywords_obj = new SearchKeywords();
  424. $query_more = "";
  425. $search_keywords_obj->members_array = array( "sk.sk_id", "sk.sk_name", "sk.sk_types" );
  426. $search_keywords_obj->GetSearchKeywords( $query_more );
  427.  
  428. for( $index = 0 ; $index < $search_keywords_obj->count ; $index++ )
  429. {
  430. $_SESSION['sk'][ $search_keywords_obj->data["sk_sk_name"][$index] ] = $search_keywords_obj->data["sk_sk_types"][$index];
  431. }
  432. }
  433.  
  434. {
  435. $sphinx_config_obj = new Sphinx();
  436. $sphinx_config_obj->members_array = array( "sc.sc_id", "sc.sc_property", "sc.sc_value" );
  437. $sphinx_config_obj->GetSphinxConfiguration( "" );
  438. $count = $sphinx_config_obj->count;
  439. $properties_array = $sphinx_config_obj->data["sc_sc_property"];
  440. $values_array = $sphinx_config_obj->data["sc_sc_value"];
  441.  
  442. $res_array = $sphinx_config_obj->BuildSphinxConfigurationArray( $properties_array, $values_array, $count );
  443.  
  444. $_SESSION['sphinx']['port'] = $res_array['sphinx_port'];
  445. }
  446.  
  447. {
  448. $this->BuildUserPrivilege();
  449. }
  450.  
  451. {/** fill privileges in session */
  452.  
  453. {/** Privilege actions */
  454.  
  455. $priv_obj = new PrivilegeManagement();
  456.  
  457. $priv_array = $priv_obj->GetStorageLocationPrivileges();
  458.  
  459. $action_code = $priv_array['action_code'];
  460. $access = $priv_array['access'];
  461. $roles = $priv_array['roles'];
  462.  
  463. for( $p = 0; $p < count( $action_code ); $p++ )
  464. {
  465. $_SESSION['privilege'][ $roles[$p] ][ $action_code[$p] ] = $access[$p];
  466. }
  467. }
  468. }
  469.  
  470. {
  471. $style_preferencees_obj = new ThemePreferences();
  472. $style_preferencees_obj->FillThemePreferences();
  473. }
  474.  
  475. $folder_permission_obj = new FolderPermission();
  476. $folder_permission_obj->FillAllowedUserPath();
  477.  
  478. //$this->RemoveUserSearchFiles();
  479. $this->CheckIfCacheDeleted();
  480. }
  481.  
  482. function CheckIfCacheDeleted()
  483. {
  484. if( $this->u_is_cache_deleted == 0 )
  485. {
  486. URLHelper::DeleteBrowserCache();
  487. $this->UpdateCacheAsDeleted( $this->digital_asset_user_id );
  488. }
  489. }
  490.  
  491. function UpdateCacheAsDeleted ( $user_id )
  492. {
  493. global $tableCollab;
  494.  
  495. $tmp_delete_cache = "UPDATE " . $tableCollab["users"] . " SET u_is_cache_deleted=1";
  496. $tmp_delete_cache .= " WHERE u_id = '" . $user_id . "'";
  497. AdvancedConnectSql( $tmp_delete_cache );
  498. }
  499.  
  500. function RemoveUserSearchFiles()
  501. {
  502. global $config;
  503. $path = $config['dam_path'] . "dspace/tmp/search/" . SessionHelper::GetUserID();
  504. is_dir($path) && DirectoryHelper::DeleteDirectory($path);
  505. }
  506.  
  507. /**
  508. * Delete User
  509. *
  510. * @param int $user_id
  511. */
  512. function DeleteUser ( $user_id, $deleted_by = 0 )
  513. {
  514. global $tableCollab;
  515.  
  516. $deleted_by = ( $deleted_by == 0 ? SessionHelper::GetUserID() : $deleted_by );
  517.  
  518. $tmp_delete_user = "UPDATE " . $tableCollab["users"] . " SET u_is_deleted=1, u_deleted_by=" . $deleted_by . ", u_deleted_date=NOW()";
  519. $tmp_delete_user .= " WHERE u_id = '" . $user_id . "'";
  520. AdvancedConnectSql( $tmp_delete_user );
  521. }
  522.  
  523. /**
  524. * Delete User
  525. *
  526. * @param int $user_id
  527. */
  528. function DisableUser ( $user_id )
  529. {
  530. global $tableCollab;
  531.  
  532. $tmp_delete_user = "UPDATE " . $tableCollab["users"] . " SET u_is_disabled=1";
  533. $tmp_delete_user .= " WHERE u_id = '" . $user_id . "'";
  534. AdvancedConnectSql( $tmp_delete_user );
  535. }
  536.  
  537. /**
  538. * Activate User
  539. *
  540. * @param int $user_id
  541. */
  542. function EnableUser ( $user_id )
  543. {
  544. global $tableCollab;
  545.  
  546. $tmp_delete_user = "UPDATE " . $tableCollab["users"] . " SET u_is_disabled=0";
  547. $tmp_delete_user .= " WHERE u_id = '" . $user_id . "'";
  548. AdvancedConnectSql( $tmp_delete_user );
  549. }
  550.  
  551. /**
  552. * Activate User
  553. *
  554. * @param int $user_id
  555. */
  556. function ActivateUser ( $user_id )
  557. {
  558. global $tableCollab;
  559.  
  560. $tmp_delete_user = "UPDATE " . $tableCollab["users"] . " SET u_is_deleted=0";
  561. $tmp_delete_user .= " WHERE u_id = '" . $user_id . "'";
  562. AdvancedConnectSql( $tmp_delete_user );
  563. }
  564.  
  565. /**
  566. * Activate User
  567. *
  568. * @param int $user_id
  569. */
  570. function EraseUser( $user_id )
  571. {
  572. global $tableCollab;
  573.  
  574. $perm_delete_user = "DELETE FROM " . $tableCollab["users"] . " WHERE u_id = '" . $user_id . "'";
  575. AdvancedConnectSql( $perm_delete_user );
  576. }
  577.  
  578. /**
  579. * Set default filter
  580. *
  581. * @param int $user_id
  582. */
  583. function SetDefaultFilter ( $filter_id )
  584. {
  585. global $tableCollab;
  586.  
  587. $tmp_update_user = "UPDATE " . $tableCollab["users"] . " SET fk_filters_f_id=" . $filter_id;
  588. $tmp_update_user .= " WHERE u_id = '" . SessionHelper::GetUserID() . "'";
  589. AdvancedConnectSql( $tmp_update_user );
  590.  
  591. $_SESSION['user_default_filter'] = $filter_id;
  592. }
  593.  
  594.  
  595. /**
  596. * Add new user
  597. *
  598. * @param Array $user_info_array
  599. * @param Object $language_management
  600. * @return Int
  601. */
  602. function AddUser( $user_info_array, &$language_management )
  603. {
  604. global $tableCollab;
  605.  
  606. $user_password = CryptManagement::CheckIfNeedEncodeAndReturnString( $user_info_array["user_password"] );
  607. $auto_pagination = $user_info_array["u_auto_pagination"] ? 1 : 0;
  608. $u_is_approver = $user_info_array["u_is_approver"] ? 1 : 0;
  609. $is_deleted = ( $user_info_array["is_deleted"] == 1 ? 1 : 0 );
  610. $u_allow_external_access = ( $user_info_array['u_allow_external_access'] == 1 ? 1 : 0 );
  611. $tmp_add_user = "INSERT INTO " . $tableCollab["users"]
  612. . "( u_name, u_password ,u_role_id,u_first_name,u_last_name,u_creation_date,u_created_by, u_profil, u_lan, u_displayed_records, u_theme_id, u_color, u_sort_by, u_email, fk_sl_id, u_default_page, u_default_search_type, fk_adh_id, u_default_view, fk_filters_f_id, u_allowed_file_owner, u_path_home_page, u_auto_pagination, u_allowed_assign_job, u_is_disabled, u_sl_default_search, u_is_deleted, u_is_archivist, u_is_approver, u_allow_external_access ) VALUES ('" . $user_info_array["user_name"] . "','" . $user_password . "','" . $user_info_array["user_role"] . "','" . $user_info_array["first_name"] . "','" . $user_info_array["last_name"] . "',now(), " . SessionHelper::GetUserID() . ",'1','" . $user_info_array["user_language"] . "', ". $user_info_array["displayed_records"] .", " . $user_info_array["user_theme"] . ", '" . $user_info_array["user_color"] . "', '" . $user_info_array["user_sort_by"] . "', '" . $user_info_array["user_email"] . "', " . $user_info_array["user_sl_id"] . ", '" . $user_info_array["default_page"] . "', '" . $user_info_array["default_search"] . "', '" . $user_info_array["user_adh"] . "', '" . $user_info_array["default_view"] . "', 0, " . $user_info_array["allowed_file_owner"] . ", '" . $user_info_array["u_path_home_page"] . "', " . $auto_pagination . ", " . $user_info_array['allowed_assign_job'] . ", 0, '". $user_info_array['default_search'] ."', " . $is_deleted . ", " . $user_info_array['u_is_archivist'] . ", " . $u_is_approver . ", " . $u_allow_external_access . ")";
  613.  
  614. $res = AdvancedConnectSql( $tmp_add_user );
  615.  
  616. if( !$res['query_error'] )
  617. {
  618. for( $i = 0 ; $i < count( $user_info_array["user_group"] ) ; $i++ )
  619. {
  620. if( $user_info_array["user_group"][$i] != "ALL" )
  621. {
  622. $tmp_add_user = "INSERT INTO " . $tableCollab["user_group"]
  623. . "( fk_groups_g_id, fk_users_u_id ) VALUES (" . $user_info_array["user_group"][$i] . "," . $res["last_id"] . ")";
  624.  
  625. AdvancedConnectSql( $tmp_add_user );
  626.  
  627. $insert_permission = "INSERT IGNORE INTO " . $tableCollab['maintenance_users_permissions_run'] . " ( mupr_type, mupr_user_group_id) VALUES ('group', " . $user_info_array["user_group"][$i] . ")";
  628. $errors = AdvancedConnectSql( $insert_permission );
  629. }
  630. }
  631. }
  632.  
  633. $return_array = array(
  634. "query_error" => $res['query_error'],
  635. "last_id" => $res["last_id"]
  636. );
  637.  
  638. return $return_array;
  639. }
  640.  
  641. /**
  642. * Edit Profile
  643. *
  644. * @param array $user_info_array
  645. * @param array $language_management
  646. * @return array $res
  647. */
  648.  
  649. function EditProfile( $user_info_array, &$language_management )
  650. {
  651. //echo "<pre>"; print_r($user_info_array); exit;
  652. global $tableCollab;
  653.  
  654. if ($user_info_array["user_theme"] > 0)
  655. {
  656. $theme_obj = new ThemePreferences();
  657. $theme_obj->members_array = array('tp.tp_header_bg');
  658. $more = " WHERE tp_id='" . $user_info_array["user_theme"] . "'";
  659. $theme_obj->GetThemePreferences($more);
  660. $color = $theme_obj->data['tp_tp_header_bg'][0];
  661.  
  662. if ( $color != "" )
  663. {
  664. {
  665. $default_css_path = '../themes/original/css/default.css';
  666. $destination_css_path = '../../backup/themes/theme' . $user_info_array["user_theme"] . '.css';
  667.  
  668. $css_buffer = file_get_contents($default_css_path);
  669. ob_start();
  670. $keywords = array( '#2679A8', '#2585e5', '#1d6186', '#1a5779', '#3ca5e0', 'rgb(38, 121, 168)' );
  671. $colors = array($color);
  672. $css_buffer = str_replace($keywords ,$color ,$css_buffer );
  673. echo $css_buffer;
  674. $new_css = ob_get_clean();
  675.  
  676. PrintHelper::WriteToFile($destination_css_path,'w',$new_css);
  677. }
  678.  
  679. {
  680. $default_ar_css_path = '../themes/original/css/default-ar.css';
  681. $destination_ar_css_path = '../../backup/themes/theme' . $user_info_array["user_theme"] . '-ar.css';
  682.  
  683. $css_buffer = file_get_contents($default_ar_css_path);
  684. ob_start();
  685. $keywords = array( '#2679A8', '#2585e5', '#1d6186', '#1a5779', '#3ca5e0', 'rgb(38, 121, 168)' );
  686. $colors = array($color);
  687. $css_buffer = str_replace($keywords ,$color ,$css_buffer );
  688. echo $css_buffer;
  689. $new_css = ob_get_clean();
  690.  
  691. PrintHelper::WriteToFile($destination_ar_css_path,'w',$new_css);
  692. }
  693. }
  694. }
  695.  
  696. $tmp_edit_user = "UPDATE " . $tableCollab["users"] . " SET u_name='" . $user_info_array["user_name"] . "'";
  697.  
  698. if( strlen( trim( $user_info_array["user_password"] ) ) > 0 )
  699. {
  700. $user_password = CryptManagement::CheckIfNeedEncodeAndReturnString( $user_info_array["user_password"] );
  701. $tmp_edit_user .= ", u_password ='" . $user_password . "' ";
  702. }
  703.  
  704. $tmp_edit_user .= ", u_first_name='" . $user_info_array["first_name"] . "', u_last_name='" . $user_info_array["last_name"] . "',u_lan ='" . $user_info_array["user_language"] . "', u_displayed_records='". $user_info_array["displayed_records"] ."', u_theme_id=" . $user_info_array["user_theme"] . ",u_color='" . $user_info_array["user_color"] . "', u_sort_by='" . $user_info_array["user_sort_by"] . "', u_email='" . $user_info_array["user_email"] . "'" . ", fk_sl_id=" . $user_info_array["user_sl_id"] . ", u_default_page='" . $user_info_array["default_page"] . "', u_default_search_type='" . $user_info_array["default_search"] . "', u_default_view = '" . $user_info_array["default_view"] ."', u_default_file_open = '" . $user_info_array["u_default_file_open"] . "', u_auto_pagination = '" . $user_info_array["u_auto_pagination"] . "', u_visible_menu_items = '" . $user_info_array["visible_menu_items"] . "', u_sl_default_search = '" . $user_info_array['sl_default_search']."', u_default_search_keywords='" . implode("|", $user_info_array["my_profile_search_keywords"]) . "'";
  705. $tmp_edit_user .= " WHERE u_id = '" . $user_info_array['user_id'] . "'";
  706. $res = AdvancedConnectSql( $tmp_edit_user );
  707.  
  708. if( $res['query_error'] == 0 )
  709. {
  710. if( strlen( trim( $user_info_array["user_password"] ) ) > 0 )
  711. {
  712. $file_logs_obj = new FileLogs();
  713. $extra_array = array();
  714. $extra_array['desc'] = "%change_of_user_password% : " . $user_info_array["first_name"] . " " . $user_info_array["last_name"];
  715. $extra_array['sf_id'] = 0;
  716.  
  717. $file_logs_obj->InsertLog( '', 83, $extra_array );
  718. }
  719.  
  720. if( $user_info_array['user_id'] == SessionHelper::GetUserID() )
  721. {
  722. $_SESSION['user_displayed_records'] = $user_info_array["displayed_records"];
  723. $this->UpdateUserStyle( $user_info_array["user_theme"] );
  724. }
  725.  
  726. $_SESSION['user_language'] = $user_info_array["user_language"];
  727.  
  728. $lang_index = array_search( $_SESSION['user_language'], $language_management->data["lm_lm_main_type"] ) ;
  729.  
  730. {
  731. $_SESSION[$_SESSION['user_language']]['align'] = $language_management->data["lm_lm_align"][$lang_index];
  732. $_SESSION[$_SESSION['user_language']]['dir'] = $language_management->data["lm_lm_dir"][$lang_index];
  733. $_SESSION[$_SESSION['user_language']]['type'] = $language_management->data["lm_lm_type"][$lang_index];
  734. }
  735.  
  736.  
  737.  
  738. if( $user_info_array['user_id'] == SessionHelper::GetUserID() )
  739. {
  740. $_SESSION['user_name'] = $user_info_array["user_name"];
  741. $_SESSION['user_fname'] = $user_info_array["first_name"];
  742. $_SESSION['user_lname'] = $user_info_array["last_name"];
  743. $_SESSION['user_role'] = $user_info_array["user_role"];
  744. $_SESSION['user_language'] = $user_info_array["user_language"];
  745. $_SESSION['user_displayed_records'] = $user_info_array["displayed_records"];
  746. $_SESSION['user_theme_id'] = $user_info_array["user_theme"];
  747. $_SESSION['visible_menu_items'] = $user_info_array["visible_menu_items"];
  748. $_SESSION['user_group_id'] = implode( ",", $user_info_array["user_group"] );
  749. $_SESSION['sl_default_search'] = $user_info_array["sl_default_search"];
  750. $_SESSION['u_default_search_keywords'] = $user_info_array["my_profile_search_keywords"];
  751.  
  752. $query_cond = " WHERE users.u_id = '" . SessionHelper::GetUserID() . "'";
  753. $this->query_joins_array = array("user_group");
  754.  
  755. $this->members_array = array( "users.u_id","users.u_profil", "users.u_default_search_keywords" ,"users.u_password", "users.u_name", "users.u_role_id", "users.u_first_name", "users.u_last_name", "users.u_lan", "users.u_displayed_records", "users.u_theme_id", "ug.fk_groups_g_id", "users.fk_adh_id", "users.u_color", "users.u_sort_by", "users.u_default_page", "users.u_default_search_type", "users.u_default_view", "users.u_default_file_open", "users.u_path_home_page", "users.u_auto_pagination", "users.u_visible_menu_items", "users.u_sl_default_search", "users.u_is_approver" );
  756. $this->GetUsers( $query_cond );
  757. $this->FillArrayData();
  758. }
  759. }
  760.  
  761. return $res['query_error'];
  762. }
  763.  
  764. function EditUser( $user_info_array, &$language_management )
  765. {
  766. global $tableCollab;
  767.  
  768. $u_is_approver = $user_info_array["u_is_approver"] ? 1 : 0;
  769.  
  770. $tmp_edit_user = "UPDATE " . $tableCollab["users"] . " SET u_name='" . $user_info_array["user_name"] . "'";
  771.  
  772. if(strlen(trim( $user_info_array["user_password"] ) ) > 0 )
  773. {
  774. $user_password = CryptManagement::CheckIfNeedEncodeAndReturnString( $user_info_array["user_password"] );
  775.  
  776. $tmp_edit_user .= ", u_password ='" . $user_password . "' ";
  777. }
  778.  
  779. $tmp_edit_user .= ", u_role_id='" . $user_info_array["user_role"] . "', u_first_name='" . $user_info_array["first_name"] . "', u_last_name='" . $user_info_array["last_name"] . "',u_lan ='" . $user_info_array["user_language"] . "', u_displayed_records='". $user_info_array["displayed_records"] ."', u_theme_id=" . $user_info_array["user_theme"] . ",u_color='" . $user_info_array["user_color"] . "', u_sort_by='" . $user_info_array["user_sort_by"] . "', u_email='" . $user_info_array["user_email"] . "'" . ", fk_sl_id=" . $user_info_array["user_sl_id"] . ", u_default_page='" . $user_info_array["default_page"] . "', u_default_search_type='" . $user_info_array["default_search"] . "', fk_adh_id='" . $user_info_array["user_adh"] . "', u_default_view = '" . $user_info_array["default_view"] ."', u_default_file_open = '" . $user_info_array["u_default_file_open"] . "', u_allowed_file_owner = '" . $user_info_array["allowed_file_owner"] . "', u_path_home_page = '" . $user_info_array["u_path_home_page"] . "', u_allowed_assign_job= '" . $user_info_array["allowed_assign_job"] . "'";
  780.  
  781. if( $user_info_array["u_is_archivist"] >= 0 )
  782. {
  783. $tmp_edit_user .= ", u_is_archivist = '" . $user_info_array["u_is_archivist"] . "'";
  784. }
  785.  
  786. if( $user_info_array["u_sl_default_search"] != 0 )
  787. {
  788. $tmp_edit_user .= ", u_sl_default_search = '" . $user_info_array["u_sl_default_search"] . "'";
  789. }
  790.  
  791. if( $user_info_array["u_is_approver"] != 0 )
  792. {
  793. $tmp_edit_user .= ", u_is_approver = '" . $user_info_array["u_is_approver"] . "'";
  794. }
  795.  
  796. if( $user_info_array["u_is_approver"] != 0 )
  797. {
  798. $tmp_edit_user .= ", u_is_approver = '" . $user_info_array["u_is_approver"] . "'";
  799. }
  800.  
  801. if( $user_info_array["u_allow_external_access"] >= 0 )
  802. {
  803. $tmp_edit_user .= ", u_allow_external_access = '" . $user_info_array["u_allow_external_access"] . "'";
  804. }
  805.  
  806. $tmp_edit_user .= " WHERE u_id = '" . $user_info_array['user_id'] . "'";
  807.  
  808. $res = AdvancedConnectSql( $tmp_edit_user );
  809.  
  810. if( $res['query_error'] == 0 )
  811. {
  812. if( strlen( trim( $user_info_array["user_password"] ) ) > 0 )
  813. {
  814. $file_logs_obj = new FileLogs();
  815. $extra_array = array();
  816. $extra_array['desc'] = "%change_of_user_password% : " . $user_info_array["first_name"] . " " . $user_info_array["last_name"];
  817. $extra_array['sf_id'] = 0;
  818.  
  819. $file_logs_obj->InsertLog( '', 83, $extra_array );
  820. }
  821.  
  822. if( $user_info_array["old_user_adh"] != $user_info_array["user_adh"] )
  823. {
  824. $file_logs_obj = new FileLogs();
  825. $extra_array = array();
  826. $extra_array['desc'] = "%change_of_authentication_type% : " . $user_info_array["first_name"] . " " . $user_info_array["last_name"];
  827. $extra_array['sf_id'] = 0;
  828.  
  829. $file_logs_obj->InsertLog( '', 85, $extra_array );
  830. }
  831.  
  832. {
  833. $user_group_obj = new Groups();
  834. $user_group_obj->members_array = array( "ug.fk_users_u_id", "ug.fk_groups_g_id" );
  835. $query_more = " WHERE ug.fk_users_u_id=" . $user_info_array["user_id"];
  836. $user_group_obj->GetUserGroups( $query_more );
  837.  
  838. for( $i = 0 ; $i < $user_group_obj->count ; $i++ )
  839. {
  840. $insert_permission = "INSERT IGNORE INTO " . $tableCollab['maintenance_users_permissions_run'] . " ( mupr_type, mupr_user_group_id) VALUES ('group', " . $user_group_obj->data[ "ug_fk_groups_g_id" ][$i] . ")";
  841. $errors = AdvancedConnectSql( $insert_permission );
  842. }
  843. }
  844.  
  845. $tmp_delete = "DELETE FROM " . $tableCollab["user_group"];
  846. $tmp_delete .= " WHERE fk_users_u_id = '" . $user_info_array["user_id"] . "'";
  847. AdvancedConnectSql( $tmp_delete );
  848.  
  849. for( $i = 0 ; $i < count( $user_info_array["user_group"] ) ; $i++ )
  850. {
  851. if( $res_1['affected_rows'] == 0 && $user_info_array["user_group"][$i] != "ALL" )
  852. {
  853. $tmp_edit_group = "INSERT INTO " . $tableCollab["user_group"]
  854. . "( fk_groups_g_id, fk_users_u_id ) VALUES (" . $user_info_array["user_group"][$i] . "," . $user_info_array['user_id'] . ")";
  855. AdvancedConnectSql( $tmp_edit_group );
  856.  
  857. $insert_permission = "INSERT IGNORE INTO " . $tableCollab['maintenance_users_permissions_run'] . " ( mupr_type, mupr_user_group_id) VALUES ('group', " . $user_info_array["user_group"][$i] . ")";
  858. $errors = AdvancedConnectSql( $insert_permission );
  859. }
  860. }
  861.  
  862. if( $user_info_array['user_id'] == SessionHelper::GetUserID() )
  863. {
  864. $lang_index = array_search( $_SESSION['user_language'], $language_management->data["lm_lm_main_type"] ) ;
  865.  
  866. $_SESSION[$_SESSION['user_language']]['align'] = $language_management->data["lm_lm_align"][$lang_index];
  867. $_SESSION[$_SESSION['user_language']]['dir'] = $language_management->data["lm_lm_dir"][$lang_index];
  868. $_SESSION[$_SESSION['user_language']]['type'] = $language_management->data["lm_lm_type"][$lang_index];
  869.  
  870. $_SESSION['user_language'] = $user_info_array["user_language"];
  871. $_SESSION['user_name'] = $user_info_array["user_name"];
  872. $_SESSION['user_fname'] = $user_info_array["first_name"];
  873. $_SESSION['user_lname'] = $user_info_array["last_name"];
  874. $_SESSION['user_role'] = $user_info_array["user_role"];
  875. $_SESSION['user_language'] = $user_info_array["user_language"];
  876. $_SESSION['user_displayed_records'] = $user_info_array["displayed_records"];
  877. $_SESSION['user_theme_id'] = $user_info_array["user_theme"];
  878. $_SESSION['user_group_id'] = implode( ",", $user_info_array["user_group"] );
  879. $_SESSION['sl_default_search'] = $user_info_array["sl_default_search"];
  880.  
  881. $_SESSION['user_displayed_records'] = $user_info_array["displayed_records"];
  882. $this->UpdateUserStyle( $user_info_array["user_theme"] );
  883.  
  884. $query_cond = " WHERE users.u_id = '" . SessionHelper::GetUserID() . "'";
  885. $this->query_joins_array = array("user_group");
  886.  
  887. $this->members_array = array( "users.u_id","users.u_profil", "users.u_password", "users.u_name", "users.u_role_id", "users.u_first_name", "users.u_last_name", "users.u_lan", "users.u_displayed_records", "users.u_theme_id", "ug.fk_groups_g_id", "users.fk_adh_id", "users.u_color", "users.u_sort_by", "users.u_default_page", "users.u_default_search_type", "users.u_default_view", "users.u_default_file_open", "users.u_path_home_page", "users.u_auto_pagination", "users.u_sl_default_search", "users.u_is_approver" );
  888. $this->GetUsers( $query_cond );
  889. $this->FillArrayData();
  890. }
  891. }
  892.  
  893. return $res['query_error'];
  894. }
  895.  
  896. function UpdateUserStyle( $user_style )
  897. {
  898. $_SESSION['user_theme_id'] = $user_style;
  899.  
  900. $style_preferencees_obj = new ThemePreferences();
  901.  
  902. $style_preferencees_obj->FillThemePreferences();
  903. }
  904.  
  905. /**
  906. * fill all privilege in session
  907. *
  908. */
  909. function BuildUserPrivilege()
  910. {
  911. $role_priv = new PrivilegeManagement();
  912.  
  913. $role_query_cond .= ' WHERE rolepriv.fk_role_r_id = ' . $_SESSION['user_role'];
  914.  
  915. $role_priv->members_array = array( "rolepriv.rp_id", "rolepriv.fk_role_r_id", "rolepriv.rp_action_code", "rolepriv.rp_privilege" );
  916. $role_priv->GetRolePrivileges( $role_query_cond );
  917.  
  918. for( $i = 0 ; $i < $role_priv->count ; $i++ )
  919. {
  920. $_SESSION['privilege'][ $role_priv->data['rolepriv_fk_role_r_id'][$i] ][ $role_priv->data['rolepriv_rp_action_code'][$i] ] = $role_priv->data['rolepriv_rp_privilege'][$i];
  921. }
  922. }
  923.  
  924. function SplitNPData( $np_data )
  925. {
  926. $np_array_data = array();
  927. $data = explode( ";;", $np_data );
  928.  
  929. for( $i = 0 ; $i < count( $data ) ; $i++ )
  930. {
  931. $split_data = explode( ":", $data[$i] );
  932.  
  933. switch ( $split_data[0] )
  934. {
  935. case "auto_user_name":
  936. $np_array_data[ "auto_user_name" ] = $split_data[1];
  937. break;
  938. case "auto_user_password":
  939. $np_array_data[ "auto_user_password" ] = $split_data[1];
  940. break;
  941. default:
  942. $np_array_data[ $split_data[0] ] = $split_data[1];
  943. break;
  944. }
  945. }
  946.  
  947. return $np_array_data;
  948. }
  949.  
  950. /**
  951. * Apply Function To All Users
  952. *
  953. * @param array $post_data
  954. */
  955. function ApplyFunctionsToAllUsers( $post_data )
  956. {
  957. global $tableCollab;
  958.  
  959. $update_query = "UPDATE " . $tableCollab["users"] . " SET ";
  960.  
  961. if( isset( $_POST['sort_by_check'] ))
  962. {
  963. $post_array['u_sort_by'] = "u_sort_by='" . $post_data['u_sort_by'] . "'";
  964. }
  965. if( isset( $_POST['displayed_record_check'] ) )
  966. {
  967. $post_array['u_displayed_records'] = "u_displayed_records='" . $post_data['displayed_records'] . "'";
  968. }
  969. if( isset( $_POST['default_open_file_check'] ) )
  970. {
  971. $post_array['u_default_file_open'] = "u_default_file_open='" . $post_data['u_default_file_open'] . "'" ;
  972. }
  973. if( isset( $_POST['default_view_check'] ) )
  974. {
  975. $post_array['u_default_view'] = "u_default_view='" . $post_data['default_view'] . "'";
  976. }
  977. if( isset( $_POST['default_page_check'] ) )
  978. {
  979. $post_array['u_default_page'] = "u_default_page='" . $post_data['default_page'] . "'";
  980. }
  981. if( isset( $_POST['default_search_check'] ) )
  982. {
  983. $post_array['default_search_check'] = "u_default_search_type='" . $post_data['default_search'] . "'";
  984. }
  985. if( isset( $_POST['themes_check'] ) )
  986. {
  987. $post_array['themes_check'] = "u_theme_id='" . $post_data['themes'] . "'";
  988. }
  989. if( isset( $_POST['keywords_check'] ) )
  990. {
  991. $my_profile_search_keywords = $post_data['my_profile_search_keywords'];
  992.  
  993. $post_array['default_search_keywords'] = "u_default_search_keywords='" . implode("|", $my_profile_search_keywords) . "'";
  994.  
  995. }
  996.  
  997. $implode .= implode(',',$post_array);
  998.  
  999. $update_query .= $implode ;
  1000. $res = AdvancedConnectSql( $update_query );
  1001.  
  1002. return $res['query_error'];
  1003. }
  1004.  
  1005. public static function MarkAsNotifiedNow()
  1006. {
  1007. global $tableCollab;
  1008.  
  1009. $update = "UPDATE " . $tableCollab['users'] . " SET u_last_notified=NOW() WHERE u_id='" . SessionHelper::GetUserID() . "'";
  1010. $res = AdvancedConnectSql($update);
  1011.  
  1012. return $res;
  1013. }
  1014.  
  1015. public static function GetUserIfAllowedAssignJob( $user_id = 0 )
  1016. {
  1017. $user_id = empty($user_id) ? ( strlen( trim( SessionHelper::GetUserID() ) ) > 0 ? SessionHelper::GetUserID() : 0 ) : $user_id;
  1018. $users_obj = new UsersManagement();
  1019. $users_obj->members_array = array( 'users.u_allowed_assign_job' );
  1020. $query_more = ' WHERE users.u_id=' . $user_id;
  1021. $users_obj->GetUsers( $query_more );
  1022.  
  1023. $u_allowed_assign_job = empty($users_obj->data["users_u_allowed_assign_job"][0]) ? 0 : 1;
  1024.  
  1025. return $u_allowed_assign_job;
  1026. }
  1027.  
  1028. function FillNPData()
  1029. {
  1030. if( isset( $_SESSION['np_data'] ) && !isset( $_SESSION['np_user_id'] ) )
  1031. {
  1032. $np_data = $this->SplitNPData( $_SESSION['np_data'] );
  1033.  
  1034. foreach ( $np_data as $key => $value )
  1035. {
  1036. if( $key != 'auto_user_name' && $key != 'auto_user_password' && $key != 'auto_login_user' )
  1037. {
  1038. $_SESSION[ $key ] = $value;
  1039. }
  1040. }
  1041. }
  1042. }
  1043. }
  1044.  
  1045. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement