OSDN Git Service

BugTrack2/236: If you compare two numerical strings, they are compared as integers
authorhenoheno <henoheno>
Sat, 6 Oct 2007 13:20:59 +0000 (22:20 +0900)
committerumorigu <umorigu@gmail.com>
Sun, 30 Nov 2014 02:20:42 +0000 (11:20 +0900)
lib/file.php
lib/link.php
lib/make_link.php
plugin/edit.inc.php
plugin/include.inc.php
plugin/menu.inc.php
plugin/navi.inc.php
plugin/popular.inc.php
plugin/rename.inc.php

index 54023be..400c204 100644 (file)
@@ -415,7 +415,7 @@ function put_lastmodified()
        // Check ALL filetime
        $recent_pages = array();
        foreach($pages as $page)
-               if ($page != $whatsnew && ! check_non_list($page))
+               if ($page !== $whatsnew && ! check_non_list($page))
                        $recent_pages[$page] = get_filetime($page);
 
        // Sort decending order of last-modification date
@@ -713,7 +713,7 @@ function links_get_related($page)
        if (isset($links[$page])) return $links[$page];
 
        // If possible, merge related pages generated by make_link()
-       $links[$page] = ($page == $vars['page']) ? $related : array();
+       $links[$page] = ($page === $vars['page']) ? $related : array();
 
        // Get repated pages from DB
        $links[$page] += links_get_related_db($vars['page']);
index f0fea50..b105364 100644 (file)
@@ -67,7 +67,7 @@ function links_update($page)
        $links    = links_get_objects($page, TRUE);
        foreach ($links as $_obj) {
                if (! isset($_obj->type) || $_obj->type != 'pagename' ||
-                   $_obj->name == $page || $_obj->name == '')
+                   $_obj->name === $page || $_obj->name == '')
                        continue;
 
                if (is_a($_obj, 'Link_autolink')) { // ¹Ôµ·¤¬°­¤¤
@@ -109,7 +109,7 @@ function links_update($page)
                $search_non_list = 1;
                $pages           = do_search($page, 'AND', TRUE);
                foreach ($pages as $_page) {
-                       if ($_page != $page)
+                       if ($_page !== $page)
                                links_update($_page);
                }
        }
@@ -193,7 +193,7 @@ function links_add($page, $add, $rel_auto)
                        foreach (file($ref_file) as $line) {
                                list($ref_page, $ref_auto) = explode("\t", rtrim($line));
                                if (! $ref_auto) $all_auto = FALSE;
-                               if ($ref_page != $page) $ref .= $line;
+                               if ($ref_page !== $page) $ref .= $line;
                        }
                        unlink($ref_file);
                }
@@ -220,7 +220,7 @@ function links_delete($page, $del)
                $ref = '';
                foreach (file($ref_file) as $line) {
                        list($ref_page, $ref_auto) = explode("\t", rtrim($line));
-                       if ($ref_page != $page) {
+                       if ($ref_page !== $page) {
                                if (! $ref_auto) $all_auto = FALSE;
                                $ref .= $line;
                        }
index 362701a..9c620b0 100644 (file)
@@ -2,7 +2,7 @@
 // PukiWiki - Yet another WikiWikiWeb clone.
 // $Id: make_link.php,v 1.38 2011/01/25 15:01:01 henoheno Exp $
 // Copyright (C)
-//   2003-2005 PukiWiki Developers Team
+//   2003-2005, 2007 PukiWiki Developers Team
 //   2001-2002 Originally written by yu-ji
 // License: GPL v2 or (at your option) any later version
 //
@@ -716,7 +716,7 @@ function make_pagelink($page, $alias = '', $anchor = '', $refer = '', $isautolin
        $r_page  = rawurlencode($page);
        $r_refer = ($refer == '') ? '' : '&amp;refer=' . rawurlencode($refer);
 
-       if (! isset($related[$page]) && $page != $vars['page'] && is_page($page))
+       if (! isset($related[$page]) && $page !== $vars['page'] && is_page($page))
                $related[$page] = get_filetime($page);
 
        if ($isautolink || is_page($page)) {
index 8fc0418..555370e 100644 (file)
@@ -93,7 +93,7 @@ function plugin_edit_inline()
        $s_label = strip_htmltag(array_pop($args), FALSE);
 
        $page    = array_shift($args);
-       if ($page == NULL) $page = '';
+       if ($page === NULL) $page = '';
        $_noicon = $_nolabel = FALSE;
        foreach($args as $arg){
                switch(strtolower($arg)){
index d9066c5..d8cc731 100644 (file)
@@ -108,7 +108,7 @@ function plugin_include_convert()
        if ($with_title) {
                $link = '<a href="' . $script . '?cmd=edit&amp;page=' . $r_page .
                        '">' . $s_page . '</a>';
-               if ($page == $menubar) {
+               if ($page === $menubar) {
                        $body = '<span align="center"><h5 class="side_label">' .
                                $link . '</h5></span><small>' . $body . '</small>';
                } else {
index 6cd03af..e2d18d2 100644 (file)
@@ -47,7 +47,7 @@ function plugin_menu_convert()
 
                if (! is_page($page)) {
                        return '';
-               } else if ($vars['page'] == $page) {
+               } else if ($vars['page'] === $page) {
                        return '<!-- #menu(): You already view ' . htmlsc($page) . ' -->';
                } else {
                        // Cut fixed anchors
index 47545c4..36a9dbb 100644 (file)
@@ -100,7 +100,7 @@ function plugin_navi_convert()
 
                $prev = $home;
                foreach ($pages as $page) {
-                       if ($page == $current) break;
+                       if ($page === $current) break;
                        $prev = $page;
                }
                $next = current($pages);
@@ -154,7 +154,7 @@ function plugin_navi_convert()
                } else {
                        $ret .= '<ul>';
                        foreach ($pages as $page)
-                               if ($page != $home)
+                               if ($page !== $home)
                                        $ret .= ' <li>' . make_pagelink($page) . '</li>';
                        $ret .= '</ul>';
                }
index b771201..fc3d97e 100644 (file)
@@ -81,7 +81,7 @@ function plugin_popular_convert()
                        $page = substr($page, 1);
 
                        $s_page = htmlsc($page);
-                       if ($page == $vars['page']) {
+                       if ($page === $vars['page']) {
                                // No need to link itself, notifies where you just read
                                $pg_passage = get_pg_passage($page,FALSE);
                                $items .= ' <li><span title="' . $s_page . ' ' . $pg_passage . '">' .
index e97c0e7..4b096d1 100644 (file)
@@ -39,7 +39,7 @@ function plugin_rename_action()
                $page  = plugin_rename_getvar('page');
                $refer = plugin_rename_getvar('refer');
 
-               if ($refer === '') {
+               if ($refer == '') {
                        return plugin_rename_phase1();
 
                } else if (! is_page($refer)) {
@@ -48,7 +48,7 @@ function plugin_rename_action()
                } else if ($refer === $whatsnew) {
                        return plugin_rename_phase1('norename', $refer);
 
-               } else if ($page === '' || $page === $refer) {
+               } else if ($page == '' || $page === $refer) {
                        return plugin_rename_phase2();
 
                } else if (! is_pagename($page)) {