function SearchBlog($pattern) { global $dataDir, $gp_index, $gp_titles, $config; if (!$this->search_config['search_blog']) { return; } $blog_index = SimpleSearch::BlogInstalled(); if (!$blog_index) { return; } $slug = array_search($blog_index, $gp_index); $addon = $gp_titles[$blog_index]['addon']; $blog_label = $gp_titles[$blog_index]['label']; //blod data folder $addon_info = $config['addons'][$addon]; if (isset($addon_info['data_folder'])) { $blog_data_folder = $dataDir . '/data/_addondata/' . $addon_info['data_folder']; } else { $blog_data_folder = $dataDir . '/data/_addondata/' . $addon; } // config of installed addon to get to know how many post files are $full_path = $blog_data_folder . '/index.php'; if (!file_exists($full_path)) { //nothing in the blog yet return; } require $full_path; $fileIndexMax = floor($blogData['post_index'] / 20); // '20' I found in SimpleBlogCommon.php function GetPostFile (line 62) for ($fileIndex = 0; $fileIndex <= $fileIndexMax; $fileIndex++) { $postFile = $blog_data_folder . '/posts_' . $fileIndex . '.php'; if (!file_exists($postFile)) { continue; } require $postFile; foreach ($posts as $id => $post) { $title = $blog_label . ': ' . str_replace('_', ' ', $post['title']); $content = str_replace('_', ' ', $post['title']) . ' ' . $post['content']; $this->findString($content, $pattern, $title, $slug, '?cmd=post&id=' . $id); } $posts = array(); } $this->ReduceResults(); }