コード例 #1
0
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     require_lang('galleries');
     require_code('galleries');
     require_css('galleries');
     require_css('side_blocks');
     $parent_id = array_key_exists('param', $map) ? $map['param'] : 'root';
     $zone = array_key_exists('zone', $map) ? $map['zone'] : get_module_zone('galleries');
     $show_empty = array_key_exists('show_empty', $map) ? $map['show_empty'] == '1' : false;
     $depth = array_key_exists('depth', $map) ? intval($map['depth']) : 0;
     // If depth is 1 then we go down 1 level. Only 0 or 1 is supported.
     // For all galleries off the root gallery
     $query = 'SELECT name,fullname FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'galleries WHERE ' . db_string_equal_to('parent_id', $parent_id) . ' AND name NOT LIKE \'' . db_encode_like('download\\_%') . '\' ORDER BY add_date';
     $galleries = $GLOBALS['SITE_DB']->query($query, 300);
     if ($depth == 0) {
         $content = $this->inside($zone, $galleries, 'BLOCK_SIDE_ROOT_GALLERIES_LINE', $show_empty);
     } else {
         $content = new ocp_tempcode();
         foreach ($galleries as $gallery) {
             if ($show_empty || gallery_has_content($gallery['name'])) {
                 $subgalleries = $GLOBALS['SITE_DB']->query_select('galleries', array('name', 'fullname'), array('parent_id' => $gallery['name']), 'ORDER BY add_date', 300);
                 $nest = $this->inside($zone, $subgalleries, 'BLOCK_SIDE_ROOT_GALLERIES_LINE_DEPTH', $show_empty);
                 $caption = get_translated_text($gallery['fullname']);
                 $content->attach(do_template('BLOCK_SIDE_ROOT_GALLERIES_LINE_CONTAINER', array('_GUID' => 'e50b84369b5e2146c4fab4fddc84bf0a', 'ID' => $gallery['name'], 'CAPTION' => $caption, 'CONTENTS' => $nest)));
             }
         }
     }
     $_title = $GLOBALS['SITE_DB']->query_value_null_ok('galleries', 'fullname', array('name' => $parent_id));
     if (!is_null($_title)) {
         $title = get_translated_text($_title);
     } else {
         $title = '';
     }
     return do_template('BLOCK_SIDE_ROOT_GALLERIES', array('_GUID' => 'ed420ce9d1b1dde95eb3fd8473090228', 'TITLE' => $title, 'ID' => $parent_id, 'DEPTH' => $depth != 0, 'CONTENT' => $content));
 }
コード例 #2
0
ファイル: video.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular info function for award hooks. Provides information to allow task reporting, randomisation, and add-screen linking, to function.
  *
  * @return ?array	Map of award content-type info (NULL: disabled).
  */
 function info()
 {
     $info = array();
     $info['connection'] = $GLOBALS['SITE_DB'];
     $info['table'] = 'videos';
     $info['date_field'] = 'add_date';
     $info['id_field'] = 'id';
     $info['add_url'] = has_submit_permission('mid', get_member(), get_ip_address(), 'cms_galleries') ? build_url(array('page' => 'cms_galleries', 'type' => 'av'), get_module_zone('cms_galleries')) : new ocp_tempcode();
     $info['category_field'] = 'cat';
     $info['category_type'] = 'galleries';
     $info['parent_spec__table_name'] = 'galleries';
     $info['parent_spec__parent_name'] = 'parent_id';
     $info['parent_spec__field_name'] = 'name';
     $info['parent_field_name'] = 'cat';
     $info['submitter_field'] = 'submitter';
     $info['id_is_string'] = false;
     require_lang('galleries');
     $info['title'] = do_lang_tempcode('VIDEOS');
     $info['validated_field'] = 'validated';
     $info['category_is_string'] = true;
     $info['archive_url'] = build_url(array('page' => 'galleries'), get_module_zone('galleries'));
     $info['cms_page'] = 'cms_galleries';
     $info['where'] = 'cat NOT LIKE \'' . db_encode_like('download\\_%') . '\'';
     $info['views_field'] = 'video_views';
     $info['supports_custom_fields'] = true;
     return $info;
 }
コード例 #3
0
ファイル: pointstore.php プロジェクト: erico-deh/ocPortal
/**
 * Get a tempcode list of the available mail domains.
 *
 * @param  ID_TEXT		The type of mail domain
 * @set    pop3 forw
 * @param  integer		Description
 * @return tempcode		The tempcode list of available domains
 */
function get_mail_domains($type, $points_left)
{
    $rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . get_table_prefix() . 'prices WHERE name LIKE \'' . db_encode_like($type . '%') . '\'');
    $list = new ocp_tempcode();
    foreach ($rows as $row) {
        $address = substr($row['name'], strlen($type));
        //If we can't afford the mail, turn the text red
        $red = $points_left < $row['price'];
        $list->attach(form_input_list_entry($address, false, '@' . $address . ' ' . do_lang('PRICE_GIVE', integer_format($row['price'])), $red));
    }
    return $list;
}
コード例 #4
0
ファイル: pop3.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard pointstore item configuration function.
  *
  * @return ?array		A tuple: list of [fields to shown, hidden fields], title for add form, add form (NULL: disabled)
  */
 function config()
 {
     $rows = $GLOBALS['SITE_DB']->query('SELECT price,name FROM ' . get_table_prefix() . 'prices WHERE name LIKE \'' . db_encode_like('pop3_%') . '\'');
     $out = array();
     foreach ($rows as $i => $row) {
         $fields = new ocp_tempcode();
         $hidden = new ocp_tempcode();
         $domain = substr($row['name'], strlen('pop3_'));
         $hidden->attach(form_input_hidden('dpop3_' . strval($i), $domain));
         $fields->attach(form_input_line(do_lang_tempcode('MAIL_DOMAIN'), do_lang_tempcode('DESCRIPTION_MAIL_DOMAIN'), 'ndpop3_' . strval($i), substr($row['name'], 5), true));
         $fields->attach(form_input_integer(do_lang_tempcode('MAIL_COST'), do_lang_tempcode('DESCRIPTION_MAIL_COST', escape_html('pop3'), escape_html($domain)), 'pop3_' . strval($i), $row['price'], true));
         $fields->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('TITLE' => do_lang_tempcode('ACTIONS'))));
         $fields->attach(form_input_tick(do_lang_tempcode('DELETE'), do_lang_tempcode('DESCRIPTION_DELETE'), 'delete_pop3_' . strval($i), false));
         $out[] = array($fields, $hidden, do_lang_tempcode('EDIT_POP3_DOMAIN'));
     }
     return array($out, do_lang_tempcode('ADD_NEW_POP3_DOMAIN'), $this->get_fields());
 }
コード例 #5
0
ファイル: galleries.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular run function for newsletter hooks.
  *
  * @param  TIME				The time that the entries found must be newer than
  * @param  LANGUAGE_NAME	The language the entries found must be in
  * @param  string				Category filter to apply
  * @return array				Tuple of result details
  */
 function run($cutoff_time, $lang, $filter)
 {
     if (!addon_installed('galleries')) {
         return array();
     }
     require_lang('galleries');
     $new = new ocp_tempcode();
     $count = $GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT COUNT(*) FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'galleries WHERE name NOT LIKE \'' . db_encode_like('download\\_%') . '\'');
     if ($count < 500) {
         $_galleries = $GLOBALS['SITE_DB']->query('SELECT name,fullname FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'galleries WHERE name NOT LIKE \'' . db_encode_like('download\\_%') . '\'', 300);
         if (count($_galleries) == 300) {
             return array();
         }
         foreach ($_galleries as $i => $_gallery) {
             $_galleries[$i]['text_original'] = get_translated_text($_gallery['fullname']);
         }
         $galleries = collapse_2d_complexity('name', 'text_original', $_galleries);
     } else {
         $galleries = array();
     }
     require_code('ocfiltering');
     $or_list = ocfilter_to_sqlfragment($filter, 'cat', NULL, NULL, NULL, NULL, false);
     $rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'videos WHERE add_date>' . strval((int) $cutoff_time) . ' AND validated=1 AND (' . $or_list . ') ORDER BY add_date DESC', 300);
     if (count($rows) == 300) {
         return array();
     }
     foreach ($rows as $row) {
         $_url = build_url(array('page' => 'galleries', 'type' => 'video', 'id' => $row['id']), get_module_zone('galleries'), NULL, false, false, true);
         $url = $_url->evaluate();
         if (!array_key_exists($row['cat'], $galleries)) {
             $galleries[$row['cat']] = get_translated_text($GLOBALS['SITE_DB']->query_value('galleries', 'fullname', array('name' => $row['cat'])));
         }
         $name = $galleries[$row['cat']];
         $_name = get_translated_text($row['title']);
         if ($_name != '') {
             $name = $_name;
         }
         $description = get_translated_text($row['comments'], NULL, $lang);
         $member_id = is_guest($row['submitter']) ? NULL : strval($row['submitter']);
         $new->attach(do_template('NEWSLETTER_NEW_RESOURCE_FCOMCODE', array('_GUID' => 'dfe5850aa67c0cd00ff7d465248b87a5', 'MEMBER_ID' => $member_id, 'URL' => $url, 'NAME' => $name, 'DESCRIPTION' => $description)));
     }
     return array($new, do_lang('GALLERIES', '', '', '', $lang));
 }
コード例 #6
0
ファイル: comment.php プロジェクト: erico-deh/ocPortal
 function setUp()
 {
     parent::setUp();
     require_code('calendar2');
     require_code('feedback');
     require_code('ocf_posts_action');
     require_code('ocf_forum_driver_helper');
     require_lang('lang');
     $this->event_id = add_calendar_event(8, '1', NULL, 0, 'test_event', '', 3, 1, 2010, 1, 10, 10, 15, 2010, NULL, 1, 1, 19, NULL, 1, 1, 1, 1, 1, '', NULL, 0, NULL, NULL, NULL);
     if ('test_event' == get_translated_text($GLOBALS['SITE_DB']->query_value('calendar_events', 'e_title ', array('id' => $this->event_id)))) {
         $lang_id = insert_lang_comcode('test_comment_desc_1', 4, $GLOBALS['FORUM_DB']);
         $map = array('p_title' => 'test_comment1', 'p_post' => $lang_id, 'p_ip_address' => '127.0.0.1', 'p_time' => time(), 'p_poster' => 0, 'p_poster_name_if_guest' => '', 'p_validated' => 1, 'p_topic_id' => 4, 'p_is_emphasised' => 0, 'p_cache_forum_id' => 4, 'p_last_edit_time' => NULL, 'p_last_edit_by' => NULL, 'p_intended_solely_for' => NULL, 'p_skip_sig' => 0, 'p_parent_id' => NULL);
         $this->post_id = $GLOBALS['FORUM_DB']->query_insert('f_posts', $map, true);
     }
     $rows = $GLOBALS['FORUM_DB']->query('SELECT p_title FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'f_posts p LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'translate t ON t.id=p.p_post WHERE t.text_original NOT LIKE \'%' . db_encode_like(do_lang('SPACER_POST_MATCHER', '', '', '', get_site_default_lang()) . '%') . '\' AND ( p.id = ' . strval($this->post_id) . ') ORDER BY p.id');
     $title = $rows[0]['p_title'];
     // Test the forum was actually created
     $this->assertTrue('test_comment1' == $title);
 }
コード例 #7
0
ファイル: image_thumbs.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular run function.
  *
  * @return tempcode	Results
  */
 function run()
 {
     $thumb_fields = $GLOBALS['SITE_DB']->query('SELECT m_name,m_table FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'db_meta WHERE m_name LIKE \'' . db_encode_like('%thumb_url') . '\'');
     foreach ($thumb_fields as $field) {
         if ($field['m_table'] == 'videos') {
             continue;
         }
         $GLOBALS['SITE_DB']->query_update($field['m_table'], array($field['m_name'] => ''));
     }
     $full = get_custom_file_base() . '/uploads/auto_thumbs';
     $dh = opendir($full);
     if ($dh !== false) {
         while (($file = readdir($dh)) !== false) {
             @unlink($full . '/' . $file);
         }
         closedir($dh);
     }
     require_code('view_modes');
     erase_comcode_cache();
     return new ocp_tempcode();
 }
コード例 #8
0
 /**
  * Standard modular run function for symbol hooks. Searches for tasks to perform.
  *
  * @param  array		Symbol parameters
  * @return string		Result
  */
 function run($param)
 {
     $value = '';
     if (array_key_exists(0, $param)) {
         $limit = array_key_exists(1, $param) ? intval($param[1]) : NULL;
         $resolve = array_key_exists(2, $param) ? $param[2] : '';
         // Content-type to associate back to, and fetch the ID for
         $rating_type = array_key_exists(3, $param) ? $param[3] : '';
         // If non empty, it will get the highest rated first
         $done = 0;
         $table = 'catalogue_fields f JOIN ' . get_table_prefix() . 'catalogue_efv_short s ON f.id=s.cf_id AND ' . db_string_equal_to('cf_type', 'reference') . ' OR cf_type LIKE \'' . db_encode_like('ck_%') . '\'';
         $select = array('ce_id');
         $order_by = '';
         if ($resolve != '') {
             $table .= ' JOIN ' . get_table_prefix() . 'catalogue_entry_linkage ON ' . db_string_equal_to('content_type', $param[2]) . ' AND catalogue_entry_id=ce_id';
             $select[] = 'content_id';
             if ($rating_type != '') {
                 $select[] = '(SELECT AVG(rating) FROM ' . get_table_prefix() . 'rating WHERE ' . db_string_equal_to('rating_for_type', $rating_type) . ' AND rating_for_id=content_id) AS compound_rating';
                 $order_by = 'ORDER BY compound_rating DESC';
             }
         }
         $results = $GLOBALS['SITE_DB']->query_select($table, $select, array('cv_value' => $param[0]), $order_by);
         foreach ($results as $result) {
             if ($value != '') {
                 $value .= ',';
             }
             if ($resolve != '') {
                 $value .= $result['content_id'];
             } else {
                 $value .= strval($result['ce_id']);
             }
             $done++;
             if (!is_null($limit) && $done == $limit) {
                 break;
             }
         }
     }
     return $value;
 }
コード例 #9
0
ファイル: galleries.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular render function for profile tab hooks.
  *
  * @param  MEMBER			The ID of the member who is being viewed
  * @param  MEMBER			The ID of the member who is doing the viewing
  * @param  boolean		Whether to leave the tab contents NULL, if tis hook supports it, so that AJAX can load it later
  * @return array			A triple: The tab title, the tab contents, the suggested tab order
  */
 function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false)
 {
     require_lang('galleries');
     $title = do_lang_tempcode('GALLERIES');
     $order = 30;
     if ($leave_to_ajax_if_possible) {
         return array($title, NULL, $order);
     }
     $galleries = new ocp_tempcode();
     require_code('galleries');
     require_css('galleries');
     $rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . get_table_prefix() . 'galleries WHERE name LIKE \'' . db_encode_like('member\\_' . strval($member_id_of) . '\\_%') . '\'');
     foreach ($rows as $i => $row) {
         $galleries->attach(do_template('GALLERY_SUBGALLERY_WRAP', array('CONTENT' => show_gallery_box($row, 'root', false, get_module_zone('galleries')))));
         $this->attach_gallery_subgalleries($row['name'], $galleries);
     }
     $add_gallery_url = new ocp_tempcode();
     $add_image_url = new ocp_tempcode();
     $add_video_url = new ocp_tempcode();
     if ($member_id_of == $member_id_viewing) {
         if (count($rows) == 0) {
             $test = $GLOBALS['SITE_DB']->query_select('galleries', array('accept_images', 'accept_videos', 'name'), array('is_member_synched' => 1));
             if (array_key_exists(0, $test)) {
                 if ($test[0]['accept_images'] == 1) {
                     $add_image_url = build_url(array('page' => 'cms_galleries', 'type' => 'ad', 'cat' => 'member_' . strval($member_id_of) . '_' . $test[0]['name']), get_module_zone('cms_galleries'));
                 }
                 if ($test[0]['accept_videos'] == 1) {
                     $add_video_url = build_url(array('page' => 'cms_galleries', 'type' => 'av', 'cat' => 'member_' . strval($member_id_of) . '_' . $test[0]['name']), get_module_zone('cms_galleries'));
                 }
             }
         } else {
             if (has_actual_page_access(NULL, 'cms_galleries', NULL, NULL) && has_submit_permission('cat_mid', get_member(), get_ip_address(), 'cms_galleries')) {
                 $add_gallery_url = build_url(array('page' => 'cms_galleries', 'type' => 'ac', 'cat' => $rows[0]['name']), get_module_zone('cms_galleries'));
             }
         }
     }
     $content = do_template('OCF_MEMBER_PROFILE_GALLERIES', array('MEMBER_ID' => strval($member_id_of), 'GALLERIES' => $galleries, 'ADD_GALLERY_URL' => $add_gallery_url, 'ADD_IMAGE_URL' => $add_image_url, 'ADD_VIDEO_URL' => $add_video_url));
     return array($title, $content, $order);
 }
コード例 #10
0
ファイル: relations.php プロジェクト: erico-deh/ocPortal
 function testRelationsdefined()
 {
     require_code('relations');
     if (in_safe_mode()) {
         $this->assertTrue(false, 'Cannot work in safe mode');
         return;
     }
     /* Actually only done for complex ones
     		$all_tables=$GLOBALS['SITE_DB']->query('SELECT DISTINCT m_table FROM '.get_table_prefix().'db_meta WHERE m_type LIKE \''.db_encode_like('%AUTO_LINK%').'\' ORDER BY m_table');
     		$table_descriptions=get_table_descriptions();
     
     		foreach ($all_tables as $t)
     		{
     			$this->assertFalse(!array_key_exists($t['m_table'],$table_descriptions),'Table not described: '.$t['m_table']);
     		}*/
     $all_links = $GLOBALS['SITE_DB']->query('SELECT m_table,m_name FROM ' . get_table_prefix() . 'db_meta WHERE m_type LIKE \'' . db_encode_like('%AUTO_LINK%') . '\' ORDER BY m_table');
     $links = get_relation_map();
     foreach ($all_links as $l) {
         $_l = $l['m_table'] . '.' . $l['m_name'];
         $this->assertFalse(!array_key_exists($_l, $links), 'Link not described: ' . $_l);
     }
 }
コード例 #11
0
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     require_code('galleries');
     require_lang('galleries');
     $number = array_key_exists('param', $map) ? intval($map['param']) : 10;
     $zone = array_key_exists('zone', $map) ? $map['zone'] : get_module_zone('galleries');
     $out = new ocp_tempcode();
     $rows1 = $GLOBALS['SITE_DB']->query('SELECT DISTINCT g.name,g.add_date FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'galleries g JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'images i ON g.name=i.cat WHERE i.add_date IS NOT NULL AND name NOT LIKE \'' . db_encode_like('download\\_%') . '\' ORDER BY g.add_date DESC', $number);
     $rows2 = $GLOBALS['SITE_DB']->query('SELECT DISTINCT g.name,g.add_date FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'galleries g JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'videos i ON g.name=i.cat WHERE i.add_date IS NOT NULL AND name NOT LIKE \'' . db_encode_like('download\\_%') . '\' ORDER BY g.add_date DESC', $number);
     $galleries = array_unique(collapse_2d_complexity('name', 'add_date', array_merge($rows1, $rows2)));
     arsort($galleries);
     if (count($galleries) == 0) {
         return do_template('BLOCK_NO_ENTRIES', array('_GUID' => 'e6d16782037d35949646f95656382783', 'HIGH' => false, 'TITLE' => do_lang_tempcode('RECENT', make_string_tempcode(integer_format($number)), do_lang_tempcode('GALLERIES')), 'MESSAGE' => do_lang_tempcode('NO_CATEGORIES'), 'ADD_NAME' => '', 'SUBMIT_URL' => ''));
     } else {
         foreach (array_keys($galleries) as $i => $gallery) {
             if ($i == $number) {
                 break;
             }
             $row = $GLOBALS['SITE_DB']->query_select('galleries', array('*'), array('name' => $gallery), '', 1);
             $out->attach(do_template('GALLERY_SUBGALLERY_WRAP', array('CONTENT' => show_gallery_box($row[0], 'root', true, $zone, false, true))));
         }
     }
     return do_template('BLOCK_MAIN_RECENT_GALLERIES', array('_GUID' => 'a7fca7d625a3d3af362735dad670f6eb', 'CONTENT' => $out, 'NUMBER' => integer_format($number)));
 }
コード例 #12
0
ファイル: vb.php プロジェクト: erico-deh/ocPortal
 /**
  * Get custom profile fields values for all 'ocp_' prefixed keys.
  *
  * @param  MEMBER			The member id
  * @return ?array			A map of the custom profile fields, key_suffix=>value (NULL: no fields)
  */
 function get_custom_fields($member)
 {
     if (!isset($GLOBALS['SITE_INFO']['vb_version']) || $GLOBALS['SITE_INFO']['vb_version'] >= 3.6) {
         $rows = $this->connection->query('SELECT f.profilefieldid,p.text AS title FROM ' . $this->connection->get_table_prefix() . 'profilefield f LEFT JOIN ' . $this->connection->get_table_prefix() . 'phrase p ON (' . db_string_equal_to('product', 'vbulletin') . ' AND p.varname=CONCAT(\'field\',f.profilefieldid,\'_title\')) WHERE p.text LIKE \'' . db_encode_like('ocp_%') . '\'');
     } else {
         $rows = $this->connection->query('SELECT profilefieldid,title FROM ' . $this->connection->get_table_prefix() . 'profilefield WHERE title LIKE \'' . db_encode_like('ocp_%') . '\'');
     }
     $values = $this->connection->query_select('userfield', array('*'), array('userid' => $member), '', 1);
     if (!array_key_exists(0, $values)) {
         return NULL;
     }
     $out = array();
     foreach ($rows as $row) {
         $title = substr($row['title'], 4);
         $out[$title] = $values[0]['field' . strval($row['profilefieldid'])];
     }
     return $out;
 }
コード例 #13
0
ファイル: aef.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_ocf_member_files($db, $table_prefix, $file_base)
 {
     global $STRICT_FILE;
     $options = $db->query('SELECT * FROM ' . $table_prefix . 'registry WHERE name LIKE \'' . db_encode_like('%avatar%') . '\'');
     $options_array = array();
     $avatar_path = '';
     $avatar_gallery_path = '';
     foreach ($options as $option) {
         $options_array[$option['name']] = $option['regval'];
         if ($option['name'] == 'uploadavatardir') {
             $avatar_path = $option['regval'];
         }
         if ($option['name'] == 'avatardir') {
             $avatar_gallery_path = $option['regval'];
         }
     }
     $row_start = 0;
     $rows = array();
     do {
         $query = 'SELECT id,avatar,avatar_type,avatar_width,avatar_height FROM ' . $table_prefix . 'users WHERE id<>-1 ORDER BY id';
         $rows = $db->query($query, 200, $row_start);
         foreach ($rows as $row) {
             if (import_check_if_imported('member_files', strval($row['id']))) {
                 continue;
             }
             $member_id = import_id_remap_get('member', strval($row['id']));
             $avatar_url = '';
             switch ($row['avatar_type']) {
                 case '0':
                     break;
                 case '1':
                     // Gallery
                     $filename = $row['avatar'];
                     if (file_exists(get_custom_file_base() . '/uploads/ocf_avatars/' . $filename) || @rename($avatar_gallery_path . '/' . $filename, get_custom_file_base() . '/uploads/ocf_avatars/' . $filename)) {
                         $avatar_url = 'uploads/ocf_avatars/' . substr($filename, strrpos($filename, '/'));
                         sync_file($avatar_url);
                     } else {
                         // Try as a pack avatar then
                         $striped_filename = str_replace('/', '_', $filename);
                         if (file_exists(get_custom_file_base() . '/uploads/ocf_avatars/' . $striped_filename)) {
                             $avatar_url = 'uploads/ocf_avatars/' . substr($filename, strrpos($filename, '/'));
                         } else {
                             if ($STRICT_FILE) {
                                 warn_exit(do_lang_tempcode('MISSING_AVATAR', escape_html($filename)));
                             }
                             $avatar_url = '';
                         }
                     }
                     break;
                 case '2':
                     // Remote
                     $avatar_url = $row['avatar'];
                     break;
                 case '3':
                     // Upload
                     $filename = $row['avatar'];
                     if (file_exists(get_custom_file_base() . '/uploads/ocf_avatars/' . $filename) || @rename($avatar_path . '/' . $filename, get_custom_file_base() . '/uploads/ocf_avatars/' . $filename)) {
                         $avatar_url = 'uploads/ocf_avatars/' . $filename;
                         sync_file($avatar_url);
                     } else {
                         if ($STRICT_FILE) {
                             warn_exit(do_lang_tempcode('MISSING_AVATAR', escape_html($filename)));
                         }
                         $avatar_url = '';
                     }
                     break;
             }
             $GLOBALS['FORUM_DB']->query_update('f_members', array('m_avatar_url' => $avatar_url), array('id' => $member_id), '', 1);
             import_id_remap_put('member_files', strval($row['id']), 1);
         }
         $row_start += 200;
     } while (count($rows) > 0);
 }
コード例 #14
0
ファイル: themes2.php プロジェクト: erico-deh/ocPortal
/**
 * Get all the image IDs (both already known, and those uncached) of a certain type (i.e. under a subdirectory).
 *
 * @param  ID_TEXT		The type of image (e.g. 'ocf_emoticons')
 * @param  boolean		Whether to search recursively; i.e. in subdirectories of the type subdirectory
 * @param  ?object		The database connection to work over (NULL: site db)
 * @param  ?ID_TEXT		The theme to search in, in addition to the default theme (NULL: current theme)
 * @param  boolean		Whether to only return directories (advanced option, rarely used)
 * @param  boolean		Whether to only return from the database (advanced option, rarely used)
 * @return array			The list of image IDs
 */
function get_all_image_ids_type($type, $recurse = false, $db = NULL, $theme = NULL, $dirs_only = false, $db_only = false)
{
    if (is_null($db)) {
        $db = $GLOBALS['SITE_DB'];
    }
    if (is_null($theme)) {
        $theme = $GLOBALS['FORUM_DRIVER']->get_theme();
    }
    if (substr($type, 0, 4) == 'ocf_' && file_exists(get_file_base() . '/themes/default/images/avatars/index.html')) {
        $type = substr($type, 4);
    }
    if (substr($type, -1) == '/') {
        $type = substr($type, 0, strlen($type) - 1);
    }
    $ids = array();
    if (!$db_only && ($db->connection_write == $GLOBALS['SITE_DB']->connection_write || $dirs_only || get_db_forums() == get_db_site())) {
        _get_all_image_ids_type($ids, get_file_base() . '/themes/default/images/' . ($type == '' ? '' : $type . '/'), $type, $recurse, $dirs_only);
        _get_all_image_ids_type($ids, get_file_base() . '/themes/default/images/' . get_site_default_lang() . '/' . ($type == '' ? '' : $type . '/'), $type, $recurse, $dirs_only);
        if ($theme != 'default') {
            _get_all_image_ids_type($ids, get_custom_file_base() . '/themes/' . $theme . '/images/' . ($type == '' ? '' : $type . '/'), $type, $recurse, $dirs_only);
            _get_all_image_ids_type($ids, get_custom_file_base() . '/themes/' . $theme . '/images/' . get_site_default_lang() . '/' . ($type == '' ? '' : $type . '/'), $type, $recurse, $dirs_only);
        }
        _get_all_image_ids_type($ids, get_file_base() . '/themes/default/images_custom/' . ($type == '' ? '' : $type . '/'), $type, $recurse, $dirs_only);
        _get_all_image_ids_type($ids, get_file_base() . '/themes/default/images_custom/' . get_site_default_lang() . '/' . ($type == '' ? '' : $type . '/'), $type, $recurse, $dirs_only);
        if ($theme != 'default') {
            _get_all_image_ids_type($ids, get_custom_file_base() . '/themes/' . $theme . '/images_custom/' . ($type == '' ? '' : $type . '/'), $type, $recurse, $dirs_only);
            _get_all_image_ids_type($ids, get_custom_file_base() . '/themes/' . $theme . '/images_custom/' . get_site_default_lang() . '/' . ($type == '' ? '' : $type . '/'), $type, $recurse, $dirs_only);
        }
    }
    if (!$dirs_only) {
        $query = 'SELECT DISTINCT id,path FROM ' . $db->get_table_prefix() . 'theme_images WHERE ';
        if (!$db_only) {
            $query .= 'path NOT LIKE \'' . db_encode_like('themes/default/images/%') . '\' AND ' . db_string_not_equal_to('path', 'themes/default/images/blank.gif') . ' AND ';
        }
        $query .= '(' . db_string_equal_to('theme', $theme) . ' OR ' . db_string_equal_to('theme', 'default') . ') AND id LIKE \'' . db_encode_like($type . '%') . '\' ORDER BY path';
        $rows = $db->query($query);
        foreach ($rows as $row) {
            if ($row['path'] == '') {
                continue;
            }
            if (url_is_local($row['path']) && !file_exists((substr($row['path'], 0, 15) == 'themes/default/' ? get_file_base() : get_custom_file_base()) . '/' . rawurldecode($row['path']))) {
                continue;
            }
            if ($row['path'] != 'themes/default/images/blank.gif') {
                $ids[] = $row['id'];
            } else {
                $key = array_search($row['id'], $ids);
                if (is_integer($key)) {
                    unset($ids[$key]);
                }
            }
        }
    }
    sort($ids);
    return array_unique($ids);
}
コード例 #15
0
ファイル: admin_config.php プロジェクト: erico-deh/ocPortal
 /**
  * The actualiser to edit a configuration page.
  *
  * @return tempcode		The UI
  */
 function config_set()
 {
     $page = get_param('id', 'MAIN');
     $title = get_page_title(do_lang_tempcode('CONFIG_CATEGORY_' . $page), false);
     // Make sure we haven't locked ourselves out due to clean URL support
     if (post_param_integer('mod_rewrite', 0) == 1 && substr(ocp_srv('SERVER_SOFTWARE'), 0, 6) == 'Apache' && (!file_exists(get_file_base() . '/.htaccess') || strpos(file_get_contents(get_file_base() . '/.htaccess'), 'RewriteEngine on') === false)) {
         warn_exit(do_lang_tempcode('BEFORE_MOD_REWRITE'));
     }
     // Make sure we haven't just locked staff out
     $new_site_name = substr(post_param('site_name', ''), 0, 200);
     if ($new_site_name != '' && get_option('is_on_sync_staff', true) === '1') {
         $admin_groups = array_merge($GLOBALS['FORUM_DRIVER']->get_super_admin_groups(), $GLOBALS['FORUM_DRIVER']->get_moderator_groups());
         $staff = $GLOBALS['FORUM_DRIVER']->member_group_query($admin_groups, 100);
         if (count($staff) < 100) {
             foreach ($staff as $row_staff) {
                 $member = $GLOBALS['FORUM_DRIVER']->pname_id($row_staff);
                 if ($GLOBALS['FORUM_DRIVER']->is_staff($member)) {
                     $sites = get_ocp_cpf('sites');
                     $sites = str_replace(', ' . get_site_name(), '', $sites);
                     $sites = str_replace(',' . get_site_name(), '', $sites);
                     $sites = str_replace(get_site_name() . ', ', '', $sites);
                     $sites = str_replace(get_site_name() . ',', '', $sites);
                     $sites = str_replace(get_site_name(), '', $sites);
                     if ($sites != '') {
                         $sites .= ', ';
                     }
                     $sites .= $new_site_name;
                     $GLOBALS['FORUM_DRIVER']->set_custom_field($member, 'sites', $sites);
                 }
             }
         }
     }
     // Empty thumbnail cache if needed
     if (get_option('is_on_gd') == '1' && function_exists('imagetypes')) {
         if (!is_null(post_param('thumb_width', NULL)) && post_param('thumb_width') != get_option('thumb_width')) {
             $thumb_fields = $GLOBALS['SITE_DB']->query('SELECT m_name,m_table FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'db_meta WHERE m_name LIKE \'' . db_encode_like('%thumb_url') . '\'');
             $GLOBALS['NO_DB_SCOPE_CHECK'] = true;
             foreach ($thumb_fields as $field) {
                 if ($field['m_table'] == 'videos') {
                     continue;
                 }
                 $GLOBALS['SITE_DB']->query_update($field['m_table'], array($field['m_name'] => ''));
             }
             $GLOBALS['NO_DB_SCOPE_CHECK'] = false;
         }
     }
     $rows = $GLOBALS['SITE_DB']->query_select('config', array('*'), array('the_page' => $page));
     if ($page == 'SITE') {
         $rows[] = array('the_name' => 'timezone', 'shared_hosting_restricted' => 0, 'the_type' => 'special', 'eval' => '');
     }
     foreach ($rows as $myrow) {
         if ($myrow['eval'] != '') {
             if (defined('HIPHOP_PHP')) {
                 require_code('hooks/systems/config_default/' . $myrow['the_name']);
                 $hook = object_factory('Hook_config_default_' . $myrow['the_name']);
                 if (is_null($hook->get_default())) {
                     continue;
                 }
             } else {
                 $GLOBALS['REQUIRE_LANG_LOOP'] = 10;
                 // LEGACY Workaround for corrupt webhost installers
                 if (is_null(@eval($myrow['eval'] . ';'))) {
                     continue;
                 }
                 // @'d in case default is corrupt, don't want it to give errors forever
                 $GLOBALS['REQUIRE_LANG_LOOP'] = 0;
                 // LEGACY
             }
         }
         if ($myrow['shared_hosting_restricted'] == 1 && !is_null($GLOBALS['CURRENT_SHARE_USER'])) {
             continue;
         }
         if ($myrow['the_type'] == 'tick') {
             $value = strval(post_param_integer($myrow['the_name'], 0));
         } elseif ($myrow['the_type'] == 'date') {
             $date_value = get_input_date($myrow['the_name']);
             $value = is_null($date_value) ? '' : strval($date_value);
         } elseif (($myrow['the_type'] == 'forum' || $myrow['the_type'] == '?forum') && get_forum_type() == 'ocf') {
             $value = post_param($myrow['the_name']);
             if (is_numeric($value)) {
                 $value = $GLOBALS['FORUM_DB']->query_value_null_ok('f_forums', 'f_name', array('id' => post_param_integer($myrow['the_name'])));
             }
             if (is_null($value)) {
                 $value = '';
             }
         } elseif ($myrow['the_type'] == 'category' && get_forum_type() == 'ocf') {
             $value = post_param($myrow['the_name']);
             if (is_numeric($value)) {
                 $value = $GLOBALS['FORUM_DB']->query_value_null_ok('f_categories', 'c_title', array('id' => post_param_integer($myrow['the_name'])));
             }
             if (is_null($value)) {
                 $value = '';
             }
         } elseif ($myrow['the_type'] == 'usergroup' && get_forum_type() == 'ocf') {
             $value = $GLOBALS['FORUM_DB']->query_value_null_ok('f_groups g LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON t.id=g.g_name', 'text_original', array('g.id' => post_param_integer($myrow['the_name'])));
             if (is_null($value)) {
                 $value = '';
             }
         } else {
             $value = post_param($myrow['the_name'], '');
         }
         if ($myrow['the_type'] == 'special') {
             if ($myrow['the_name'] == 'timezone') {
                 set_value('timezone', $value);
             }
         } else {
             if (($myrow['the_type'] == 'transline' || $myrow['the_type'] == 'transtext') && is_numeric($myrow['config_value'])) {
                 $old_value = get_translated_text(intval($myrow['config_value']));
             } else {
                 $old_value = $myrow['config_value'];
             }
             // If the option was changed
             if ($old_value != $value || $myrow['c_set'] == 0) {
                 set_option($myrow['the_name'], $value, $myrow['the_type'], $myrow['config_value']);
             }
         }
     }
     // Clear some cacheing
     require_code('view_modes');
     require_code('zones2');
     require_code('zones3');
     erase_comcode_page_cache();
     erase_tempcode_cache();
     //persistant_cache_delete('OPTIONS');  Done by set_option
     persistant_cache_empty();
     erase_cached_templates();
     // Show it worked / Refresh
     $redirect = get_param('redirect', NULL);
     if ($redirect === NULL) {
         $url = build_url(array('page' => '_SELF', 'type' => 'misc'), '_SELF');
         // ,'type'=>'category','id'=>$page
     } else {
         $url = make_string_tempcode($redirect);
     }
     return redirect_screen($title, $url, do_lang_tempcode('SUCCESS'));
 }
コード例 #16
0
 /**
  * The actualiser to set page access.
  *
  * @return tempcode		The UI
  */
 function set_page_access()
 {
     $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/permissionstree';
     $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_permissions';
     $title = get_page_title('PAGE_ACCESS');
     // Delete to cleanup
     $zone = post_param('zone');
     $GLOBALS['SITE_DB']->query('DELETE FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'group_page_access WHERE page_name NOT LIKE \'' . db_encode_like('%:%') . '\' AND ' . db_string_equal_to('zone_name', $zone));
     $groups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(false, true);
     //	$zones=find_all_zones();
     $admin_groups = $GLOBALS['FORUM_DRIVER']->get_super_admin_groups();
     $zones = array($zone);
     foreach ($zones as $zone) {
         $pages = find_all_pages_wrap($zone);
         foreach (array_keys($pages) as $page) {
             foreach (array_keys($groups) as $id) {
                 if (in_array($id, $admin_groups)) {
                     continue;
                 }
                 $val = post_param_integer('p_' . $zone . '__' . $page . '__' . strval($id), 0);
                 if ($val == 0) {
                     $GLOBALS['SITE_DB']->query_insert('group_page_access', array('zone_name' => $zone, 'page_name' => $page, 'group_id' => $id));
                 }
             }
         }
     }
     breadcrumb_set_parents(array(array('_SELF:_SELF:page', do_lang_tempcode('CHOOSE')), array('_SELF:_SELF:page:zone=' . $zone, do_lang_tempcode('PAGE_ACCESS'))));
     breadcrumb_set_self(do_lang_tempcode('DONE'));
     decache('main_sitemap');
     $GLOBALS['SITE_DB']->query_delete('cache');
     if (function_exists('persistant_cache_empty')) {
         persistant_cache_empty();
     }
     // Show it worked / Refresh
     $url = build_url(array('page' => '_SELF', 'type' => 'page'), '_SELF');
     return redirect_screen($title, $url, do_lang_tempcode('SUCCESS'));
 }
コード例 #17
0
ファイル: ipb3.php プロジェクト: erico-deh/ocPortal
 /**
  * Get an array of topics in the given forum. Each topic is an array with the following attributes:
  * - id, the topic ID
  * - title, the topic title
  * - lastusername, the username of the last poster
  * - lasttime, the timestamp of the last reply
  * - closed, a Boolean for whether the topic is currently closed or not
  * - firsttitle, the title of the first post
  * - firstpost, the first post (only set if $show_first_posts was true)
  *
  * @param  mixed			The forum name or an array of forum IDs
  * @param  integer		The limit
  * @param  integer		The start position
  * @param  integer		The total rows (not a parameter: returns by reference)
  * @param  SHORT_TEXT	The topic title filter
  * @param  boolean		Whether to show the first posts
  * @param  string			The date key to sort by
  * @set    lasttime firsttime
  * @param  boolean		Whether to limit to hot topics
  * @param  SHORT_TEXT	The topic description filter
  * @return ?array			The array of topics (NULL: error)
  */
 function show_forum_topics($name, $limit, $start, &$max_rows, $filter_topic_title = '', $show_first_posts = false, $date_key = 'lasttime', $hot = false, $filter_topic_description = '')
 {
     require_code('xhtml');
     if (is_integer($name)) {
         $id_list = 'forum_id=' . strval((int) $name);
     } elseif (!is_array($name)) {
         if ($name == '<announce>' || is_null($name)) {
             $id_list = '(forum_id IS NULL)';
         } else {
             $id = $this->forum_id_from_name($name);
             if (is_null($id)) {
                 return NULL;
             }
             $id_list = 'forum_id=' . strval((int) $id);
         }
     } else {
         $id_list = '';
         $id_list_2 = '';
         foreach (array_keys($name) as $id) {
             if ($id_list != '') {
                 $id_list .= ' OR ';
             }
             if (is_null($id) || $id == '') {
                 $id_list .= '(forum_id IS NULL)';
             } else {
                 $id_list .= 'forum_id=' . strval((int) $id);
             }
         }
         if ($id_list == '') {
             return NULL;
         }
     }
     $topic_filter = $filter_topic_title != '' ? 'AND title LIKE \'' . db_encode_like($this->ipb_escape($filter_topic_title)) . '\'' : '';
     if ($filter_topic_description != '') {
         $topic_filter .= ' AND description LIKE \'' . db_encode_like($this->ipb_escape($filter_topic_description)) . '\'';
     }
     $rows = $this->connection->query('SELECT * FROM ' . $this->connection->get_table_prefix() . 'topics WHERE (' . $id_list . ') ' . $topic_filter . ' ORDER BY ' . ($date_key == 'lasttime' ? 'last_post' : 'start_date') . ' DESC', $limit, $start);
     $max_rows = $this->connection->query_value_null_ok_full('SELECT COUNT(*) FROM ' . $this->connection->get_table_prefix() . 'topics WHERE (' . $id_list . ') ' . $topic_filter);
     $emoticons_set_dir = $this->get_emo_dir();
     $out = array();
     foreach ($rows as $i => $r) {
         $out[$i] = array();
         $out[$i]['id'] = $r['tid'];
         $out[$i]['num'] = $r['posts'];
         $out[$i]['title'] = $this->ipb_unescape($r['title']);
         $out[$i]['firstusername'] = $this->ipb_unescape($r['starter_name']);
         $out[$i]['lastusername'] = $this->ipb_unescape($r['last_poster_name']);
         $out[$i]['firstmemberid'] = $r['starter_id'];
         $out[$i]['lastmemberid'] = $r['last_poster_id'];
         $out[$i]['firsttime'] = $r['start_date'];
         $out[$i]['lasttime'] = $r['last_post'];
         $out[$i]['closed'] = $r['state'] == 'closed';
         $fp_rows = $this->connection->query('SELECT * FROM ' . $this->connection->get_table_prefix() . 'posts WHERE post NOT LIKE \'' . db_encode_like(do_lang('SPACER_POST', '', '', '', get_site_default_lang()) . '%') . '\' AND topic_id=' . strval((int) $out[$i]['id']) . ' ORDER BY post_date', 1);
         if (!array_key_exists(0, $fp_rows)) {
             unset($out[$i]);
             continue;
         }
         $out[$i]['firsttitle'] = $this->ipb_unescape($fp_rows[0]['post_title']);
         if ($show_first_posts) {
             $post_id = $fp_rows[0]['pid'];
             $post = $fp_rows[0]['post'];
             if (array_key_exists('post_htmlstate', $fp_rows[0]) && $fp_rows[0]['post_htmlstate'] != 0) {
                 if ($fp_rows[0]['post_htmlstate'] == 1) {
                     $post = str_replace('<br />', '', $post);
                 }
                 $post = @html_entity_decode($post, ENT_QUOTES, get_charset());
             }
             $post = preg_replace('#public/style_emoticons/<\\#EMO_DIR\\#>(.+?)\'#is', $emoticons_set_dir . '\\1\'', $post);
             $post = str_replace("class='quotetop'", "class='comcode_quote_h4'", $post);
             $post = str_replace("class='quotemain'", "class='comcode_quote_content'", $post);
             // Attachments
             $attachments = $this->connection->query_select('attachments', array('attach_member_id', 'attach_id', 'attach_file', 'attach_location', 'attach_thumb_location', 'attach_is_image', 'attach_filesize', 'attach_hits'), array('attach_post_key' => $fp_rows[0]['post_key']));
             foreach ($attachments as $attachment) {
                 if ($attachment['attach_thumb_location'] != '' || $attachment['attach_is_image'] == 0) {
                     $url = get_forum_base_url() . '/index.php?act=Attach&type=post&id=' . $attachment['attach_id'];
                     if ($attachment['attach_thumb_location'] != '') {
                         $special = do_template('FORUM_ATTACHMENT_IMAGE_THUMB', array('_GUID' => '98a66462f270f53101c4c0a1b63f0bfc', 'FULL' => $url, 'URL' => get_forum_base_url() . '/uploads/' . $attachment['attach_thumb_location']));
                     } else {
                         $special = do_template('FORUM_ATTACHMENT_LINK', array('_GUID' => '002a3220f35debbe567ce7a225aa221e', 'FULL' => $url, 'FILENAME' => $attachment['attach_file'], 'CLEAN_SIZE' => clean_file_size($attachment['attach_filesize']), 'NUM_DOWNLOADS' => integer_format($attachment['attach_hits'])));
                     }
                 } else {
                     $special = do_template('FORUM_ATTACHMENT_IMAGE', array('_GUID' => '49dbf65cb5e20340a5ad4379ea6344c3', 'URL' => get_forum_base_url() . '/uploads/' . $attachment['attach_location']));
                 }
                 // See if we have to place it somewhere special inside the post
                 $old_post = $post;
                 $post = str_replace('[attachmentid=' . $attachment['attach_id'] . ']', $special->evaluate(), $post);
                 if ($old_post == $post) {
                     $post .= $special->evaluate();
                 }
             }
             global $LAX_COMCODE;
             $end = 0;
             while (($pos = strpos($post, '[right]', $end)) !== false) {
                 $e_pos = strpos($post, '[/right]', $pos);
                 if ($e_pos === false) {
                     break;
                 }
                 $end = $e_pos + strlen('[/right]');
                 $segment = substr($post, $pos, $end - $pos);
                 $temp = $LAX_COMCODE;
                 $LAX_COMCODE = true;
                 $comcode = comcode_to_tempcode($segment, $r['starter_id']);
                 $LAX_COMCODE = $temp;
                 $post = substr($post, 0, $pos) . $comcode->evaluate() . substr($post, $end);
             }
             $temp = $LAX_COMCODE;
             $LAX_COMCODE = true;
             $out[$i]['firstpost'] = comcode_to_tempcode(xhtmlise_html($post), $r['starter_id'], false, 60, NULL, NULL, false, false, true);
             // Assumes HTML for posts
             $LAX_COMCODE = $temp;
         }
     }
     if (count($out) != 0) {
         return $out;
     }
     return NULL;
 }
コード例 #18
0
ファイル: admin_import.php プロジェクト: erico-deh/ocPortal
 /**
  * Special import-esque function to aid switching to OCF after importing forum previously served by a forum driver.
  *
  * @return tempcode	Information about progress
  */
 function ocf_switch()
 {
     $out = new ocp_tempcode();
     $todos = array('USER' => array('member', db_get_first_id(), NULL), 'GROUP' => array('group', NULL, 'group_id'));
     foreach ($todos as $db_abstraction => $definition) {
         list($import_code, $default_id, $field_name_also) = $definition;
         $count = 0;
         $extra = is_null($field_name_also) ? '' : ' OR ' . db_string_equal_to('m_name', $field_name_also);
         $fields = $GLOBALS['SITE_DB']->query('SELECT m_table,m_name FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'db_meta WHERE (NOT (m_table LIKE \'' . db_encode_like('f_%') . '\')) AND (' . db_string_equal_to('m_type', $db_abstraction) . ' OR ' . db_string_equal_to('m_type', '*' . $db_abstraction) . ' OR ' . db_string_equal_to('m_type', '?' . $db_abstraction) . $extra . ')');
         foreach ($fields as $field) {
             if ($field['m_table'] == 'stats') {
                 continue;
             }
             // Lots of data and it's not important
             //echo '(working) '.$field['m_table'].'/'.$field['m_name'].'<br />';
             $values = $GLOBALS['SITE_DB']->query_select($field['m_table'], array('*'));
             foreach ($values as $value) {
                 $current = $value[$field['m_name']];
                 $remapped = import_id_remap_get($import_code, $current, true);
                 if (is_null($remapped)) {
                     $remapped = $default_id;
                 }
                 if (!is_null($remapped)) {
                     $value2 = $value;
                     $value2[$field['m_name']] = -$remapped;
                     $c = $GLOBALS['SITE_DB']->query_update($field['m_table'], $value2, $value, '', NULL, NULL, true, true);
                     if (is_null($c)) {
                         $GLOBALS['SITE_DB']->query_delete($field['m_table'], $value);
                     } else {
                         $count += $c;
                     }
                 } else {
                     $GLOBALS['SITE_DB']->query_delete($field['m_table'], $value);
                 }
             }
             $GLOBALS['SITE_DB']->query('UPDATE ' . $GLOBALS['SITE_DB']->get_table_prefix() . $field['m_table'] . ' SET ' . $field['m_name'] . '=-' . $field['m_name'] . ' WHERE ' . $field['m_name'] . '<0');
         }
         $out->attach(paragraph(do_lang_tempcode('OCF_CONVERTED_' . $db_abstraction, $count == 0 ? '?' : strval($count))));
     }
     // info.php
     global $FILE_BASE;
     $info_file = (file_exists('use_comp_name') ? array_key_exists('COMPUTERNAME', $_ENV) ? $_ENV['COMPUTERNAME'] : $_SERVER['SERVER_NAME'] : 'info') . '.php';
     $info = @fopen($FILE_BASE . '/' . $info_file, 'wt') or intelligent_write_error($FILE_BASE . '/' . $info_file);
     fwrite($info, "<" . "?php\n");
     global $SITE_INFO;
     $SITE_INFO['forum_type'] = 'ocf';
     $SITE_INFO['ocf_table_prefix'] = $SITE_INFO['table_prefix'];
     $SITE_INFO['db_forums'] = $SITE_INFO['db_site'];
     $SITE_INFO['db_forums_host'] = array_key_exists('db_site_host', $SITE_INFO) ? $SITE_INFO['db_site_host'] : 'localhost';
     $SITE_INFO['db_forums_user'] = $SITE_INFO['db_site_user'];
     $SITE_INFO['db_forums_password'] = $SITE_INFO['db_site_password'];
     $SITE_INFO['board_prefix'] = get_base_url();
     foreach ($SITE_INFO as $key => $val) {
         $_val = str_replace('\\', '\\\\', $val);
         fwrite($info, '$SITE_INFO[\'' . $key . '\']=\'' . $_val . "';\n");
     }
     fwrite($info, "?" . ">\n");
     fclose($info);
     fix_permissions($FILE_BASE . '/' . $info_file);
     sync_file($FILE_BASE . '/' . $info_file);
     $out->attach(paragraph(do_lang_tempcode('OCF_CONVERTED_INFO')));
     $LANG = get_site_default_lang();
     $trans5 = insert_lang(do_lang('FORUM'), 1, NULL, false, NULL, $LANG);
     $GLOBALS['SITE_DB']->query_insert('zones', array('zone_name' => 'forum', 'zone_title' => insert_lang(do_lang('SECTION_FORUMS'), 1), 'zone_default_page' => 'forumview', 'zone_header_text' => $trans5, 'zone_theme' => '-1', 'zone_wide' => NULL, 'zone_require_session' => 0, 'zone_displayed_in_menu' => 1));
     require_code('menus2');
     add_menu_item_simple('zone_menu', NULL, 'SECTION_FORUMS', 'forum' . ':forumview', 0, 1);
     return $out;
 }
コード例 #19
0
ファイル: vb3.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_ocf_personal_topics($db, $table_prefix, $old_base_dir)
 {
     $rows = $db->query('SELECT * FROM ' . $table_prefix . 'pm p LEFT JOIN ' . $table_prefix . 'pmtext t ON p.pmtextid=t.pmtextid WHERE folderid<>-1 AND title NOT LIKE \'' . db_encode_like('Sent:  %') . '\' ORDER BY dateline');
     // Group them up into what will become topics
     $groups = array();
     foreach ($rows as $row) {
         // Do some fiddling around for duplication
         if ($row['fromuserid'] > $row['userid']) {
             $a = $row['userid'];
             $b = $row['fromuserid'];
         } else {
             $a = $row['fromuserid'];
             $b = $row['userid'];
         }
         $row['title'] = str_replace('Re: ', '', $row['title']);
         $groups[strval($a) . ':' . strval($b) . ':' . $row['title']][] = $row;
     }
     // Import topics
     foreach ($groups as $group) {
         $row = $group[0];
         if (import_check_if_imported('pt', strval($row['pmid']))) {
             continue;
         }
         // Create topic
         $from_id = import_id_remap_get('member', strval($row['fromuserid']), true);
         if (is_null($from_id)) {
             $from_id = $GLOBALS['OCF_DRIVER']->get_guest_id();
         }
         $to_id = import_id_remap_get('member', strval($row['userid']), true);
         if (is_null($to_id)) {
             $to_id = $GLOBALS['OCF_DRIVER']->get_guest_id();
         }
         $topic_id = ocf_make_topic(NULL, '', $this->convert_topic_emoticon($row['iconid']), 1, 1, 0, 0, 0, $from_id, $to_id, false);
         $first_post = true;
         foreach ($group as $_postdetails) {
             if ($first_post) {
                 $title = $row['title'];
             } else {
                 $title = '';
             }
             $post = $this->fix_links($_postdetails['message'], $db, $table_prefix);
             $validated = 1;
             $from_id = import_id_remap_get('member', strval($_postdetails['fromuserid']), true);
             if (is_null($from_id)) {
                 $from_id = $GLOBALS['OCF_DRIVER']->get_guest_id();
             }
             $poster_name_if_guest = $_postdetails['fromusername'];
             $ip_address = $GLOBALS['OCF_DRIVER']->get_member_row_field($from_id, 'm_ip_address');
             $time = $_postdetails['dateline'];
             $poster = $from_id;
             $last_edit_time = NULL;
             $last_edit_by = NULL;
             ocf_make_post($topic_id, $title, $post, 0, $first_post, $validated, 0, $poster_name_if_guest, $ip_address, $time, $poster, NULL, $last_edit_time, $last_edit_by, false, false, NULL, false);
             $first_post = false;
         }
         import_id_remap_put('pt', strval($row['pmid']), $topic_id);
     }
 }
コード例 #20
0
ファイル: admin_orders.php プロジェクト: erico-deh/ocPortal
 /**
  * UI to show all orders
  *
  * @return tempcode	The interface.
  */
 function show_orders()
 {
     require_code('shopping');
     $title = get_page_title('ORDER_LIST');
     $filter = get_param('filter', NULL);
     $search = get_param('search', '', true);
     $cond = "WHERE 1=1";
     if ($filter == 'undispatched') {
         $cond .= " AND t1.order_status='ORDER_STATUS_payment_received'";
         $title = get_page_title('UNDISPATCHED_ORDER_LIST');
     }
     $extra_join = '';
     if (!is_null($search) && $search != '') {
         $GLOBALS['NO_DB_SCOPE_CHECK'] = true;
         $cond .= " AND (t1.id LIKE '" . db_encode_like(str_replace('#', '', $search) . '%') . "' OR t2.m_username LIKE '" . db_encode_like(str_replace('#', '', $search) . '%') . "')";
         $extra_join = ' JOIN ' . get_table_prefix() . 'f_members t2 ON t2.id=t1.c_member';
     }
     breadcrumb_set_parents(array(array('_SEARCH:admin_ecommerce:ecom_usage', do_lang_tempcode('ECOMMERCE')), array('_SELF:_SELF:misc', do_lang_tempcode('ORDERS'))));
     $orders = array();
     //pagination
     $start = get_param_integer('start', 0);
     $max = get_param_integer('max', 10);
     require_code('templates_results_browser');
     require_code('templates_results_table');
     $sortables = array('t1.id' => do_lang_tempcode('ECOM_ORDER'), 't1.add_date' => do_lang_tempcode('ORDERED_DATE'), 't1.c_member' => do_lang_tempcode('ORDERED_BY'), 't1.tot_price' => do_lang_tempcode('ORDER_PRICE_AMT'), 't3.included_tax' => do_lang_tempcode('TAX_PAID'), 't1.order_status' => do_lang_tempcode('STATUS'), 't1.transaction_id' => do_lang_tempcode('TRANSACTION_ID'));
     $query_sort = explode(' ', get_param('sort', 't1.add_date ASC'), 2);
     if (count($query_sort) == 1) {
         $query_sort[] = 'ASC';
     }
     list($sortable, $sort_order) = $query_sort;
     if (strtoupper($sort_order) != 'ASC' && strtoupper($sort_order) != 'DESC' || !array_key_exists($sortable, $sortables)) {
         log_hack_attack_and_exit('ORDERBY_HACK');
     }
     global $NON_CANONICAL_PARAMS;
     $NON_CANONICAL_PARAMS[] = 'sort';
     $fields_title = results_field_title(array(do_lang_tempcode('ECOM_ORDER'), do_lang_tempcode('THE_PRICE'), do_lang_tempcode('TAX_PAID'), do_lang_tempcode('ORDERED_DATE'), do_lang_tempcode('ORDERED_BY'), do_lang_tempcode('TRANSACTION_ID'), do_lang_tempcode('STATUS'), do_lang_tempcode('ACTIONS')), $sortables, 'sort', $sortable . ' ' . $sort_order);
     global $NO_DB_SCOPE_CHECK;
     $NO_DB_SCOPE_CHECK = true;
     $max_rows = $GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT COUNT(*) FROM ' . get_table_prefix() . 'shopping_order t1' . $extra_join . ' LEFT JOIN ' . get_table_prefix() . 'shopping_order_details t3 ON t1.id=t3.order_id ' . $cond);
     $results_browser = results_browser(do_lang_tempcode('ORDERS'), NULL, $start, 'start', $max, 'max', $max_rows, NULL, 'show_orders', true, true);
     $rows = $GLOBALS['SITE_DB']->query('SELECT t1.*,(t3.p_quantity*t3.included_tax) as tax FROM ' . get_table_prefix() . 'shopping_order t1' . $extra_join . ' LEFT JOIN ' . get_table_prefix() . 'shopping_order_details t3 ON t1.id=t3.order_id ' . $cond . ' GROUP BY t1.id ORDER BY ' . db_string_equal_to('t1.order_status', 'ORDER_STATUS_cancelled') . ',' . $sortable . ' ' . $sort_order, $max, $start);
     $order_entries = new ocp_tempcode();
     foreach ($rows as $row) {
         if ($row['purchase_through'] == 'cart') {
             $order_det_url = build_url(array('page' => '_SELF', 'type' => 'order_det', 'id' => $row['id']), '_SELF');
             $order_title = do_lang('CART_ORDER', strval($row['id']));
         } else {
             $res = $GLOBALS['SITE_DB']->query_select('shopping_order_details', array('p_id', 'p_name'), array('order_id' => $row['id']));
             if (!array_key_exists(0, $res)) {
                 continue;
             }
             // DB corruption
             $product_det = $res[0];
             $order_title = do_lang('PURCHASE_ORDER', strval($row['id']));
             $order_det_url = build_url(array('page' => 'catalogues', 'type' => 'entry', 'id' => $product_det['p_id']), get_module_zone('catalogues'));
         }
         $submitted_by = $GLOBALS['FORUM_DRIVER']->get_username($row['c_member']);
         $order_status = do_lang($row['order_status']);
         $ordr_act_submit = build_url(array('page' => '_SELF', 'type' => 'order_act', 'id' => $row['id']), '_SELF');
         $actions = do_template('ADMIN_ORDER_ACTIONS', array('ORDER_TITLE' => $order_title, 'ORDR_ACT_URL' => $ordr_act_submit, 'ORDER_STATUS' => $order_status));
         $url = build_url(array('page' => 'members', 'type' => 'view', 'id' => $row['c_member']), get_module_zone('members'));
         $member = hyperlink($url, $submitted_by, false, true, do_lang('CUSTOMER'));
         $view_url = build_url(array('page' => '_SELF', 'type' => 'order_det', 'id' => $row['id']), '_SELF');
         $order_date = hyperlink($view_url, get_timezoned_date($row['add_date'], true, false, true, true));
         $transaction_details_link = build_url(array('page' => '_SELF', 'type' => 'order_det', 'id' => $row['id']), '_SELF');
         if ($row['transaction_id'] != '') {
             $transaction_details_link = build_url(array('page' => 'admin_ecommerce', 'type' => 'logs', 'product' => $order_title, 'id' => $row['id']), get_module_zone('admin_ecommerce'));
             $transaction_id = hyperlink($transaction_details_link, strval($row['transaction_id']));
         } else {
             $transaction_id = do_lang_tempcode('INCOMPLETED_TRANCACTION');
         }
         $order_entries->attach(results_entry(array(escape_html($order_title), ecommerce_get_currency_symbol() . escape_html(float_format($row['tot_price'], 2)), escape_html(float_format($row['tax'], 2)), $order_date, $member, $transaction_id, $order_status, $actions), false, NULL));
     }
     $width = array('110', '70', '80', '200', '120', '180', '180', '200');
     $results_table = results_table(do_lang_tempcode('ORDERS'), 0, 'start', $max_rows, 'max', $max_rows, $fields_title, $order_entries, $sortables, $sortable, $sort_order, 'sort', NULL, $width, 'cart');
     if (is_null($order_entries)) {
         inform_exit(do_lang_tempcode('NO_ENTRIES'));
     }
     $hidden = build_keep_form_fields('_SELF', true, array('filter'));
     $search_url = get_self_url(true);
     return do_template('ECOM_ADMIN_ORDERS_SCREEN', array('TITLE' => $title, 'CURRENCY' => get_option('currency'), 'ORDERS' => $orders, 'RESULTS_BROWSER' => $results_browser, 'RESULT_TABLE' => $results_table, 'SEARCH_URL' => $search_url, 'HIDDEN' => $hidden, 'SEARCH_VAL' => $search));
 }
コード例 #21
0
ファイル: comcode_pages.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular run function for search results.
  *
  * @param  string			Search string
  * @param  boolean		Whether to only do a META (tags) search
  * @param  ID_TEXT		Order direction
  * @param  integer		Start position in total results
  * @param  integer		Maximum results to return in total
  * @param  boolean		Whether only to search titles (as opposed to both titles and content)
  * @param  string			Where clause that selects the content according to the main search string (SQL query fragment) (blank: full-text search)
  * @param  SHORT_TEXT	Username/Author to match for
  * @param  ?MEMBER		Member-ID to match for (NULL: unknown)
  * @param  TIME			Cutoff date
  * @param  string			The sort type (gets remapped to a field in this function)
  * @set    title add_date
  * @param  integer		Limit to this number of results
  * @param  string			What kind of boolean search to do
  * @set    or and
  * @param  string			Where constraints known by the main search code (SQL query fragment)
  * @param  string			Comma-separated list of categories to search under
  * @param  boolean		Whether it is a boolean search
  * @return array			List of maps (template, orderer)
  */
 function run($content, $only_search_meta, $direction, $max, $start, $only_titles, $content_where, $author, $author_id, $cutoff, $sort, $limit_to, $boolean_operator, $where_clause, $search_under, $boolean_search)
 {
     $remapped_orderer = '';
     switch ($sort) {
         case 'title':
             $remapped_orderer = 'the_page';
             break;
         case 'add_date':
             $remapped_orderer = 'the_zone';
             // Stucked
             break;
     }
     load_up_all_self_page_permissions(get_member());
     $sq = build_search_submitter_clauses('p_submitter', $author_id, $author);
     if (is_null($sq)) {
         return array();
     } else {
         $where_clause .= $sq;
     }
     if (!$GLOBALS['FORUM_DRIVER']->is_super_admin(get_member())) {
         $where_clause .= ' AND ';
         $where_clause .= 'z.zone_name IS NOT NULL';
     }
     if (strpos($content, 'panel_') === false) {
         $where_clause .= ' AND ';
         $where_clause .= '(r.the_page NOT LIKE \'' . db_encode_like('panel\\_%') . '\') AND (r.the_page NOT LIKE \'' . db_encode_like('\\_%') . '\')';
     }
     if (!is_null($search_under) && $search_under != '!') {
         $where_clause .= ' AND ';
         $where_clause .= '(' . db_string_equal_to('r.the_zone', $search_under) . ')';
     }
     if (!has_specific_permission(get_member(), 'see_unvalidated')) {
         $where_clause .= ' AND ';
         $where_clause .= 'p_validated=1';
     }
     require_lang('zones');
     $g_or = _get_where_clause_groups(get_member(), false);
     // Calculate and perform query
     if ($g_or == '') {
         $rows = get_search_rows('comcode_page', 'the_zone:the_page', $content, $boolean_search, $boolean_operator, $only_search_meta, $direction, $max, $start, $only_titles, 'cached_comcode_pages r LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'comcode_pages q ON (q.the_zone=r.the_zone AND q.the_page=r.the_page)', array('r.cc_page_title', 'r.string_index'), $where_clause, $content_where, $remapped_orderer, 'r.*');
     } else {
         $rows = get_search_rows('comcode_page', 'the_zone:the_page', $content, $boolean_search, $boolean_operator, $only_search_meta, $direction, $max, $start, $only_titles, 'cached_comcode_pages r LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'comcode_pages q ON (q.the_zone=r.the_zone AND q.the_page=r.the_page) LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'group_zone_access z ON (z.zone_name=r.the_zone AND (' . str_replace('group_id', 'z.group_id', $g_or) . '))', array('r.cc_page_title', 'r.string_index'), $where_clause, $content_where, $remapped_orderer, 'r.*');
     }
     if (addon_installed('redirects_editor')) {
         $redirects = $GLOBALS['SITE_DB']->query_select('redirects', array('*'));
     } else {
         $redirects = array();
     }
     $out = array();
     $pages_found = array();
     foreach ($rows as $i => $row) {
         foreach ($redirects as $redirect) {
             if ($redirect['r_from_page'] == $row['the_page'] && $redirect['r_from_zone'] == $row['the_zone']) {
                 continue 2;
             }
         }
         if ($row['the_zone'] == '!') {
             continue;
         }
         if (array_key_exists($row['the_zone'] . ':' . $row['the_page'], $pages_found)) {
             continue;
         }
         $pages_found[$row['the_zone'] . ':' . $row['the_page']] = 1;
         $out[$i]['data'] = $row + array('extra' => array($row['the_zone'], $row['the_page'], $limit_to));
         if ($remapped_orderer != '' && array_key_exists($remapped_orderer, $row)) {
             $out[$i]['orderer'] = $row[$remapped_orderer];
         } elseif (substr($remapped_orderer, 0, 7) == '_rating') {
             $out[$i]['orderer'] = $row['compound_rating'];
         }
         if (!has_page_access(get_member(), $row['the_page'], $row['the_zone'])) {
             $out[$i]['restricted'] = true;
         }
     }
     if ($author == '') {
         // Make sure we record that for all cached Comcode pages, we know of them (only those not cached would not have been under the scope of the current search)
         $all_pages = $GLOBALS['SITE_DB']->query_select('cached_comcode_pages', array('the_zone', 'the_page'));
         foreach ($all_pages as $row) {
             $pages_found[$row['the_zone'] . ':' . $row['the_page']] = 1;
         }
         // Now, look on disk for non-cached comcode pages
         $zones = find_all_zones();
         $i = count($out);
         if (!is_null($search_under) && $search_under != '!') {
             $zones = array($search_under);
         }
         foreach ($zones as $zone) {
             if (!has_zone_access(get_member(), $zone)) {
                 continue;
             }
             $pages = find_all_pages($zone, 'comcode/' . user_lang(), 'txt') + find_all_pages($zone, 'comcode_custom/' . user_lang(), 'txt') + find_all_pages($zone, 'comcode/' . get_site_default_lang(), 'txt') + find_all_pages($zone, 'comcode_custom/' . get_site_default_lang(), 'txt');
             foreach ($pages as $page => $dir) {
                 if (!is_string($page)) {
                     $page = strval($page);
                 }
                 if (!array_key_exists($zone . ':' . $page, $pages_found)) {
                     if (!has_page_access(get_member(), $page, $zone)) {
                         continue;
                     }
                     if (strpos($content, 'panel_') === false) {
                         if (substr($page, 0, 6) == 'panel_') {
                             continue;
                         }
                     }
                     if (substr($page, 0, 1) == '_') {
                         continue;
                     }
                     foreach ($redirects as $redirect) {
                         if ($redirect['r_from_page'] == $page && $redirect['r_from_zone'] == $zone) {
                             continue 2;
                         }
                     }
                     $path = zone_black_magic_filterer(($dir == 'comcode_custom' ? get_custom_file_base() : get_file_base()) . '/' . $zone . '/pages/' . $dir . '/' . $page . '.txt');
                     if (!is_null($cutoff) && filemtime($path) < $cutoff) {
                         continue;
                     }
                     $contents = file_get_contents($path, FILE_TEXT);
                     if ($only_titles) {
                         $contents = preg_replace('#^.*\\[title(="1")?\\](.*)\\[/title\\].*$#Us', '${2}', $contents);
                     }
                     if (in_memory_search_match(array('content' => $content, 'conjunctive_operator' => $boolean_operator), $contents)) {
                         $out[$i]['data'] = array('the_zone' => $zone, 'the_page' => $page) + array('extra' => array($zone, $page, $limit_to));
                         if ($remapped_orderer == 'the_page') {
                             $out[$i]['orderer'] = $page;
                         } elseif ($remapped_orderer == 'the_zone') {
                             $out[$i]['orderer'] = $zone;
                         }
                         $i++;
                         $GLOBALS['TOTAL_RESULTS']++;
                         // Let it cache for next time
                         if (get_option('is_on_comcode_page_cache') == '1') {
                             request_page($page, false, $zone, $dir, false, true);
                         }
                     }
                 }
             }
         }
     }
     return $out;
 }
コード例 #22
0
ファイル: phpbb3.php プロジェクト: erico-deh/ocPortal
 /**
  * Find all members with a name matching the given SQL LIKE string.
  *
  * @param  string			The pattern
  * @param  ?integer		Maximum number to return (limits to the most recent active) (NULL: no limit)
  * @return ?array			The array of matched members (NULL: none found)
  */
 function get_matching_members($pattern, $limit = NULL)
 {
     $rows = $this->connection->query('SELECT * FROM ' . $this->connection->get_table_prefix() . 'users WHERE username_clean LIKE \'' . db_encode_like(strtolower($pattern)) . '\' AND user_id<>' . strval($this->get_guest_id()) . ' ORDER BY user_lastvisit DESC', $limit);
     global $M_SORT_KEY;
     $M_SORT_KEY = 'username';
     uasort($rows, 'multi_sort');
     return $rows;
 }
コード例 #23
0
ファイル: galleries.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular new-style deep page-link finder function (does not return the main entry-points).
  *
  * @param  string  	Callback function to send discovered page-links to.
  * @param  MEMBER		The member we are finding stuff for (we only find what the member can view).
  * @param  integer	Code for how deep we are tunnelling down, in terms of whether we are getting entries as well as categories.
  * @param  string		Stub used to create page-links. This is passed in because we don't want to assume a zone or page name within this function.
  * @param  ?string	Where we're looking under (NULL: root of tree). We typically will NOT show a root node as there's often already an entry-point representing it.
  * @param  integer	Our recursion depth (used to calculate importance of page-link, used for instance by Google sitemap). Deeper is typically less important.
  * @param  ?array		Non-standard for API [extra parameter tacked on] (NULL: yet unknown). Contents of database table for performance.
  * @param  ?array		Non-standard for API [extra parameter tacked on] (NULL: yet unknown). Contents of database table for performance.
  * @param  ?array		Non-standard for API [extra parameter tacked on] (NULL: yet unknown). Contents of database table for performance.
  */
 function get_sitemap_pagelinks($callback, $member_id, $depth, $pagelink_stub, $parent_pagelink = NULL, $recurse_level = 0, $category_data = NULL, $image_data = NULL, $video_data = NULL)
 {
     // This is where we start
     if (is_null($parent_pagelink)) {
         $parent_pagelink = $pagelink_stub . ':misc';
         // This is the entry-point we're under
         $parent_attributes = array('id' => 'root');
     } else {
         list(, $parent_attributes, ) = page_link_decode($parent_pagelink);
     }
     // We read in all data for efficiency
     if (is_null($category_data)) {
         $category_data_count = $GLOBALS['SITE_DB']->query_value('galleries', 'COUNT(*)');
         if ($category_data_count > 2000) {
             $category_data = $GLOBALS['SITE_DB']->query('SELECT name AS id,name AS title,parent_id,add_date FROM ' . get_table_prefix() . 'galleries WHERE name NOT LIKE \'' . db_encode_like('member\\_%') . '\'');
         } else {
             $category_data = $GLOBALS['SITE_DB']->query_select('galleries', array('name AS id', 'name AS title', 'parent_id', 'add_date'));
         }
     }
     if (is_null($image_data)) {
         $image_data_count = $GLOBALS['SITE_DB']->query_value('images', 'COUNT(*)');
         $image_data = $image_data_count > 2000 ? array() : $GLOBALS['SITE_DB']->query_select('images d LEFT JOIN ' . get_table_prefix() . 'translate t ON ' . db_string_equal_to('language', user_lang()) . ' AND t.id=d.title', array('d.title', 'd.id', 't.text_original AS ntitle', 'cat AS category_id', 'add_date', 'edit_date'));
     }
     if (is_null($video_data)) {
         $video_data_count = $GLOBALS['SITE_DB']->query_value('videos', 'COUNT(*)');
         $video_data = $video_data_count > 2000 ? array() : $GLOBALS['SITE_DB']->query_select('videos d LEFT JOIN ' . get_table_prefix() . 'translate t ON ' . db_string_equal_to('language', user_lang()) . ' AND t.id=d.title', array('d.title', 'd.id', 't.text_original AS ntitle', 'cat AS category_id', 'add_date', 'edit_date'));
     }
     // Subcategories
     foreach ($category_data as $row) {
         if ($row['parent_id'] != '' && $row['parent_id'] == $parent_attributes['id']) {
             $pagelink = $pagelink_stub . 'misc:' . $row['id'];
             if (__CLASS__ != '') {
                 $this->get_sitemap_pagelinks($callback, $member_id, $depth, $pagelink_stub, $pagelink, $recurse_level + 1, $category_data, $image_data, $video_data);
                 // Recurse
             } else {
                 call_user_func_array(__FUNCTION__, array($callback, $member_id, $depth, $pagelink_stub, $pagelink, $recurse_level + 1, $category_data, $image_data, $video_data));
                 // Recurse
             }
             if (has_category_access($member_id, 'galleries', $row['id'])) {
                 call_user_func_array($callback, array($pagelink, $parent_pagelink, $row['add_date'], NULL, max(0.7 - $recurse_level * 0.1, 0.3), $row['title']));
                 // Callback
             } else {
                 call_user_func_array($callback, array($pagelink, $parent_pagelink, $row['add_date'], NULL, max(0.7 - $recurse_level * 0.1, 0.3), do_lang('UNKNOWN'), false));
                 // Callback
             }
         }
     }
     // Entries
     if ($depth >= DEPTH__ENTRIES && has_category_access($member_id, 'galleries', $parent_attributes['id'])) {
         foreach ($image_data as $row) {
             if ($row['category_id'] == $parent_attributes['id']) {
                 $pagelink = $pagelink_stub . 'image:' . strval($row['id']);
                 if (is_null($row['title'])) {
                     $row['ntitle'] = get_translated_text($row['title']);
                 }
                 call_user_func_array($callback, array($pagelink, $parent_pagelink, $row['add_date'], $row['edit_date'], 0.2, $row['ntitle']));
                 // Callback
             }
         }
         foreach ($video_data as $row) {
             if ($row['category_id'] == $parent_attributes['id']) {
                 $pagelink = $pagelink_stub . 'video:' . strval($row['id']);
                 if (is_null($row['title'])) {
                     $row['ntitle'] = get_translated_text($row['title']);
                 }
                 call_user_func_array($callback, array($pagelink, $parent_pagelink, $row['add_date'], $row['edit_date'], 0.2, $row['ntitle']));
                 // Callback
             }
         }
     }
 }
コード例 #24
0
 /**
  * The UI to show a results table of moderation actions for a moderator.
  *
  * @return tempcode		The UI
  */
 function choose_action()
 {
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('VIEW_ACTION_LOGS'))));
     breadcrumb_set_self(do_lang_tempcode('RESULTS'));
     $title = get_page_title('VIEW_ACTION_LOGS');
     require_code('templates_internalise_screen');
     $test_tpl = internalise_own_screen($title);
     if (is_object($test_tpl)) {
         return $test_tpl;
     }
     $id = get_param_integer('id', -1);
     $start = get_param_integer('start', 0);
     $max = get_param_integer('max', 50);
     $sortables = array('date_and_time' => do_lang_tempcode('DATE_TIME'), 'the_type' => do_lang_tempcode('ACTION'));
     $test = explode(' ', get_param('sort', 'date_and_time DESC'), 2);
     if (count($test) == 1) {
         $test[1] = 'DESC';
     }
     list($sortable, $sort_order) = $test;
     if (strtoupper($sort_order) != 'ASC' && strtoupper($sort_order) != 'DESC' || !array_key_exists($sortable, $sortables)) {
         log_hack_attack_and_exit('ORDERBY_HACK');
     }
     global $NON_CANONICAL_PARAMS;
     $NON_CANONICAL_PARAMS[] = 'sort';
     require_code('templates_results_table');
     $field_titles = array(do_lang_tempcode('USERNAME'), do_lang_tempcode('DATE_TIME'), do_lang_tempcode('ACTION'), do_lang_tempcode('PARAMETER_A'), do_lang_tempcode('PARAMETER_B'));
     if (addon_installed('securitylogging')) {
         $field_titles[] = do_lang_tempcode('_BANNED');
     }
     $fields_title = results_field_title($field_titles, $sortables, 'sort', $sortable . ' ' . $sort_order);
     $filter_to_type = get_param('to_type', '');
     $filter_param_a = get_param('param_a', '');
     $filter_param_b = get_param('param_b', '');
     $max_rows = 0;
     // Pull up our rows: forum
     if (get_forum_type() == 'ocf') {
         // Possible filter (called up by URL)
         $where = '1=1';
         if ($filter_to_type != '') {
             $where .= ' AND ' . db_string_equal_to('l_the_type', $filter_to_type);
         }
         if ($filter_param_a != '') {
             $where .= ' AND l_param_a LIKE \'' . db_encode_like('%' . $filter_param_a . '%') . '\'';
         }
         if ($filter_param_b != '') {
             $where .= ' AND l_param_b LIKE \'' . db_encode_like('%' . $filter_param_b . '%') . '\'';
         }
         if ($id != -1) {
             $where .= ' AND l_by=' . strval($id);
         }
         // Fetch
         $rows1 = $GLOBALS['FORUM_DB']->query('SELECT l_reason,id,l_by AS the_user,l_date_and_time AS date_and_time,l_the_type AS the_type,l_param_a AS param_a,l_param_b AS param_b FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_moderator_logs WHERE ' . $where . ' ORDER BY ' . $sortable . ' ' . $sort_order, $max + $start);
         $max_rows += $GLOBALS['FORUM_DB']->query_value_null_ok_full('SELECT COUNT(*) FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_moderator_logs WHERE ' . $where);
     } else {
         $rows1 = array();
     }
     // Possible filter (called up by URL)
     $where = '1=1';
     if ($filter_to_type != '') {
         $where .= ' AND ' . db_string_equal_to('the_type', $filter_to_type);
     }
     if ($filter_param_a != '') {
         $where .= ' AND param_a LIKE \'' . db_encode_like('%' . $filter_param_a . '%') . '\'';
     }
     if ($filter_param_b != '') {
         $where .= ' AND param_b LIKE \'' . db_encode_like('%' . $filter_param_b . '%') . '\'';
     }
     if ($id != -1) {
         $where .= ' AND the_user='******'SITE_DB']->query('SELECT id,the_user,date_and_time,the_type,param_a,param_b,ip FROM ' . get_table_prefix() . 'adminlogs WHERE ' . $where . ' ORDER BY ' . $sortable . ' ' . $sort_order, $max + $start);
     $max_rows += $GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT COUNT(*) FROM ' . get_table_prefix() . 'adminlogs WHERE ' . $where);
     $rows = array_merge($rows1, $rows2);
     require_code('actionlog');
     $fields = new ocp_tempcode();
     $pos = 0;
     while (count($rows) != 0 && $pos - $start < $max) {
         $best = 0;
         // Initialise type to integer
         $_best = 0;
         // Initialise type to integer
         $best = NULL;
         $_best = NULL;
         foreach ($rows as $x => $row) {
             if (is_null($best) || $row['date_and_time'] < $_best && $sortable == 'date_and_time' && $sort_order == 'ASC' || $row['date_and_time'] > $_best && $sortable == 'date_and_time' && $sort_order == 'DESC' || intval($row['the_type']) < $_best && $sortable == 'the_type' && $sort_order == 'ASC' || intval($row['the_type']) > $_best && $sortable == 'the_type' && $sort_order == 'DESC') {
                 $best = $x;
                 if ($sortable == 'date_and_time') {
                     $_best = $row['date_and_time'];
                 }
                 if ($sortable == 'the_type') {
                     $_best = $row['the_type'];
                 }
             }
         }
         if ($pos >= $start) {
             $myrow = $rows[$best];
             $username = $GLOBALS['FORUM_DRIVER']->member_profile_hyperlink($myrow['the_user']);
             $mode = array_key_exists('l_reason', $myrow) ? 'ocf' : 'ocp';
             $url = build_url(array('page' => '_SELF', 'type' => 'view', 'id' => $myrow['id'], 'mode' => $mode), '_SELF');
             $mode_nice = $mode == 'ocp' ? 'ocPortal' : 'OCF';
             $date = hyperlink($url, get_timezoned_date($myrow['date_and_time']), false, true, $mode_nice . '/' . $row['the_type'] . '/' . strval($myrow['id']), NULL, NULL, NULL, '_top');
             if (!is_null($myrow['param_a'])) {
                 $a = $myrow['param_a'];
             } else {
                 $a = '';
             }
             if (!is_null($myrow['param_b'])) {
                 $b = $myrow['param_b'];
             } else {
                 $b = '';
             }
             require_code('templates_interfaces');
             $_a = tpl_crop_text_mouse_over($a, 8);
             $_b = tpl_crop_text_mouse_over($b, 15);
             $type_str = do_lang($myrow['the_type'], $_a, $_b, NULL, NULL, false);
             if (is_null($type_str)) {
                 $type_str = $myrow['the_type'];
             }
             $test = actionlog_linkage($myrow['the_type'], $a, $b, $_a, $_b);
             if (!is_null($test)) {
                 list($_a, $_b) = $test;
             }
             $result_entry = array($username, $date, $type_str, $_a, $_b);
             if (addon_installed('securitylogging')) {
                 $banned_test_1 = array_key_exists('ip', $myrow) ? $GLOBALS['SITE_DB']->query_value_null_ok('usersubmitban_ip', 'ip', array('ip' => $myrow['ip'])) : NULL;
                 $banned_test_2 = $GLOBALS['SITE_DB']->query_value_null_ok('usersubmitban_member', 'the_member', array('the_member' => $myrow['the_user']));
                 $banned_test_3 = $GLOBALS['FORUM_DRIVER']->is_banned($myrow['the_user']);
                 $banned = is_null($banned_test_1) && is_null($banned_test_2) && !$banned_test_3 ? do_lang_tempcode('NO') : do_lang_tempcode('YES');
                 $result_entry[] = $banned;
             }
             $fields->attach(results_entry($result_entry, true));
         }
         unset($rows[$best]);
         $pos++;
     }
     $table = results_table(do_lang_tempcode('ACTIONS'), $start, 'start', $max, 'max', $max_rows, $fields_title, $fields, $sortables, $sortable, $sort_order, 'sort');
     return do_template('ACTION_LOGS_SCREEN', array('_GUID' => 'd75c813e372c3ca8d1204609e54c9d65', 'TABLE' => $table, 'TITLE' => $title));
 }
コード例 #25
0
ファイル: aef.php プロジェクト: erico-deh/ocPortal
 /**
  * Find all members with a name matching the given SQL LIKE string.
  *
  * @param  string			The pattern
  * @param  ?integer		Maximum number to return (limits to the most recent active) (NULL: no limit)
  * @return ?array			The array of matched members (NULL: none found)
  */
 function get_matching_members($pattern, $limit = NULL)
 {
     $rows = $this->connection->query('SELECT * FROM ' . $this->connection->get_table_prefix() . 'users WHERE username LIKE \'' . db_encode_like($pattern) . '\' AND id<>' . strval($this->get_guest_id()) . ' ORDER BY lastlogin_1 DESC', $limit);
     //it could be ordered by 'lastlogin' too
     global $M_SORT_KEY;
     $M_SORT_KEY = 'username';
     uasort($rows, 'multi_sort');
     return $rows;
 }
コード例 #26
0
/**
 * Get a bit of SQL to make sure that a DB field is not like a spacer post in any of the languages.
 *
 * @param  ID_TEXT		The field name
 * @return string			The SQL
 */
function not_like_spacer_posts($field)
{
    $ret = '';
    $langs = find_all_langs();
    foreach (array_keys($langs) as $lang) {
        if (@filesize(get_file_base() . '/lang/' . $lang . '/global.ini') || @filesize(get_file_base() . '/lang_custom/' . $lang . '/global.ini')) {
            // Check it's a real lang and not a stub dir
            $ret .= ' AND ' . $field . ' NOT LIKE \'%' . db_encode_like(do_lang('SPACER_POST_MATCHER', '', '', '', $lang) . '%') . '\'';
        }
    }
    return $ret;
}
コード例 #27
0
ファイル: ipb1.php プロジェクト: erico-deh/ocPortal
 /**
  * Get an array of topics in the given forum. Each topic is an array with the following attributes:
  * - id, the topic ID
  * - title, the topic title
  * - lastusername, the username of the last poster
  * - lasttime, the timestamp of the last reply
  * - closed, a Boolean for whether the topic is currently closed or not
  * - firsttitle, the title of the first post
  * - firstpost, the first post (only set if $show_first_posts was true)
  *
  * @param  mixed			The forum name or an array of forum IDs
  * @param  integer		The limit
  * @param  integer		The start position
  * @param  integer		The total rows (not a parameter: returns by reference)
  * @param  SHORT_TEXT	The topic title filter
  * @param  boolean		Whether to show the first posts
  * @param  string			The date key to sort by
  * @set    lasttime firsttime
  * @param  boolean		Whether to limit to hot topics
  * @param  SHORT_TEXT	The topic description filter
  * @return ?array			The array of topics (NULL: error)
  */
 function show_forum_topics($name, $limit, $start, &$max_rows, $filter_topic_title = '', $show_first_posts = false, $date_key = 'lasttime', $hot = false, $filter_topic_description = '')
 {
     if (is_integer($name)) {
         $id_list = 'forum_id=' . strval((int) $name);
     } elseif (!is_array($name)) {
         $id = $this->forum_id_from_name($name);
         if (is_null($id)) {
             return NULL;
         }
         $id_list = 'forum_id=' . strval((int) $id);
     } else {
         $id_list = '';
         foreach (array_keys($name) as $id) {
             if ($id_list != '') {
                 $id_list .= ' OR ';
             }
             $id_list .= 'forum_id=' . strval((int) $id);
         }
         if ($id_list == '') {
             return NULL;
         }
     }
     $topic_filter = $filter_topic_title != '' ? 'AND title LIKE \'' . db_encode_like($this->ipb_escape($filter_topic_title)) . '\'' : '';
     $rows = $this->connection->query('SELECT * FROM ' . $this->connection->get_table_prefix() . 'topics WHERE (' . $id_list . ') ' . $topic_filter . ' ORDER BY ' . ($date_key == 'lasttime' ? 'last_post' : 'start_date') . ' DESC', $limit, $start);
     $max_rows = $this->connection->query_value_null_ok_full('SELECT COUNT(*) FROM ' . $this->connection->get_table_prefix() . 'topics WHERE (' . $id_list . ') ' . $topic_filter);
     $out = array();
     foreach ($rows as $i => $r) {
         $out[$i] = array();
         $out[$i]['id'] = $r['tid'];
         $out[$i]['num'] = $r['posts'];
         $out[$i]['title'] = $this->ipb_unescape($r['title']);
         $out[$i]['description'] = $this->ipb_unescape($r['title']);
         $out[$i]['firstusername'] = $this->ipb_unescape($r['starter_name']);
         $out[$i]['lastusername'] = $this->ipb_unescape($r['last_poster_name']);
         $out[$i]['firstmemberid'] = $r['starter_id'];
         $out[$i]['lastmemberid'] = $r['last_poster_id'];
         $out[$i]['firsttime'] = $r['start_date'];
         $out[$i]['lasttime'] = $r['last_post'];
         $out[$i]['closed'] = $r['state'] == 'closed';
         $fp_rows = $this->connection->query('SELECT post_title,post FROM ' . $this->connection->get_table_prefix() . 'posts WHERE post NOT LIKE \'' . db_encode_like(do_lang('SPACER_POST', '', '', '', get_site_default_lang()) . '%') . '\' AND topic_id=' . strval((int) $out[$i]['id']) . ' ORDER BY post_date', 1);
         if (!array_key_exists(0, $fp_rows)) {
             unset($out[$i]);
             continue;
         }
         $out[$i]['firsttitle'] = $this->ipb_unescape($fp_rows[0]['post_title']);
         if ($show_first_posts) {
             $out[$i]['firstpost'] = $fp_rows[0]['post'];
             // Assumes HTML for posts
         }
     }
     if (count($out) != 0) {
         return $out;
     }
     return NULL;
 }
コード例 #28
0
ファイル: ocp_merge.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_themes($db, $table_prefix, $file_base)
 {
     $rows = $db->query('SELECT * FROM ' . $table_prefix . 'theme_images WHERE path LIKE \'' . db_encode_like('%/images_custom/%') . '\'');
     foreach ($rows as $row) {
         $GLOBALS['SITE_DB']->query_delete('theme_images', $row, '', 1);
         $GLOBALS['SITE_DB']->query_insert('theme_images', $row, false, true);
         // Allow failure if row already there
     }
 }
コード例 #29
0
ファイル: wbb.php プロジェクト: erico-deh/ocPortal
 /**
  * Get custom profile fields values for all 'ocp_' prefixed keys.
  *
  * @param  MEMBER			The member id
  * @return ?array			A map of the custom profile fields, key_suffix=>value (NULL: no fields)
  */
 function get_custom_fields($member)
 {
     $rows = $this->connection->query('SELECT profilefieldid,title FROM ' . $this->connection->get_table_prefix() . 'profilefields WHERE title LIKE \'' . db_encode_like('ocp_%') . '\'');
     $values = $this->connection->query_select('userfields', array('*'), array('userid' => $member), '', 1);
     if (!array_key_exists(0, $values)) {
         return NULL;
     }
     $out = array();
     foreach ($rows as $row) {
         $title = substr($row['title'], 4);
         $out[$title] = $values[0]['field' . strval($row['profilefieldid'])];
     }
     return $out;
 }
コード例 #30
0
ファイル: smf2.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_ocf_member_files($db, $table_prefix, $file_base)
 {
     $boardurl = '';
     $boarddir = '';
     global $STRICT_FILE;
     require $file_base . '/Settings.php';
     $options = $db->query('SELECT * FROM ' . $table_prefix . 'settings WHERE variable LIKE \'' . db_encode_like('%avatar%') . '\'');
     $options_array = array();
     $homeurl = $boardurl;
     $avatar_path = '';
     $avatar_gallery_path = '';
     $avatar_path = 'members';
     foreach ($options as $option) {
         $options_array[$option['variable']] = $option['value'];
         if ($option['variable'] == 'avatar_url') {
             $avatar_gallery_path = $option['value'];
         }
     }
     $avatar_gallery_path = str_replace($boardurl, '', $avatar_gallery_path);
     $host = preg_replace('#\\.#', '\\.', $_SERVER['HTTP_HOST']);
     $doc_root = $_SERVER['DOCUMENT_ROOT'];
     $forum_dir = preg_replace('#\\\\#', '/', $boarddir);
     $avatar_gallery_path = $forum_dir . $avatar_gallery_path;
     $avatar_path = $forum_dir . '/' . $avatar_path;
     $row_start = 0;
     $rows = array();
     do {
         $query = 'SELECT id_member,avatar FROM ' . $table_prefix . 'members WHERE id_member<>-1 ORDER BY id_member';
         $rows = $db->query($query, 200, $row_start);
         foreach ($rows as $row) {
             if (import_check_if_imported('member_files', strval($row['id_member']))) {
                 continue;
             }
             $member_id = import_id_remap_get('member', strval($row['id_member']));
             $avatar_url = '';
             if (!isset($row['avatar']) || strlen($row['avatar']) == 0) {
                 $query_attachments = 'SELECT id_member,filename,width,height,size,attachment_type FROM ' . $table_prefix . 'attachments WHERE attachment_type=\'1\' AND id_member=\'' . strval($row['id_member']) . '\'';
                 $attachment_data = $db->query($query_attachments, 1, 0);
                 if (isset($attachment_data[0]['filename']) && strlen($attachment_data[0]['filename']) > 0) {
                     // Uploaded avatar
                     $filename = $attachment_data[0]['filename'];
                     if (file_exists(get_custom_file_base() . '/uploads/ocf_avatars/' . $filename) || @rename($avatar_path . '/' . $filename, get_custom_file_base() . '/uploads/ocf_avatars/' . $filename)) {
                         $avatar_url = 'uploads/ocf_avatars/' . $filename;
                         sync_file($avatar_url);
                     } else {
                         if ($STRICT_FILE) {
                             warn_exit(do_lang_tempcode('MISSING_AVATAR', escape_html($filename)));
                         }
                         $avatar_url = '';
                     }
                 }
             } else {
                 if (preg_match('#http\\:#', $row['avatar']) != 0) {
                     //Remote file is set as avatar
                     $avatar_url = $row['avatar'];
                 } elseif (strlen($row['avatar']) > 0) {
                     // Gallery
                     $filename_with_subdir = $row['avatar'];
                     $filename = preg_replace('#.*\\/#', '', $filename_with_subdir);
                     //we need just a filename
                     if (file_exists(get_custom_file_base() . '/uploads/ocf_avatars/' . $filename) || @rename($avatar_gallery_path . '/' . $filename_with_subdir, get_custom_file_base() . '/uploads/ocf_avatars/' . $filename)) {
                         $avatar_url = 'uploads/ocf_avatars/' . substr($filename, strrpos($filename, '/'));
                         sync_file($avatar_url);
                     } else {
                         // Try as a pack avatar then
                         $striped_filename = str_replace('/', '_', $filename);
                         if (file_exists(get_custom_file_base() . '/uploads/ocf_avatars/' . $striped_filename)) {
                             $avatar_url = 'uploads/ocf_avatars/' . substr($filename, strrpos($filename, '/'));
                         } else {
                             if ($STRICT_FILE) {
                                 warn_exit(do_lang_tempcode('MISSING_AVATAR', escape_html($filename)));
                             }
                             $avatar_url = '';
                         }
                     }
                 }
             }
             $GLOBALS['FORUM_DB']->query_update('f_members', array('m_avatar_url' => $avatar_url), array('id' => $member_id), '', 1);
             import_id_remap_put('member_files', strval($row['id_member']), 1);
         }
         $row_start += 200;
     } while (count($rows) > 0);
 }