function delete_entry($id) { $file = open_book_file(); $item_to_remove = "/" . search_file_for_id($id) . "/"; for ($x = 0; $x < count($file); $x++) { if (preg_match($item_to_remove, $file[$x])) { $file[$x] = ""; } } rewrite_file($file, "books.txt"); }
$temp = $result->current(); $cache[MAILQUEUE][] = $temp; } $result->freeResult(); DBCache::createCache(array(MAILQUEUE => $cache[MAILQUEUE]), CACHE_EMAIL_FILE); } else { /* Include the cache file */ include_once CACHE_EMAIL_FILE; if (!isset($cache) || !is_array($cache) || empty($cache)) { compile_error('The cached email queue array does not exist or it is empty.', __FILE__, __LINE__); } } /** * Should we reqrite our topic deletion cache file? */ if (rewrite_file(CACHE_TOPIC_FILE, CACHE_INTERVAL)) { /** * Get all of the lazy loads that need to be executed */ $cache[TOPICQUEUE] = array(); $result =& $_DBA->executeQuery("SELECT * FROM " . TOPICQUEUE . " WHERE finished = 0 LIMIT 1"); while ($result->next()) { $temp = $result->current(); $cache[TOPICQUEUE][] = $temp; } $result->freeResult(); DBCache::createCache(array(TOPICQUEUE => $cache[TOPICQUEUE]), CACHE_TOPIC_FILE); } else { /* Include the cache file */ include_once CACHE_TOPIC_FILE; if (!isset($cache) || !is_array($cache) || empty($cache)) {
function remove($id) { // grab domain and port information if (!($results = mysql_fetch_array(mque("select * from domains where id='" . $id . "'")))) { mlog("remove.checkdomain", FATAL, "Domain not found!"); } if (!($ports = mque("select * from ports where did='" . $id . "'"))) { mlog("remove.checkports", FATAL, "No ports found!"); } // process the sudoers file $bash = $results['bash']; rewrite_file("/etc/sudoers", "{$bash} ALL = NOPASSWD: /root/bin/backup {$bash} *,/root/bin/import {$bash} *,/root/bin/reload {$bash},/root/bin/subdomain {$bash},/root/bin/pass {$bash}", "remove.rewritesudoers"); // process the ports.conf file while ($port = mysql_fetch_array($ports)) { rewrite_file("/etc/apache2/ports.conf", "Listen " . $results['ip'] . ":" . $port['port'], "remove.rewriteports"); } mlog("remove.main", !FATAL, "Successfully removed sudo user and ports."); }
$r = 'Файл "' . $file . '" перезаписан.'; } } else { $r = 'Ошибка открытия файла.'; } return $r; } #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### Поехали -> $t = THEME; if (isset($_REQUEST['change_theme'])) { change_theme($_REQUEST['theme']); $t = $_REQUEST['theme']; } if (isset($_REQUEST['sub'])) { $report = rewrite_file($_REQUEST['file']); } echo '<p><span class="mes">Шаблоны</span><br> Текущий шаблон: <span class="mes">' . $t . '</span></p> <form method="post" name="te"> <INPUT TYPE="hidden" NAME="action" VALUE="theme_list"> <SELECT class="unit_button" NAME="theme" class="comment">'; /* chdir(TE_DIR.'/themes'); $d = @opendir("."); if (!$d) return; while (($e=readdir($d)) !== false) { if ($e=='.' || $e=='..') continue; if (!@is_dir($e)) continue; $theme_list[$e] = $e;