getDB(); $param = $system->getRequest()->getParam(); $code = 1; $where = array(); $where['id'] = $param['site']; $data = array(); $data['online'] = $param['online']; $db->table('websites')->update($data, $where); unset($where); $data = array(); $data['site_id'] = $param['site']; $data['instance'] = ''; $db->isTransactionSupported() and $db->startTransaction(); foreach (array( 'layout' => $param['layout'], 'layout_desc' => $param['layout_desc'], 'layout_tags' => $param['layout_tags'], 'layout_htmlmin' => $param['layout_htmlmin'], 'layout_cssmin' => $param['layout_cssmin'] ) as $key => $value) { $data['key'] = $key; if(is_null($value)) $value = ''; $test = $db->table('websitesettings')->select($data); if($test->getRowCount() != 0) $db->table('websitesettings')->update(array('value' => $value), $data); else $db->table('websitesettings')->insert(array_merge($data, array('value' => $value))); $test->close(); } $db->isTransactionSupported() and $db->commit(); $system->cacheClean(); $response->setRedirectURL(_SELF_ . '?cat=' . $this->getMyRef() . '&site=' . $param['site'] . '&action=settings&code=' . $code); } /** * shows the basic website settings */ public function runSettings(Response $response) { $system = System::getInstance(); $part = $system->getTarget('part'); $action = $system->getTarget('action'); ob_start(); include (__DIR__ . __DS__ . 'page.' . $part . '.' . $action . '.php'); $response->setFragment('CONTENT', ob_get_clean()); } public function runClearCache(Response $response) { $system = System::getInstance(); $db = $system->getDB(); $param = $system->getRequest()->getParam(); $cachedir = _DATAPATH_ . __DS__ . 'cache' . __DS__ . 'mmpilayout'; if(!is_dir($cachedir)) mkdir($cachedir); $cachedir = $cachedir . __DS__ . 'css'; if(!is_dir($cachedir)) mkdir($cachedir); $cacheurl = _DATAURL_ . '/cache/mmpilayout/css'; preg_match_all('#]*href="./([a-zA-Z0-9_-]*/){0,1}([a-zA-Z0-9_-]*\.[cC][sS]{2})"[^>]*/>#is', $layout, $match); if(count($match) > 0) { unset($match[0]); foreach($match[2] as $fid=>$cssfile) { if(empty($match[1][$fid])) { $basefile = $layoutbase . __DS__ . $cssfile; $baseurl = './' . $cssfile; $targetfile = $cachedir . __DS__ . $system->getSiteId() . __DS__ . $cssfile; $targeturl = $cacheurl . '/' . $system->getSiteId() . '/' . $cssfile; } else { $basefile = $layoutbase . __DS__ . $match[1][$fid] . __DS__ . $cssfile; $baseurl = './' . $match[1][$fid] . $cssfile; $targetfile = $cachedir . __DS__ . $system->getSiteId() . __DS__ . $match[1][$fid] . __DS__ . $cssfile; $targeturl = $cacheurl . '/' . $system->getSiteId() . '/' . $match[1][$fid] . $cssfile; } if(file_exists($targetfile)) { echo $targetfile; } } } // TODO: fix this throw new \Exception("NOT FINISHED"); $response->setRedirectURL(_SELF_ . '?cat=' . $this->getMyRef() . '&site=' . $param['site'] . '&action=settings&code=' . $code); } }