function page_change($id, $newid, $title, $text, $description, $keywords, $mode = 'html', $date) { global $system; $id = basename($id); $newid = basename($newid); if (preg_replace("/[a-z0-9\\-\\_]*/i", '', $id) != '' || empty($id)) { return false; } if (preg_replace("/[a-z0-9\\-\\_]*/i", '', $newid) != '' || empty($newid)) { return false; } if (!is_file(PAGES_PATH . $id)) { return false; } if ($id != $newid && is_file(PAGES_PATH . $newid)) { return false; } $page = array('title' => $title, 'text' => $text, 'description' => $description, 'keywords' => $keywords, 'mode' => $mode, 'author_nick' => $system->user['nickname'], 'author_name' => $system->user['username'], 'date' => sql_to_unix_time($date)); if (!file_write_contents(PAGES_PATH . $id, serialize($page))) { return false; } rcms_rename_file(PAGES_PATH . $id, PAGES_PATH . $newid); return true; }
* Perform deletion of articles * ******************************************************************************/ if (!empty($_POST['delete'])) { foreach ($_POST['delete'] as $id => $chk) { if ($chk && $articles->setWorkContainer($c) && $articles->deleteArticle($b, $id)) { rcms_showAdminMessage(__('Article removed') . ': ' . $c . '/' . $b . '/' . $id); } else { rcms_showAdminMessage($articles->last_error . ': ' . $c . '/' . $b . '/' . $id); } } } /****************************************************************************** * Perform changing of article * ******************************************************************************/ if (!empty($_POST['save']) && !empty($c) && (!empty($b) || $c == '#hidden' || $c == '#root') && !empty($a) && $articles->setWorkContainer($c) && ($article = $articles->getArticle($b, $a, false, true, true, false)) !== false) { $time = sql_to_unix_time($_POST['time']); if ($_POST['mode'] == 'php' && !$system->checkForRight('GENERAL')) { return rcms_showAdminMessage(__('Error occurred') . ': ' . __('You are not administrator of this site')); } if (!@$articles->saveArticle($b, $a, $_POST['title'], $_POST['source'], $_POST['keywords'], $_POST['sef_desc'], $_POST['description'], $_POST['text'], $_POST['mode'], $_POST['comments'], $time)) { rcms_showAdminMessage($articles->last_error); } else { rcms_showAdminMessage(__('Article saved')); sleep(1); if (!empty($nb) && $nb != $b) { if (!$articles->moveArticle($b, $a, $nb)) { rcms_showAdminMessage($articles->last_error); } else { rcms_showAdminMessage(__('Article moved')); } } else {