*\r
* @license http://nucleuscms.org/license.txt GNU General Public License\r
* @copyright Copyright (C) 2002-2009 The Nucleus Group\r
- * @version $Id: SKIN.php 1784 2012-04-22 04:28:30Z sakamocchi $
+ * @version $Id: SKIN.php 1784 2012-04-22 04:28:30Z sakamocchi $\r
*/\r
\r
if ( !function_exists('requestVar') ) \r
// set output type\r
sendContentType($this->getContentType(), 'skin');\r
\r
- // set skin name as global var (so plugins can access it)\r
+ /* FIX: should be obsoleted */\r
$currentSkinName = $this->getName();\r
\r
+ // retrieve contents\r
$contents = FALSE;\r
if ( $type != 'fileparse' )\r
{\r
- $contents = $this->getContent($type);\r
+ $contents = $this->getContentFromDB($type);\r
}\r
else if ( $path !== '' && i18n::strpos(realpath($path), realpath("$DIR_NUCLEUS/../")) == 0 )\r
{\r
- $contents = $this->getFileContent($path);\r
+ $contents = $this->getContentFromFile($path);\r
}\r
- \r
- if ( !$contents )\r
+ // use base skin if this skin does not have contents\r
+ if ( $contents === FALSE )\r
{\r
- // use base skin if this skin does not have contents\r
$defskin = new SKIN($CONF['BaseSkin']);\r
- $contents = $defskin->getContent($type);\r
+ $contents = $defskin->getContentFromDB($type);\r
if ( !$contents )\r
{\r
echo _ERROR_SKIN;\r
Parser::setProperty('IncludeMode', $this->getIncludeMode());\r
Parser::setProperty('IncludePrefix', $this->getIncludePrefix());\r
\r
+ // call action handler\r
$action_class = $this->action_class;\r
$handler = new $action_class($type);\r
\r
+ // register action handler to parser\r
$actions = $handler->getDefinedActions($type);\r
$parser = new Parser($actions, $handler);\r
\r
}\r
\r
/**\r
- * Skin::getContent()\r
- * Get content of the skin part from the database\r
+ * Skin::getContentFromDB()\r
* \r
- * @param string $type type of the skin (e.g. index, item, search ...)\r
- * @return string content of scontent\r
+ * @param string $skintype skin type\r
+ * @return string content for the skin type\r
*/\r
- public function getContent($type)\r
+ public function getContentFromDB($skintype)\r
{\r
- $query = "SELECT scontent FROM %s WHERE sdesc=%d and stype='%s'";\r
- $query = sprintf($query, sql_table('skin'), (integer) $this->id, sql_real_escape_string($type));\r
+ $query = "SELECT scontent FROM %s WHERE sdesc=%d and stype='%s';";\r
+ $query = sprintf($query, sql_table('skin'), (integer) $this->id, sql_real_escape_string($skintype));\r
$res = sql_query($query);\r
\r
if ( sql_num_rows($res) == 0 )\r
{\r
return FALSE;\r
}\r
+ \r
return sql_result($res, 0, 0);\r
}\r
\r
/**\r
- * Skin::getFileContent()\r
+ * Skin::getContentFromFile()\r
* \r
* @param string $fullpath fullpath to the file to parse\r
* @return mixed file contents or FALSE\r
*/\r
- public function getFileContent($fullpath)\r
+ public function getContentFromFile($fullpath)\r
{\r
$fsize = filesize($fullpath);\r
if ( $fsize <= 0 )\r
}\r
\r
/**\r
- * Skin::getDefaultTypes()
+ * Skin::getDefaultTypes()\r
* \r
- * @param string void
- * @return array default skin types
+ * @param string void\r
+ * @return array default skin types\r
*/\r
- public function getDefaultTypes()
+ public function getDefaultTypes()\r
{\r
- return call_user_func(array($this->action_class, 'getDefaultSkinTypes'));
+ return call_user_func(array($this->action_class, 'getDefaultSkinTypes'));\r
}\r
\r
/**\r
- * Skin::getAvailableTypes()
+ * Skin::getAvailableTypes()\r
* \r
* @param string void\r
- * @return array registered skin types
+ * @return array registered skin types\r
*/\r
- public function getAvailableTypes()
+ public function getAvailableTypes()\r
{\r
- $default_skintypes = $this->getDefaultTypes();
- $query = "SELECT stype FROM %s WHERE sdesc=%d;";
- $query = sprintf($query, sql_table('skin'), (integer) $this->id);
-
- /* NOTE: force to put default types in the beginning */
- $in_default = array();
- $no_default = array();
-
- $res = sql_query($query);
- while ( $row = sql_fetch_array($res) )
- {
- if ( !array_key_exists($row['stype'], $default_skintypes) )
- {
- $no_default[$row['stype']] = FALSE;
+ $default_skintypes = $this->getDefaultTypes();\r
+ $query = "SELECT stype FROM %s WHERE sdesc=%d;";\r
+ $query = sprintf($query, sql_table('skin'), (integer) $this->id);\r
+ \r
+ /* NOTE: force to put default types in the beginning */\r
+ $in_default = array();\r
+ $no_default = array();\r
+ \r
+ $res = sql_query($query);\r
+ while ( $row = sql_fetch_array($res) )\r
+ {\r
+ if ( !array_key_exists($row['stype'], $default_skintypes) )\r
+ {\r
+ $no_default[$row['stype']] = FALSE;\r
+ }\r
+ else\r
+ {\r
+ $in_default[$row['stype']] = $default_skintypes[$row['stype']];\r
+ }\r
+ }\r
+ \r
+ return array_merge($in_default, $no_default);\r
}\r
- else
- {
- $in_default[$row['stype']] = $default_skintypes[$row['stype']];
- }
- }
-
- return array_merge($in_default, $no_default);
- }
-
- /**
- * Skin::getAllowedActionsForType()
- * Get the allowed actions for a skin type
- * returns an array with the allowed actions
- *
- * @param string $type type of the skin
- * @return array allowed action types
- */
- public function getAllowedActionsForType($type)
- {
- return call_user_func(array($this->action_class, 'getDefinedActions'), $type);
- }
-
+ \r
+ /**\r
+ * Skin::getAllowedActionsForType()\r
+ * Get the allowed actions for a skin type\r
+ * returns an array with the allowed actions\r
+ * \r
+ * @param string $type type of the skin\r
+ * @return array allowed action types\r
+ */\r
+ public function getAllowedActionsForType($type)\r
+ {\r
+ return call_user_func(array($this->action_class, 'getDefinedActions'), $type);\r
+ }\r
+ \r
}\r