*
* @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') )
$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)
// 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;
+ }
+ else
+ {
+ if ( $type != 'fileparse' && $type != 'importAdmin')
+ {
+ $contents = $this->getContentFromDB($type);
+ }
+ else if ( $path !== '' && i18n::strpos(realpath($path), realpath("$DIR_NUCLEUS/../")) == 0 )
+ {
+ $contents = $this->getContentFromFile($path);
+ }
+>>>>>>> skinnable-master
}
// use base skin if this skin does not have contents
if ( $contents === FALSE )
$handler = new $action_class($type);
// register action handler to parser
- $actions = $handler->getDefinedActions($type);
- $parser = new Parser($actions, $handler);
-
- $handler->setParser($parser);
- $handler->setSkin($this);
+ $parser = new Parser($handler);
+ $parser->setSkin($this);
$parser->parse($contents);
$data = array(
$res = DB::getValue($query);
$skintypeexists = !empty($res);
+<<<<<<< HEAD
$skintypevalue = ($content == true);
+=======
+ $skintypevalue = !empty($content);
+>>>>>>> skinnable-master
if( $skintypevalue && $skintypeexists )
{
'type' => $type,
'content' => &$content
);
+<<<<<<< HEAD
// PreUpdateSkinPart event
$manager->notify("PreUpdate{{$this->event_identifier}}Part", $data);
$manager->notify("PreAdd{$this->event_identifier}Part", $data);
}
else if( !$skintypevalue && $skintypeexists )
+=======
+ $manager->notify("PreUpdate{$this->event_identifier}Part", $data);
+ }
+ else if( $skintypevalue )
+ {
+ $data = array(
+ 'skinid' => $this->id,
+ 'type' => $type,
+ 'content' => &$content
+ );
+ $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);
}
if( $skintypevalue && $skintypeexists )
{
$data = array(
+<<<<<<< HEAD
'skinid' => $this->id,
'type' => $type,
'content' => &$content
$manager->notify("PostAdd{$this->event_identifier}Part", $data);
}
else if( (!$skintypevalue) && $skintypeexists )
+=======
+ 'skinid' => $this->id,
+ 'type' => $type,
+ 'content' => &$content
+ );
+ $manager->notify("PostUpdate{$this->event_identifier}Part", $data);
+ }
+ else if( $skintypevalue )
+ {
+ $data = array(
+ 'skinid' => $this->id,
+ 'type' => $type,
+ 'content' => &$content
+ );
+ $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;
}
/**
+<<<<<<< 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, 'getDefaultSkinTypes'));
+ return call_user_func(array($this->action_class, 'getAvailableSkinTypes'));
+=======
+ public function getNormalTypes()
+ {
+ return call_user_func(array($this->action_class, 'getNormalSkinTypes'));
+>>>>>>> skinnable-master
}
/**
*/
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);
* Skin::getAllowedActionsForType()
* Get the allowed actions for a skin type
* returns an array with the allowed actions
+<<<<<<< HEAD
*
- * @param string $type type of the skin
+=======
+ * @return array allowed action types
+>>>>>>> skinnable-master
+ * @param string $skintype type of the skin
* @return array allowed action types
*/
- public function getAllowedActionsForType($type)
+ public function getAllowedActionsForType($skintype)
{
- return call_user_func(array($this->action_class, 'getDefinedActions'), $type);
+ $handler = new $this->action_class($skintype);
+ return $handler->getAvailableActions();
}
}