/** * Standard modular run function for RSS hooks. * * @param string A list of categories we accept from * @param TIME Cutoff time, before which we do not show results from * @param string Prefix that represents the template set we use * @set RSS_ ATOM_ * @param string The standard format of date to use for the syndication type represented in the prefix * @param integer The maximum number of entries to return, ordering by date * @return ?array A pair: The main syndication section, and a title (NULL: error) */ function run($_filters, $cutoff, $prefix, $date_string, $max) { require_lang('activities'); require_code('activities'); list(, $whereville) = find_activities(get_member(), $_filters == '' ? 'all' : 'some_members', $_filters == '' ? NULL : array_map('intval', explode(',', $_filters))); $rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . get_table_prefix() . 'activities WHERE (' . $whereville . ') AND a_time>' . strval($cutoff) . ' ORDER BY a_time DESC', $max, 0); $content = new ocp_tempcode(); foreach ($rows as $row) { $id = strval($row['id']); $author = $GLOBALS['FORUM_DRIVER']->get_username($row['a_member_id']); if (is_null($author)) { $author = do_lang('UNKNOWN'); } $news_date = date($date_string, $row['a_time']); $edit_date = ''; list($_title, ) = render_activity($row); $news_title = xmlentities($_title->evaluate()); $summary = xmlentities(''); $news = ''; $category = ''; $category_raw = ''; $view_url = build_url(array('page' => 'members', 'type' => 'view', 'id' => $row['a_member_id']), get_module_zone('members'), NULL, false, false, true); $if_comments = new ocp_tempcode(); $content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date))); } return array($content, do_lang('ACTIVITIES_TITLE')); }
/** * Standard modular run function for RSS hooks. * * @param string A list of categories we accept from * @param TIME Cutoff time, before which we do not show results from * @param string Prefix that represents the template set we use * @set RSS_ ATOM_ * @param string The standard format of date to use for the syndication type represented in the prefix * @param integer The maximum number of entries to return, ordering by date * @return ?array A pair: The main syndication section, and a title (NULL: error) */ function run($_filters, $cutoff, $prefix, $date_string, $max) { if (!has_actual_page_access(get_member(), 'members')) { return NULL; } $rows = $GLOBALS['FORUM_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'f_members p WHERE m_join_time>' . strval($cutoff) . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND m_validated=1 AND m_validated_email_confirm_code=\'\' ' : '') . ' ORDER BY m_join_time DESC', $max); $categories = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(true); $content = new ocp_tempcode(); foreach ($rows as $row) { $id = strval($row['id']); $author = ''; $news_date = date($date_string, $row['m_join_time']); $edit_date = ''; $news_title = xmlentities($row['m_username']); $summary = ''; $news = ''; $category = array_key_exists($row['m_primary_group'], $categories) ? $categories[$row['m_primary_group']] : ''; $category_raw = strval($row['m_primary_group']); $view_url = build_url(array('page' => 'members', 'type' => 'view', 'id' => $row['id']), get_module_zone('members'), NULL, false, false, true); $if_comments = new ocp_tempcode(); $content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date))); } require_lang('ocf'); return array($content, do_lang('MEMBERS')); }
/** * Standard modular run function for ajax-tree hooks. Generates XML for a tree list, which is interpreted by Javascript and expanded on-demand (via new calls). * * @param ?ID_TEXT The ID to do under (NULL: root) * @param array Options being passed through * @param ?ID_TEXT The ID to select by default (NULL: none) * @return string XML in the special category,entry format */ function run($id, $options, $default = NULL) { require_code('ocf_forums'); require_code('ocf_forums2'); $tree = ocf_get_topic_tree(is_null($id) ? NULL : intval($id), NULL, NULL, is_null($id) ? 0 : 1); if (!has_actual_page_access(NULL, 'forumview')) { $tree = array(); } $out = ''; foreach ($tree as $t) { $_id = $t['id']; if ($id === strval($_id)) { foreach ($t['entries'] as $eid => $etitle) { $out .= '<entry id="' . xmlentities(strval($eid)) . '" title="' . xmlentities($etitle) . '" selectable="true"></entry>'; } continue; } $title = $t['title']; $has_children = $t['child_count'] != 0 || $t['child_entry_count'] != 0; $out .= '<category id="' . xmlentities(strval($_id)) . '" title="' . xmlentities($title) . '" has_children="' . ($has_children ? 'true' : 'false') . '" selectable="false"></category>'; } // Mark parent cats for pre-expansion if (!is_null($default) && $default != '') { $cat = $GLOBALS['FORUM_DB']->query_value_null_ok('f_topics', 't_forum_id', array('id' => intval($default))); while (!is_null($cat)) { $out .= '<expand>' . strval($cat) . '</expand>'; $cat = $GLOBALS['FORUM_DB']->query_value_null_ok('f_forums', 'f_parent_forum', array('id' => $cat)); } } return '<result>' . $out . '</result>'; }
/** * Standard modular run function for RSS hooks. * * @param string A list of categories we accept from * @param TIME Cutoff time, before which we do not show results from * @param string Prefix that represents the template set we use * @set RSS_ ATOM_ * @param string The standard format of date to use for the syndication type represented in the prefix * @param integer The maximum number of entries to return, ordering by date * @return ?array A pair: The main syndication section, and a title (NULL: error) */ function run($_filters, $cutoff, $prefix, $date_string, $max) { if (!addon_installed('cedi')) { return NULL; } if (!has_actual_page_access(get_member(), 'cedi')) { return NULL; } $filters = ocfilter_to_sqlfragment($_filters, 'id', 'seedy_children', 'parent_id', 'parent_id', 'child_id'); $content = new ocp_tempcode(); $rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'seedy_pages WHERE ' . $filters . ' AND add_date>' . strval((int) $cutoff) . ' ORDER BY add_date DESC', $max); foreach ($rows as $row) { $id = strval($row['id']); if (!has_category_access(get_member(), 'seedy_page', strval($row['id']))) { continue; } $author = ''; $news_date = date($date_string, $row['add_date']); $edit_date = ''; $news_title = xmlentities(escape_html(get_translated_text($row['title']))); $_summary = get_translated_tempcode($row['description']); $summary = xmlentities($_summary->evaluate()); $news = ''; $category = ''; $category_raw = ''; $view_url = build_url(array('page' => 'cedi', 'type' => 'misc', 'id' => $row['id'] == db_get_first_id() ? NULL : $row['id']), get_module_zone('cedi'), NULL, false, false, true); $if_comments = new ocp_tempcode(); $content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date))); } require_lang('cedi'); return array($content, do_lang('CEDI_PAGES')); }
/** * Standard modular run function for RSS hooks. * * @param string A list of categories we accept from * @param TIME Cutoff time, before which we do not show results from * @param string Prefix that represents the template set we use * @set RSS_ ATOM_ * @param string The standard format of date to use for the syndication type represented in the prefix * @param integer The maximum number of entries to return, ordering by date * @return ?array A pair: The main syndication section, and a title (NULL: error) */ function run($_filters, $cutoff, $prefix, $date_string, $max) { if (!addon_installed('news')) { return NULL; } if (!has_actual_page_access(get_member(), 'news')) { return NULL; } $filters_1 = ocfilter_to_sqlfragment($_filters, 'p.news_category', 'news_categories', NULL, 'p.news_category', 'id'); // Note that the parameters are fiddled here so that category-set and record-set are the same, yet SQL is returned to deal in an entirely different record-set (entries' record-set) $filters_2 = ocfilter_to_sqlfragment($_filters, 'd.news_entry_category', 'news_categories', NULL, 'd.news_category', 'id'); // Note that the parameters are fiddled here so that category-set and record-set are the same, yet SQL is returned to deal in an entirely different record-set (entries' record-set) $filters = '(' . $filters_1 . ' OR ' . $filters_2 . ')'; $rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'news p LEFT JOIN ' . get_table_prefix() . 'news_category_entries d ON d.news_entry=p.id WHERE date_and_time>' . strval($cutoff) . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND validated=1 ' : '') . ' AND ' . $filters . (can_arbitrary_groupby() ? ' GROUP BY p.id' : '') . ' ORDER BY date_and_time DESC', $max); $rows = remove_duplicate_rows($rows, 'id'); $_categories = $GLOBALS['SITE_DB']->query_select('news_categories', array('id', 'nc_title'), array('nc_owner' => NULL)); foreach ($_categories as $i => $_category) { $_categories[$i]['text_original'] = get_translated_text($_category['nc_title']); } $categories = collapse_2d_complexity('id', 'text_original', $_categories); $content = new ocp_tempcode(); foreach ($rows as $row) { if (has_category_access(get_member(), 'news', strval($row['news_category']))) { $id = strval($row['id']); $author = $row['author']; $news_date = date($date_string, $row['date_and_time']); $edit_date = is_null($row['edit_date']) ? '' : date($date_string, $row['edit_date']); $_title = get_translated_tempcode($row['title']); $news_title = xmlentities($_title->evaluate()); $_summary = get_translated_tempcode($row['news']); if ($_summary->is_empty()) { $_summary = get_translated_tempcode($row['news_article']); } $summary = xmlentities($_summary->evaluate()); if (!is_null($row['news_article'])) { $_news = get_translated_tempcode($row['news_article']); if ($_news->is_empty()) { $news = ''; } else { $news = xmlentities($_news->evaluate()); } } else { $news = ''; } if (!array_key_exists($row['news_category'], $categories)) { $categories[$row['news_category']] = get_translated_text($GLOBALS['SITE_DB']->query_value('news_categories', 'nc_title', array('id' => $row['news_category']))); } $category = $categories[$row['news_category']]; $category_raw = strval($row['news_category']); $view_url = build_url(array('page' => 'news', 'type' => 'view', 'id' => $row['id']), get_module_zone('news'), NULL, false, false, true); if ($prefix == 'RSS_' && get_option('is_on_comments') == '1' && $row['allow_comments'] >= 1) { $if_comments = do_template('RSS_ENTRY_COMMENTS', array('_GUID' => 'b4f25f5cf68304f8d402bb06851489d6', 'COMMENT_URL' => $view_url, 'ID' => strval($row['id']))); } else { $if_comments = new ocp_tempcode(); } $content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date))); } } return array($content, do_lang('NEWS')); }
/** * Standard modular run function for RSS hooks. * * @param string A list of categories we accept from * @param TIME Cutoff time, before which we do not show results from * @param string Prefix that represents the template set we use * @set RSS_ ATOM_ * @param string The standard format of date to use for the syndication type represented in the prefix * @param integer The maximum number of entries to return, ordering by date * @return ?array A pair: The main syndication section, and a title (NULL: error) */ function run($_filters, $cutoff, $prefix, $date_string, $max) { if (!addon_installed('galleries')) { return NULL; } if (!has_actual_page_access(get_member(), 'galleries')) { return NULL; } $filters_1 = ocfilter_to_sqlfragment($_filters, 'name', 'galleries', 'parent_id', 'name', 'name', false, false); // Note that the parameters are fiddled here so that category-set and record-set are the same, yet SQL is returned to deal in an entirely different record-set (entries' record-set) $filters = ocfilter_to_sqlfragment($_filters, 'cat', 'galleries', 'parent_id', 'cat', 'name', false, false); // Note that the parameters are fiddled here so that category-set and record-set are the same, yet SQL is returned to deal in an entirely different record-set (entries' record-set) require_lang('galleries'); $content = new ocp_tempcode(); $_galleries = array(); if ($GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT COUNT(*) FROM ' . get_table_prefix() . 'galleries WHERE ' . $filters_1) < 3000) { $_galleries = $GLOBALS['SITE_DB']->query('SELECT fullname,name FROM ' . get_table_prefix() . 'galleries WHERE ' . $filters_1); foreach ($_galleries as $i => $_gallery) { $_galleries[$i]['text_original'] = get_translated_text($_gallery['fullname']); } } $galleries = collapse_2d_complexity('name', 'text_original', $_galleries); $rows1 = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'videos WHERE add_date>' . strval((int) $cutoff) . ' AND ' . $filters . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND validated=1 ' : '') . ' ORDER BY add_date DESC', $max); $rows2 = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'images WHERE add_date>' . strval((int) $cutoff) . ' AND ' . $filters . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND validated=1 ' : '') . ' ORDER BY add_date DESC', $max); $rows = array_merge($rows1, $rows2); foreach ($rows as $row) { $id = strval($row['id']); $author = $GLOBALS['FORUM_DRIVER']->get_username($row['submitter']); if (is_null($author)) { $author = ''; } $news_date = date($date_string, $row['add_date']); $edit_date = is_null($row['edit_date']) ? '' : date($date_string, $row['edit_date']); $news_title = xmlentities(do_lang('THIS_WITH_SIMPLE', array_key_exists('video_views', $row) ? do_lang('VIDEO') : do_lang('IMAGE'), strval($row['id']))); $_summary = get_translated_tempcode($row['comments']); $summary = xmlentities($_summary->evaluate()); $news = ''; if (!array_key_exists($row['cat'], $galleries)) { $_fullname = $GLOBALS['SITE_DB']->query_value_null_ok('galleries', 'fullname', array('name' => $row['cat'])); if (is_null($_fullname)) { continue; } $galleries[$row['cat']] = get_translated_text($_fullname); } $category = $galleries[$row['cat']]; $category_raw = $row['cat']; $view_url = build_url(array('page' => 'galleries', 'type' => array_key_exists('video_views', $row) ? 'video' : 'image', 'id' => $row['id']), get_module_zone('galleries'), NULL, false, false, true); if ($prefix == 'RSS_' && get_option('is_on_comments') == '1' && $row['allow_comments'] >= '1') { $if_comments = do_template('RSS_ENTRY_COMMENTS', array('_GUID' => '65dc0cec8c75f565c58c95fa1667aa1e', 'COMMENT_URL' => $view_url, 'ID' => strval($row['id']))); } else { $if_comments = new ocp_tempcode(); } require_code('images'); $enclosure_url = ensure_thumbnail($row['url'], $row['thumb_url'], 'galleries', array_key_exists('video_views', $row) ? 'videos' : 'images', $row['id']); list($enclosure_length, $enclosure_type) = get_enclosure_details($row['url'], $enclosure_url); $content->attach(do_template($prefix . 'ENTRY', array('ENCLOSURE_URL' => $enclosure_url, 'ENCLOSURE_LENGTH' => $enclosure_length, 'ENCLOSURE_TYPE' => $enclosure_type, 'VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date))); } require_lang('galleries'); return array($content, do_lang('GALLERIES')); }
function writeInternal($str) { global $opt; // close the last file? if ($this->oSitemapFile !== false && ($this->nWrittenSize + strlen($str) > $this->nMaxFileSize || $this->nWrittenCount >= $this->nMaxUrlCount)) { gzwrite($this->oSitemapFile, '</urlset>'); gzclose($this->oSitemapFile); $this->oSitemapFile = false; } // open new XML file? if ($this->oSitemapFile === false) { $this->nSitemapIndex++; $sFilename = 'sitemap-' . $this->nSitemapIndex . '.xml.gz'; $this->oSitemapFile = gzopen($this->sPath . $sFilename, 'wb'); fwrite($this->oIndexFile, '<sitemap><loc>' . xmlentities($this->sDomain . $sFilename) . '</loc><lastmod>' . xmlentities(date('c')) . '</lastmod></sitemap>'); gzwrite($this->oSitemapFile, '<?xml version="1.0" encoding="UTF-8"?>' . "\n"); gzwrite($this->oSitemapFile, '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'); // includes end of xml-tag $this->nWrittenSize = 108; $this->nWrittenCount = 0; } // write string to XML gzwrite($this->oSitemapFile, $str); $this->nWrittenSize += strlen($str); $this->nWrittenCount++; }
/** * Standard modular run function for ajax-tree hooks. Generates XML for a tree list, which is interpreted by Javascript and expanded on-demand (via new calls). * * @param ?ID_TEXT The ID to do under (NULL: root) * @param array Options being passed through * @param ?ID_TEXT The ID to select by default (NULL: none) * @return string XML in the special category,entry format */ function run($id, $options, $default = NULL) { require_code('galleries'); $only_owned = array_key_exists('only_owned', $options) ? is_null($options['only_owned']) ? NULL : intval($options['only_owned']) : NULL; $editable_filter = array_key_exists('editable_filter', $options) ? $options['editable_filter'] : false; $tree = get_gallery_content_tree('images', $only_owned, $id, NULL, NULL, is_null($id) ? 0 : 1, false, $editable_filter); if (!has_actual_page_access(NULL, 'galleries')) { $tree = array(); } $out = ''; foreach ($tree as $t) { $_id = $t['id']; if ($id === $_id) { foreach ($t['entries'] as $eid => $etitle) { if (is_object($etitle)) { $etitle = @html_entity_decode(strip_tags($etitle->evaluate()), ENT_QUOTES, get_charset()); } $out .= '<entry id="' . xmlentities(strval($eid)) . '" title="' . xmlentities($etitle) . '" selectable="true"></entry>'; } continue; } $title = $t['title']; $has_children = $t['child_count'] != 0 || $t['child_entry_count'] != 0; $out .= '<category id="' . xmlentities($_id) . '" title="' . xmlentities($title) . '" has_children="' . ($has_children ? 'true' : 'false') . '" selectable="false"></category>'; } // Mark parent cats for pre-expansion if (!is_null($default) && $default != '') { $cat = $GLOBALS['SITE_DB']->query_value_null_ok('images', 'cat', array('id' => intval($default))); while (!is_null($cat) && $cat != '') { $out .= '<expand>' . $cat . '</expand>'; $cat = $GLOBALS['SITE_DB']->query_value_null_ok('galleries', 'parent_id', array('name' => $cat)); } } return '<result>' . $out . '</result>'; }
/** * Standard modular run function for OcCLE hooks. * * @param array The options with which the command was called * @param array The parameters with which the command was called * @param array A reference to the OcCLE filesystem object * @return array Array of stdcommand, stdhtml, stdout, and stderr responses */ function run($options, $parameters, &$occle_fs) { if (array_key_exists('h', $options) || array_key_exists('help', $options)) { return array('', do_command_help('exit', array('h'), array()), '', ''); } else { return array('if (document.getElementById(\'occle_box\')) load_occle(); else window.location.href=\'' . xmlentities(addslashes(static_evaluate_tempcode(build_url(array('page' => ''), '')))) . '\';', '', do_lang('SUCCESS'), ''); } }
/** * Standard modular run function for RSS hooks. * * @param string A list of categories we accept from * @param TIME Cutoff time, before which we do not show results from * @param string Prefix that represents the template set we use * @set RSS_ ATOM_ * @param string The standard format of date to use for the syndication type represented in the prefix * @param integer The maximum number of entries to return, ordering by date * @return ?array A pair: The main syndication section, and a title (NULL: error) */ function run($_filters, $cutoff, $prefix, $date_string, $max) { if (!addon_installed('tickets')) { return NULL; } if (!has_actual_page_access(get_member(), 'tickets')) { return NULL; } if (is_guest()) { return NULL; } require_code('tickets'); require_code('tickets2'); $ticket_types = ocfilter_to_idlist_using_callback($_filters, '', NULL, NULL, NULL, NULL, false); if (count($ticket_types) != 0) { $rows = array(); foreach ($ticket_types as $ticket_type) { if (!has_category_access(get_member(), 'tickets', get_translated_text($ticket_type))) { continue; } $rows = array_merge($rows, get_tickets(get_member(), $ticket_type, false, false, true)); } } else { $rows = get_tickets(get_member(), NULL, false, false, true); } require_code('feedback'); $content = new ocp_tempcode(); foreach ($rows as $i => $row) { if ($i == $max) { break; } if ($row['lasttime'] < $cutoff) { continue; } $ticket_id = extract_topic_identifier($row['description']); $ticket_type = $GLOBALS['SITE_DB']->query_value_null_ok('tickets', 'ticket_type', array('ticket_id' => $ticket_id)); $author = $row['firstusername']; $date = date($date_string, $row['firsttime']); $edit_date = date($date_string, $row['lasttime']); $title = xmlentities($row['firsttitle']); $summary = xmlentities($row['firstpost']->evaluate()); $category = ''; $category_raw = ''; if (!is_null($ticket_type)) { $category = get_translated_text($ticket_type); $category_raw = strval($ticket_type); } $view_url = build_url(array('page' => 'tickets', 'type' => 'ticket', 'id' => $ticket_id), get_module_zone('tickets'), NULL, false, false, true); if ($prefix == 'RSS_' && get_option('is_on_comments') == '1') { $if_comments = do_template('RSS_ENTRY_COMMENTS', array('_GUID' => 'b4f25f5cf68304f8d402bb06851489d6', 'COMMENT_URL' => $view_url, 'ID' => strval($ticket_id))); } else { $if_comments = new ocp_tempcode(); } $content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $ticket_id, 'NEWS' => '', 'DATE' => $date))); } require_lang('tickets'); return array($content, do_lang('SUPPORT_TICKETS')); }
/** * Standard modular run function for ajax-tree hooks. Generates XML for a tree list, which is interpreted by Javascript and expanded on-demand (via new calls). * * @param ?ID_TEXT The ID to do under (NULL: root) * @param array Options being passed through * @param ?ID_TEXT The ID to select by default (NULL: none) * @return string XML in the special category,entry format */ function run($id, $options, $default = NULL) { if ($id === NULL) { $id = ''; } require_code('files2'); require_code('images'); $fullpath = get_custom_file_base() . '/uploads/filedump'; if ($id != '') { $fullpath .= '/' . $id; } $folder = isset($options['folder']) && $options['folder']; // We want to select folders, not files $out = ''; if (has_actual_page_access(NULL, 'filedump') && file_exists($fullpath)) { $files = get_directory_contents($fullpath, '', false, false); foreach ($files as $f) { $description = $GLOBALS['SITE_DB']->query_value_null_ok('filedump', 'description', array('name' => basename($f), 'path' => $id . '/')); if (isset($options['attachment_ready']) && $options['attachment_ready']) { $entry_id = 'url_' . 'uploads/filedump/' . ($id == '' ? '' : rawurlencode($id) . '/') . rawurlencode($f); } else { $entry_id = 'uploads/filedump/' . ($id == '' ? '' : rawurlencode($id) . '/') . rawurlencode($f); } if (is_dir($fullpath . '/' . $f)) { $has_children = count(get_directory_contents($fullpath . '/' . $f, '', false, false)) > 0; $out .= '<category id="' . xmlentities(($id == '' ? '' : $id . '/') . $f) . '" title="' . xmlentities($f) . '" has_children="' . ($has_children ? 'true' : 'false') . '" selectable="' . ($folder ? 'true' : 'false') . '"></category>'; } elseif (!$folder) { if (!isset($options['only_images']) || !$options['only_images'] || is_image($f)) { if (is_null($description) || get_translated_text($description) == '') { $_description = ''; if (is_image($f)) { $url = get_custom_base_url() . '/uploads/filedump/' . ($id == '' ? '' : $id . '/') . $f; $_description = static_evaluate_tempcode(do_image_thumb($url, '', true, true)); } } else { $_description = escape_html(get_translated_text($description)); } $out .= '<entry id="' . xmlentities($entry_id) . '" title="' . xmlentities($f) . '" description_html="' . xmlentities($_description) . '" selectable="true"></entry>'; } } } // Mark parent cats for pre-expansion if (!is_null($default) && $default != '') { $cat = ''; foreach (explode('/', $default) as $_cat) { if ($_cat != '') { $cat .= '/'; $cat .= $_cat; } $out .= '<expand>' . $cat . '</expand>'; } } } return '<result>' . $out . '</result>'; }
/** * Standard modular run function for RSS hooks. * * @param string A list of categories we accept from * @param TIME Cutoff time, before which we do not show results from * @param string Prefix that represents the template set we use * @set RSS_ ATOM_ * @param string The standard format of date to use for the syndication type represented in the prefix * @param integer The maximum number of entries to return, ordering by date * @return ?array A pair: The main syndication section, and a title (NULL: error) */ function run($_filters, $cutoff, $prefix, $date_string, $max) { if (!addon_installed('chat')) { return NULL; } if (!has_actual_page_access(get_member(), 'chat')) { return NULL; } $filters = ocfilter_to_sqlfragment($_filters, 'room_id', 'chat_rooms', NULL, 'room_id', 'id'); // Note that the parameters are fiddled here so that category-set and record-set are the same, yet SQL is returned to deal in an entirely different record-set (entries' record-set) require_code('chat'); $rows = $GLOBALS['SITE_DB']->query('SELECT m.* FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'chat_messages m LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'chat_rooms r ON r.id=m.room_id WHERE r.is_im=0 AND date_and_time>' . strval(time() - $cutoff) . ' AND ' . $filters . ' ORDER BY date_and_time DESC', $max); $count = $GLOBALS['SITE_DB']->query_value('chat_rooms', 'COUNT(*)', array('is_im' => 0)); $categories = array(); if ($count < 100) { $_categories = $GLOBALS['SITE_DB']->query_select('chat_rooms', array('*'), array('is_im' => 0)); foreach ($_categories as $category) { $categories[$category['id']] = $category; } } $content = new ocp_tempcode(); foreach ($rows as $row) { if (!array_key_exists($row['room_id'], $categories) && $count >= 100) { $_categories = $GLOBALS['SITE_DB']->query_select('chat_rooms', array('*'), array('id' => $row['room_id']), '', 1); if (array_key_exists(0, $_categories)) { $categories[$row['room_id']] = $_categories[0]; } } if (!array_key_exists($row['room_id'], $categories)) { continue; } // Message is in deleted room (although should not exist in DB anymore!) if (check_chatroom_access($categories[$row['room_id']], true)) { $id = strval($row['id']); $author = $GLOBALS['FORUM_DRIVER']->get_username($row['user_id']); if (is_null($author)) { $author = ''; } $news_date = date($date_string, $row['date_and_time']); $edit_date = ''; $_title = get_translated_tempcode($row['the_message']); $news_title = xmlentities($_title->evaluate()); $summary = ''; $news = ''; $category = $categories[$row['room_id']]['room_name']; $category_raw = strval($row['room_id']); $view_url = build_url(array('page' => 'chat', 'type' => 'room', 'id' => $row['room_id']), get_module_zone('chat'), NULL, false, false, true); $if_comments = new ocp_tempcode(); $content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date))); } } require_lang('chat'); return array($content, do_lang('MESSAGES')); }
function echo_sitemap_url($loc, $priority, $freq) { $loc_xml = isset($_SERVER['HTTP_HOST']) ? xmlentities("http://{$_SERVER['HTTP_HOST']}/{$loc}") : xmlentities("http://www.boost.org/{$loc}"); echo <<<EOL <url> <loc>{$loc_xml}</loc> <priority>{$priority}</priority> <changefreq>{$freq}</changefreq> </url> EOL; }
/** * Standard modular run function for ajax-tree hooks. Generates XML for a tree list, which is interpreted by Javascript and expanded on-demand (via new calls). * * @param ?ID_TEXT The ID to do under (NULL: root) * @param array Options being passed through * @param ?ID_TEXT The ID to select by default (NULL: none) * @return string XML in the special category,entry format */ function run($id, $options, $default = NULL) { require_code('galleries'); require_lang('galleries'); $must_accept_images = array_key_exists('must_accept_images', $options) ? $options['must_accept_images'] : false; $must_accept_videos = array_key_exists('must_accept_videos', $options) ? $options['must_accept_videos'] : false; $filter = array_key_exists('filter', $options) ? $options['filter'] : NULL; $purity = array_key_exists('purity', $options) ? $options['purity'] : false; $member_id = array_key_exists('member_id', $options) ? $options['member_id'] : NULL; $compound_list = array_key_exists('compound_list', $options) ? $options['compound_list'] : false; $addable_filter = array_key_exists('addable_filter', $options) ? $options['addable_filter'] : false; $stripped_id = $compound_list ? preg_replace('#,.*$#', '', $id) : $id; $tree = get_gallery_tree(is_null($id) ? 'root' : $stripped_id, '', NULL, true, $filter, false, false, $purity, $compound_list, is_null($id) ? 0 : 1, $member_id, $addable_filter); if (!has_actual_page_access(NULL, 'galleries')) { $tree = array(); } if ($compound_list) { list($tree, ) = $tree; } $out = ''; for ($i = 0; $i < count($tree); $i++) { $t = $tree[$i]; $_id = $compound_list ? $t['compound_list'] : $t['id']; if ($stripped_id === $t['id']) { // Possible when we look under as a root if (array_key_exists('children', $t)) { $tree = $t['children']; $i = 0; } continue; } $title = $t['title']; if (is_object($title)) { $title = @html_entity_decode(strip_tags($title->evaluate()), ENT_QUOTES, get_charset()); } $has_children = $t['child_count'] != 0; $selectable = ($addable_filter !== true || $t['addable']) && ($t['accept_videos'] == 1 && $t['is_member_synched'] == 0 || !$must_accept_videos) && ($t['accept_images'] == 1 && $t['is_member_synched'] == 0 || !$must_accept_images); $tag = 'category'; // category $out .= '<' . $tag . ' id="' . xmlentities($_id) . '" title="' . xmlentities($title) . '" has_children="' . ($has_children ? 'true' : 'false') . '" selectable="' . ($selectable ? 'true' : 'false') . '"></' . $tag . '>'; // Mark parent cats for pre-expansion if (!is_null($default) && $default != '') { $cat = $default; while (!is_null($cat) && $cat != '') { $out .= '<expand>' . $cat . '</expand>'; $cat = $GLOBALS['SITE_DB']->query_value_null_ok('galleries', 'parent_id', array('name' => $cat)); } } } $tag = 'result'; // result return '<' . $tag . '>' . $out . '</' . $tag . '>'; }
/** * Standard modular run function for ajax-tree hooks. Generates XML for a tree list, which is interpreted by Javascript and expanded on-demand (via new calls). * * @param ?ID_TEXT The ID to do under (NULL: root) * @param array Options being passed through * @param ?ID_TEXT The ID to select by default (NULL: none) * @return string XML in the special category,entry format */ function run($id, $options, $default = NULL) { require_code('catalogues'); require_lang('catalogues'); $catalogue_name = array_key_exists('catalogue_name', $options) ? $options['catalogue_name'] : NULL; $addable_filter = array_key_exists('addable_filter', $options) ? $options['addable_filter'] : false; $compound_list = array_key_exists('compound_list', $options) ? $options['compound_list'] : false; $stripped_id = $compound_list ? preg_replace('#,.*$#', '', $id) : $id; if (is_null($catalogue_name)) { $tree = array(); $catalogues = $GLOBALS['SITE_DB']->query_select('catalogues', array('c_name')); foreach ($catalogues as $catalogue) { $tree = array_merge($tree, get_catalogue_category_tree($catalogue['c_name'], is_null($id) ? NULL : intval($id), NULL, NULL, 1, $addable_filter, $compound_list)); } } else { $tree = get_catalogue_category_tree($catalogue_name, is_null($id) ? NULL : intval($id), NULL, NULL, 1, $addable_filter, $compound_list); } if (!has_actual_page_access(NULL, 'catalogues')) { $tree = array(); } $out = ''; foreach ($tree as $t) { if ($compound_list) { $_id = $t['compound_list']; } else { $_id = strval($t['id']); } if ($stripped_id === strval($t['id'])) { continue; } // Possible when we look under as a root $title = $t['title']; $has_children = $t['child_count'] != 0; $selectable = $addable_filter !== true || $t['addable']; $tag = 'category'; // category $out .= '<' . $tag . ' id="' . $_id . '" title="' . xmlentities($title) . '" has_children="' . ($has_children ? 'true' : 'false') . '" selectable="' . ($selectable ? 'true' : 'false') . '"></' . $tag . '>'; } // Mark parent cats for pre-expansion if (!is_null($default) && $default != '') { $cat = intval($default); while (!is_null($cat)) { $out .= '<expand>' . strval($cat) . '</expand>'; $cat = $GLOBALS['SITE_DB']->query_value_null_ok('catalogue_categories', 'cc_parent_id', array('id' => $cat)); } } $tag = 'result'; // result return '<' . $tag . '>' . $out . '</' . $tag . '>'; }
/** * Standard modular run function for RSS hooks. * * @param string A list of categories we accept from * @param TIME Cutoff time, before which we do not show results from * @param string Prefix that represents the template set we use * @set RSS_ ATOM_ * @param string The standard format of date to use for the syndication type represented in the prefix * @param integer The maximum number of entries to return, ordering by date * @return ?array A pair: The main syndication section, and a title (NULL: error) */ function run($_filters, $cutoff, $prefix, $date_string, $max) { if (!addon_installed('ocf_forum')) { return NULL; } if (get_forum_type() != 'ocf') { return NULL; } if (!has_actual_page_access(get_member(), 'forumview')) { return NULL; } $filters = ocfilter_to_sqlfragment($_filters, 'p_topic_id', 'f_forums', 'f_parent_forum', 'p_cache_forum_id', 'id', true, true, $GLOBALS['FORUM_DB']); $cutoff = max($cutoff, time() - 60 * 60 * 24 * 60); if (!is_guest()) { $filters .= ' AND (p_poster<>' . strval(get_member()) . ')'; } $rows = $GLOBALS['FORUM_DB']->query('SELECT * FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_posts WHERE p_time>' . strval($cutoff) . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND p_validated=1 ' : '') . ' AND ' . $filters . ' ORDER BY p_time DESC,id DESC', $max); $categories = list_to_map('id', $GLOBALS['FORUM_DB']->query('SELECT id,t_cache_first_title,t_pt_from,t_pt_to FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_topics WHERE t_cache_last_time>' . strval((int) $cutoff))); $content = new ocp_tempcode(); foreach ($rows as $row) { if (!array_key_exists($row['p_topic_id'], $categories)) { continue; } $category = $categories[$row['p_topic_id']]['t_cache_first_title']; if ((!is_null($row['p_cache_forum_id']) || $categories[$row['p_topic_id']]['t_pt_from'] == get_member() || $categories[$row['p_topic_id']]['t_pt_to'] == get_member()) && (is_null($row['p_intended_solely_for']) || $row['p_intended_solely_for'] == get_member()) && has_category_access(get_member(), 'forums', strval($row['p_cache_forum_id']))) { $id = strval($row['id']); $author = $row['p_poster_name_if_guest']; $news_date = date($date_string, $row['p_time']); $edit_date = is_null($row['p_last_edit_time']) ? '' : date($date_string, $row['p_last_edit_time']); if ($edit_date == $news_date) { $edit_date = ''; } $news_title = xmlentities($row['p_title']); $_summary = get_translated_tempcode($row['p_post'], $GLOBALS['FORUM_DB']); $summary = xmlentities($_summary->evaluate()); $news = ''; $category_raw = strval($row['p_topic_id']); $view_url = build_url(array('page' => 'topicview', 'type' => 'findpost', 'id' => $row['id']), get_module_zone('forumview'), NULL, false, false, true); if ($prefix == 'RSS_') { $if_comments = do_template('RSS_ENTRY_COMMENTS', array('_GUID' => 'ed06bc8f174a5427e1789820666fdd81', 'COMMENT_URL' => $view_url, 'ID' => strval($row['p_topic_id']))); } else { $if_comments = new ocp_tempcode(); } $content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date))); } } require_lang('ocf'); return array($content, do_lang('FORUM_TOPICS')); }
/** * Standard modular run function for RSS hooks. * * @param string A list of categories we accept from * @param TIME Cutoff time, before which we do not show results from * @param string Prefix that represents the template set we use * @set RSS_ ATOM_ * @param string The standard format of date to use for the syndication type represented in the prefix * @param integer The maximum number of entries to return, ordering by date * @return ?array A pair: The main syndication section, and a title (NULL: error) */ function run($_filters, $cutoff, $prefix, $date_string, $max) { if (get_forum_type() != 'ocf') { return NULL; } if (is_guest()) { return NULL; } $member_id = get_member(); if (get_forum_type() != 'ocf') { return NULL; } if (!has_actual_page_access($member_id, 'forumview')) { return NULL; } if (is_guest()) { return NULL; } require_code('ocf_notifications'); $rows = ocf_get_pp_rows($max); $content = new ocp_tempcode(); foreach ($rows as $row) { $id = strval($row['p_id']); $author = $row['t_cache_first_username']; $news_date = date($date_string, $row['t_cache_first_time']); $edit_date = date($date_string, $row['t_cache_last_time']); if ($edit_date == $news_date) { $edit_date = ''; } $news_title = xmlentities($row['t_cache_first_title']); $_summary = get_translated_tempcode($row['t_cache_first_post'], $GLOBALS['FORUM_DB']); $summary = xmlentities($_summary->evaluate()); $news = ''; $category = do_lang('NA'); $category_raw = ''; $_view_url = build_url(array('page' => 'topicview', 'id' => $row['t_id']), get_module_zone('forumview')); $view_url = $_view_url->evaluate(); $view_url .= '#' . strval($row['p_id']); if ($prefix == 'RSS_') { $if_comments = do_template('RSS_ENTRY_COMMENTS', array('COMMENT_URL' => $view_url, 'ID' => strval($row['p_id']))); } else { $if_comments = new ocp_tempcode(); } $content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date))); } require_lang('ocf'); return array($content, do_lang('PERSONAL_TOPICS')); }
function get_header($module, $update_time, $author, $title = '', $feed_path = '') { $result = array(); $result[] = '<?xml version="1.0" encoding="utf-8"?>'; $result[] = '<feed xmlns="http://www.w3.org/2005/Atom">' . $this->newline; $result[] = ' <title>' . xmlentities($module->title . $title) . '</title>'; $result[] = ' <link rel="alternate" href="' . xmlentities($module->url()) . '"/>'; $result[] = ' <link rel="self" href="' . xmlentities($module->url('feeds') . $feed_path) . '"/>'; $result[] = ' <updated>' . xmlentities($update_time) . '</updated>'; $result[] = ' <author>'; $result[] = ' <name>' . xmlentities($author) . '</name>'; $result[] = ' </author>'; $result[] = ' <id>' . xmlentities($module->url('feeds') . $feed_path) . '</id>' . $this->newline; $result = join($this->newline, $result) . $this->newline; return $result; }
/** * Standard modular run function for ajax-tree hooks. Generates XML for a tree list, which is interpreted by Javascript and expanded on-demand (via new calls). * * @param ?ID_TEXT The ID to do under (NULL: root) * @param array Options being passed through * @param ?ID_TEXT The ID to select by default (NULL: none) * @return string XML in the special category,entry format */ function run($id, $options, $default = NULL) { require_code('ocf_forums'); require_code('ocf_forums2'); $compound_list = array_key_exists('compound_list', $options) ? $options['compound_list'] : false; $addable_filter = array_key_exists('addable_filter', $options) ? $options['addable_filter'] : false; $stripped_id = $compound_list ? preg_replace('#,.*$#', '', $id) : $id; $tree = ocf_get_forum_tree_secure(NULL, is_null($id) ? NULL : intval($id), false, NULL, '', NULL, NULL, $compound_list, 1, true); $out = ''; if (!has_actual_page_access(NULL, 'forumview')) { $tree = $compound_list ? array(array(), '') : array(); } $categories = collapse_2d_complexity('id', 'c_title', $GLOBALS['FORUM_DB']->query_select('f_categories', array('id', 'c_title'))); if ($compound_list) { list($tree, ) = $tree; } foreach ($tree as $t) { if ($compound_list) { $_id = $t['compound_list']; } else { $_id = strval($t['id']); } if ($stripped_id === strval($t['id'])) { continue; } // Possible when we look under as a root $title = $t['title']; $description = array_key_exists($t['group'], $categories) ? $categories[$t['group']] : ''; $has_children = $t['child_count'] != 0; $selectable = !$addable_filter || ocf_may_post_topic($t['id']); $tag = 'category'; // category $out .= '<' . $tag . ' id="' . $_id . '" title="' . xmlentities($title) . '" description="' . xmlentities($description) . '" has_children="' . ($has_children ? 'true' : 'false') . '" selectable="' . ($selectable ? 'true' : 'false') . '"></' . $tag . '>'; } // Mark parent cats for pre-expansion if (!is_null($default) && $default != '') { $cat = intval($default); while (!is_null($cat)) { $out .= '<expand>' . strval($cat) . '</expand>'; $cat = $GLOBALS['FORUM_DB']->query_value_null_ok('f_forums', 'f_parent_forum', array('id' => $cat)); } } $tag = 'result'; // result return '<' . $tag . '>' . $out . '</' . $tag . '>'; }
/** * Standard modular run function for RSS hooks. * * @param string A list of categories we accept from * @param TIME Cutoff time, before which we do not show results from * @param string Prefix that represents the template set we use * @set RSS_ ATOM_ * @param string The standard format of date to use for the syndication type represented in the prefix * @param integer The maximum number of entries to return, ordering by date * @return ?array A pair: The main syndication section, and a title (NULL: error) */ function run($_filters, $cutoff, $prefix, $date_string, $max) { if (!addon_installed('ocf_forum')) { return NULL; } if (get_forum_type() != 'ocf') { return NULL; } if (!has_actual_page_access(get_member(), 'forumview')) { return NULL; } $filters = ocfilter_to_sqlfragment($_filters, 't_forum_id', 'f_forums', 'f_parent_forum', 't_forum_id', 'id', true, true, $GLOBALS['FORUM_DB']); // Note that the parameters are fiddled here so that category-set and record-set are the same, yet SQL is returned to deal in an entirely different record-set (entries' record-set) $rows = $GLOBALS['FORUM_DB']->query('SELECT * FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_topics WHERE t_cache_last_time>' . strval($cutoff) . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND t_validated=1 ' : '') . ' AND ' . $filters . ' ORDER BY t_cache_last_time DESC', $max); $categories = collapse_2d_complexity('id', 'f_name', $GLOBALS['FORUM_DB']->query('SELECT id,f_name FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_forums WHERE f_cache_num_posts>0')); $content = new ocp_tempcode(); foreach ($rows as $row) { if ((!is_null($row['t_forum_id']) || $row['t_pt_to'] == get_member()) && has_category_access(get_member(), 'forums', strval($row['t_forum_id']))) { $id = strval($row['id']); $author = $row['t_cache_first_username']; $news_date = date($date_string, $row['t_cache_first_time']); $edit_date = date($date_string, $row['t_cache_last_time']); if ($edit_date == $news_date) { $edit_date = ''; } $news_title = xmlentities($row['t_cache_first_title']); $_summary = get_translated_tempcode($row['t_cache_first_post'], $GLOBALS['FORUM_DB']); $summary = xmlentities($_summary->evaluate()); $news = ''; $category = array_key_exists($row['t_forum_id'], $categories) ? $categories[$row['t_forum_id']] : do_lang('NA'); $category_raw = strval($row['t_forum_id']); $view_url = build_url(array('page' => 'topicview', 'id' => $row['id']), get_module_zone('forumview'), NULL, false, false, true); if ($prefix == 'RSS_') { $if_comments = do_template('RSS_ENTRY_COMMENTS', array('_GUID' => 'f5dd7ba612b989bba5e2d496da5bf161', 'COMMENT_URL' => $view_url, 'ID' => strval($row['id']))); } else { $if_comments = new ocp_tempcode(); } $content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date))); } } require_lang('ocf'); return array($content, do_lang('SECTION_FORUMS')); }
/** * Standard modular run function for RSS hooks. * * @param string A list of categories we accept from * @param TIME Cutoff time, before which we do not show results from * @param string Prefix that represents the template set we use * @set RSS_ ATOM_ * @param string The standard format of date to use for the syndication type represented in the prefix * @param integer The maximum number of entries to return, ordering by date * @return ?array A pair: The main syndication section, and a title (NULL: error) */ function run($_filters, $cutoff, $prefix, $date_string, $max) { if (get_forum_type() != 'ocf') { return NULL; } if (!has_actual_page_access(get_member(), 'forumview')) { return NULL; } if (is_guest()) { return NULL; } $condition = 'l_time<t_cache_last_time OR (l_time IS NULL AND t_cache_last_time>' . strval(time() - 60 * 60 * 24 * intval(get_option('post_history_days'))) . ')'; $query = ' FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_topics top LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_read_logs l ON (top.id=l.l_topic_id AND l.l_member_id=' . strval((int) get_member()) . ') LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON ' . db_string_equal_to('language', user_lang()) . ' AND top.t_cache_first_post=t.id WHERE (' . $condition . ') AND t_forum_id IS NOT NULL ' . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND t_validated=1 ' : '') . ' ORDER BY t_cache_last_time DESC'; $rows = $GLOBALS['FORUM_DB']->query('SELECT *,top.id AS t_id ' . $query, $max); $categories = collapse_2d_complexity('id', 'f_name', $GLOBALS['FORUM_DB']->query('SELECT id,f_name FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_forums WHERE f_cache_num_posts>0')); $content = new ocp_tempcode(); foreach ($rows as $row) { if ((!is_null($row['t_forum_id']) || $row['t_pt_to'] == get_member()) && has_category_access(get_member(), 'forums', strval($row['t_forum_id']))) { $id = strval($row['id']); $author = $row['t_cache_first_username']; $news_date = date($date_string, $row['t_cache_first_time']); $edit_date = date($date_string, $row['t_cache_last_time']); if ($edit_date == $news_date) { $edit_date = ''; } $news_title = xmlentities($row['t_cache_first_title']); $_summary = get_translated_tempcode($row['t_cache_first_post'], $GLOBALS['FORUM_DB']); $summary = xmlentities($_summary->evaluate()); $news = ''; $category = array_key_exists($row['t_forum_id'], $categories) ? $categories[$row['t_forum_id']] : do_lang('NA'); $category_raw = strval($row['t_forum_id']); $view_url = build_url(array('page' => 'topicview', 'id' => $row['t_id']), get_module_zone('topicview')); if ($prefix == 'RSS_') { $if_comments = do_template('RSS_ENTRY_COMMENTS', array('COMMENT_URL' => $view_url, 'ID' => strval($row['t_id']))); } else { $if_comments = new ocp_tempcode(); } $content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date))); } } require_lang('ocf'); return array($content, do_lang('TOPICS_UNREAD')); }
/** * Standard modular run function for RSS hooks. * * @param string A list of categories we accept from * @param TIME Cutoff time, before which we do not show results from * @param string Prefix that represents the template set we use * @set RSS_ ATOM_ * @param string The standard format of date to use for the syndication type represented in the prefix * @param integer The maximum number of entries to return, ordering by date * @return ?array A pair: The main syndication section, and a title (NULL: error) */ function run($_filters, $cutoff, $prefix, $date_string, $max) { unset($_filters); // Not used if (!addon_installed('polls')) { return NULL; } if (!has_actual_page_access(get_member(), 'polls')) { return NULL; } $content = new ocp_tempcode(); $rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'poll WHERE add_time>' . strval((int) $cutoff) . ' AND (votes1+votes2+votes3+votes4+votes5+votes6+votes7+votes8+votes9+votes10<>0 OR is_current=1) ORDER BY add_time DESC', $max); foreach ($rows as $row) { $id = strval($row['id']); $author = $GLOBALS['FORUM_DRIVER']->get_username($row['submitter']); if (is_null($author)) { $author = ''; } $news_date = date($date_string, $row['add_time']); $edit_date = is_null($row['edit_date']) ? '' : date($date_string, $row['edit_date']); $_news_title = get_translated_tempcode($row['question']); $news_title = xmlentities($_news_title->evaluate()); $answers = array(); for ($i = 1; $i <= 5; $i++) { $answers[] = get_translated_tempcode($row['option' . strval($i)]); } $_summary = do_template('POLL_RSS_SUMMARY', array('_GUID' => 'db39d44c1fa871122e1ae717e4947244', 'ANSWERS' => $answers)); $summary = xmlentities($_summary->evaluate()); $news = ''; $category = ''; $category_raw = ''; $view_url = build_url(array('page' => 'polls', 'type' => 'view', 'id' => $row['id']), get_module_zone('polls'), NULL, false, false, true); if ($prefix == 'RSS_' && get_option('is_on_comments') == '1' && $row['allow_comments'] >= 1) { $if_comments = do_template('RSS_ENTRY_COMMENTS', array('_GUID' => '0a3e8d0b18e619d88f12bc7665fbbbca', 'COMMENT_URL' => $view_url, 'ID' => strval($row['id']))); } else { $if_comments = new ocp_tempcode(); } $content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date))); } require_lang('polls'); return array($content, do_lang('POLLS')); }
/** * Standard modular run function for RSS hooks. * * @param string A list of categories we accept from * @param TIME Cutoff time, before which we do not show results from * @param string Prefix that represents the template set we use * @set RSS_ ATOM_ * @param string The standard format of date to use for the syndication type represented in the prefix * @param integer The maximum number of entries to return, ordering by date * @return ?array A pair: The main syndication section, and a title (NULL: error) */ function run($_filters, $cutoff, $prefix, $date_string, $max) { unset($_filters); // Not used if (!addon_installed('iotds')) { return NULL; } if (!has_actual_page_access(get_member(), 'iotds')) { return NULL; } $content = new ocp_tempcode(); $rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'iotd WHERE add_date>' . strval((int) $cutoff) . ' AND (used=1 OR is_current=1) ORDER BY add_date DESC', $max); foreach ($rows as $row) { $id = strval($row['id']); $author = $GLOBALS['FORUM_DRIVER']->get_username($row['submitter']); if (is_null($author)) { $author = ''; } $news_date = date($date_string, $row['add_date']); $edit_date = is_null($row['edit_date']) ? '' : date($date_string, $row['edit_date']); $_news_title = get_translated_tempcode($row['i_title']); $news_title = xmlentities($_news_title->evaluate()); $_summary = get_translated_tempcode($row['caption']); $summary = xmlentities($_summary->evaluate()); $news = ''; $category = ''; $category_raw = ''; $view_url = build_url(array('page' => 'iotds', 'type' => 'view', 'id' => $row['id']), get_module_zone('iotds'), NULL, false, false, true); if ($prefix == 'RSS_' && get_option('is_on_comments') == '1' && $row['allow_comments'] >= 1) { $if_comments = do_template('RSS_ENTRY_COMMENTS', array('_GUID' => 'a8ccf291cb27c8ffb34f023416b85664', 'COMMENT_URL' => $view_url, 'ID' => strval($row['id']))); } else { $if_comments = new ocp_tempcode(); } require_code('images'); $enclosure_url = ensure_thumbnail($row['url'], $row['thumb_url'], 'iotds', 'iotd', $row['id']); list($enclosure_length, $enclosure_type) = get_enclosure_details($row['url'], $enclosure_url); $content->attach(do_template($prefix . 'ENTRY', array('ENCLOSURE_URL' => $enclosure_url, 'ENCLOSURE_LENGTH' => $enclosure_length, 'ENCLOSURE_TYPE' => $enclosure_type, 'VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date))); } require_lang('iotds'); return array($content, do_lang('IOTDS')); }
/** * Standard modular run function for RSS hooks. * * @param string A list of categories we accept from * @param TIME Cutoff time, before which we do not show results from * @param string Prefix that represents the template set we use * @set RSS_ ATOM_ * @param string The standard format of date to use for the syndication type represented in the prefix * @param integer The maximum number of entries to return, ordering by date * @return ?array A pair: The main syndication section, and a title (NULL: error) */ function run($_filters, $cutoff, $prefix, $date_string, $max) { if (!addon_installed('points')) { return NULL; } if (!has_actual_page_access(get_member(), 'points')) { return NULL; } $filters = ocfilter_to_sqlfragment($_filters, 'gift_to', 'f_members', NULL, 'gift_to', 'id', true, true, $GLOBALS['FORUM_DB']); // Note that the parameters are fiddled here so that category-set and record-set are the same, yet SQL is returned to deal in an entirely different record-set (entries' record-set) require_lang('points'); $content = new ocp_tempcode(); $rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'gifts WHERE ' . $filters . ' AND date_and_time>' . strval((int) $cutoff) . ' ORDER BY date_and_time DESC', $max); foreach ($rows as $row) { $id = strval($row['id']); $author = ''; if ($row['anonymous'] == 0) { $from = $GLOBALS['FORUM_DRIVER']->get_username($row['gift_from']); if (is_null($from)) { $from = ''; } } $news_date = date($date_string, $row['date_and_time']); $edit_date = ''; $to = $GLOBALS['FORUM_DRIVER']->get_username($row['gift_to']); if (is_null($to)) { $to = do_lang('UNKNOWN'); } $news_title = xmlentities(do_lang('POINTS_RSS_LINE', $to, integer_format($row['amount']))); $summary = xmlentities(get_translated_text($row['reason'])); $news = ''; $category = ''; $category_raw = ''; $view_url = build_url(array('page' => 'points', 'type' => 'member', 'id' => $row['gift_to']), get_module_zone('points'), NULL, false, false, true); $if_comments = new ocp_tempcode(); $content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date))); } require_lang('points'); return array($content, do_lang('POINTS')); }
/** * Convert some data to XML-RPC format. * * @param mixed Data * @return string XML-RPC format version */ function _xml_rpc_type_convert($_value) { switch (gettype($_value)) { case 'boolean': $value = '<boolean>' . ($_value ? '1' : '0') . '</boolean>'; break; case 'array': $keys = array_keys($_value); if (count($_value) > 0 && !is_integer(array_pop($keys))) { $value = '<struct>'; foreach ($_value as $k => $v) { $value .= '<name>' . $k . '</name><value>' . _xml_rpc_type_convert($v) . '</value>'; } $value .= '</struct>'; } else { $value = '<array><data>'; foreach ($_value as $v) { $value .= '<value>' . _xml_rpc_type_convert($v) . '</value>'; } $value .= '</data></array>'; } break; case 'object': $value = '<string>' . xmlentities($_value->evaluate()) . '</string>'; break; case 'integer': $value = '<i4>' . strval($_value) . '</i4>'; break; case 'float': $value = '<double>' . float_to_raw_string($_value) . '</double>'; break; case 'NULL': $value = '<nil/>'; break; default: $value = '<string>' . xmlentities(strval($_value)) . '</string>'; break; } return $value; }
/** * Standard modular run function for RSS hooks. * * @param string A list of categories we accept from * @param TIME Cutoff time, before which we do not show results from * @param string Prefix that represents the template set we use * @set RSS_ ATOM_ * @param string The standard format of date to use for the syndication type represented in the prefix * @param integer The maximum number of entries to return, ordering by date * @return ?array A pair: The main syndication section, and a title (NULL: error) */ function run($_filters, $cutoff, $prefix, $date_string, $max) { if (!has_actual_page_access(get_member(), 'admin_actionlog')) { return NULL; } $filters = ocfilter_to_sqlfragment($_filters, 'the_user', 'f_members', NULL, 'the_user', 'id'); $rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'adminlogs WHERE date_and_time>' . strval($cutoff) . ' AND ' . $filters . ' ORDER BY date_and_time DESC', $max); require_all_lang(); $content = new ocp_tempcode(); foreach ($rows as $row) { $id = strval($row['id']); $author = $GLOBALS['FORUM_DRIVER']->get_username($row['the_user']); if (is_null($author)) { $author = do_lang('UNKNOWN'); } $author .= ' / ' . $row['ip']; $news_date = date($date_string, $row['date_and_time']); $edit_date = escape_html(''); $type = do_lang($row['the_type'], NULL, NULL, NULL, NULL, false); if (is_null($type)) { $type = $row['the_type']; } $news_title = xmlentities($type); $_summary = $row['param_a'] . ($row['param_b'] == '' ? '' : ' / ') . $row['param_b']; $summary = xmlentities($_summary); $news = escape_html(''); $category = $type; $category_raw = $type; $view_url = build_url(array('page' => 'admin_actionlog', 'type' => 'view', 'mode' => 'ocp', 'id' => $row['id']), 'adminzone'); if ($prefix == 'RSS_') { $if_comments = do_template('RSS_ENTRY_COMMENTS', array('COMMENT_URL' => $view_url, 'ID' => strval($row['id']))); } else { $if_comments = new ocp_tempcode(); } $content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date))); } return array($content, do_lang('VIEW_ACTION_LOGS')); }
static function createXMLElement($node) { if (is_a($node, "DOMText")) { return; } // Get attributes into a proper array $items = array(); if ($node->attributes) { foreach ($node->attributes as $key => $value) { $items[$key] = xmlentities($node->getAttribute($key)); } } $value = ""; // Just check to see if there are any child textnodes, and pull them out and set as value if ($node->childNodes) { foreach ($node->childNodes as $childNode) { if (is_a($childNode, "DOMText") && trim($childNode->nodeValue) != '') { $value .= xmlentities($childNode->nodeValue); } } } return new XMLElement($node->nodeName, $value, $items); }
/** * Standard modular run function for RSS hooks. * * @param string A list of categories we accept from * @param TIME Cutoff time, before which we do not show results from * @param string Prefix that represents the template set we use * @set RSS_ ATOM_ * @param string The standard format of date to use for the syndication type represented in the prefix * @param integer The maximum number of entries to return, ordering by date * @return ?array A pair: The main syndication section, and a title (NULL: error) */ function run($_filters, $cutoff, $prefix, $date_string, $max) { unset($_filters); // Not used if (!addon_installed('authors')) { return NULL; } if (!has_actual_page_access(get_member(), 'authors')) { return NULL; } $content = new ocp_tempcode(); $rows = $GLOBALS['SITE_DB']->query('SELECT author,description FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'authors', 1000); if (count($rows) == 1000) { return NULL; } // Too much foreach ($rows as $i => $row) { if ($i == $max) { break; } $id = $row['author']; $author = ''; $news_date = ''; $edit_date = ''; $news_title = xmlentities(escape_html($row['author'])); $_summary = get_translated_tempcode($row['description']); $summary = xmlentities($_summary->evaluate()); $news = ''; $category = ''; $category_raw = ''; $view_url = build_url(array('page' => 'authors', 'type' => 'view', 'id' => $row['author']), get_module_zone('authors'), NULL, false, false, true); $if_comments = new ocp_tempcode(); $content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date))); } require_lang('authors'); return array($content, do_lang('AUTHORS')); }
} else { $thisline = mb_ereg_replace('{archivedflag}', 'Archiviert!, ', $thisline); } } else { $thisline = mb_ereg_replace('{archivedflag}', '', $thisline); } $thisline = mb_ereg_replace('{type}', xmlentities($r['typedesc']), $thisline); $thisline = mb_ereg_replace('{{size}}', xmlentities($r['sizedesc']), $thisline); $difficulty = sprintf('%01.1f', $r['difficulty'] / 2); $thisline = mb_ereg_replace('{difficulty}', $difficulty, $thisline); $terrain = sprintf('%01.1f', $r['terrain'] / 2); $thisline = mb_ereg_replace('{terrain}', $terrain, $thisline); $time = date($kmlTimeFormat, strtotime($r['date_hidden'])); $thisline = mb_ereg_replace('{{time}}', $time, $thisline); $thisline = mb_ereg_replace('{username}', xmlentities($r['username']), $thisline); $thisline = mb_ereg_replace('{cacheid}', xmlentities($r['cacheid']), $thisline); echo $thisline; } mysql_free_result($rs); echo $kmlFoot; exit; function xmlentities($str) { $from[0] = '&'; $to[0] = '&'; $from[1] = '<'; $to[1] = '<'; $from[2] = '>'; $to[2] = '>'; $from[3] = '"'; $to[3] = '"';
<?php $databaseServer = "localhost"; $databaseUsername = "******"; $databasePassword = "******"; $databaseName = "moveon"; $databaseTable = "city_pages"; header("Content-Type: text/xml"); function xmlentities($text) { $search = array('&', '<', '>', '"', '\''); $replace = array('&', '<', '>', '"', '''); return str_replace($search, $replace, $text); } print chr(60) . "?xml version='1.0' encoding='UTF-8'?" . chr(62); print chr(60) . "urlset xmlns='http://www.google.com/schemas/sitemap/0.84' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.google.com/schemas/sitemap/0.84 http://www.google.com/schemas/sitemap/0.84/sitemap.xsd'" . chr(62); $sql = "SELECT * FROM `" . $databaseTable . "`"; $link = mysql_connect($databaseServer, $databaseUsername, $databasePassword); mysql_select_db($databaseName, $link); $result = mysql_unbuffered_query($sql, $link); $urlPath = "http://moveplus.co.uk/"; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $service_slug = $row["service_slug"]; $county_slug = $row["county_slug"]; $city_slug = $row["city_slug"]; print "<url>"; print "<loc>" . $urlPath . xmlentities($service_slug) . "/" . $county_slug . "/" . $city_slug . "</loc>"; print "</url>"; } print "</urlset>";