Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • 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

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