Esempio n. 1
0
 public function getList_A($d = array())
 {
     $warehouse = ABSPATH . frameBup::_()->getModule('options')->get('warehouse');
     if (!file_exists($warehouse)) {
         utilsBup::createDir($warehouse, $params = array('chmod' => 0755, 'httpProtect' => 2));
     }
     $arrFile = scandir($warehouse);
     $arrFile = array_diff($arrFile, array('.', '..'));
     arsort($arrFile);
     $arrId = array();
     foreach ($arrFile as $file) {
         preg_match_all('~_id(\\d+)~', $file, $out);
         if (!empty($out[1][0]) && !in_array($out[1][0], $arrId)) {
             $arrId[] = $out[1][0];
             // get file array
         }
     }
     $arrBlock = array();
     foreach ($arrId as $id) {
         if ($id > $d['limitFrom'] && $id <= $d['limitTo']) {
             $pattern = "~_id{$id}~";
             foreach ($arrFile as $file) {
                 if (preg_match($pattern, $file)) {
                     $arrBlock[$id][] = $file;
                 }
             }
         }
     }
     return $arrBlock;
 }
Esempio n. 2
0
 public function put($d = array())
 {
     $res = new responseBup();
     $id = $this->_getIDFromReq($d);
     $d = prepareParamsBup($d);
     if (is_numeric($id) && $id) {
         if (isset($d['active'])) {
             $d['active'] = is_string($d['active']) && $d['active'] == 'true' || $d['active'] == 1 ? 1 : 0;
         }
         //mmm.... govnokod?....)))
         /* else
            $d['active'] = 0;*/
         if (frameBup::_()->getTable('modules')->update($d, array('id' => $id))) {
             $res->messages[] = langBup::_('Module Updated');
             $mod = frameBup::_()->getTable('modules')->getById($id);
             $newType = frameBup::_()->getTable('modules_type')->getById($mod['type_id'], 'label');
             $newType = $newType['label'];
             $res->data = array('id' => $id, 'label' => $mod['label'], 'code' => $mod['code'], 'type' => $newType, 'params' => utilsBup::jsonEncode($mod['params']), 'description' => $mod['description'], 'active' => $mod['active']);
         } else {
             if ($tableErrors = frameBup::_()->getTable('modules')->getErrors()) {
                 $res->errors = array_merge($res->errors, $tableErrors);
             } else {
                 $res->errors[] = langBup::_('Module Update Failed');
             }
         }
     } else {
         $res->errors[] = langBup::_('Error module ID');
     }
     parent::put($d);
     return $res;
 }
Esempio n. 3
0
 public function get($d = array())
 {
     parent::get($d);
     if (empty($this->_allTemplates)) {
         $directories = utilsBup::getDirList(BUP_TEMPLATES_DIR);
         if (!empty($directories)) {
             foreach ($directories as $code => $dir) {
                 if ($xml = utilsBup::getXml($dir['path'] . 'settings.xml')) {
                     $this->_allTemplates[$code] = $xml;
                     $this->_allTemplates[$code]->prevImg = BUP_TEMPLATES_PATH . $code . '/screenshot.png';
                 }
             }
         }
         if (is_dir(utilsBup::getCurrentWPThemeDir() . 'csp' . DS)) {
             if ($xml = utilsBup::getXml(utilsBup::getCurrentWPThemeDir() . 'csp' . DS . 'settings.xml')) {
                 $code = utilsBup::getCurrentWPThemeCode();
                 if (strpos($code, '/') !== false) {
                     // If theme is in sub-folder
                     $code = explode('/', $code);
                     $code = trim($code[count($code) - 1]);
                 }
                 $this->_allTemplates[$code] = $xml;
                 if (is_file(utilsBup::getCurrentWPThemeDir() . 'screenshot.jpg')) {
                     $this->_allTemplates[$code]->prevImg = utilsBup::getCurrentWPThemePath() . '/screenshot.jpg';
                 } else {
                     $this->_allTemplates[$code]->prevImg = utilsBup::getCurrentWPThemePath() . '/screenshot.png';
                 }
             }
         }
     }
     if (isset($d['code']) && isset($this->_allTemplates[$d['code']])) {
         return $this->_allTemplates[$d['code']];
     }
     return $this->_allTemplates;
 }
Esempio n. 4
0
 protected function _extractModules()
 {
     $activeModules = $this->getTable('modules')->innerJoin($this->getTable('modules_type'), 'type_id')->get($this->getTable('modules')->alias() . '.*, ' . $this->getTable('modules_type')->alias() . '.label as type_name');
     if ($activeModules) {
         foreach ($activeModules as $m) {
             $code = $m['code'];
             $moduleLocationDir = BUP_MODULES_DIR;
             if (!empty($m['ex_plug_dir'])) {
                 $moduleLocationDir = utilsBup::getExtModDir($m['ex_plug_dir']);
             }
             if (is_dir($moduleLocationDir . $code)) {
                 $this->_allModules[$m['code']] = 1;
                 if ((bool) $m['active']) {
                     importClassBup($code . strFirstUp(BUP_CODE), $moduleLocationDir . $code . DS . 'mod.php');
                     $moduleClass = toeGetClassNameBup($code);
                     if (class_exists($moduleClass)) {
                         $this->_modules[$code] = new $moduleClass($m);
                         $this->_modules[$code]->setParams((array) json_decode($m['params']));
                         if (is_dir($moduleLocationDir . $code . DS . 'tables')) {
                             $this->_extractTables($moduleLocationDir . $code . DS . 'tables' . DS);
                         }
                     }
                 }
             }
         }
     }
     //$operationTime = microtime(true) - $startTime;
 }
Esempio n. 5
0
    public function initJsVars()
    {
        $ajaxurl = admin_url('admin-ajax.php');
        if (frameBup::_()->getModule('options')->get('ssl_on_ajax')) {
            $ajaxurl = uriBup::makeHttps($ajaxurl);
        }
        $jsData = array('siteUrl' => BUP_SITE_URL, 'imgPath' => BUP_IMG_PATH, 'loader' => BUP_LOADER_IMG, 'close' => BUP_IMG_PATH . 'cross.gif', 'ajaxurl' => $ajaxurl, 'animationSpeed' => frameBup::_()->getModule('options')->get('js_animation_speed'), 'BUP_CODE' => BUP_CODE);
        return '<script type="text/javascript">
		// <!--
			var BUP_DATA = ' . utilsBup::jsonEncode($jsData) . ';
		// -->
		</script>';
    }
Esempio n. 6
0
 public function __construct($d, $params = array())
 {
     $this->setTypeID($d['type_id']);
     $this->setType($d['type_name']);
     $this->setCode($d['code']);
     $this->setLabel($d['label']);
     $this->setDescription($d['description']);
     $this->setParams($d['params']);
     $this->_setID($d['id']);
     if (isset($d['ex_plug_dir']) && !empty($d['ex_plug_dir'])) {
         $this->isExternal(true);
         $this->setExternalDir(utilsBup::getExtModDir($d['ex_plug_dir']));
         $this->setExternalPath(utilsBup::getExtModPath($d['ex_plug_dir']));
     }
 }
Esempio n. 7
0
 public function getPath($tpl)
 {
     $path = '';
     $code = $this->_code;
     $parentModule = frameBup::_()->getModule($this->_code);
     $plTemplate = frameBup::_()->getModule('options')->get('template');
     // Current plugin template
     if (empty($plTemplate) || !frameBup::_()->getModule($plTemplate)) {
         $plTemplate = '';
     }
     if (file_exists(utilsBup::getCurrentWPThemeDir() . 'bup' . DS . $code . DS . $tpl . '.php')) {
         $path = utilsBup::getCurrentWPThemeDir() . 'bup' . DS . $code . DS . $tpl . '.php';
     } elseif ($plTemplate && file_exists(frameBup::_()->getModule($plTemplate)->getModDir() . 'templates' . DS . $code . DS . $tpl . '.php')) {
         $path = frameBup::_()->getModule($plTemplate)->getModDir() . 'templates' . DS . $code . DS . $tpl . '.php';
     } elseif (file_exists($parentModule->getModDir() . 'views' . DS . 'tpl' . DS . $tpl . '.php')) {
         //Then try to find it in module directory
         $path = $parentModule->getModDir() . DS . 'views' . DS . 'tpl' . DS . $tpl . '.php';
     }
     return $path;
 }
Esempio n. 8
0
 public static function _installTables($module)
 {
     $modDir = empty($module['ex_plug_dir']) ? BUP_MODULES_DIR . $module['code'] . DS : utilsBup::getPluginDir($module['ex_plug_dir']) . $module['code'] . DS;
     if (is_dir($modDir . 'tables')) {
         $tableFiles = utilsBup::getFilesList($modDir . 'tables');
         if (!empty($tableFiles)) {
             frameBup::_()->extractTables($modDir . 'tables' . DS);
             foreach ($tableFiles as $file) {
                 $tableName = str_replace('.php', '', $file);
                 if (frameBup::_()->getTable($tableName)) {
                     frameBup::_()->getTable($tableName)->install();
                 }
             }
         }
     }
 }
Esempio n. 9
0
<script type="text/javascript">
// <!--
jQuery(document).ready(function(){
	var toeGlobalMessages = <?php 
echo utilsBup::jsonEncode($this->messages);
?>
;
	var toeGlobalMessagesStr = '';
	if(toeGlobalMessages.adminAlerts) {
		for(var i in toeGlobalMessages.adminAlerts) {
			toeGlobalMessagesStr += '<div class="toeSystemAlert">'+ 
				'<i style="font-size: 12px;"><?php 
echo $this->forAdminOnly;
?>
</i><br class="toeClear" />'+ 
				toeGlobalMessages.adminAlerts[ i ]+ 
				'</div>';
		}
	}
	if(toeGlobalMessagesStr != '') {
		jQuery('body:first').prepend(toeGlobalMessagesStr);
	}
		
});
// -->
</script>
Esempio n. 10
0
 public function getBgCssAttrs()
 {
     return utilsBup::arrToCss($this->getBgCssAttrsArray());
 }
Esempio n. 11
0
 public static function init()
 {
     if (!utilsBup::isSessionStarted()) {
         session_start();
     }
 }
Esempio n. 12
0
 public static function getCurrentWPThemeDir()
 {
     static $themePath;
     if (empty($themePath)) {
         $themePath = get_theme_root() . DS . utilsBup::getCurrentWPThemeCode() . DS;
     }
     return $themePath;
 }
Esempio n. 13
0
 public function init()
 {
     if (is_admin() && frameBup::_()->isPluginAdminPage()) {
         $this->_styles = array('styleBup' => array('path' => BUP_CSS_PATH . 'style.css'), 'adminStylesBup' => array('path' => BUP_CSS_PATH . 'adminStyles.css'), 'jquery-tabs' => array('path' => BUP_CSS_PATH . 'jquery-tabs.css'), 'jquery-buttons' => array('path' => BUP_CSS_PATH . 'jquery-buttons.css'), 'wp-jquery-ui-dialog' => array(), 'farbtastic' => array(), 'jquery-dialog' => array('path' => BUP_CSS_PATH . 'jquery-dialog.css'), 'jquery-progress' => array('path' => BUP_CSS_PATH . 'jquery-progress.css'));
         $defaultPlugTheme = frameBup::_()->getModule('options')->get('default_theme');
         $ajaxurl = admin_url('admin-ajax.php');
         if (frameBup::_()->getModule('options')->get('ssl_on_ajax')) {
             $ajaxurl = uriBup::makeHttps($ajaxurl);
         }
         $jsData = array('siteUrl' => BUP_SITE_URL, 'imgPath' => BUP_IMG_PATH, 'loader' => BUP_LOADER_IMG, 'close' => BUP_IMG_PATH . 'cross.gif', 'ajaxurl' => $ajaxurl, 'animationSpeed' => frameBup::_()->getModule('options')->get('js_animation_speed'), 'siteLang' => langBup::getData(), 'options' => frameBup::_()->getModule('options')->getByCode(), 'BUP_CODE' => BUP_CODE);
         $jsData = dispatcherBup::applyFilters('jsInitVariables', $jsData);
         frameBup::_()->addScript('jquery');
         frameBup::_()->addScript('jquery-ui-tabs', '', array('jquery'));
         frameBup::_()->addScript('jquery-ui-dialog', '', array('jquery'));
         frameBup::_()->addScript('jquery-ui-button', '', array('jquery'));
         frameBup::_()->addScript('farbtastic');
         frameBup::_()->addScript('commonBup', BUP_JS_PATH . 'common.js');
         frameBup::_()->addScript('coreBup', BUP_JS_PATH . 'core.js');
         //installerBup::isUsed() ? frameBup::_()->addScript('adminOptionsBup', BUP_JS_PATH. 'admin.options.js') : false;
         frameBup::_()->addScript('adminOptionsBup', BUP_JS_PATH . 'admin.options.js');
         frameBup::_()->addScript('ajaxupload', BUP_JS_PATH . 'ajaxupload.js');
         frameBup::_()->addScript('postbox', get_bloginfo('wpurl') . '/wp-admin/js/postbox.js');
         frameBup::_()->addJSVar('coreBup', 'BUP_DATA', $jsData);
         /*$desktop = true;
         		if(utilsBup::isTablet()) {
         			$this->_styles['style-tablet'] = array();
         			$desktop = false;
         		} elseif(utilsBup::isMobile()) {
         			$this->_styles['style-mobile'] = array();
         			$desktop = false;
         		}
         		if($desktop) {
         			$this->_styles['style-desctop'] = array();
         		}*/
         foreach ($this->_styles as $s => $sInfo) {
             if (isset($sInfo['for'])) {
                 if ($sInfo['for'] == 'frontend' && is_admin() || $sInfo['for'] == 'admin' && !is_admin()) {
                     continue;
                 }
             }
             $canBeSubstituted = true;
             if (isset($sInfo['substituteFor'])) {
                 switch ($sInfo['substituteFor']) {
                     case 'frontend':
                         $canBeSubstituted = !is_admin();
                         break;
                     case 'admin':
                         $canBeSubstituted = is_admin();
                         break;
                 }
             }
             if ($canBeSubstituted && file_exists(BUP_TEMPLATES_DIR . $defaultPlugTheme . DS . $s . '.css')) {
                 frameBup::_()->addStyle($s, BUP_TEMPLATES_PATH . $defaultPlugTheme . '/' . $s . '.css');
             } elseif ($canBeSubstituted && file_exists(utilsBup::getCurrentWPThemeDir() . 'csp' . DS . $s . '.css')) {
                 frameBup::_()->addStyle($s, utilsBup::getCurrentWPThemePath() . '/toe/' . $s . '.css');
             } elseif (!empty($sInfo['path'])) {
                 frameBup::_()->addStyle($s, $sInfo['path']);
             } else {
                 frameBup::_()->addStyle($s);
             }
         }
         add_action('wp_head', array($this, 'addInitJsVars'));
     }
     parent::init();
 }
Esempio n. 14
0
 public static function textFieldsDynamicTable($name, $params = array('value' => '', 'attrs' => '', 'options' => array()))
 {
     $res = '';
     if (empty($params['options'])) {
         $params['options'] = array(0 => array('label' => ''));
     }
     if (!empty($params['options'])) {
         $pattern = array();
         foreach ($params['options'] as $key => $p) {
             $pattern[$key] = htmlBup::text($name . '[][' . $key . ']');
         }
         $countOptions = count($params['options']);
         $remove = '<a href="#" onclick="toeRemoveTextFieldsDynamicTable(this); return false;">remove</a>';
         $add = '<a href="#" onclick="toeAddTextFieldsDynamicTable(this, ' . $countOptions . '); return false;">add</a>';
         $res = '<div class="toeTextFieldsDynamicTable">';
         if (empty($params['value'])) {
             $params['value'] = array();
         } elseif (!is_array($params['value'])) {
             $params['value'] = utilsBup::jsonDecode($params['value']);
             //$params['value'] = $params['value'][0];
         }
         $i = 0;
         do {
             $res .= '<div class="toeTextFieldDynamicRow">';
             foreach ($params['options'] as $key => $p) {
                 switch ($countOptions) {
                     case 1:
                         if (isset($params['value'][$i])) {
                             $value = is_array($params['value'][$i]) ? $params['value'][$i][$key] : $params['value'][$i];
                         } else {
                             $value = '';
                         }
                         break;
                     case 2:
                     default:
                         $value = isset($params['value'][$i][$key]) ? $params['value'][$i][$key] : '';
                         break;
                 }
                 $paramsForText = array('value' => $value);
                 $res .= __($p['label'], BUP_LANG_CODE) . htmlBup::text($name . '[' . $i . '][' . $key . ']', $paramsForText);
             }
             $res .= $remove . '</div>';
             $i++;
         } while ($i < count($params['value']));
         $res .= $add;
         $res .= '</div>';
     }
     return $res;
 }
Esempio n. 15
0
 private function createFileName()
 {
     return utilsBup::getRandStr() . '-' . utilsBup::getRandStr() . '-' . utilsBup::getRandStr() . '-' . utilsBup::getRandStr();
 }
Esempio n. 16
0
 public function removeLogoImg($d = array())
 {
     $logoImgDirPath = frameBup::_()->getModule('options')->getLogoImgFullDir();
     if ($this->save(array('opt_values' => array('logo_image' => ''), 'code' => 'logo_image')) && utilsBup::deleteFile($logoImgDirPath)) {
         return true;
     } else {
         $this->pushError(__('Unable to remove image', BUP_LANG_CODE));
     }
 }
Esempio n. 17
0
 public static function init()
 {
     global $wpdb;
     $wpPrefix = $wpdb->prefix;
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     $current_version = get_option(BUP_DB_PREF . 'db_version', 0);
     $installed = (int) get_option(BUP_DB_PREF . 'db_installed', 0);
     if (!dbBup::exist($wpPrefix . BUP_DB_PREF . "htmltype")) {
         dbDelta("CREATE TABLE IF NOT EXISTS `" . $wpPrefix . BUP_DB_PREF . "htmltype` (\r\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t\t  `label` varchar(32) NOT NULL,\r\n\t\t\t  `description` varchar(255) NOT NULL,\r\n\t\t\t  PRIMARY KEY (`id`),\r\n\t\t\t  UNIQUE INDEX `label` (`label`)\r\n\t\t\t) DEFAULT CHARSET=utf8");
         dbBup::query("INSERT INTO `" . $wpPrefix . BUP_DB_PREF . "htmltype` VALUES\r\n\t\t\t\t(1, 'text', 'Text'),\r\n\t\t\t\t(2, 'password', 'Password'),\r\n\t\t\t\t(3, 'hidden', 'Hidden'),\r\n\t\t\t\t(4, 'checkbox', 'Checkbox'),\r\n\t\t\t\t(5, 'checkboxlist', 'Checkboxes'),\r\n\t\t\t\t(6, 'datepicker', 'Date Picker'),\r\n\t\t\t\t(7, 'submit', 'Button'),\r\n\t\t\t\t(8, 'img', 'Image'),\r\n\t\t\t\t(9, 'selectbox', 'Drop Down'),\r\n\t\t\t\t(10, 'radiobuttons', 'Radio Buttons'),\r\n\t\t\t\t(11, 'countryList', 'Countries List'),\r\n\t\t\t\t(12, 'selectlist', 'List'),\r\n\t\t\t\t(13, 'countryListMultiple', 'Country List with posibility to select multiple countries'),\r\n\t\t\t\t(14, 'block', 'Will show only value as text'),\r\n\t\t\t\t(15, 'statesList', 'States List'),\r\n\t\t\t\t(16, 'textFieldsDynamicTable', 'Dynamic table - multiple text options set'),\r\n\t\t\t\t(17, 'textarea', 'Textarea'),\r\n\t\t\t\t(18, 'checkboxHiddenVal', 'Checkbox with Hidden field')");
     }
     /**
      * modules
      */
     if (!dbBup::exist($wpPrefix . BUP_DB_PREF . "modules")) {
         dbDelta("CREATE TABLE IF NOT EXISTS `" . $wpPrefix . BUP_DB_PREF . "modules` (\r\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t\t  `code` varchar(64) NOT NULL,\r\n\t\t\t  `active` tinyint(1) NOT NULL DEFAULT '0',\r\n\t\t\t  `type_id` smallint(3) NOT NULL DEFAULT '0',\r\n\t\t\t  `params` text,\r\n\t\t\t  `has_tab` tinyint(1) NOT NULL DEFAULT '0',\r\n\t\t\t  `label` varchar(128) DEFAULT NULL,\r\n\t\t\t  `description` text,\r\n\t\t\t  `ex_plug_dir` varchar(255) DEFAULT NULL,\r\n\t\t\t  PRIMARY KEY (`id`),\r\n\t\t\t  UNIQUE INDEX `code` (`code`)\r\n\t\t\t) DEFAULT CHARSET=utf8;");
         dbBup::query("INSERT INTO `" . $wpPrefix . BUP_DB_PREF . "modules` (id, code, active, type_id, params, has_tab, label, description) VALUES\r\n\t\t\t\t(NULL, 'adminmenu',1,1,'',0,'Admin Menu',''),\r\n\t\t\t\t(NULL, 'options',1,1,'',1,'Options',''),\r\n\t\t\t\t(NULL, 'log', 1, 1, '', 1, 'Log', 'Internal system module to log some actions on server'),\r\n\t\t\t\t(NULL, 'templates',1,1,'',0,'Templates for Plugin',''),\r\n\t\t\t\t(NULL, 'backup', 1, 1, '', 1, 'Backup by Supsystic!', 'Backup by Supsystic!'),\r\n\t\t\t\t(NULL, 'storage', 1, 1, '', 1, 'Storage', 'Storage'),\r\n\t\t\t\t(NULL, 'gdrive', 1, 1, '', 1, 'gdrive', 'gdrive'),\r\n\t\t\t\t(NULL, 'onedrive', 1, 1, '', 1, 'onedrive', 'onedrive'),\r\n\t\t\t\t(NULL, 'amazon', 1, 1, '', 1, 'amazon', 'amazon'),\r\n\t\t\t\t(NULL, 'dropbox', 1, 1, '', 1, 'dropbox', 'dropbox')");
     }
     if (!dbBup::exist($wpPrefix . BUP_DB_PREF . "modules", 'code', 'gdrive')) {
         dbBup::query("INSERT INTO `" . $wpPrefix . BUP_DB_PREF . "modules` (id, code, active, type_id, params, has_tab, label, description) VALUES\r\n\t\t    (NULL, 'gdrive', 1, 1, '', 1, 'gdrive', 'gdrive')");
     }
     if (!dbBup::exist($wpPrefix . BUP_DB_PREF . "modules", 'code', 'dropbox')) {
         dbBup::query("INSERT INTO `" . $wpPrefix . BUP_DB_PREF . "modules` (id, code, active, type_id, params, has_tab, label, description) VALUES\r\n            (NULL, 'dropbox', 1, 1, '', 1, 'dropbox', 'dropbox')");
     }
     if (!dbBup::exist($wpPrefix . BUP_DB_PREF . "modules", 'code', 'amazon')) {
         dbBup::query("INSERT INTO `" . $wpPrefix . BUP_DB_PREF . "modules` (id, code, active, type_id, params, has_tab, label, description) VALUES\r\n\t\t    (NULL, 'amazon', 1, 1, '', 1, 'amazon', 'amazon')");
     }
     if (!dbBup::exist($wpPrefix . BUP_DB_PREF . "modules", 'code', 'onedrive')) {
         dbBup::query("INSERT INTO `" . $wpPrefix . BUP_DB_PREF . "modules` (id, code, active, type_id, params, has_tab, label, description) VALUES\r\n\t\t    (NULL, 'onedrive', 1, 1, '', 1, 'onedrive', 'onedrive')");
     }
     /**
      *  modules_type
      */
     if (!dbBup::exist($wpPrefix . BUP_DB_PREF . "modules_type")) {
         dbDelta("CREATE TABLE IF NOT EXISTS `" . $wpPrefix . BUP_DB_PREF . "modules_type` (\r\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t\t  `label` varchar(64) NOT NULL,\r\n\t\t\t  PRIMARY KEY (`id`)\r\n\t\t\t) AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;");
         dbBup::query("INSERT INTO `" . $wpPrefix . BUP_DB_PREF . "modules_type` VALUES\r\n\t\t\t\t(1,'system'),\r\n\t\t\t\t(2,'addons')");
     }
     /**
      * options
      */
     $eol = "\n";
     $warehouse = '/' . BUP_WP_CONTENT_DIR . '/upsupsystic/';
     $msgText = 'We apologize, but at this time our site does not work. But we promise you, very soon we will resume work. ' . $eol . 'We just want to improve our site for your comfort.Be among the first to see our new website! Just send your email using the form below and we will inform you.';
     if (!dbBup::exist($wpPrefix . BUP_DB_PREF . "options")) {
         dbDelta("CREATE TABLE IF NOT EXISTS `" . $wpPrefix . BUP_DB_PREF . "options` (\r\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t\t  `code` varchar(64) CHARACTER SET latin1 NOT NULL,\r\n\t\t\t  `value` longtext NULL,\r\n\t\t\t  `label` varchar(128) CHARACTER SET latin1 DEFAULT NULL,\r\n\t\t\t  `description` text CHARACTER SET latin1,\r\n\t\t\t  `htmltype_id` smallint(2) NOT NULL DEFAULT '1',\r\n\t\t\t  `params` text NULL,\r\n\t\t\t  `cat_id` mediumint(3) DEFAULT '0',\r\n\t\t\t  `sort_order` mediumint(3) DEFAULT '0',\r\n\t\t\t  `value_type` varchar(16) CHARACTER SET latin1 DEFAULT NULL,\r\n\t\t\t  PRIMARY KEY (`id`),\r\n\t\t\t  KEY `id` (`id`),\r\n\t\t\t  UNIQUE INDEX `code` (`code`)\r\n\t\t\t) DEFAULT CHARSET=utf8");
         dbBup::query("INSERT INTO `" . $wpPrefix . BUP_DB_PREF . "options` (`id`,`code`,`value`,`label`,`description`,`htmltype_id`,`params`,`cat_id`,`sort_order`,`value_type`) VALUES\r\n\t\t\t\t(NULL,'full','1','Full backup','on/off full backup',1,'',0,0,'dest_backup'),\r\n\t\t\t\t(NULL,'wp_core','1','Wordpress core backup','on/off Wordpress core backup',1,'',0,0,'dest_backup'),\r\n\t\t\t\t(NULL,'plugins','1','Plugins','on/off backup plugins',1,'',0,0,'dest_backup'),\r\n\t\t\t\t(NULL,'themes','1','Themes','on/off backup themes',1,'',0,0,'dest_backup'),\r\n\t\t\t\t(NULL,'uploads','1','Uploads','on/off backup uploads',1,'',0,0,'dest_backup'),\r\n\t\t\t\t(NULL,'database','1','Database','on/off backup database',1,'',0,0,'db_backup'),\r\n\t\t\t\t(NULL,'any_directories','1','Any','Any other directories found inside wp-content',1,'',0,0,'dest_backup'),\r\n\t\t\t\t(NULL,'warehouse','" . $warehouse . "','Warehouse','path to storage',1,'',0,0,''),\r\n\t\t\t\t(NULL,'warehouse_ignore','upsupsystic','Warehouse_ignore','Name ignore directory storage',1,'',0,0,''),\r\n\t\t\t\t(NULL,'safe_array','','Safe array','Safe file array',1,'',0,0,''),\r\n\t\t\t\t(NULL,'dropbox_model','','Dropbox model','Module uses two models: for PHP 5.2.x and for PHP >= 5.3.x', '1','', '', '',''),\r\n\t\t\t\t(NULL,'aws_access_key','','AWS Access Key','Amazon Web Services Access Key to work with the Amazon S3', '1','', '', '',''),\r\n\t\t\t\t(NULL,'aws_secret_key','','AWS Secret Key','Amazon Web Services Secret Key to work with Amazon S3', '1','', '', '',''),\r\n\t\t\t\t(NULL,'aws_s3_bucket','','S3 Bucket','Name of bucket to upload backups', '1','', '', '','');");
     }
     //(NULL,'exclude','upgrade,cache','Exclude','Exclude directories',1,'',0,0,'')
     if (!dbBup::exist($wpPrefix . BUP_DB_PREF . "options", 'code', 'dropbox_model')) {
         dbBup::query("INSERT INTO `" . $wpPrefix . BUP_DB_PREF . "options` (`id`,`code`,`value`,`label`,`description`,`htmltype_id`,`params`,`cat_id`,`sort_order`,`value_type`) VALUES\r\n\t\t\t    (NULL,'dropbox_model','','Dropbox model','Module uses two models: for PHP 5.2.x and for PHP >= 5.3.x', '1','', '', '','');");
     }
     if (!dbBup::exist($wpPrefix . BUP_DB_PREF . "options", 'code', 'gdrive_refresh_token')) {
         dbBup::query("INSERT INTO `" . $wpPrefix . BUP_DB_PREF . "options` (`id`,`code`,`value`,`label`,`description`,`htmltype_id`,`params`,`cat_id`,`sort_order`,`value_type`) VALUES\r\n\t\t\t    (NULL,'gdrive_refresh_token','','Google Refresh Token','GoogleDrive refresh token using for automatically extend token time', '1','', '', '','');");
     }
     if (!dbBup::exist($wpPrefix . BUP_DB_PREF . "options", 'code', 'aws_access_key')) {
         dbBup::query("INSERT INTO `" . $wpPrefix . BUP_DB_PREF . "options` (`id`,`code`,`value`,`label`,`description`,`htmltype_id`,`params`,`cat_id`,`sort_order`,`value_type`) VALUES\r\n\t\t\t    (NULL,'aws_access_key','','AWS Access Key','Amazon Web Services Access Key to work with the Amazon S3', '1','', '', '','');");
     }
     if (!dbBup::exist($wpPrefix . BUP_DB_PREF . "options", 'code', 'aws_secret_key')) {
         dbBup::query("INSERT INTO `" . $wpPrefix . BUP_DB_PREF . "options` (`id`,`code`,`value`,`label`,`description`,`htmltype_id`,`params`,`cat_id`,`sort_order`,`value_type`) VALUES\r\n\t\t\t    (NULL,'aws_secret_key','','AWS Secret Key','Amazon Web Services Secret Key to work with Amazon S3', '1','', '', '','');");
     }
     if (!dbBup::exist($wpPrefix . BUP_DB_PREF . "options", 'code', 'aws_s3_bucket')) {
         dbBup::query("INSERT INTO `" . $wpPrefix . BUP_DB_PREF . "options` (`id`,`code`,`value`,`label`,`description`,`htmltype_id`,`params`,`cat_id`,`sort_order`,`value_type`) VALUES\r\n\t\t\t    (NULL,'aws_s3_bucket','','S3 Bucket','Name of bucket to upload backups', '1','', '', '','');");
     }
     if (!dbBup::exist($wpPrefix . BUP_DB_PREF . "options", 'code', 'wp_core')) {
         dbBup::query("INSERT INTO `" . $wpPrefix . BUP_DB_PREF . "options` (`id`,`code`,`value`,`label`,`description`,`htmltype_id`,`params`,`cat_id`,`sort_order`,`value_type`) VALUES\r\n\t\t\t    (NULL,'wp_core','1','Wordpress core backup','on/off Wordpress core backup',1,'',0,0,'dest_backup');");
     }
     if (!dbBup::exist($wpPrefix . BUP_DB_PREF . "options", 'code', 'serialized_backups_path')) {
         dbBup::query("INSERT INTO `" . $wpPrefix . BUP_DB_PREF . "options` (`id`,`code`,`value`,`label`,`description`,`htmltype_id`,`params`,`cat_id`,`sort_order`,`value_type`) VALUES\r\n\t\t\t    (NULL,'serialized_backups_path','','Serialized backups path','Store all backups path in serialized data',0,'',0,0,'');");
     }
     /* options categories */
     if (!dbBup::exist($wpPrefix . BUP_DB_PREF . "options_categories")) {
         dbDelta("CREATE TABLE IF NOT EXISTS `" . $wpPrefix . BUP_DB_PREF . "options_categories` (\r\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t\t  `label` varchar(128) NOT NULL,\r\n\t\t\t  PRIMARY KEY (`id`),\r\n\t\t\t  KEY `id` (`id`)\r\n\t\t\t) DEFAULT CHARSET=utf8");
         dbBup::query("INSERT INTO `" . $wpPrefix . BUP_DB_PREF . "options_categories` VALUES\r\n\t\t\t\t(1, 'General'),\r\n\t\t\t\t(2, 'Template'),\r\n\t\t\t\t(3, 'Subscribe'),\r\n\t\t\t\t(4, 'Social');");
     }
     /**
      * Log table - all logs in project
      */
     // I didn't see that it was used somwhere - all log's was done in log files for backups, is this correct?
     /*if(!dbBup::exist($wpPrefix.BUP_DB_PREF."log")) {
     			dbDelta("CREATE TABLE `".$wpPrefix.BUP_DB_PREF."log` (
     			  `id` int(11) NOT NULL AUTO_INCREMENT,
     			  `type` varchar(64) NOT NULL,
     			  `data` text,
     			  `date_created` int(11) NOT NULL DEFAULT '0',
     			  `uid` int(11) NOT NULL DEFAULT 0,
     			  PRIMARY KEY (`id`)
     			) DEFAULT CHARSET=utf8");
     		}*/
     installerDbUpdaterBup::runUpdate();
     update_option(BUP_DB_PREF . 'db_version', BUP_VERSION);
     add_option(BUP_DB_PREF . 'db_installed', 1);
     dbBup::query("UPDATE `" . $wpPrefix . BUP_DB_PREF . "options` SET value = '" . BUP_VERSION . "' WHERE code = 'version' LIMIT 1");
     $warehouse = ABSPATH . $warehouse;
     if (!file_exists($warehouse)) {
         utilsBup::createDir($warehouse, $params = array('chmod' => 0755, 'httpProtect' => 2));
     }
 }
Esempio n. 18
0
<?php

$not_piad = utilsBup::checkPRO() ? '' : 'bupNotPaid';
?>
<form class="cspNiceStyle" id="bupAdminMainForm">
<div class="main-progress-bar" style="display:none;">
	<div class="progress-bar devblue shine"> <!-- -->
    	<span style="width: 0%;"></span>
	</div>
</div>
	<div id="BUP_MESS_MAIN"></div>
    <?php 
$wpcontent = ABSPATH . 'wp-content';
$wh = frameBup::_()->getModule('options')->get('warehouse');
$warehouse = substr(ABSPATH, 0, strlen(ABSPATH) - 1) . substr($wh, 0, strlen($wh) - 1);
//$access_wp_content = (is_writable($wpcontent) && is_readable($wpcontent)) ? true : false;
$access_wp_content = is_writable($wpcontent) ? true : false;
//echo $access_wp_content ? 'access_wp_content = true<br />' : 'access_wp_content = false<br />';
$access_warehouse = is_writable($warehouse) && is_readable($warehouse) ? true : false;
//echo $access_warehouse ? 'access_warehouse = true<br />' : 'access_warehouse = false<br />';
if (!$access_wp_content && !$access_warehouse) {
    echo '<div id="checkWritable" style="color:#C00;"><strong>Warning:</strong> Directory<br />' . ABSPATH . 'wp-content/' . substr(ABSPATH, 0, strlen(ABSPATH) - 1) . frameBup::_()->getModule('options')->get('warehouse') . ' didn\'t exist. Please create directory with permission 755 or 777 manually!"</div>';
} elseif (!$access_warehouse) {
    echo '<div id="checkWritable" style="color:#C00;"><strong>Warning:</strong> Directory<br />' . ABSPATH . 'wp-content/' . substr(ABSPATH, 0, strlen(ABSPATH) - 1) . frameBup::_()->getModule('options')->get('warehouse') . ' didn\'t exist. Please create directory with permission 755 or 777 manually!"</div>';
}
?>

	<table width="100%">
    	<tr class="cspAdminOptionRow cspTblRow">
        	<td width="100">Backup site</td>
            <td>
Esempio n. 19
0
 /**
  * Check if the element exists in array
  * @param array $param 
  */
 function checkVarFromParam($param, $element)
 {
     return utilsBup::xmlAttrToStr($param, $element);
     /*if (isset($param[$element])) {
     			// convert object element to string
     			return (string)$param[$element];
     		} else {
     			return '';
     		}*/
 }
Esempio n. 20
0
 public static function userFieldDestFromDB($value)
 {
     return utilsBup::jsonDecode($value);
 }
Esempio n. 21
0
 public static function init()
 {
     global $wpdb;
     $wpPrefix = $wpdb->prefix;
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     $current_version = get_option(BUP_DB_PREF . 'db_version', 0);
     $installed = (int) get_option(BUP_DB_PREF . 'db_installed', 0);
     if (!dbBup::exist($wpPrefix . BUP_DB_PREF . "htmltype")) {
         $q = "CREATE TABLE IF NOT EXISTS `" . $wpPrefix . BUP_DB_PREF . "htmltype` (\r\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t\t  `label` varchar(32) NOT NULL,\r\n\t\t\t  `description` varchar(255) NOT NULL,\r\n\t\t\t  PRIMARY KEY (`id`),\r\n\t\t\t  UNIQUE INDEX `label` (`label`)\r\n\t\t\t) DEFAULT CHARSET=utf8";
         dbDelta($q);
     }
     dbBup::query("INSERT INTO `" . $wpPrefix . BUP_DB_PREF . "htmltype` VALUES\r\n\t\t\t(1, 'text', 'Text'),\r\n\t\t\t(2, 'password', 'Password'),\r\n\t\t\t(3, 'hidden', 'Hidden'),\r\n\t\t\t(4, 'checkbox', 'Checkbox'),\r\n\t\t\t(5, 'checkboxlist', 'Checkboxes'),\r\n\t\t\t(6, 'datepicker', 'Date Picker'),\r\n\t\t\t(7, 'submit', 'Button'),\r\n\t\t\t(8, 'img', 'Image'),\r\n\t\t\t(9, 'selectbox', 'Drop Down'),\r\n\t\t\t(10, 'radiobuttons', 'Radio Buttons'),\r\n\t\t\t(11, 'countryList', 'Countries List'),\r\n\t\t\t(12, 'selectlist', 'List'),\r\n\t\t\t(13, 'countryListMultiple', 'Country List with posibility to select multiple countries'),\r\n\t\t\t(14, 'block', 'Will show only value as text'),\r\n\t\t\t(15, 'statesList', 'States List'),\r\n\t\t\t(16, 'textFieldsDynamicTable', 'Dynamic table - multiple text options set'),\r\n\t\t\t(17, 'textarea', 'Textarea'),\r\n\t\t\t(18, 'checkboxHiddenVal', 'Checkbox with Hidden field')");
     /**
      * modules
      */
     if (!dbBup::exist($wpPrefix . BUP_DB_PREF . "modules")) {
         $q = "CREATE TABLE IF NOT EXISTS `" . $wpPrefix . BUP_DB_PREF . "modules` (\r\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t\t  `code` varchar(64) NOT NULL,\r\n\t\t\t  `active` tinyint(1) NOT NULL DEFAULT '0',\r\n\t\t\t  `type_id` smallint(3) NOT NULL DEFAULT '0',\r\n\t\t\t  `params` text,\r\n\t\t\t  `has_tab` tinyint(1) NOT NULL DEFAULT '0',\r\n\t\t\t  `label` varchar(128) DEFAULT NULL,\r\n\t\t\t  `description` text,\r\n\t\t\t  `ex_plug_dir` varchar(255) DEFAULT NULL,\r\n\t\t\t  PRIMARY KEY (`id`),\r\n\t\t\t  UNIQUE INDEX `code` (`code`)\r\n\t\t\t) DEFAULT CHARSET=utf8;";
         dbDelta($q);
     }
     dbBup::query("INSERT INTO `" . $wpPrefix . BUP_DB_PREF . "modules` (id, code, active, type_id, params, has_tab, label, description) VALUES\r\n\t\t  (NULL, 'adminmenu',1,1,'',0,'Admin Menu',''),\r\n\t\t  (NULL, 'options',1,1,'',1,'Options',''),\r\n\t\t  (NULL, 'log', 1, 1, '', 1, 'Log', 'Internal system module to log some actions on server'),\r\n\t\t  (NULL, 'templates',1,1,'',0,'Templates for Plugin',''),\r\n\t\t  (NULL, 'backup', 1, 1, '', 1, 'Backup ready!', 'Backup ready!'),\r\n\t\t  (NULL, 'schedule', 1, 1, '', 1, 'Schedule', 'Schedule'),\r\n\t\t  (NULL, 'storage', 1, 1, '', 1, 'Storage', 'Storage')\r\n\t\t  ");
     /**
      *  modules_type
      */
     if (!dbBup::exist($wpPrefix . BUP_DB_PREF . "modules_type")) {
         $q = "CREATE TABLE IF NOT EXISTS `" . $wpPrefix . BUP_DB_PREF . "modules_type` (\r\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t\t  `label` varchar(64) NOT NULL,\r\n\t\t\t  PRIMARY KEY (`id`)\r\n\t\t\t) AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;";
         dbDelta($q);
     }
     dbBup::query("INSERT INTO `" . $wpPrefix . BUP_DB_PREF . "modules_type` VALUES\r\n\t\t  (1,'system'),\r\n\t\t  (2,'addons')\r\n\t\t  ");
     /**
      * options
      */
     if (!dbBup::exist($wpPrefix . BUP_DB_PREF . "options")) {
         $q = "CREATE TABLE IF NOT EXISTS `" . $wpPrefix . BUP_DB_PREF . "options` (\r\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t\t  `code` varchar(64) CHARACTER SET latin1 NOT NULL,\r\n\t\t\t  `value` longtext NULL,\r\n\t\t\t  `label` varchar(128) CHARACTER SET latin1 DEFAULT NULL,\r\n\t\t\t  `description` text CHARACTER SET latin1,\r\n\t\t\t  `htmltype_id` smallint(2) NOT NULL DEFAULT '1',\r\n\t\t\t  `params` text NULL,\r\n\t\t\t  `cat_id` mediumint(3) DEFAULT '0',\r\n\t\t\t  `sort_order` mediumint(3) DEFAULT '0',\r\n\t\t\t  `value_type` varchar(16) CHARACTER SET latin1 DEFAULT NULL,\r\n\t\t\t  PRIMARY KEY (`id`),\r\n\t\t\t  KEY `id` (`id`),\r\n\t\t\t  UNIQUE INDEX `code` (`code`)\r\n\t\t\t) DEFAULT CHARSET=utf8";
         dbDelta($q);
     }
     $eol = "\n";
     $warehouse = "/wp-content/upready/";
     $msgText = 'We apologize, but at this time our site does not work. But we promise you, very soon we will resume work. ' . $eol . 'We just want to improve our site for your comfort.Be among the first to see our new website! Just send your email using the form below and we will inform you.';
     dbBup::query("INSERT INTO `" . $wpPrefix . BUP_DB_PREF . "options` (`id`,`code`,`value`,`label`,`description`,`htmltype_id`,`params`,`cat_id`,`sort_order`,`value_type`) VALUES\r\n\t\t\t(NULL,'full','1','Full backup','on/off full backup',1,'',0,0,'dest_backup'),\r\n\t\t\t(NULL,'plugins','0','Plugins','on/off backup plugins',1,'',0,0,'dest_backup'),\r\n\t\t\t(NULL,'themes','0','Themes','on/off backup themes',1,'',0,0,'dest_backup'),\r\n\t\t\t(NULL,'uploads','0','Uploads','on/off backup uploads',1,'',0,0,'dest_backup'),\r\n\t\t\t(NULL,'database','0','Database','on/off backup database',1,'',0,0,'db_backup'),\r\n\t\t\t(NULL,'any_directories','0','Any','Any other directories found inside wp-content',1,'',0,0,'dest_backup'),\r\n\t\t\t(NULL,'warehouse','" . $warehouse . "','Warehouse','path to storage',1,'',0,0,''),\r\n\t\t\t(NULL,'warehouse_ignore','upready','Warehouse_ignore','Name ignore directory storage',1,'',0,0,''),\r\n\t\t\t(NULL,'safe_array','','Safe array','Safe file array',1,'',0,0,'');");
     //(NULL,'exclude','upgrade,cache','Exclude','Exclude directories',1,'',0,0,'')
     /* options categories */
     if (!dbBup::exist($wpPrefix . BUP_DB_PREF . "options_categories")) {
         $q = "CREATE TABLE IF NOT EXISTS `" . $wpPrefix . BUP_DB_PREF . "options_categories` (\r\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t\t  `label` varchar(128) NOT NULL,\r\n\t\t\t  PRIMARY KEY (`id`),\r\n\t\t\t  KEY `id` (`id`)\r\n\t\t\t) DEFAULT CHARSET=utf8";
         dbDelta($q);
     }
     dbBup::query("INSERT INTO `" . $wpPrefix . BUP_DB_PREF . "options_categories` VALUES\r\n\t\t\t(1, 'General'),\r\n\t\t\t(2, 'Template'),\r\n\t\t\t(3, 'Subscribe'),\r\n\t\t\t(4, 'Social');");
     /**
      * Log table - all logs in project
      */
     if (!dbBup::exist($wpPrefix . BUP_DB_PREF . "log")) {
         dbDelta("CREATE TABLE `" . $wpPrefix . BUP_DB_PREF . "log` (\r\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t\t  `type` varchar(64) NOT NULL,\r\n\t\t\t  `data` text,\r\n\t\t\t  `date_created` int(11) NOT NULL DEFAULT '0',\r\n\t\t\t  `uid` int(11) NOT NULL DEFAULT 0,\r\n\t\t\t  PRIMARY KEY (`id`)\r\n\t\t\t) DEFAULT CHARSET=utf8");
     }
     /**
      * Files
      */
     if (!dbBup::exist($wpPrefix . BUP_DB_PREF . "files")) {
         dbDelta("CREATE TABLE IF NOT EXISTS `" . $wpPrefix . BUP_DB_PREF . "files` (\r\n\t\t\t `id` int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t\t `pid` int(11) NOT NULL,\r\n\t\t\t `name` varchar(255) NOT NULL,\r\n\t\t\t `path` varchar(255) NOT NULL,\r\n\t\t\t `mime_type` varchar(255) DEFAULT NULL,\r\n\t\t\t `size` int(11) NOT NULL DEFAULT '0',\r\n\t\t\t `active` tinyint(1) NOT NULL,\r\n\t\t\t `date` datetime DEFAULT NULL,\r\n\t\t\t `download_limit` int(11) NOT NULL DEFAULT '0',\r\n\t\t\t `period_limit` int(11) NOT NULL DEFAULT '0',\r\n\t\t\t `description` text NOT NULL,\r\n\t\t\t `type_id` SMALLINT(5) NOT NULL DEFAULT 1,\r\n\t\t\t PRIMARY KEY (`id`)\r\n\t\t   ) DEFAULT CHARSET=utf8");
     }
     installerDbUpdaterBup::runUpdate();
     update_option(BUP_DB_PREF . 'db_version', BUP_VERSION);
     add_option(BUP_DB_PREF . 'db_installed', 1);
     dbBup::query("UPDATE `" . $wpPrefix . BUP_DB_PREF . "options` SET value = '" . BUP_VERSION . "' WHERE code = 'version' LIMIT 1");
     $warehouse = ABSPATH . $warehouse;
     if (!file_exists($warehouse)) {
         utilsBup::createDir($warehouse, $params = array('chmod' => 0755, 'httpProtect' => 2));
     }
 }