/**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct();
     // Objects
     $this->objSyncCtoFiles = SyncCtoFiles::getInstance();
     $this->objSyncCtoHelper = SyncCtoHelper::getInstance();
 }
예제 #2
0
 /**
  * Initialize the object
  */
 public function __construct()
 {
     \BackendUser::getInstance()->authenticate();
     parent::__construct();
     $this->loadLanguageFile('default');
     $this->objSyncCtoHelper = SyncCtoHelper::getInstance();
     $this->initGetParams();
 }
예제 #3
0
 /**
  * Constructor
  */
 public function __construct()
 {
     $this->BackendUser = BackendUser::getInstance();
     parent::__construct();
     $this->Encryption = Encryption::getInstance();
     $this->Config = Config::getInstance();
     $this->objSyncCtoFiles = SyncCtoFiles::getInstance();
     $this->objSyncCtoDatabase = SyncCtoDatabase::getInstance();
     $this->objSyncCtoHelper = SyncCtoHelper::getInstance();
     $this->loadLanguageFile("default");
     $this->arrDebug = array();
 }
예제 #4
0
 public function getHiddenTables()
 {
     // Get the data from the helper.
     $arrTables = SyncCtoHelper::getInstance()->hiddenTables();
     $arrReturn = array();
     // Check if a regex remove this entry from the list.
     foreach ($arrTables as $strTable) {
         if (SyncCtoHelper::getInstance()->isTableHiddenByPlaceholder($strTable)) {
             $arrReturn[$strTable] = sprintf($GLOBALS['TL_LANG']['tl_syncCto_settings']['hide_by_regex'], $strTable);
         } else {
             $arrReturn[$strTable] = $strTable;
         }
     }
     // Return the values.
     return $arrReturn;
 }
예제 #5
0
 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct();
     // Init some vars
     $this->arrBackupTables = array();
     $this->strTimestampFormat = str_replace(array_keys($GLOBALS['SYC_CONFIG']['folder_file_replacement']), array_values($GLOBALS['SYC_CONFIG']['folder_file_replacement']), $GLOBALS['TL_CONFIG']['datimFormat']);
     $this->intMaxMemoryUsage = SyncCtoModuleClient::parseSize(ini_get('memory_limit'));
     $this->intMaxMemoryUsage = $this->intMaxMemoryUsage / 100 * 80;
     // Load hidden tables
     $this->arrHiddenTables = deserialize($GLOBALS['SYC_CONFIG']['table_hidden']);
     if (!is_array($this->arrHiddenTables)) {
         $this->arrHiddenTables = array();
     }
     // Load Helper
     $this->objSyncCtoHelper = SyncCtoHelper::getInstance();
     $this->Database = Database::getInstance();
 }
예제 #6
0
 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct();
     // Init
     $this->objSyncCtoHelper = SyncCtoHelper::getInstance();
     $this->objFiles = \Files::getInstance();
     $this->strTimestampFormat = str_replace(array(':', ' '), array('', '_'), $GLOBALS['TL_CONFIG']['datimFormat']);
     // Load blacklists and whitelists
     $this->arrRootFolderList = $this->objSyncCtoHelper->getWhitelistFolder();
     // Get memory limit
     $this->intMaxMemoryUsage = SyncCtoModuleClient::parseSize(ini_get('memory_limit'));
     $this->intMaxMemoryUsage = $this->intMaxMemoryUsage / 100 * 30;
     // Get execution limit
     $this->intMaxExecutionTime = SyncCtoHelper::parseRuntime(ini_get('max_execution_time'));
     $this->intMaxExecutionTime = intval($this->intMaxExecutionTime / 100 * 25);
     // Flags for file scanning.
     $this->strRDIFlags = RecursiveDirectoryIterator::FOLLOW_SYMLINKS | RecursiveDirectoryIterator::SKIP_DOTS | RecursiveDirectoryIterator::UNIX_PATHS;
 }
예제 #7
0
 /**
  * Initialize the object
  */
 public function __construct()
 {
     // Check user auth
     \BackendUser::getInstance()->authenticate();
     // Call the parent.
     parent::__construct();
     // Set language from get or user
     if (\Input::getInstance()->get('language') != '') {
         $GLOBALS['TL_LANGUAGE'] = \Input::getInstance()->get('language');
     } else {
         $GLOBALS['TL_LANGUAGE'] = \BackendUser::getInstance()->language;
     }
     // Load language
     $this->loadLanguageFile('default');
     $this->loadLanguageFile("modules");
     $this->loadLanguageFile("tl_syncCto_database");
     $this->objSyncCtoHelper = SyncCtoHelper::getInstance();
     $this->initGetParams();
 }
예제 #8
0
 /**
  * Constructor
  *
  * @param DataContainer $objDc
  */
 public function __construct(DataContainer $objDc = null)
 {
     parent::__construct($objDc);
     // Load helper
     $this->objSyncCtoDatabase = SyncCtoDatabase::getInstance();
     $this->objSyncCtoFiles = SyncCtoFiles::getInstance();
     $this->objSyncCtoCommunicationClient = SyncCtoCommunicationClient::getInstance();
     $this->objSyncCtoHelper = SyncCtoHelper::getInstance();
     // Load language
     $this->loadLanguageFile("tl_syncCto_steps");
     $this->loadLanguageFile("tl_syncCto_check");
     // Load CSS
     $GLOBALS['TL_CSS'][] = 'system/modules/syncCto/assets/css/steps.css';
     // Init classes.
     $this->User = \BackendUser::getInstance();
 }
예제 #9
0
 /**
  * Backup filesystem 
  */
 protected function pageFileBackupPage()
 {
     // Init | Set Step to 1
     if ($this->intStep == 0) {
         // Init content
         $this->booError = false;
         $this->booAbort = false;
         $this->booFinished = false;
         $this->strError = "";
         $this->booRefresh = true;
         $this->strUrl = "contao/main.php?do=syncCto_backups&table=tl_syncCto_backup_file&act=start";
         $this->strGoBack = \Environment::get('base') . "contao/main.php?do=syncCto_backups&table=tl_syncCto_backup_file";
         $this->strHeadline = $GLOBALS['TL_LANG']['tl_syncCto_backup_file']['edit'];
         $this->strInformation = "";
         $this->intStep = 1;
         $this->floStart = microtime(true);
         $this->objData = new ContentData(array(), $this->intStep);
         // Reset some Sessions
         $this->resetStepPool();
     }
     // Load step pool
     $this->loadStepPool();
     // Set content back to normale mode
     $this->booRefresh = true;
     $this->objData->setStep(1);
     $this->objData->setState(SyncCtoEnum::WORK_WORK);
     $this->objData->setHtml("");
     try {
         switch ($this->intStep) {
             case 1:
                 $this->objData->setTitle($GLOBALS['TL_LANG']['MSC']['step'] . " %s");
                 $this->objData->setDescription($GLOBALS['TL_LANG']['tl_syncCto_backup_file']['step1']);
                 $this->objData->setState(SyncCtoEnum::WORK_WORK);
                 $this->objStepPool->zipname = "";
                 $this->objStepPool->skippedfiles = array();
                 $this->intStep++;
                 break;
             case 2:
                 if (!file_exists(TL_ROOT . '/' . SyncCtoHelper::getInstance()->standardizePath($GLOBALS['SYC_PATH']['file']))) {
                     throw new Exception(sprintf($GLOBALS['TL_LANG']['ERR']['missing_file_folder'], SyncCtoHelper::getInstance()->standardizePath($GLOBALS['SYC_PATH']['file'])));
                 }
                 $arrResult = $this->objSyncCtoFiles->runDump($this->arrBackupSettings['backup_name'], $this->arrBackupSettings['core_files'], $this->arrBackupSettings['filelist']);
                 $this->objStepPool->zipname = $arrResult["name"];
                 $this->objStepPool->skippedfiles = $arrResult["skipped"];
                 \Dbafs::addResource(SyncCtoHelper::getInstance()->standardizePath($GLOBALS['SYC_PATH']['file'], $this->objStepPool->zipname));
                 $this->intStep++;
                 break;
             case 3:
                 $this->booFinished = true;
                 $this->booRefresh = false;
                 $this->objData->setStep(1);
                 $this->objData->setState(SyncCtoEnum::WORK_OK);
                 $strHTML = "<p class='tl_help'><br />";
                 $strHTML .= "<a onclick=\"Backend.openModalIframe({'width':600,'title':'" . $this->objStepPool->zipname . "','url':this.href,'height':216});return false\" href='contao/popup.php?src=" . base64_encode($GLOBALS['TL_CONFIG']['uploadPath'] . "/syncCto_backups/files/" . $this->objStepPool->zipname) . "'>" . $GLOBALS['TL_LANG']['MSC']['fileDownload'] . "</a>";
                 $strHTML .= "</p>";
                 if (count($this->objStepPool->skippedfiles) != 0) {
                     $strHTML = '<br /><p class="tl_help">' . count($this->objStepPool->skippedfiles) . $GLOBALS['TL_LANG']['MSC']['skipped_files'] . '</p>';
                     $strHTML .= '<ul class="fileinfo">';
                     foreach ($this->objStepPool->skippedfiles as $value) {
                         $strHTML .= "<li>" . $value . "</li>";
                     }
                     $strHTML .= "</ul>";
                 }
                 $this->objData->setStep(2);
                 $this->objData->setTitle($GLOBALS['TL_LANG']['MSC']['complete']);
                 $this->objData->setDescription($GLOBALS['TL_LANG']['tl_syncCto_backup_file']['complete'] . " " . $this->objStepPool->zipname);
                 $this->objData->setHtml($strHTML);
                 $this->objData->setState(SyncCtoEnum::WORK_OK);
                 break;
         }
     } catch (Exception $exc) {
         $objErrTemplate = new BackendTemplate('be_syncCto_error');
         $objErrTemplate->strErrorMsg = $exc->getMessage();
         $this->booRefresh = false;
         $this->objData->setState(SyncCtoEnum::WORK_ERROR);
         $this->objData->setHtml($objErrTemplate->parse());
     }
 }
예제 #10
0
 /**
  * Add the address to the label.
  *
  * @param $row
  *
  * @param $label
  *
  * @return mixed
  */
 public function setLabel($row, $label)
 {
     $intMaxChars = 65;
     $intMinChars = 30;
     $intLeft = $intMaxChars - (strlen($row['title']) + strlen($row['id']));
     $intLeft = max($intLeft, $intMinChars);
     $strAddress = SyncCtoHelper::getInstance()->substrCenter($row['address'] . $row['path'], $intLeft, ' [...] ');
     return str_replace('[URL]', $strAddress, $label);
 }
예제 #11
0
 /**
  * Constructor
  */
 public function __construct()
 {
     $this->BackendUser = BackendUser::getInstance();
     $this->objSyncCtoHelper = SyncCtoHelper::getInstance();
 }