OSDN Git Service

Merge branch 'skinnable-master'
[nucleus-jp/nucleus-next.git] / nucleus / libs / SKIN.php
index 1cd58ea..55547be 100644 (file)
  *
  * @license http://nucleuscms.org/license.txt GNU General Public License
  * @copyright Copyright (C) 2002-2009 The Nucleus Group
+<<<<<<< HEAD
+ * @version $Id: SKIN.php 1816 2012-05-03 01:40:10Z sakamocchi $
+=======
  * @version $Id: SKIN.php 1886 2012-06-17 08:27:27Z sakamocchi $
+>>>>>>> skinnable-master
  */
 
 if ( !function_exists('requestVar') )
@@ -54,7 +58,13 @@ class Skin
                
                $this->id = (integer) $id;
                
+<<<<<<< HEAD
+               /*
+                * NOTE: include needed action class
+                */
+=======
                /* NOTE: include needed action class */
+>>>>>>> skinnable-master
                if ( $action_class != 'Actions' )
                {
                        if ( !class_exists($action_class, FALSE)
@@ -336,6 +346,15 @@ class Skin
                
                // retrieve contents
                $contents = FALSE;
+<<<<<<< HEAD
+               if ( $type != 'fileparse' )
+               {
+                       $contents = $this->getContentFromDB($type);
+               }
+               else if ( $path !== ''  && i18n::strpos(realpath($path), realpath("$DIR_NUCLEUS/../")) == 0 )
+               {
+                       $contents = $this->getContentFromFile($path);
+=======
                if ( $type == 'pluginadmin' )
                {
                        $contents = $path;
@@ -350,6 +369,7 @@ class Skin
                        {
                                $contents = $this->getContentFromFile($path);
                        }
+>>>>>>> skinnable-master
                }
                // use base skin if this skin does not have contents
                if ( $contents === FALSE )
@@ -455,7 +475,11 @@ class Skin
                $res = DB::getValue($query);
                
                $skintypeexists = !empty($res);
+<<<<<<< HEAD
+               $skintypevalue = ($content == true);
+=======
                $skintypevalue = !empty($content);
+>>>>>>> skinnable-master
                
                if( $skintypevalue && $skintypeexists )
                {
@@ -464,6 +488,23 @@ class Skin
                                'type'          =>  $type,
                                'content'       => &$content
                        );
+<<<<<<< HEAD
+                       
+                       // PreUpdateSkinPart event
+                       $manager->notify("PreUpdate{{$this->event_identifier}}Part", $data);
+               }
+               else if( $skintypevalue && !$skintypeexists )
+               {
+                       $data = array(
+                               'skinid'        => $this->id,
+                               'type'          => $type,
+                               'content'       => &$content
+                       );
+                       
+                       $manager->notify("PreAdd{$this->event_identifier}Part", $data);
+               }
+               else if( !$skintypevalue && $skintypeexists )
+=======
                        $manager->notify("PreUpdate{$this->event_identifier}Part", $data);
                }
                else if( $skintypevalue )
@@ -476,23 +517,36 @@ class Skin
                        $manager->notify("PreAdd{$this->event_identifier}Part", $data);
                }
                else if( $skintypeexists )
+>>>>>>> skinnable-master
                {
                        $data = array(
                                'skinid'        => $this->id,
                                'type'          => $type
                        );
+<<<<<<< HEAD
+                       
+=======
+>>>>>>> skinnable-master
                        $manager->notify("PreDelete{$this->event_identifier}Part", $data);
                }
                
                // delete old thingie
+<<<<<<< HEAD
+               $query = "DELETE FROM %s WHERE stype=%s and sdesc=%d";
+=======
                $query = "DELETE FROM %s WHERE stype=%s and sdesc=%d;";
+>>>>>>> skinnable-master
                $query = sprintf($query, sql_table('skin'), DB::quoteValue($type), (integer) $this->id);
                DB::execute($query);
                
                // write new thingie
                if ( $content )
                {
+<<<<<<< HEAD
+                       $query = "INSERT INTO %s (scontent, stype, sdesc) VALUE (%s, %s, %d)";
+=======
                        $query = "INSERT INTO %s (scontent, stype, sdesc) VALUES (%s, %s, %d);";
+>>>>>>> skinnable-master
                        $query = sprintf($query, sql_table('skin'), DB::quoteValue($content), DB::quoteValue($type), (integer) $this->id);
                        DB::execute($query);
                }
@@ -500,6 +554,28 @@ class Skin
                if( $skintypevalue && $skintypeexists )
                {
                        $data = array(
+<<<<<<< HEAD
+                               'skinid'        => $this->id,
+                               'type'          => $type,
+                               'content'       => &$content
+                       );
+                       
+                       // PostUpdateSkinPart event
+                       $manager->notify("PostUpdate{$this->event_identifier}Part", $data);
+               }
+               else if( $skintypevalue && (!$skintypeexists) )
+               {
+                       $data = array(
+                               'skinid'        => $this->id,
+                               'type'          => $type,
+                               'content'       => &$content
+                       );
+                       
+                       // PostAddSkinPart event
+                       $manager->notify("PostAdd{$this->event_identifier}Part", $data);
+               }
+               else if( (!$skintypevalue) && $skintypeexists )
+=======
                                'skinid'        =>  $this->id,
                                'type'          =>  $type,
                                'content'       => &$content
@@ -516,11 +592,16 @@ class Skin
                        $manager->notify("PostAdd{$this->event_identifier}Part", $data);
                }
                else if( $skintypeexists )
+>>>>>>> skinnable-master
                {
                        $data = array(
                                'skinid'        => $this->id,
                                'type'          => $type
                        );
+<<<<<<< HEAD
+                       
+=======
+>>>>>>> skinnable-master
                        $manager->notify("PostDelete{$this->event_identifier}Part", $data);
                }
                return;
@@ -609,14 +690,24 @@ class Skin
        }
        
        /**
+<<<<<<< HEAD
+        * Skin::getDefaultTypes()
+=======
         * Skin::getNormalTypes()
+>>>>>>> skinnable-master
         * 
         * @param       string  void
         * @return      array   default skin types
         */
+<<<<<<< HEAD
+       public function getDefaultTypes()
+       {
+               return call_user_func(array($this->action_class, 'getAvailableSkinTypes'));
+=======
        public function getNormalTypes()
        {
                return call_user_func(array($this->action_class, 'getNormalSkinTypes'));
+>>>>>>> skinnable-master
        }
        
        /**
@@ -627,7 +718,11 @@ class Skin
         */
        public function getAvailableTypes()
        {
+<<<<<<< HEAD
+               $default_skintypes = $this->getDefaultTypes();
+=======
                $default_skintypes = $this->getNormalTypes();
+>>>>>>> skinnable-master
                $query = "SELECT stype FROM %s WHERE sdesc=%d;";
                $query = sprintf($query, sql_table('skin'), (integer) $this->id);
                
@@ -655,7 +750,11 @@ class Skin
         * Skin::getAllowedActionsForType()
         * Get the allowed actions for a skin type
         * returns an array with the allowed actions
+<<<<<<< HEAD
+        * 
+=======
         * @return      array   allowed action types
+>>>>>>> skinnable-master
         * @param       string  $skintype       type of the skin
         * @return      array   allowed action types
         */