Changeset 1442
- Timestamp:
- 04/16/06 21:10:16 (3 years ago)
- Location:
- trunk/rss
- Files:
-
- 2 modified
-
cls/user.php (modified) (8 diffs)
-
themes/default/mobile/plugins.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/rss/cls/user.php
r1439 r1442 42 42 /** List of valid IP subnets this user is allowed to log in via a cookie */ 43 43 var $_validIPs; 44 /** Mobile session */ 45 var $_mobileSession; 44 46 45 47 /** … … 51 53 */ 52 54 function RSSUser() { 55 56 // We need sessions for the mobile version 57 ini_set('session.use_trans_sid',true); 58 session_start(); 59 53 60 $this -> _uid = 0; 54 61 $this -> _validIPs = array(); … … 57 64 $this -> _realName = ''; 58 65 $this -> _hash = null; 59 66 $this -> _mobileSession = (isset($_POST['media']) && 'mobile' == $_POST['media']); 67 60 68 if (array_key_exists('logout',$_GET)) { 61 69 $this -> logout(); 62 70 rss_redirect(''); 63 71 } 64 72 65 73 $cuname = $chash = null; 66 74 if (isset($_POST['username']) && isset($_POST['password'])) { 67 75 $_cuname = trim($_POST['username']); 68 $_chash = md5($_POST['password']); 76 if ($this -> _mobileSession) { 77 $_chash = md5(md5($_POST['password'] . $_POST['username'])); 78 } else { 79 $_chash = md5($_POST['password']); 80 } 69 81 if ($this -> login($_cuname,$_chash)) { 70 82 $cuname = $_cuname; … … 77 89 elseif(isset($_SESSION['mobile'])) { 78 90 list($cuname,$chash) = explode('|',$_SESSION['mobile']); 91 $this -> _mobileSession = true; 79 92 } 80 93 if ($cuname && $chash) { … … 124 137 ." where uname = '$uname' "; 125 138 rss_query($sql); 126 $this -> setUserCookie($uname,$pass); 139 if ($this -> _mobileSession) { 140 $this -> setUserSession($uname,$pass); 141 } else { 142 $this -> setUserCookie($uname,$pass); 143 } 127 144 rss_invalidate_cache(); 128 145 return true; … … 136 153 */ 137 154 function setUserCookie($user,$hash) { 138 // if (getConfig('rss.config.autologout')) { 139 // $t = 0; 140 // } else { 141 $t =time()+COOKIE_LIFESPAN; 142 // } 155 $rs = rss_query( 156 'select value_ from ' .getTable('config') . "where key_ = 'rss.config.autologout'", false,true); 157 if (rss_is_sql_error(RSS_SQL_ERROR_NO_ERROR) && rss_num_rows($rs) > 0) { 158 list($als) = rss_fetch_row($rs); 159 $al = ($als == 'true'); 160 } else { 161 $al = false; 162 } 163 $t = $al ? 0: time()+COOKIE_LIFESPAN; 143 164 setcookie(RSS_USER_COOKIE, $user .'|' . $hash , $t, getPath()); 144 165 } 145 166 167 function setUserSession($user,$hash) { 168 $_SESSION['mobile'] = $user . "|" . $hash; 169 } 170 146 171 /** 147 172 * Logs the user out. … … 151 176 */ 152 177 function logout() { 153 if (array_key_exists(RSS_USER_COOKIE, $_COOKIE) ) {178 if (array_key_exists(RSS_USER_COOKIE, $_COOKIE) || isset($_SESSION['mobile'])) { 154 179 $subnet = preg_replace('#^([0-9]+\.[0-9]+\.[0-9]+)\.[0-9]+$#','\1',$_SERVER['REMOTE_ADDR']); 155 180 … … 169 194 unset($_COOKIE[RSS_USER_COOKIE]); 170 195 setcookie(RSS_USER_COOKIE, "", -1, getPath()); 196 if (isset($_SESSION['mobile'])) { 197 unset($_SESSION['mobile']); 198 } 199 171 200 rss_invalidate_cache(); 172 201 } -
trunk/rss/themes/default/mobile/plugins.php
r1434 r1442 3 3 // stores constants for overrides' defaults 4 4 require_once('mobileconstants.php'); 5 6 // Mobile theme relys on PHP sessions7 ini_set('session.use_trans_sid',true);8 session_start();9 10 //var_dump($_SESSION['mobile']);11 5 12 6 function __mobile_strip_images($i) {
