[P2-php-svn] [900] expack:

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 1月 10日 (月) 23:49:29 JST


Revision: 900
          http://sourceforge.jp/projects/p2-php/svn/view?view=rev&revision=900
Author:   rsk
Date:     2011-01-10 23:49:28 +0900 (Mon, 10 Jan 2011)

Log Message:
-----------
expack:
- devicePixelRatio関連のバグ修正。

Modified Paths:
--------------
    p2ex/trunk/lib/Login.php


-------------- next part --------------
Modified: p2ex/trunk/lib/Login.php
===================================================================
--- p2ex/trunk/lib/Login.php	2011-01-10 12:33:14 UTC (rev 899)
+++ p2ex/trunk/lib/Login.php	2011-01-10 14:49:28 UTC (rev 900)
@@ -778,6 +778,9 @@
         $user_time  = $user_u . ':' . time() . ':';
         $md5_utpx = md5($user_time . $pass_x);
         $cid_src  = $user_time . $md5_utpx;
+        if (isset($_SESSION['device_pixel_ratio'])) {
+            $cid_src .= ':' . $_SESSION['device_pixel_ratio'];
+        }
         return MD5Crypt::encrypt($cid_src, self::getMd5CryptPassForCid());
     }
 
@@ -796,8 +799,19 @@
         $dec = MD5Crypt::decrypt($cid, self::getMd5CryptPassForCid());
 
         $cid_info = explode(':', $dec);
-        if (count($cid_info) != 3) {
-            return false;
+        switch (count($cid_info)) {
+            case 3:
+                break;
+            case 4:
+                $device_pixel_ratio = floatval(array_pop($cid_info));
+                if (isset($GLOBALS['_p2session'])
+                    && ($device_pixel_ratio === 1.5 || $device_pixel_ratio === 2.0)
+                ) {
+                    $_SESSION['device_pixel_ratio'] = $device_pixel_ratio;
+                }
+                break;
+            default:
+                return false;
         }
 
         list($user, $time, $md5_utpx) = $cid_info;



P2-php-svn メーリングリストの案内
Back to archive index