/** *Function for making static html pages from selected pages in the manage all pages table *and then upload it to the specified ftp */ public function make($pids) { // turn off layout and ViewRenderer $this->_helper->viewRenderer->setNoRender(); //get Languages $langs = NetActionController::getLanguages(); //get values $values = $this->_request->getParams(); $pageIDs = $pids; $pidsArray = explode(",", $pageIDs); //$publishedBool = $values['pubval']; $publishedBool = "1"; // This cache doesn't expire, needs to be cleaned manually. $frontendOptions = array('caching' => true, 'lifetime' => null, 'ignore_user_abort' => true, 'automatic_serialization' => true); $backendOptions = array('cache_dir' => $this->_np . 'exported/'); $cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions); if ($pageIDs != "") { //if not empty call //use all langs for update foreach ($langs as $lang) { //set value for published to all selected items in manage all pages table //$this->_sesija->lang = $lang; //file_get_contents($this->_host . "view/change-language/code/$lang"); foreach ($pidsArray as $item) { $alias = $this->_db->fetchAll("SELECT alias FROM pages_{$lang} WHERE id = ?", array($item)); $html = file_get_contents($this->_host . "view/index/id/" . $item . "/lng/{$lang}"); $html = str_replace($this->_host, "", $html); $aliasName = urlencode($alias[0]['alias']); $user = $this->_sesija->user . Zend_Session::getId(); @mkdir($this->_np . "exported/{$user}", 0755); @mkdir($this->_np . "exported/{$user}/{$lang}", 0755); $filename = $this->_np . "exported/{$user}/{$lang}/{$aliasName}.html"; if (!($handle = @fopen($filename, 'w+'))) { $message = "Cannot open file "; //return; } // Write $html to our opened file. if (fwrite($handle, $html) === FALSE) { $message = "Cannot write to file "; //return; } fclose($handle); } } if ($publishedBool == "1") { //print_r($pidsArray); echo $this->_translateCreator->_('These pages are exported!'); } else { //print_r($pidsArray); //echo 'These pages are unpublished!'; } } }
public function delCategoryAction() { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(); if ($this->_sesija->superadmin != "1") { //SUPERADMIN ONLY echo $this->_translate->_("Only superadministrator can do this!"); return; } $values = $this->_request->getParams(); $categoryId = $values['id']; if ($categoryId != "") { $db = Zend_Registry::get('db'); $db->query("DELETE FROM categories WHERE category_id =?", array($categoryId)); //$db->query("DELETE FROM menu_items WHERE menu_id =?", array($categoryId)); $langs = NetActionController::getLanguages(); foreach ($langs as $lang) { $db->query("UPDATE pages_{$lang} SET category = ? WHERE category = ?", array('0', $categoryId)); } echo $this->_translateCreator->_("Category deleted"); } }
/** *Function for changing the value of the unbound - *should the created content be inside the content area defined in the template, *or absolutely positioned on the page */ public function setBoundAction() { $this->_checkAccess(); // turn off ViewRenderer $this->_helper->viewRenderer->setNoRender(); $this->_helper->layout()->disableLayout(); $values = $this->_request->getParams(); $val = $values['val']; $pageid = $values['page']; $langs = NetActionController::getLanguages(); foreach ($langs as $lang) { $this->_db->query("UPDATE " . $this->_tblprefix . "pages_{$lang} SET unbounded = ? WHERE id = ?", array($val, $pageid)); } $this->cleanCache(); echo $this->_translateCreator->_("Done!"); }
/** *Function for installing of the exported template in the db */ public function installTemplateDbAction() { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(); //echo 'here install in the db'; //print_r($values); $db = Zend_Registry::get('db'); //here should come code for exporting current template $values = $this->_request->getParams(); $file = $values['file']; if ($file == '') { return; } $folderName = explode('__', $file); if (file_exists($this->_nps . 'templates/' . $folderName[0] . '/' . $file . '.xml')) { $xml = simplexml_load_file($this->_nps . 'templates/' . $folderName[0] . '/' . $file . '.xml'); //print_r($xml); $langs = NetActionController::getLanguages(); foreach ($langs as $lang) { $db->query("INSERT INTO templates_{$lang}(userId, title, output, bodyBg, staticFiles) VALUES(?, ?, ?, ?, ?)", array($this->_sesija->userId, $xml->title, $xml->output, $xml->bodyBg, $xml->staticFiles)); } echo 'Template installed!'; } //$res = $db->fetchAll("SELECT title, output, bodyBg, staticFiles FROM templates_$langCode WHERE id = ?", array($id)); }