1: <?php
  2:   3:   4:   5:   6:   7:   8:   9:  10:  11:  12:  13:  14: 
 15: 
 16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 17: 
 18:  19:  20:  21:  22:  23: 
 24: class cSetupClientAdjust extends cSetupMask {
 25: 
 26:     function cSetupClientAdjust($step, $previous, $next) {
 27:         global $db, $cfg, $cfgClient;
 28: 
 29:         cSetupMask::cSetupMask("templates/setup/forms/pathinfo.tpl", $step);
 30:         $this->setHeader(i18n("Client Settings", "setup"));
 31:         $this->_oStepTemplate->set("s", "TITLE", i18n("Client Settings", "setup"));
 32:         $this->_oStepTemplate->set("s", "DESCRIPTION", i18n("Please check the directories identified by the system. If you need to change a client path, click on the name and enter your new path in the available input box.", "setup"));
 33: 
 34:         $db = getSetupMySQLDBConnection();
 35: 
 36:         $aClients = listClients($db, $cfg['tab']['clients']);
 37: 
 38:         $cHTMLErrorMessageList = new cHTMLErrorMessageList();
 39:         $cHTMLFoldableErrorMessages = array();
 40: 
 41:         $aPathList = array();
 42: 
 43:         list($a_root_path, $a_root_http_path) = getSystemDirectories();
 44: 
 45:         @include($cfg['path']['contenido_config'] . 'config.php');
 46: 
 47:         setupInitializeCfgClient();
 48: 
 49:         foreach ($aClients as $idclient => $aInfo) {
 50:             $name = $aInfo['name'];
 51: 
 52:             if (isset($cfgClient[$idclient])) {
 53:                 $htmlPath = $cfgClient[$idclient]["path"]["htmlpath"];
 54:                 $frontendPath = $cfgClient[$idclient]["path"]["frontend"];
 55:             } else {
 56:                 $htmlPath = '';
 57:                 $frontendPath = '';
 58:             }
 59: 
 60:             if ($_SESSION["frontendpath"][$idclient] == "") {
 61:                 $iDifferencePos = findSimilarText($cfg['path']['frontend'] . "/", $frontendPath);
 62:                 if ($iDifferencePos > 0) {
 63:                     $sClientPath = $a_root_path . "/" . substr($frontendPath, $iDifferencePos + 1, strlen($frontendPath) - $iDifferencePos);
 64:                     $_SESSION["frontendpath"][$idclient] = $sClientPath;
 65:                 } else {
 66:                     $_SESSION["frontendpath"][$idclient] = $frontendPath;
 67:                 }
 68:             }
 69: 
 70:             if ($_SESSION["htmlpath"][$idclient] == "") {
 71:                 
 72:                 $iDifferencePos = findSimilarText($cfg['path']['frontend'] . "/", $frontendPath);
 73:                 if ($iDifferencePos > 0) {
 74:                     $sClientPath = $a_root_http_path . "/" . substr($frontendPath, $iDifferencePos + 1, strlen($frontendPath) - $iDifferencePos);
 75:                     $_SESSION["htmlpath"][$idclient] = $sClientPath;
 76:                 } else {
 77:                     $_SESSION["htmlpath"][$idclient] = $htmlPath;
 78:                 }
 79:             }
 80: 
 81:             $sName = sprintf(i18n("Old server path for %s (%s)", "setup"), $name, $idclient);
 82:             $sName .= ":<br>" . $frontendPath . "<br><br>";
 83:             $sName .= sprintf(i18n("New server path for %s (%s)", "setup"), $name, $idclient);
 84:             $sName .= ":<br>";
 85:             $oSystemPathBox = new cHTMLTextbox("frontendpath[$idclient]", $_SESSION["frontendpath"][$idclient]);
 86:             $oSystemPathBox->setWidth(100);
 87:             $oSystemPathBox->setClass("small");
 88:             $oClientSystemPath = new cHTMLInfoMessage(array($sName, $oSystemPathBox), " ");
 89:             $oClientSystemPath->_oTitle->setStyle("padding-left:8px;padding-bottom:8px;width:90%;");
 90: 
 91:             $aPathList[] = $oClientSystemPath;
 92: 
 93:             $sName = sprintf(i18n("Old web path for %s (%s)", "setup"), $name, $idclient);
 94:             $sName .= ":<br>" . $htmlPath . "<br><br>";
 95:             $sName .= sprintf(i18n("New web path for %s (%s)", "setup"), $name, $idclient);
 96:             $sName .= ":<br>";
 97:             $oSystemPathBox = new cHTMLTextbox("htmlpath[$idclient]", $_SESSION["htmlpath"][$idclient]);
 98:             $oSystemPathBox->setWidth(100);
 99:             $oSystemPathBox->setClass("small");
100:             $oClientSystemPath = new cHTMLInfoMessage(array($sName, $oSystemPathBox), " ");
101:             $oClientSystemPath->_oTitle->setStyle("padding-left:8px;padding-bottom:8px;width:90%;");
102: 
103:             $aPathList[] = $oClientSystemPath;
104:         }
105: 
106:         $cHTMLErrorMessageList->setContent($aPathList);
107: 
108:         $this->_oStepTemplate->set("s", "CONTROL_PATHINFO", $cHTMLErrorMessageList->render());
109: 
110:         $this->setNavigation($previous, $next);
111:     }
112: 
113: }
114: 
115: ?>