function static_delete($id) { if (!static_isvalid($id)) { return false; } return fs_delete(STATIC_DIR . $id . EXT); }
function _checkFile($directory, $file) { if ($file != CACHE_FILE) { array_push($this->_list, $file); fs_delete("{$directory}/{$file}"); } //trigger_error($file, E_USER_NOTICE); return 0; }
function main() { if (isset($_GET['do']) && $_GET['do'] == 'clear') { $ret1 = fs_delete(CONTENT_DIR . 'categories_encoded.dat') && ($ret2 = fs_delete(CONTENT_DIR . 'categories.txt')); $ret = $ret1 && $ret2 ? 2 : -2; $this->smarty->assign('success', $ret); } if (file_exists(CONTENT_DIR . 'categories.txt')) { $cats = io_load_file(CONTENT_DIR . 'categories.txt'); $this->smarty->assign('catdefs', $cats); } do_action('update_categories', true); return 0; }
function getstep(&$id) { global $err; $STEPS = array('locked', 'step1', 'step2', 'step3'); $MAXST = count($STEPS) - 1; $i = 0; $setupid = null; if (!file_exists(LOCKFILE)) { $setupid = setupid(); if (!$setupid) { die('Setup is running'); } if (!file_exists(SETUPTEMP_FILE)) { if (empty($_POST)) { $i = 0; } else { $i = 1; } } else { $x = explode(',', io_load_file(SETUPTEMP_FILE)); if ($x[0] != $setupid) { die('Setup is running: if you are the owner, you can delete ' . SETUPTEMP_FILE . ' to restart'); } $i = intval($x[1]); } @(include "./setup/lib/{$STEPS[$i]}.lib.php"); if (!function_exists('check_step')) { function check_step() { return true; } } if (check_step()) { ++$i; if ($i >= $MAXST) { fs_delete(SETUPTEMP_FILE); io_write_file(LOCKFILE, "locked"); } else { if ($i > 0 && !@io_write_file(SETUPTEMP_FILE, "{$setupid},{$i}")) { $err[] = 'Write error'; } } } } $id = $STEPS[$i]; return $i; }
function plugin_lastcomments_widget() { if (false === ($f = io_load_file(LASTCOMMENTS_CACHE_FILE))) { // no comments in cache $list = array(); } else { // if file exists and its correctly read, we get the stored list // (it is stored in encoded form) $list = unserialize($f); } $content = '<ul class="last-comments">'; // cimangi Aggiunta traduzione stringhe // load plugin strings // they're located under plugin.PLUGINNAME/lang/LANGID/ $lang = lang_load('plugin:lastcomments'); if ($count = count($list)) { while ($arr = array_pop($list)) { theme_comments_filters($arr, $id); $q = new FPDB_Query(array('id' => $arr['entry']), null); // first element of the array is dropped, as it is the ID, which // we already know @(list(, $entry) = $q->getEntry($query)); if (!$entry) { $count--; $update = true; continue; } $content .= "<li>\n\t\t\t<blockquote class=\"comment-quote\" cite=\"comments.php?entry={$arr['entry']}#{$arr['id']}\">\n\t\t\t{$arr['content']}\n\t\t\t<p><a href=\"" . get_comments_link($arr['entry']) . "#{$arr['id']}\">{$arr['name']} - {$entry['subject']}</a></p>\n\t\t\t</blockquote></li>\n"; } $subject = $lang['plugin']['lastcomments']['last'] . ' ' . $count . ' ' . $lang['plugin']['lastcomments']['comments']; } if (!$count) { if ($update) { fs_delete(LASTCOMMENTS_CACHE_FILE); } $content .= '<li>' . $lang['plugin']['lastcomments']['no_comments'] . '</li>'; $subject = $lang['plugin']['lastcomments']['no_new_comments']; } $content .= '</ul>'; $entry['subject'] = $subject; $entry['content'] = $content; return $entry; }
function draft_delete($id) { $dir = draft_dir($id); $f = $dir . EXT; if (!file_exists($f)) { return false; } //$draftdb =& draft_init(); //$draftdb->delete($id); fs_delete_recursive($dir); return fs_delete($f); }
/** * function comment_delete * * <p>Deletes the $id comment</p> * <p>Returns true on success, or false on failure</p> * * @param string $id string formatted like "entryYYMMDD-HHMMSS" * @param string $comment_id string representig comment id as in "commentYYMMDD-HHMMSS" * @return bool * * @see entry_delete() */ function comment_delete($id, $comment_id) { do_action('comment_delete', $id, $comment_id); $comment_dir = bdb_idtofile($id, BDB_COMMENT); $f = $comment_dir . $comment_id . EXT; return fs_delete($f); }
function entry_delete($id) { if (!($f = entry_exists($id))) { return; } /* $d = bdb_idtofile($id,BDB_COMMENT); fs_delete_recursive("$d"); // thanks to cimangi for noticing this $f = dirname($d) . '/view_counter' .EXT; fs_delete($f); $f = bdb_idtofile($id); */ $d = entry_dir($id); fs_delete_recursive($d); $obj =& entry_init(); $obj->delete($id, entry_parse($id)); do_action('delete_post', $id); return fs_delete($f); }
function fs_delete_recursive($path) { if (file_exists($path)) { $obj = new fs_pathlister($path); $list = $obj->getList(); unset($obj); $elem = null; while ($elem = array_pop($list)) { $elem; fs_delete($elem); } } return true; }
function purge() { trigger_error('cannot purge', E_USER_ERROR); return fs_delete($this->_cachefile); }