Esempio n. 1
0
 public function displayDeactivatePage()
 {
     $this->assign('GET', reqBup::get('get'));
     $this->assign('POST', reqBup::get('post'));
     $this->assign('REQUEST_METHOD', strtoupper(reqBup::getVar('REQUEST_METHOD', 'server')));
     $this->assign('REQUEST_URI', basename(reqBup::getVar('REQUEST_URI', 'server')));
     parent::display('deactivatePage');
 }
Esempio n. 2
0
 public function getList()
 {
     $res = new responseBup();
     $list = $this->getModel()->getList(reqBup::get('post'));
     $res->addData('list', $list);
     $res->addData('count', $this->getModel()->getCount());
     //$res->addMessage(__('Done', BUP_LANG_CODE));
     return $res->ajaxExec();
 }
Esempio n. 3
0
 public function saveGroupEvery()
 {
     $res = new responseBup();
     if ($data = $this->getModel()->saveGroupEvery(reqBup::get('post'))) {
         $res->addMessage(langBup::_('Save complete'));
         //$res->addData($data);
     } else {
         $res->pushError($this->getModel()->getErrors());
     }
     return $res->ajaxExec();
 }
Esempio n. 4
0
 public function saveMainFromDestGroup()
 {
     $res = new responseBup();
     $post = reqBup::get('post');
     if ($this->getModel()->saveMainFromDestGroup($post) && $this->getModel()->saveGroup($post)) {
         $res->addMessage(__('Save Complete', BUP_LANG_CODE));
         $res->addData(true);
     } else {
         $res->pushError($this->getModel('options')->getErrors());
     }
     return $res->ajaxExec();
 }
Esempio n. 5
0
 public function getActiveTabForCssClass($tabsData)
 {
     $reqTab = reqBup::getVar('tab');
     $currentTab = empty($reqTab) ? 'bupMainOptions' : $reqTab;
     foreach ($tabsData as $key => $tab) {
         if ($currentTab == $key && !empty($tab['parent'])) {
             $currentTab = $tab['parent'];
             break;
         }
     }
     return $currentTab;
 }
Esempio n. 6
0
 public function saveMainFromDestGroup()
 {
     $res = new responseBup();
     $post = reqBup::get('post');
     if ($result = $this->getModel()->saveMainFromDestGroup($post)) {
         $res->addMessage(langBup::_('Save Complete'));
         $res->addData($result);
     } else {
         $res->pushError($this->getModel('options')->getErrors());
     }
     return $res->ajaxExec();
 }
Esempio n. 7
0
 public function bupSendInfo()
 {
     $res = new responseBup();
     if ($this->getModel()->welcomePageSaveInfo(reqBup::get('post'))) {
         $res->addMessage(langBup::_('Information was saved. Thank you!'));
         $originalPage = reqBup::getVar('original_page');
         $return = $this->getModule()->decodeSlug(str_replace('return=', '', $originalPage));
         $return = admin_url(strpos($return, '?') ? $return : 'admin.php?page=' . $return);
         $res->addData('redirect', $return);
         installerBup::setUsed();
     } else {
         $res->pushError($this->getModel()->getErrors());
     }
     return $res->ajaxExec();
 }
Esempio n. 8
0
 public function ajaxExec($forceAjax = false)
 {
     $reqType = reqBup::getVar('reqType');
     $redirect = reqBup::getVar('redirect');
     if (count($this->errors) > 0) {
         $this->error = true;
     }
     if ($reqType == 'ajax' || $forceAjax) {
         exit(json_encode($this));
     }
     if ($redirect) {
         redirectBup($redirect);
     }
     return $this;
 }
Esempio n. 9
0
 public function sendMailToDevelopers()
 {
     $res = new responseBup();
     $data = reqBup::get('post');
     $fields = array('name' => new fieldBupBup('name', __('Your name field is required.', BUP_LANG_CODE), '', '', 'Your name', 0, array(), 'notEmpty'), 'website' => new fieldBupBup('website', __('Your website field is required.', BUP_LANG_CODE), '', '', 'Your website', 0, array(), 'notEmpty'), 'email' => new fieldBupBup('email', __('Your e-mail field is required.', BUP_LANG_CODE), '', '', 'Your e-mail', 0, array(), 'notEmpty, email'), 'subject' => new fieldBupBup('subject', __('Subject field is required.', BUP_LANG_CODE), '', '', 'Subject', 0, array(), 'notEmpty'), 'category' => new fieldBupBup('category', __('You must select a valid category.', BUP_LANG_CODE), '', '', 'Category', 0, array(), 'notEmpty'), 'message' => new fieldBupBup('message', __('Message field is required.', BUP_LANG_CODE), '', '', 'Message', 0, array(), 'notEmpty'));
     foreach ($fields as $f) {
         $f->setValue($data[$f->name]);
         $errors = validatorBup::validate($f);
         if (!empty($errors)) {
             $res->addError($errors);
         }
     }
     if (!$res->error) {
         $msg = 'Message from: ' . get_bloginfo('name') . ', Host: ' . $_SERVER['HTTP_HOST'] . '<br />';
         foreach ($fields as $f) {
             $msg .= '<b>' . $f->label . '</b>: ' . nl2br($f->value) . '<br />';
         }
         $headers[] = 'From: ' . $fields['name']->value . ' <' . $fields['email']->value . '>';
         wp_mail('*****@*****.**', 'Supsystic Ecommerce Contact Dev', $msg, $headers);
         $res->addMessage(__('Done', BUP_LANG_CODE));
     }
     $res->ajaxExec();
 }
Esempio n. 10
0
 /**
  * Download Action
  * Download file from Google Drive to local server
  */
 public function downloadAction()
 {
     $request = reqBup::get('post');
     $response = new responseBup();
     /** @var gdriveModelBup $model*/
     $model = $this->getModel();
     $result = false;
     if ($model->isAuthenticated() === false) {
         $response->addError(__('Authentication required', BUP_LANG_CODE));
     }
     // if there is a local file, then we do not have sense to download it
     // from the server, so just immediately recover from it
     if (!empty($request['download_url'])) {
         if ($model->isLocalFileExists($request['filename']) === false) {
             $result = $model->download($request['download_url'], $request['filename']);
         } else {
             $result = true;
         }
     } else {
         $stacksFolder = !empty($request['filename']) ? $request['filename'] : '';
         $stacksList = $model->getUploadedFiles($stacksFolder, true);
         if (!empty($stacksList)) {
             $backupPath = $model->getBackupsPath();
             $result = true;
             if (!file_exists($backupPath . $stacksFolder)) {
                 frameBup::_()->getModule('warehouse')->getController()->getModel('warehouse')->create($backupPath . $stacksFolder . DS);
             }
             foreach ($stacksList as $stack) {
                 if (!file_exists($backupPath . $stacksFolder . DS . $stack['title'])) {
                     $result = $model->download($stack['downloadUrl'], $stacksFolder . DS . $stack['title']) && $result ? true : false;
                 }
             }
         } else {
             $response->addError(__('Files not found on Google Drive', BUP_LANG_CODE));
         }
     }
     if ($result === true) {
         $response->addData(array('filename' => $request['filename']));
     } elseif ($result === null) {
         $response->addError(__('File not found on Google Drive', BUP_LANG_CODE));
     } elseif ($result === false) {
         $response->addError(__('Failed to download file', BUP_LANG_CODE));
     }
     return $response->ajaxExec();
 }
Esempio n. 11
0
 /**
  * Authenticate client
  *
  * @since  1.1
  * @return boolean
  */
 public function authenticate()
 {
     $client = $this->getClient();
     $request = reqBup::get('get');
     if (!isset($request['googleAuthCode']) or empty($request['googleAuthCode'])) {
         return $this->getAuthenticationURL();
     }
     $code = trim($request['googleAuthCode']);
     try {
         $_SESSION[self::GDRIVE_SESS_NAME] = $client->authenticate($code);
         $this->saveToken($_SESSION[self::GDRIVE_SESS_NAME]);
         $tokens = json_decode($this->readToken());
         if (!empty($tokens->refresh_token)) {
             frameBup::_()->getTable('options')->update(array('value' => $tokens->refresh_token), array('code' => 'gdrive_refresh_token'));
         }
         $uri = null;
         if (is_array($request)) {
             $uri = array();
             foreach ($request as $key => $value) {
                 if ($key != 'googleAuthCode') {
                     $uri[] = $key . '=' . $value;
                 }
             }
             $uri = 'admin.php?' . join('&', $uri);
         }
         $redirectURI = !empty($uri) ? $uri : 'admin.php?page=' . BUP_PLUGIN_PAGE_URL_SUFFIX;
         redirectBup(admin_url($redirectURI));
     } catch (Exception $e) {
         $this->pushError($e->getMessage());
         return $this->getAuthenticationURL();
     }
 }
Esempio n. 12
0
 /**
  * Download Action
  * Downloads file from Amazon S3 to local storage
  * This action triggers before restoring from Amazon S3
  *
  * @since  1.1
  */
 public function downloadAction()
 {
     $request = reqBup::get('post');
     $response = new responseBup();
     /**@var amazonModelBup $model*/
     $model = $this->getModel();
     $extension = pathinfo($request['filename'], PATHINFO_EXTENSION);
     $filename = pathinfo($request['filename'], PATHINFO_BASENAME);
     if ($extension === 'sql' || $extension === 'zip') {
         if (file_exists($model->getBackupsPath() . $filename) || $model->download($request['filename']) === 201) {
             $response->addData(array('filename' => $filename));
         } else {
             $response->addError(array(__('File not found on Amazon S3', BUP_LANG_CODE)));
         }
     } else {
         $stacksFolder = basename($request['filename']) . '/';
         $stacksFileList = $model->getUploadedFiles($stacksFolder);
         if (!empty($stacksFileList)) {
             $backupPath = $model->getBackupsPath();
             $result = true;
             if (!file_exists($backupPath . $stacksFolder)) {
                 frameBup::_()->getModule('warehouse')->getController()->getModel('warehouse')->create($backupPath . $stacksFolder . DS);
             }
             foreach ($stacksFileList as $stack) {
                 if (!file_exists($backupPath . $stacksFolder . basename($stack))) {
                     $result = $model->download($stack, $stacksFolder) === 201 && $result ? true : false;
                 }
             }
             if ($result) {
                 $response->addData(array('filename' => basename($stacksFolder)));
             } else {
                 $response->addError(__('All stacks not downloaded!', BUP_LANG_CODE));
                 frameBup::_()->getModule('backup')->getController()->getModel('filesystem')->deleteLocalBackup(array($backupPath . $stacksFolder));
             }
         } else {
             $response->addError(__('Files not found on Amazon S3!', BUP_LANG_CODE));
         }
     }
     $response->ajaxExec();
 }
Esempio n. 13
0
 /**
  * Remove Action
  */
 public function removeAction()
 {
     $request = reqBup::get('post');
     $response = new responseBup();
     $model = $this->getModel();
     if ($model->remove($request['filename']) === true) {
         $response->addMessage(langBup::_('Backup successfully removed'));
     } else {
         $response->addError(langBup::_('Unable to delete backup'));
     }
     $response->ajaxExec();
 }
Esempio n. 14
0
 public static function clearSession()
 {
     reqBup::clearVar('sesErrors', 'session');
 }
Esempio n. 15
0
 /**
  * Restore Action
  *
  * @since  1.0
  */
 public function restoreAction()
 {
     $request = reqBup::get('post');
     $response = new responseBup();
     $extension = pathinfo($request['file'], PATHINFO_EXTENSION);
     if (!isset($request['file']) or empty($request['file'])) {
         $response->addError(__('There was an error during recovery', BUP_LANG_CODE));
     }
     if ($extension === 'sql' || $extension === 'zip') {
         if ($this->model->download($request['file']) === true) {
             $response->addData(array('filename' => $request['file']));
         } else {
             $response->addError($this->model->getErrors());
         }
     } else {
         $stacksFolder = !empty($request['file']) ? $request['file'] : '';
         $stacksFileList = $this->model->getUploadedFiles($stacksFolder . '/');
         if (!empty($stacksFileList)) {
             $backupPath = $this->model->getBackupsPath();
             $result = true;
             if (!file_exists($backupPath . $stacksFolder)) {
                 frameBup::_()->getModule('warehouse')->getController()->getModel('warehouse')->create($backupPath . $stacksFolder . DS);
             }
             foreach ($stacksFileList as $stack) {
                 if (!file_exists($backupPath . $stacksFolder . DS . basename($stack))) {
                     $result = $this->model->download($stack) && $result ? true : false;
                 }
             }
             if ($result) {
                 $response->addData(array('filename' => $stacksFolder));
             } else {
                 $response->addError(__('All files not downloaded from DropBox, please, try again', BUP_LANG_CODE));
             }
         } else {
             $response->addError(__('Files not found on OneDrive', BUP_LANG_CODE));
         }
     }
     return $response->ajaxExec();
 }
Esempio n. 16
0
 public function isTplEditor()
 {
     $tplEditor = reqBup::getVar('tplEditor');
     return (bool) $tplEditor;
 }
Esempio n. 17
0
 public function downloadAction()
 {
     $request = reqBup::get('post');
     $response = new responseBup();
     /**@var onedriveModelBup $onedrive*/
     $onedrive = $this->getModel();
     $extension = pathinfo($request['fileName'], PATHINFO_EXTENSION);
     if ($extension === 'sql' || $extension === 'zip') {
         if (file_exists($onedrive->getBackupsPath() . $request['fileName']) || $onedrive->download($request['file_id'])) {
             $response->addMessage(__('File downloaded.', BUP_LANG_CODE));
         } else {
             $response->addError($onedrive->getErrors());
         }
     } else {
         $stacksFolder = !empty($request['fileName']) ? $request['fileName'] : '';
         $stacksFileList = $onedrive->getUserFiles($stacksFolder);
         if (!empty($stacksFileList)) {
             $backupPath = $onedrive->getBackupsPath();
             $result = true;
             if (!file_exists($backupPath . $stacksFolder)) {
                 frameBup::_()->getModule('warehouse')->getController()->getModel('warehouse')->create($backupPath . $stacksFolder . DS);
             }
             foreach ($stacksFileList as $stack) {
                 if (!file_exists($backupPath . $stacksFolder . DS . $stack->name)) {
                     $result = $onedrive->download($stack->id, false, $stacksFolder . DS) && $result ? true : false;
                 }
             }
         } else {
             $response->addError(__('Files not found on OneDrive', BUP_LANG_CODE));
         }
     }
     return $response->ajaxExec();
 }
Esempio n. 18
0
 public static function getMethod()
 {
     if (!self::$_requestMethod) {
         self::$_requestMethod = strtoupper(self::getVar('method', 'all', $_SERVER['REQUEST_METHOD']));
     }
     return self::$_requestMethod;
 }
Esempio n. 19
0
                  <li>Backup in archive</li>
                  <li>Restore backups anywhere</li>
                </ul>
                <p>So check full features list <a target="_blank" href="http://readyshoppingcart.com/wordpress-backup-plugin/">here</a>.</p>
                
            </div>
            <div class="clear"></div>
            
            <?php 
echo htmlBup::hidden('page', array('value' => 'promo_ready'));
?>
			<?php 
echo htmlBup::hidden('action', array('value' => 'bupSendInfo'));
?>
            <?php 
echo htmlBup::hidden('reqType', array('value' => 'ajax'));
?>
            <?php 
echo htmlBup::submit('gonext', array('value' => 'Thank for check info. Start using plugin.', 'attrs' => 'class="button button-primary button-hero"'));
?>
            <?php 
echo htmlBup::hidden('original_page', array('value' => reqBup::getVar('page')));
?>
            
           <!-- <a class="button button-primary button-hero bupSendInfo" href="javascript:void(0)">Thank for check info. Start using plugin.</a>-->
            
            <span id="bupWelcomePageFindUsMsg"></span>
        </form>
    </div>

</div>
Esempio n. 20
0
 public function getBackupLog()
 {
     $response = new responseBup();
     $request = reqBup::get('post');
     /** @var backupTechLogModelBup $techLog */
     $techLog = $this->getModel('backupTechLog');
     $techLog->setLogName($request['backupId']);
     /** @var backupLogTxtModelBup $log */
     $log = $this->getModel('backupLogTxt');
     $log->setLogName($request['backupId']);
     $backupComplete = $techLog->get('complete');
     $backupMessage = $techLog->get('backupMessage');
     $backupProcessPercent = $techLog->get('backupProcessPercent');
     $filesystemBackupComplete = $techLog->get('filesystemBackupComplete');
     $backupProcessData = array('backupLog' => $log->getContent(), 'backupComplete' => $backupComplete, 'backupMessage' => $backupMessage, 'backupProcessPercent' => $backupProcessPercent, 'filesystemBackupComplete' => $filesystemBackupComplete);
     $response->addData($backupProcessData);
     if ($backupComplete) {
         $techLog->deleteOldLogs();
         $response->addMessage(__('Backup complete!'), BUP_LANG_CODE);
     }
     return $response->ajaxExec();
 }
Esempio n. 21
0
 private static function _getPluginLocations()
 {
     $locations = array();
     $plug = reqBup::getVar('plugin');
     if (empty($plug)) {
         $plug = reqBup::getVar('checked');
         $plug = $plug[0];
     }
     $locations['plugPath'] = plugin_basename(trim($plug));
     $locations['plugDir'] = dirname(WP_PLUGIN_DIR . DS . $locations['plugPath']);
     $locations['xmlPath'] = $locations['plugDir'] . DS . 'install.xml';
     return $locations;
 }
Esempio n. 22
0
 public static function delete()
 {
     global $wpdb;
     $wpPrefix = $wpdb->prefix;
     $deleteOptions = reqBup::getVar('deleteOptions');
     if (is_null($deleteOptions)) {
         frameBup::_()->getModule('options')->getView()->displayDeactivatePage();
         exit;
     }
     if ((bool) $deleteOptions) {
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . BUP_DB_PREF . "modules`");
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . BUP_DB_PREF . "modules_type`");
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . BUP_DB_PREF . "options`");
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . BUP_DB_PREF . "options_categories`");
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . BUP_DB_PREF . "htmltype`");
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . BUP_DB_PREF . "files`");
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . BUP_DB_PREF . "log`");
     }
     frameBup::_()->getModule('schedule')->getModel()->unSetSchedule(frameBup::_()->getModule('options')->getEvery());
     delete_option(BUP_DB_PREF . 'db_version');
     delete_option(BUP_DB_PREF . 'db_installed');
 }