OSDN Git Service

Merge branch 'skinnable-master' of git.sourceforge.jp:/gitroot/nucleus-jp/nucleus...
authorsakamocchi <o-takashi@sakamocchi.jp>
Sun, 6 May 2012 14:00:14 +0000 (23:00 +0900)
committersakamocchi <o-takashi@sakamocchi.jp>
Sun, 6 May 2012 14:00:14 +0000 (23:00 +0900)
nucleus/libs/ADMIN.php
nucleus/libs/AdminActions.php
nucleus/libs/NOTIFICATION.php
nucleus/libs/sql/DB.php

index 6e4c1db..be2e28d 100644 (file)
@@ -474,7 +474,7 @@ class Admin
                // On delete: check if confirmation has been given\r
                if ( ($action == 'delete') && (requestVar('confirmation') != 'yes') )\r
                {\r
-                       self::batchAskDeleteConfirmation('comment',$selected);\r
+                       self::batchAskDeleteConfirmation('comment', $selected);\r
                }\r
                \r
                self::pagehead();\r
@@ -1064,7 +1064,7 @@ class Admin
         * @param       integer $itemid ID for item\r
         * @return      void\r
         */\r
-       static private function deleteOneItem($itemid)\r
+       static public function deleteOneItem($itemid)\r
        {\r
                global $member, $manager;\r
                \r
@@ -1396,7 +1396,7 @@ class Admin
         * @param       integer $commentid      ID for comment\r
         * @return      void\r
         */\r
-       static private function deleteOneComment($commentid)\r
+       static public function deleteOneComment($commentid)\r
        {\r
                global $member, $manager;\r
                \r
@@ -1955,7 +1955,7 @@ class Admin
         * @param       void\r
         * @return      void\r
         */\r
-       static private function deleteOneTeamMember($blogid, $memberid)\r
+       static public function deleteOneTeamMember($blogid, $memberid)\r
        {\r
                global $member, $manager;\r
                \r
@@ -2293,7 +2293,7 @@ class Admin
         * @param       String  $catid  category id for deleting\r
         * @return      Void\r
         */\r
-       static private function deleteOneCategory($catid)\r
+       static public function deleteOneCategory($catid)\r
        {\r
                global $manager, $member;\r
                \r
@@ -2593,7 +2593,7 @@ class Admin
         * @params      Integer $memberid       member id\r
         * @return      String  null string or error messages\r
         */\r
-       static private function deleteOneMember($memberid)\r
+       static public function deleteOneMember($memberid)\r
        {\r
                global $manager;\r
                \r
@@ -5604,7 +5604,7 @@ class Admin
         * @param       void\r
         * @return      void\r
         */\r
-       static private function deleteOnePlugin($pid, $callUninstall = 0)\r
+       static public function deleteOnePlugin($pid, $callUninstall = 0)\r
        {\r
                global $manager;\r
                \r
index 18863e9..c13cef3 100644 (file)
@@ -1014,7 +1014,7 @@ class AdminActions extends BaseActions
                
                $selected = requestIntArray('batch');
                $action   = requestVar('batchaction');
-               
+
                switch ( $this->skintype )
                {
                        case 'batchitem':
@@ -1055,6 +1055,7 @@ class AdminActions extends BaseActions
                // walk over all selectedids and perform action
                foreach ( $selected as $selectedid )
                {
+                       echo $selectedid;
                        $error = '';
                        $selectedid = intval($selectedid);
                        
@@ -1063,7 +1064,7 @@ class AdminActions extends BaseActions
                                case 'delete':
                                        if ( $this->skintype != 'batchteam' )
                                        {
-                                               $error = Admin::deleteaction($selectedid);
+                                               $error = call_user_func_array(array('Admin', $deleteaction), array($selectedid));
                                        }
                                        else
                                        {
@@ -1071,7 +1072,7 @@ class AdminActions extends BaseActions
                                        }
                                        break;
                                case 'move':
-                                       $error = Admin::moveaction($selectedid, $destid);
+                                       $error = call_user_func_array(array('Admin', $moveaction), array($selectedid));
                                        break;
                                case 'setadmin':
                                        // always succeeds
@@ -1109,9 +1110,9 @@ class AdminActions extends BaseActions
                        $template = ob_get_contents();
                        ob_end_clean();
                        
-                       echo Template::fill($template, $data);
-                       return;
                }
+               echo Template::fill($template, $data);
+               return;
        }
        
        /**
index a8a8fad..e756712 100644 (file)
@@ -172,7 +172,7 @@ class Notification
                $restriction = 78 - strlen($header) - strlen($footer) ;\r
                \r
                $encoded_words = array();\r
-               for ( $i = 0; $i < self::strlen($string); $i++ )\r
+               for ( $i = 0; $i < i18n::strlen($string); $i++ )\r
                {\r
                        if ( self::$scheme == 'B' )\r
                        {\r
@@ -181,7 +181,7 @@ class Notification
                                        $letters = '';\r
                                }\r
                                \r
-                               $letter = self::substr($string, $i, 1);\r
+                               $letter = i18n::substr($string, $i, 1);\r
                                $expected_length = strlen($letters) + strlen($letter) * 4 / 3;\r
                                \r
                                if ( $expected_length > $restriction )\r
@@ -193,7 +193,7 @@ class Notification
                                \r
                                $letters .= $letter;\r
                                \r
-                               if ( $i == self::strlen($string) - 1 )\r
+                               if ( $i == i18n::strlen($string) - 1 )\r
                                {\r
                                        $encoded_text = self::b_encoder($letters);\r
                                        $encoded_words[] = "{$header}{$encoded_text}{$footer}";\r
@@ -219,7 +219,7 @@ class Notification
                                \r
                                $encoded_text .= $encoded_letter;\r
                                \r
-                               if ( $i == self::strlen($string) - 1 )\r
+                               if ( $i == i18n::strlen($string) - 1 )\r
                                {\r
                                        $encoded_words[] = "{$header}{$encoded_text}{$footer}";\r
                                        break;\r
index 27b76bc..9ffe117 100644 (file)
@@ -24,6 +24,7 @@ class DB
        private static $dateFormat = '\'%Y-%m-%d %H:%M:%S\'';
        
        /**
+        * DB::setConnectionInfo()
         * Set the information to connect to the database, it will attempt to connect.
         * @param string $engine Engine
         * @param string $host Host
@@ -126,6 +127,7 @@ class DB
        }
 
        /**
+        * DB::disConnect()
         * Disconnect the connection to the database.
         */
        public static function disConnect()
@@ -134,6 +136,7 @@ class DB
        }
 
        /**
+        * DB::getExecCount()
         * To get the number of times you run the statement.
         * @return int Number of executions
         */
@@ -143,6 +146,7 @@ class DB
        }
 
        /**
+        * DB::formatDateTime()
         * The value converted to a format that can be passed to the database datetime.
         * @param int $timestamp UNIX timestamp
         * @param int $offset timestamp offset
@@ -162,6 +166,7 @@ class DB
        }
        
        /**
+        * DB::getValue()
         * Gets the value of the first column of the first row of the results obtained in the statement.
         * @param string $statement SQL Statement
         * @return mixed Result value. If the call fails, it will return FALSE.
@@ -170,15 +175,16 @@ class DB
        {
                if ( self::$dbh == null ) return FALSE;
                self::$execCount++;
-               $stmt = &self::$dbh->query($statement);
-               if ( $result = $stmt->fetch(PDO::FETCH_NUM) )
+               $result = self::showErrorDisplay(self::$dbh->query($statement));
+               if ( $row = $result->fetch(PDO::FETCH_NUM) )
                {
-                       return $result[0];
+                       return $row[0];
                }
                return FALSE;
        }
 
        /**
+        * DB::getRow()
         * Gets the first row of the results obtained in the statement.
         * @param string $statement SQL Statement
         * @return array Result row. If the call fails, it will return FALSE.
@@ -187,10 +193,12 @@ class DB
        {
                if ( self::$dbh == null ) return FALSE;
                self::$execCount++;
-               return self::$dbh->query($statement)->fetch(PDO::FETCH_BOTH);
+               $result = self::showErrorDisplay(self::$dbh->query($statement));
+               return $result->fetch(PDO::FETCH_BOTH);
        }
 
        /**
+        * DB::getResult()
         * Gets the set of results obtained in the statement.
         * @param string $statement SQL Statement
         * @return PDOStatement Result set object. If the call fails, it will return FALSE.
@@ -199,10 +207,11 @@ class DB
        {
                if ( self::$dbh == null ) return FALSE;
                self::$execCount++;
-               return self::$dbh->query($statement);
+               return self::showErrorDisplay(self::$dbh->query($statement));
        }
 
        /**
+        * DB::execute()
         * Execute an SQL statement and return the number of affected rows.
         * @param string $statement SQL Statement
         * @return int number of rows that were modified or deleted by the SQL statement you issued.
@@ -211,10 +220,31 @@ class DB
        {
                if ( self::$dbh == null ) return FALSE;
                self::$execCount++;
-               return self::$dbh->exec($statement);
+               return self::showErrorDisplay(self::$dbh->exec($statement));
+       }
+
+       /**
+        * DB::showErrorDisplay()
+        * On the display query execution result query has an error in the case of FALSE.
+        * @param mixed $result Query execution result
+        * @return mixes Query execution result
+        */
+       private static function showErrorDisplay($result)
+       {
+               global $CONF;
+               if ( array_key_exists('debug', $CONF) && $CONF['debug'] )
+               {
+                       if ( $result === FALSE )
+                       {
+                               $err = self::getError();
+                               print('mySQL error with query $query: ' . $err[2]);
+                       }
+               }
+               return $result;
        }
        
        /**
+        * DB::getError()
         * Gets the error information associated with the last operation.
         * @return array Error info
         */
@@ -225,6 +255,7 @@ class DB
        }
 
        /**
+        * DB::quoteValue()
         * Quotes a string for use in a query.
         * @param string $value Value to quote
         * @return string Quoted value
@@ -236,6 +267,7 @@ class DB
        }
 
        /**
+        * DB::getInsertId()
         * Get the value of the ID of the rows that are inserted at the end.
         * @return string ID of the row
         */
@@ -246,6 +278,7 @@ class DB
        }
 
        /**
+        * DB::getAttribute()
         * Gets the attribute of the database.
         * @return string Attribute
         */