|
From: Jon O. <jon...@us...> - 2006-06-30 12:24:41
|
Update of /cvsroot/mxbb/mx_simpledoc/simpledoc/includes In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv21570/modules/mx_simpledoc/simpledoc/includes Modified Files: functions_cache.php functions_simpledoc.php Log Message: fixes for Edit Lock Index: functions_cache.php =================================================================== RCS file: /cvsroot/mxbb/mx_simpledoc/simpledoc/includes/functions_cache.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** functions_cache.php 17 Jun 2006 20:50:47 -0000 1.2 --- functions_cache.php 30 Jun 2006 12:24:38 -0000 1.3 *************** *** 24,27 **** --- 24,28 ---- global $phpbb_root_path; global $mx_root_path, $module_root_path, $is_block, $phpEx; + $this->cache_dir = $module_root_path . 'simpledoc/cache/'; } Index: functions_simpledoc.php =================================================================== RCS file: /cvsroot/mxbb/mx_simpledoc/simpledoc/includes/functions_simpledoc.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** functions_simpledoc.php 30 Jun 2006 11:17:24 -0000 1.3 --- functions_simpledoc.php 30 Jun 2006 12:24:38 -0000 1.4 *************** *** 419,423 **** { $edit_lock = $mx_simpledoc_cache->get( 'edit_lock' ); ! die('use_cache' . var_export($edit_lock)); } else --- 419,456 ---- { $edit_lock = $mx_simpledoc_cache->get( 'edit_lock' ); ! ! // ! // Is cached simpledoc user online? ! // ! $sql = "SELECT u.username, u.user_id, u.user_level ! FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s ! WHERE u.user_id = s.session_user_id ! AND u.user_id = " . $edit_lock['user_id'] . " ! AND s.session_logged_in = '1' ! ORDER BY u.username ASC, s.session_ip ASC"; ! ! if( !($result = $db->sql_query($sql)) ) ! { ! mx_message_die(GENERAL_ERROR, 'Could not obtain user/online information', '', __LINE__, __FILE__, $sql); ! } ! ! $row = array(); ! if( $total_users = $db->sql_numrows($result) ) ! { ! $row = $db->sql_fetchrow($result); ! } ! $db->sql_freeresult($result); ! ! if ($total_users == 0) ! { ! $edit_lock['user_id'] = $userdata['user_id']; ! $edit_lock['user_name'] = $userdata['username']; ! $mx_simpledoc_cache->put( 'edit_lock', $edit_lock ); ! } ! else if ($userdata['user_id'] != $row['user_id']) ! { ! return false; ! } ! } else *************** *** 425,446 **** $edit_lock['user_id'] = $userdata['user_id']; $edit_lock['user_name'] = $userdata['username']; ! $mx_simpledoc_cache->put( 'config', $edit_lock ); ! die('recaching...' . var_export($edit_lock)); } ! echo(var_export($edit_lock)); ! ! /* ! $sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, u.user_level, s.session_logged_in, s.session_ip ! FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s ! WHERE u.user_id = s.session_user_id ! AND s.session_time >= ".( time() - 300 ) . " ! ORDER BY u.username ASC, s.session_ip ASC"; ! ! if( !($result = $db->sql_query($sql)) ) ! { ! mx_message_die(GENERAL_ERROR, 'Could not obtain user/online information', '', __LINE__, __FILE__, $sql); ! } ! */ } } --- 458,465 ---- $edit_lock['user_id'] = $userdata['user_id']; $edit_lock['user_name'] = $userdata['username']; ! $mx_simpledoc_cache->put( 'edit_lock', $edit_lock ); } ! return true; } } |