Ejemplo n.º 1
0
 /**
  * Function for exporting languages
  *
  * @param PrePersistModelEvent $objEvent
  *
  * @throws RuntimeException If the submit type is unknown.
  */
 public function submitBackup(PrePersistModelEvent $objEvent)
 {
     // Get the data from the DC.
     $arrData = $objEvent->getModel()->getPropertiesAsArray();
     foreach ($arrData as $strKey => $mixData) {
         if (empty($mixData)) {
             unset($arrData[$strKey]);
         }
     }
     // Check if core or user backup is selected
     if (!isset($arrData['core_files']) && !isset($arrData['user_files'])) {
         \Message::addError($GLOBALS['TL_LANG']['ERR']['missing_file_selection']);
         \Controller::redirect(\Environment::get('base') . "contao/main.php?do=syncCto_backups&table=tl_syncCto_backup_file");
     }
     if (isset($arrData['user_files']) && is_array($arrData['filelist']) && count($arrData['filelist']) == 0) {
         \Message::addError($GLOBALS['TL_LANG']['ERR']['missing_file_selection']);
         \Controller::redirect(\Environment::get('base') . "contao/main.php?do=syncCto_backups&table=tl_syncCto_backup_file");
     }
     foreach ((array) $arrData['filelist'] as $key => $value) {
         $arrData['filelist'][$key] = Contao\FilesModel::findByPk($value)->path;
     }
     \Session::getInstance()->set("syncCto_BackupSettings", $arrData);
     // Check the vars.
     $this->objSyncCtoHelper->checkSubmit(array('postUnset' => array('start_backup'), 'error' => array('key' => 'syncCto_submit_false', 'message' => $GLOBALS['TL_LANG']['ERR']['missing_tables']), 'redirectUrl' => \Environment::get('base') . "contao/main.php?do=syncCto_backups&table=tl_syncCto_backup_file&act=start"), $arrData);
 }
Ejemplo n.º 2
0
 protected function compile()
 {
     global $objPage;
     $dc = \Contao\Database::getInstance();
     $row = $dc->prepare('SELECT * FROM tl_rs_settings WHERE id = ?')->limit(1)->execute($this->rs_setting)->fetchAssoc();
     $href = '';
     $readid = "readid_" . $this->id;
     $fileModel = new \Contao\FilesModel();
     $fileObj = $fileModel->findByPk($this->singleSRC);
     $file = new \File($fileObj->path, true);
     if ($row) {
         $customerid = '6857';
         $cid = 'btxaq';
         $lang = $row['language_demo'];
         $speed = $row['speed'];
         $stattype = \Contao\Environment::get('host');
         $url = \Contao\Environment::get('base');
         $url .= $fileObj->path;
         if ($row['have_license']) {
             $customerid = $row['customer_id'];
             if ($row['docreader_id']) {
                 $cid = $row['docreader_id'];
             } else {
             }
             $lang = $row['language'];
         }
         $protocol = \Contao\Environment::get('https');
         $ssl = false;
         if (isset($protocol)) {
             if ('on' == strtolower($protocol)) {
                 $ssl = true;
             }
             if ('1' == $protocol) {
                 $ssl = true;
             }
         }
         /*
         if ($ssl) {
             $port = \Contao\Environment::get('server_port');
             $url = str_replace('https', 'http', $url);
             $url = str_replace(':'.$port, '', $url);
             $stattype = str_replace(':'.$port, '', $stattype);
         }
         */
         $href = '';
         if ($ssl) {
             $href = "https://docreader.readspeaker.com/docreader/?";
         } else {
             $href = "http://docreader.readspeaker.com/docreader/?";
         }
         $href .= 'cid=' . $cid;
         $href .= "&lang=" . $lang;
         $href .= "&url=" . urlencode($url);
         $href .= "&stattype=" . $stattype;
     }
     if ($this->linkTitle == '') {
         $this->linkTitle = $file->basename;
     }
     $this->Template->link = $this->linkTitle;
     $this->Template->title = specialchars($this->titleText ?: $this->linkTitle);
     $this->Template->href = $href;
     $this->Template->file_url = $url;
     $this->Template->file_name = $fileObj->name;
     $this->Template->file_size = $this->getReadableSize($file->filesize, 1);
     $this->Template->icon = TL_ASSETS_URL . 'assets/contao/images/' . $file->icon;
     $this->Template->button_title = $this->rs_player_title . ($row['docreader_id'] ? '' : ' <em>(DEMO)</em>');
 }