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; }
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; }
public function __construct() { parent::__construct(); $this->_maxFileSizeInStack = frameBup::_()->getModule('options')->get('max_file_size_in_stack_mb'); $this->_maxFileSizeInStack = $this->_maxFileSizeInStack > 0 ? $this->_maxFileSizeInStack * 1024 * 1024 : 30 * 1024 * 1024; }
public function __construct() { parent::__construct(); $this->_logDirPath = untrailingslashit(frameBup::_()->getModule('warehouse')->getPath()) . DS; }
public function __construct() { parent::__construct(); $this->_logDirPath = frameBup::_()->getModule('warehouse')->getTemporaryPath() . DS; }