$cat['lft'] = (int) $db->query('SELECT rgt FROM ' . PRE . 'cats WHERE' . ($up ? ' ID=' . $up : ' sc=0 ORDER BY lft DESC LIMIT 1'))->fetchColumn(); #Shift categories if ($up) { $db->exec('UPDATE ' . PRE . 'cats SET lft=lft+2 WHERE lft>=' . $cat['lft']); $db->exec('UPDATE ' . PRE . 'cats SET rgt=rgt+2 WHERE rgt>=' . $cat['lft']); } else { ++$cat['lft']; } $cat['rgt'] = $cat['lft'] + 1; } $q->execute($cat); #Get ID or rebuild the whole tree if (!$id) { $id = $db->lastInsertId(); } elseif ($up != $old[2]) { RebuildTree(); } #Apply changes and rebuild category structure cache $db->commit(); UpdateCatPath($id); #Redirect if (isset($_GET['ref'])) { header('Location: ' . URL . url($id)); } #Info + links $view->info($lang['saved'] . ' ID: ' . $id, array(url($id) => $lang['goCat'], url('editCat', '', 'admin') => $lang['addCat'], url('editCat/' . $id, '', 'admin') => $lang['editCat'], url('list/' . $id) => $lang['mantxt'], url('edit/' . $cat['type'], 'catid=' . $id) => $lang['addItem'])); return 1; } catch (Exception $e) { $view->info($e->getMessage()); //Errors }
function commit(&$data) { $cfg = array(); Installer::$urlMode = $this->urls; #Content options - category IDs foreach ($this->catid as $lang => $id) { $cfg['start'][$lang] = $id; } require './cfg/content.php'; $o = new Config('content'); $o->save($cfg); $cfg = array(); require './cfg/main.php'; #Get Sblam! key if (function_exists('fsockopen')) { $key = @file_get_contents('http://sblam.com/keygen.html'); $cfg['captcha'] = 1; $cfg['sbKey'] = $key ? $key : NULL; } else { $cfg['captcha'] = 0; $cfg['sbKey'] = NULL; } #Main options - page title and URL format $cfg['title'] = $this->title; $cfg['RSS'] = $this->rss; $o = new Config('main'); $o->add('cfg', $cfg); $o->save(); #Database access - db.php $this->buildConfig($data); #Rebuild polls if (file_exists('./mod/polls')) { include './mod/polls/poll.php'; RebuildPoll(null, $this->db); } #Sort categories include './lib/categories.php'; RebuildTree($this->db); RSS(null, $this->db); #Create menu cache include './lib/mcache.php'; RenderMenu($this->db); #Finish :) $this->db->commit(); }