function createPage($title, $text, $assigned_groupid = array(0), $key = '', $box_content = '') { global $db, $login; if ($key == '') { $k = stringToURL($title); } else { $k = secureMySQL($key); } $ti = secureMySQL($title); $te = mysql_real_escape_string($text); $bc = mysql_real_escape_string($box_content); $sql = "INSERT INTO `" . $this->table . "` (`key`, `title`, `text`, `box_content`, `version`, `version_timestamp`, `version_author`) \r\n\t\t\tVALUES ('" . $k . "', '" . $ti . "', '" . $te . "', '" . $bc . "', 0, " . time() . ", " . $login->currentUserId() . ");"; $db->query($sql); foreach ($assigned_groupid as $group) { $db->insert('content_permissions', array('key', 'groupid'), array("'" . $k . "'", $group)); } return $key; }
$log->add($mod, 'content ' . $_POST['title'] . ' added'); $smarty->assign('locked', true); redirect(makeURL($mod, array('mode' => 'content', 'action' => 'edit', 'key' => $_POST['key']))); } else { $notify->add($lang->get('error'), $lang->get('content_error')); } } else { $notify->add($lang->get('error'), $lang->get('fill_all_fields')); } } $smarty->assign('permissions', array()); $smarty->assign('path', $template_dir . "/content.edit.tpl"); break; case 'edit': if (isset($_POST['submit']) && trim($_POST['title']) != '' && trim($_POST['text']) != '') { if (!$this->modExists(stringToURL($_GET['key']))) { $assigned_groups = array(); foreach ($grouplist as $group) { if (@$_POST['group_' . $group['groupid']] == '1') { $assigned_groups[] = $group['groupid']; } } $content->editPage($_GET['key'], $_POST['title'], $_POST['text'], $assigned_groups, $_GET['key'], $_POST['box_content']); $notify->add($lang->get('content'), $lang->get('content_edited')); $log->add($mod, 'content ' . $_GET['key'] . ' updated'); $smarty->assign('locked', true); unset($_GET['version']); redirect(makeURL($mod, array('mode' => 'content', 'action' => 'edit', 'key' => $_GET['key']))); } else { $notify->add($lang->get('error'), $lang->get('content_error')); }