Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cVersion
  • cVersionFile
  • cVersionLayout
  • cVersionModule
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * This file contains the file version class.
  4:  *
  5:  * @package    Core
  6:  * @subpackage Versioning
  7:  * @version    SVN Revision $Rev:$
  8:  *
  9:  * @author     Bilal Arslan, Timo Trautmann
 10:  * @copyright  four for business AG <www.4fb.de>
 11:  * @license    http://www.contenido.org/license/LIZENZ.txt
 12:  * @link       http://www.4fb.de
 13:  * @link       http://www.contenido.org
 14:  */
 15: 
 16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 17: 
 18: /**
 19:  * Class of File System
 20:  * We use super class Version to create a new Version.
 21:  *
 22:  * @package    Core
 23:  * @subpackage Versioning
 24:  */
 25: class cVersionFile extends cVersion {
 26: 
 27:     /**
 28:      * Content code of current file.
 29:      */
 30:     public $sCode;
 31: 
 32:     /**
 33:      * Description folder of history sub nav.
 34:      * Its not required to use it.
 35:      */
 36:     public $sDescripion;
 37: 
 38:     /**
 39:      * The path of style file.
 40:      */
 41:     public $sPath;
 42: 
 43:     /**
 44:      * The id of Type.
 45:      */
 46:     public $sFileName;
 47: 
 48:     /**
 49:      * The class versionStyle object constructor, initializes class variables
 50:      *
 51:      * @param string $iIdOfType The name of style file
 52:      * @param array $aFileInfo Get FileInformation from table file_information
 53:      * @param array $aCfg
 54:      * @param array $aCfgClient
 55:      * @param object $oDB
 56:      * @param int $iClient
 57:      * @param string $sArea
 58:      * @param int $iFrame
 59:      */
 60:     public function __construct($iIdOfType, $aFileInfo, $sFileName, $sTypeContent, $aCfg, $aCfgClient, $oDB, $iClient, $sArea, $iFrame, $sVersionFileName = '') {
 61:         // Set globals in super class constructer
 62:         parent::__construct($aCfg, $aCfgClient, $oDB, $iClient, $sArea, $iFrame);
 63: 
 64:         // Folder name is css or js ...
 65:         $this->sType = $sTypeContent;
 66: 
 67:         // File Name for xml node
 68:         $this->sFileName = $sFileName;
 69: 
 70:         // File Information, set for class Version to generate head xml nodes
 71:         $this->sDescripion = $aFileInfo["description"];
 72:         $this->sAuthor = $aFileInfo["author"];
 73:         $this->dLastModified = $aFileInfo["lastmodified"];
 74:         $this->dCreated = $aFileInfo["created"];
 75: 
 76:         // Frontendpath to files
 77:         if ($sTypeContent == "templates") {
 78:             $sTypeContent = "tpl";
 79:         }
 80: 
 81:         $this->sPath = $this->aCfgClient[$this->iClient][$sTypeContent]["path"];
 82: 
 83:         // Identity the Id of Content Type
 84:         $this->iIdentity = $iIdOfType;
 85: 
 86:         // This function looks if maximum number of stored versions is achieved
 87:         $this->prune();
 88: 
 89:         // Take revision files if exists
 90:         $this->initRevisions();
 91: 
 92:         // Get code of style
 93:         $this->initFileContent();
 94: 
 95:         // Set Layout Table Iformation, currently not in use!
 96:         // this->setLayoutTable();
 97: 
 98:         if ($sVersionFileName == '') {
 99:             $sVersionFileName = $this->sFileName;
100:         }
101: 
102:         // Create Body Node of Xml File
103:         $this->setData("name", $sVersionFileName);
104:         $this->setData("code", $this->sCode);
105:         $this->setData("description", $this->sDescripion);
106:     }
107: 
108:     /**
109:      * This function init the class member sCode with current file content
110:      */
111:     protected function initFileContent() {
112:         if (cFileHandler::exists($this->sPath . $this->sFileName)) {
113:             $this->sCode = cFileHandler::read($this->sPath . $this->sFileName);
114:         } else {
115:             echo "<br>File not exists " . $this->sPath . $this->sFileName;
116:         }
117:     }
118: 
119:     /**
120:      * This function read an xml file nodes
121:      *
122:      * @param string $sPath Path to file
123:      *
124:      * @return {array} returns array width nodes
125:      */
126:     public function initXmlReader($sPath) {
127:         $aResult = array();
128:         if ($sPath != "") {
129:             $xml = new cXmlReader();
130:             $xml->load($sPath);
131: 
132:             $aResult['name'] = $xml->getXpathValue('/version/body/name');
133:             $aResult['desc'] = $xml->getXpathValue('/version/body/description');
134:             $aResult['code'] = $xml->getXpathValue('/version/body/code');
135:         }
136: 
137:         return $aResult;
138:     }
139: 
140:     /**
141:      * This function reads the path of file
142:      *
143:      * @param string $sPath Path to file
144:      *
145:      * @return string the path of file
146:      */
147:     public function getPathFile() {
148:         return $this->sPath;
149:     }
150: 
151:     /**
152:      * Function returns javascript which refreshes CONTENIDO frames for file
153:      * list an subnavigation.
154:      * This is neccessary, if filenames where changed, when a history entry is
155:      * restored
156:      *
157:      * @param int $iIdClient - id of client which contains this file
158:      * @param string $sArea - name of CONTENIDO area in which this procedure
159:      *            should be done
160:      * @param string $sFilename - new filename of file which should be updated
161:      *            in other frames
162:      * @param object $sess - CONTENIDO session object
163:      *
164:      * @return string - Javascript for refrehing frames
165:      */
166:     public function renderReloadScript($sArea, $sFilename, $sess) {
167:         $urlRightTop = $sess->url("main.php?area=$sArea&frame=3&file=$sFilename&history=true");
168:         $urlLeftBottom = $sess->url("main.php?area=$sArea&frame=2&file=$sFilename");
169:         $sReloadScript = <<<JS
170: <script type="text/javascript">
171: (function(Con, $) {
172:     var right_top = Con.getFrame('right_top'),
173:         left_bottom = Con.getFrame('left_bottom');
174: 
175:     if (right_top) {
176:         right_top.location.href = '{$urlRightTop}';
177:     }
178: 
179:     if (left_bottom) {
180:         left_bottom.location.href = '{$urlLeftBottom}';
181:     }
182: })(Con, Con.$);
183: </script>
184: JS;
185:         return $sReloadScript;
186:     }
187: 
188: }
189: 
CMS CONTENIDO 4.9.3 API documentation generated by ApiGen 2.8.0