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
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • PHP
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SIWECOS
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cUriBuilderMR
  • ModRewrite
  • ModRewrite_ContentController
  • ModRewrite_ContentExpertController
  • ModRewrite_ContentTestController
  • ModRewrite_ControllerAbstract
  • ModRewriteBase
  • ModRewriteController
  • ModRewriteDebugger
  • ModRewriteTest
  • ModRewriteUrlStack
  • ModRewriteUrlUtil

Functions

  • mr_arrayValue
  • mr_buildGeneratedCode
  • mr_buildNewUrl
  • mr_conCopyArtLang
  • mr_conMoveArticles
  • mr_conSaveArticle
  • mr_conSyncArticle
  • mr_debugOutput
  • mr_getConfiguration
  • mr_getConfigurationFilePath
  • mr_getRequest
  • mr_header
  • mr_i18n
  • mr_loadConfiguration
  • mr_queryAndNextRecord
  • mr_removeMultipleChars
  • mr_requestCleanup
  • mr_runFrontendController
  • mr_setClientLanguageId
  • mr_setConfiguration
  • mr_strCopyCategory
  • mr_strMovedownCategory
  • mr_strMoveSubtree
  • mr_strMoveUpCategory
  • mr_strNewCategory
  • mr_strNewTree
  • mr_strRenameCategory
  • mr_strSyncCategory
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * AMR Content expert controller class
  4:  *
  5:  * @package     Plugin
  6:  * @subpackage  ModRewrite
  7:  * @id          $Id$:
  8:  * @author      Murat Purc <murat@purc.de>
  9:  * @copyright   four for business AG <www.4fb.de>
 10:  * @license     http://www.contenido.org/license/LIZENZ.txt
 11:  * @link        http://www.4fb.de
 12:  * @link        http://www.contenido.org
 13:  */
 14: 
 15: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 16: 
 17: /**
 18:  * Content expert controller for expert settings/actions.
 19:  *
 20:  * @author      Murat Purc <murat@purc.de>
 21:  * @package     Plugin
 22:  * @subpackage  ModRewrite
 23:  */
 24: class ModRewrite_ContentExpertController extends ModRewrite_ControllerAbstract {
 25: 
 26:     /**
 27:      * Path to restrictive htaccess file
 28:      * @var string
 29:      */
 30:     protected $_htaccessRestrictive = '';
 31: 
 32:     /**
 33:      * Path to simple htaccess file
 34:      * @var string
 35:      */
 36:     protected $_htaccessSimple = '';
 37: 
 38:     /**
 39:      * Initializer method, sets the paths to htaccess files
 40:      */
 41:     public function init() {
 42:         $this->_oView->content_before = '';
 43: 
 44:         $pluginPath = $this->_cfg['path']['contenido'] . $this->_cfg['path']['plugins'] . 'mod_rewrite/';
 45:         $this->_htaccessRestrictive = $pluginPath . 'files/htaccess_restrictive.txt';
 46:         $this->_htaccessSimple = $pluginPath . 'files/htaccess_simple.txt';
 47:     }
 48: 
 49:     /**
 50:      * Index action
 51:      */
 52:     public function indexAction() {
 53:     }
 54: 
 55:     /**
 56:      * Copy htaccess action
 57:      */
 58:     public function copyHtaccessAction() {
 59:         $type = $this->_getParam('htaccesstype');
 60:         $copy = $this->_getParam('copy');
 61: 
 62:         if ($type != 'restrictive' && $type != 'simple') {
 63:             return;
 64:         } elseif ($copy != 'contenido' && $copy != 'cms') {
 65:             return;
 66:         }
 67: 
 68:         $aInfo = $this->getProperty('htaccessInfo');
 69: 
 70:         if ($aInfo['has_htaccess']) {
 71:             $this->_oView->content_before = $this->_notifyBox('warning', i18n('.htaccess already exists at CONTENIDO-/or client directory, so it is not copied.', 'mod_rewrite'));
 72:             return;
 73:         }
 74: 
 75:         if ($type == 'restrictive') {
 76:             $source = $this->_htaccessRestrictive;
 77:         } else {
 78:             $source = $this->_htaccessSimple;
 79:         }
 80: 
 81:         if ($copy == 'contenido') {
 82:             $dest = $aInfo['contenido_full_path'] . '.htaccess';
 83:         } else {
 84:             $dest = $aInfo['client_full_path'] . '.htaccess';
 85:         }
 86: 
 87:         if (!$result = @copy($source, $dest)) {
 88:             $this->_oView->content_before = $this->_notifyBox('warning', sprintf(i18n('.htaccess could not copy from <strong>%s</strong> to <strong>%s</strong>! Perhaps the target directory has not the required rights to write files at your webserver.', 'mod_rewrite'), $source, $dest));
 89:             return;
 90:         }
 91: 
 92:         $msg = sprintf(i18n('.htaccess are successfully copied to %s', 'mod_rewrite'), str_replace('.htaccess', '', $dest));
 93:         $this->_oView->content_before = $this->_notifyBox('info', $msg);
 94:     }
 95: 
 96:     /**
 97:      * Download htaccess action
 98:      *
 99:      * @throws cInvalidArgumentException
100:      * @throws cException
101:      */
102:     public function downloadHtaccessAction() {
103:         $type = $this->_getParam('htaccesstype');
104: 
105:         if ($type != 'restrictive' && $type != 'simple') {
106:             return;
107:         }
108: 
109:         if ($type == 'restrictive') {
110:             $source = $this->_htaccessRestrictive;
111:         } else {
112:             $source = $this->_htaccessSimple;
113:         }
114: 
115:         $this->_oView->content = cFileHandler::read($source);
116: 
117:         header('Content-Type: text/plain');
118:         header('Etag: ' . md5(mt_rand()));
119:         header('Content-Disposition: attachment; filename="' . $type . '.htaccess"');
120:         $this->render('{CONTENT}');
121:     }
122: 
123:     /**
124:      * Reset aliases action
125:      *
126:      * @throws cDbException
127:      * @throws cInvalidArgumentException
128:      */
129:     public function resetAction() {
130:         // recreate all aliases
131:         ModRewrite::recreateAliases(false);
132:         $this->_oView->content_before = $this->_notifyBox('info', i18n('All aliases have been reset.', 'mod_rewrite'));
133:     }
134: 
135:     /**
136:      * Reset only empty aliases action
137:      *
138:      * @throws cDbException
139:      * @throws cInvalidArgumentException
140:      */
141:     public function resetEmptyAction() {
142:         // recreate only empty aliases
143:         ModRewrite::recreateAliases(true);
144:         $this->_oView->content_before = $this->_notifyBox('info', i18n('Only empty aliases have been reset.', 'mod_rewrite'));
145:     }
146: 
147: }
148: 
CMS CONTENIDO 4.10.1 API documentation generated by ApiGen 2.8.0