本文整理汇总了PHP中misc::windows_filename_fix方法的典型用法代码示例。如果您正苦于以下问题:PHP misc::windows_filename_fix方法的具体用法?PHP misc::windows_filename_fix怎么用?PHP misc::windows_filename_fix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类misc
的用法示例。
在下文中一共展示了misc::windows_filename_fix方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: COUNT
$query = "SELECT COUNT(id) FROM posts WHERE parent = '0'";
$result = $db->query($query);
$row = $result->fetch_assoc();
$numrows = $row['COUNT(id)'];
$query = "UPDATE {$post_count_table} SET pcount='" . $row['COUNT(id)'] . "', last_update='{$date}' WHERE access_key='posts'";
$db->query($query);
}
} else {
//Searched some tag, deal with page caching of html files.
$tags = $db->real_escape_string(str_replace("%", '', mb_trim(htmlentities($_GET['tags'], ENT_QUOTES, 'UTF-8'))));
$tags = explode(" ", $tags);
$tag_count = count($tags);
$new_tag_cache = urldecode($tags[0]);
$misc = new misc();
if (strpos(strtolower($new_tag_cache), "parent:") === false && strpos(strtolower($new_tag_cache), "user:") === false && strpos(strtolower($new_tag_cache), "rating:") === false && strpos($new_tag_cache, "*") === false) {
$new_tag_cache = $misc->windows_filename_fix($new_tag_cache);
}
if (isset($_GET['pid']) && is_numeric($_GET['pid']) && $_GET['pid'] > 0) {
$page = $_GET['pid'] / $limit + 1;
} else {
$page = 0;
}
if ($tag_count > 1 || !is_dir("{$main_cache_dir}" . "" . "search_cache/" . $new_tag_cache . "/") || !file_exists("{$main_cache_dir}" . "" . "search_cache/" . $new_tag_cache . "/" . $page . ".html") || strpos(strtolower($new_tag_cache), "all") !== false || strpos(strtolower($new_tag_cache), "user:") !== false || strpos(strtolower($new_tag_cache), "rating:") !== false || substr($new_tag_cache, 0, 1) == "-" || strpos(strtolower($new_tag_cache), "*") !== false || strpos(strtolower($new_tag_cache), "parent:") !== false) {
if (!is_dir("{$main_cache_dir}" . "" . "search_cache/")) {
@mkdir("{$main_cache_dir}" . "" . "search_cache");
}
$query = $search->prepare_tags(implode(" ", $tags));
$result = $db->query($query) or die($db->error);
$numrows = $result->num_rows;
$result->free_result();
if ($tag_count > 1 || strtolower($new_tag_cache) == "all" || strpos(strtolower($new_tag_cache), "user:") !== false || strpos(strtolower($new_tag_cache), "rating:") !== false || substr($new_tag_cache, 0, 1) == "-" || strpos(strtolower($new_tag_cache), "*") !== false || strpos(strtolower($new_tag_cache), "parent:") !== false) {
示例2: explode
$mtags = explode(" ", $tags);
foreach ($mtags as $current) {
if ($current != "") {
if (is_dir("{$main_cache_dir}" . "" . "search_cache/" . $misc->windows_filename_fix($current) . "/")) {
$cache->destroy_page_cache("search_cache/" . $misc->windows_filename_fix($current) . "/");
}
}
}
}
$cache = new cache();
$misc = new misc();
$query = "SELECT rating, tags FROM {$post_table} WHERE id='{$id}' LIMIT 1";
$result = $db->query($query) or die($db->error);
$row = $result->fetch_assoc();
if ($row['rating'] != $rating) {
$tmp_tags = explode(" ", $row['tags']);
foreach ($tmp_tags as $current) {
$cache->destroy_page_cache("search_cache/" . $misc->windows_filename_fix($current) . "/");
}
}
if ($parent == '') {
$parent = 0;
}
if ($parent != $tmp_parent) {
$query = "UPDATE {$post_count_table} SET last_update='20060101' WHERE access_key='posts'";
$db->query($query);
}
$query = "UPDATE {$post_table} SET title='{$title}', tags='{$tags}', recent_tags='{$new_tags}', rating='{$rating}', source='{$source}', parent='{$parent}' WHERE id='{$id}'";
$db->query($query);
$cache->destroy("cache/" . $id . "/post.cache");
@header("Location:../index.php?page=post&s=view&id={$id}");
示例3: removeimage
function removeimage($id)
{
global $db, $post_table, $note_table, $note_history_table, $user_table, $group_table, $favorites_table, $favorites_count_table, $comment_table, $comment_vote_table, $deleted_image_table;
$can_delete = false;
$id = $db->real_escape_string($id);
$query = "SELECT directory, image, owner, tags, hash FROM {$post_table} WHERE id='{$id}'";
$result = $db->query($query);
$row = $result->fetch_assoc();
$image = $row['image'];
$dir = $row['directory'];
$owner = $row['owner'];
$tags = $row['tags'];
$hash = $row['hash'];
if (isset($_COOKIE['user_id']) && is_numeric($_COOKIE['user_id']) && isset($_COOKIE['pass_hash'])) {
$user_id = $db->real_escape_string($_COOKIE['user_id']);
$pass_hash = $db->real_escape_string($_COOKIE['pass_hash']);
$query = "SELECT user FROM {$user_table} WHERE id='{$user_id}' AND pass='{$pass_hash}'";
$result = $db->query($query);
$row = $result->fetch_assoc();
$user = $row['user'];
$query = "SELECT t2.delete_posts FROM {$user_table} AS t1 JOIN {$group_table} AS t2 ON t2.id=t1.ugroup WHERE t1.id='{$user_id}' AND t1.pass='{$pass_hash}'";
$result = $db->query($query);
$row = $result->fetch_assoc();
if (strtolower($user) == strtolower($owner) && $user != "Anonymous" || $row['delete_posts'] == true) {
$can_delete = true;
}
}
if ($can_delete == true) {
$cache = new cache();
$query = "SELECT parent FROM {$post_table} WHERE id='{$id}'";
$result = $db->query($query);
$row = $result->fetch_assoc();
if ($row['parent'] != "" && $row['parent'] != 0) {
$cache->destroy("../cache/" . $row['parent'] . "/post.cache");
}
$query = "DELETE FROM {$post_table} WHERE id='{$id}'";
$db->query($query);
$query = "DELETE FROM {$note_table} WHERE post_id='{$id}'";
$db->query($query);
$query = "DELETE FROM {$note_history_table} WHERE post_id='{$id}'";
$db->query($query);
$query = "DELETE FROM {$comment_table} WHERE post_id='{$id}'";
$db->query($query);
$query = "DELETE FROM {$comment_vote_table} WHERE post_id='{$id}'";
$db->query($query);
$query = "SELECT user_id FROM {$favorites_table} WHERE favorite='{$id}' ORDER BY user_id";
$result = $db->query($query);
while ($row = $result->fetch_assoc()) {
$ret = "UPDATE {$favorites_count_table} SET fcount=fcount-1 WHERE user_id='" . $row['user_id'] . "'";
$db->query($ret);
}
$query = "DELETE FROM {$favorites_table} WHERE favorite='{$id}'";
$db->query($query);
$query = "DELETE FROM {$parent_child_table} WHERE parent='{$id}'";
$db->query($query);
$query = "SELECT id FROM {$post_table} WHERE parent='{$id}'";
$result = $db->query($query);
while ($row = $result->fetch_assoc()) {
$cache->destroy("../cache/" . $id . "/post.cache");
}
$query = "UPDATE {$post_table} SET parent='' WHERE parent='{$id}'";
$db->query($query);
unlink("../images/" . $dir . "/" . $image);
$thumb = explode($image);
array_pop($thumb);
$thumb = implode($thumb) . ".jpg";
unlink("../thumbnails/" . $dir . "/thumbnail_" . $thumb);
$this->folder_index_decrement($dir);
$itag = new tag();
$tags = explode(" ", $tags);
$misc = new misc();
foreach ($tags as $tag) {
if ($tag != "") {
$itag->deleteindextag($tag);
if (is_dir("../search_cache/" . $misc->windows_filename_fix($tag) . "/")) {
$cache->destroy_page_cache("../search_cache/" . $misc->windows_filename_fix($tag) . "/");
}
}
}
$query = "UPDATE {$post_count_table} SET last_update='20060101' WHERE access_key='posts'";
$db->query($query);
$query = "INSERT INTO {$deleted_image_table}(hash) VALUES('{$hash}')";
$db->query($query);
return true;
}
return false;
}
示例4: foreach
foreach ($key_array as $key) {
$ttags[$key] = $alias;
}
}
}
}
$tags = implode(" ", $ttags);
foreach ($ttags as $current) {
if ($current != "" && $current != " " && !$misc->is_html($current)) {
$ttags = $tclass->filter_tags($tags, $current, $ttags);
$tclass->addindextag($current);
$cache = new cache();
if (is_dir("{$main_cache_dir}" . "" . "search_cache/" . $current . "/")) {
$cache->destroy_page_cache("search_cache/" . $current . "/");
} else {
if (is_dir("{$main_cache_dir}" . "" . "search_cache/" . $misc->windows_filename_fix($current) . "/")) {
$cache->destroy_page_cache("search_cache/" . $misc->windows_filename_fix($current) . "/");
}
}
}
}
asort($ttags);
$tags = implode(" ", $ttags);
$tags = mb_trim(str_replace(" ", "", $tags));
if (substr($tags, 0, 1) != " ") {
$tags = " {$tags}";
}
if (substr($tags, -1, 1) != " ") {
$tags = "{$tags} ";
}
$rating = $db->real_escape_string($_POST['rating']);