예제 #1
0
                     }
                 }
                 closedir($dir);
             }
         }
     }
 }
 if ($recache) {
     include_once $phpbb_root_path . 'includes/acp/acp_styles.' . $phpEx;
     $theme['theme_data'] = acp_styles::db_theme_data($theme);
     $theme['theme_mtime'] = $update_time;
     // Save CSS contents
     $sql_ary = array('theme_mtime' => $theme['theme_mtime'], 'theme_data' => $theme['theme_data']);
     $sql = 'UPDATE ' . STYLES_THEME_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "\n\t\t\tWHERE theme_id = {$theme['theme_id']}";
     $db->sql_query($sql);
     $cache->destroy('sql', STYLES_THEME_TABLE);
 }
 // Only set the expire time if the theme changed data is older than 30 minutes - to cope with changes from the ACP
 if ($recache || $theme['theme_mtime'] > time() - 1800) {
     header('Expires: 0');
 } else {
     header('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', time() + $expire_time));
 }
 header('Content-type: text/css; charset=UTF-8');
 // Parse Theme Data
 $replace = array('{T_THEME_PATH}' => "{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme', '{T_TEMPLATE_PATH}' => "{$phpbb_root_path}styles/" . $theme['template_path'] . '/template', '{T_IMAGESET_PATH}' => "{$phpbb_root_path}styles/" . $theme['imageset_path'] . '/imageset', '{T_IMAGESET_LANG_PATH}' => "{$phpbb_root_path}styles/" . $theme['imageset_path'] . '/imageset/' . $user_image_lang, '{T_STYLESHEET_NAME}' => $theme['theme_name'], '{S_USER_LANG}' => $user['user_lang']);
 $theme['theme_data'] = str_replace(array_keys($replace), array_values($replace), $theme['theme_data']);
 $matches = array();
 preg_match_all('#\\{IMG_([A-Za-z0-9_]*?)_(WIDTH|HEIGHT|SRC)\\}#', $theme['theme_data'], $matches);
 $imgs = $find = $replace = array();
 if (isset($matches[0]) && sizeof($matches[0])) {
예제 #2
0
            $cache = new cache();
            $query = "SELECT post_id FROM {$comment_table} where id='{$rid}'";
            $result = $db->query($query);
            $row = $result->fetch_assoc();
            $cache->destroy_page_cache("cache/" . $row['post_id']);
            $cache->create_page_cache("cache/" . $row['post_id']);
            print "pass";
        } else {
            print "fail";
        }
    } else {
        if ($type == "post") {
            $user = new user();
            if (!$user->check_log()) {
                header("Location: ../index.php?page=post&s=view&id={$rid}");
                exit;
            }
            $reason = $db->real_escape_string(htmlentities($_POST['reason'], ENT_QUOTES, 'UTF-8'));
            if (strlen($reason) > 0) {
                $query = "UPDATE {$post_table} SET spam=TRUE, reason='{$reason}' WHERE id='{$rid}'";
                $db->query($query);
            }
            $cache = new cache();
            $cache->destroy("cache/" . $rid . "/post.cache");
            header("Location:../index.php?page=post&s=view&id={$rid}");
        } else {
            header("Location:../index.php");
        }
    }
    exit;
}
예제 #3
0
        $query = "SELECT x, y, width, height, x, y, body, created_at, updated_at, ip,  version, user_id FROM {$note_table} WHERE id='{$id}' AND post_id='{$post_id}' LIMIT 1";
        $result = $db->query($query);
        $row = $result->fetch_assoc();
        $query = "INSERT INTO {$note_history_table}(x, y, width, height, body, created_at, updated_at, ip, user_id, version, id, post_id) VALUES('" . $row['x'] . "', '" . $row['y'] . "', '" . $row['width'] . "', '" . $row['height'] . "', '" . $row['body'] . "', '" . $row['created_at'] . "', '" . $row['updated_at'] . "', '" . $row['ip'] . "', '" . $checked_user_id . "', '" . $row['version'] . "', '{$id}', '{$post_id}')";
        $result->free_result();
        $db->query($query);
        $query = "UPDATE {$note_table} SET x='{$x}', y='{$y}', width='{$width}', height='{$height}', body='{$body}', updated_at=NOW(), user_id='" . $checked_user_id . "', ip='{$ip}', version=version+1 WHERE post_id='{$post_id}' AND id='{$id}'";
        $db->query($query);
    } else {
        $result->free_result();
        $date = date("Y-m-d H:i:s");
        $query = "SELECT COUNT(*) FROM {$note_table} WHERE post_id='{$post_id}'";
        $result = $db->query($query);
        $row = $result->fetch_assoc();
        if ($row['COUNT(*)'] < 1) {
            $result->free_result();
            $query = "INSERT INTO {$note_table}(x, y, width, height, body, post_id, id, ip, user_id, created_at, updated_at) VALUES('{$x}', '{$y}', '{$width}', '{$height}', '{$body}', '{$post_id}', '1', '{$ip}', '{$checked_user_id}', '{$date}', '{$date}')";
        } else {
            $result->free_result();
            $query = "INSERT INTO {$note_table}(x, y, width, height, body, post_id, id, ip, user_id, created_at, updated_at) VALUES('{$x}', '{$y}', '{$width}', '{$height}', '{$body}', '{$post_id}', notes_next_id({$post_id}), '{$ip}', '{$checked_user_id}', '{$date}', '{$date}')";
        }
        $db->query($query);
        $query = "SELECT id FROM {$note_table} WHERE post_id='{$post_id}' AND body='{$body}' AND ip='{$ip}' AND created_at='{$date}'";
        $result = $db->query($query);
        $row = $result->fetch_assoc();
        print $row['id'] . ":" . $id;
        $result->free_result();
    }
    $cache = new cache();
    $cache->destroy("../cache/" . $post_id . "/post.cache");
}
예제 #4
0
        exit;
    }
    $query = "SELECT COUNT(*) FROM {$post_vote_table} WHERE post_id='{$id}' AND ip='{$ip}'" . $query_part;
    $result = $db->query($query);
    $row = $result->fetch_assoc();
    if ($row['COUNT(*)'] < 1) {
        $result->free_result();
        if ($type == "up") {
            $query = "UPDATE {$post_table} SET score=score+1 WHERE id='{$id}'";
            $db->query($query);
        } else {
            if ($type == "down") {
                $query = "UPDATE {$post_table} SET score=score-1 WHERE id='{$id}'";
                $db->query($query);
            } else {
                exit;
            }
        }
        $query = "INSERT INTO {$post_vote_table}(rated, ip, post_id, user_id) VALUES('{$type}', '{$ip}', '{$id}', '{$user_id}')";
        $db->query($query);
        $cache = new cache();
        $cache->destroy("cache/{$id}/post.cache");
    } else {
        $result->free_result();
    }
    $query = "SELECT score FROM {$post_table} WHERE id='{$id}'";
    $result = $db->query($query);
    $row = $result->fetch_assoc();
    echo $row['score'];
    $result->free_result();
}
예제 #5
0
 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='******'";
         $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='******'";
         $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;
 }
예제 #6
0
     $row = $result->fetch_assoc();
     $tags = $db->real_escape_string($row['tags']);
     $date = date("Y-m-d H:i:s");
     $query = "INSERT INTO {$tag_history_table}(id,tags,user_id,updated_at,ip) VALUES('" . $row['id'] . "','{$tags}','{$checked_user_id}','{$date}','{$ip}')";
     $db->query($query) or die($db->error);
     $cache = new cache();
     if ($parent != '' && is_numeric($parent)) {
         $parent_check = "SELECT COUNT(*) FROM {$post_table} WHERE id='{$parent}'";
         $pres = $db->query($parent_check);
         $prow = $pres->fetch_assoc();
         if ($prow['COUNT(*)'] > 0) {
             $temp = "INSERT INTO {$parent_child_table}(parent,child) VALUES('{$parent}','" . $row['id'] . "')";
             $db->query($temp);
             $temp = "UPDATE {$post_table} SET parent='{$parent}' WHERE id='" . $row['id'] . "'";
             $db->query($temp);
             $cache->destroy("cache/" . $parent . "/post.cache");
         }
     }
     if (is_dir("{$main_cache_dir}" . "" . "cache/" . $row['id'])) {
         $cache->destroy_page_cache("cache/" . $row['id']);
     }
     $query = "SELECT id FROM {$post_table} WHERE id < " . $row['id'] . " ORDER BY id DESC LIMIT 1";
     $result = $db->query($query);
     $row = $result->fetch_assoc();
     $cache->destroy_page_cache("cache/" . $row['id']);
     $query = "UPDATE {$post_count_table} SET last_update='20060101' WHERE access_key='posts'";
     $db->query($query);
     $query = "UPDATE {$user_table} SET post_count = post_count+1 WHERE id='{$checked_user_id}'";
     $db->query($query);
     print '<script>alert("Image added!")</script>';
 }