当前位置: 首页>>代码示例>>PHP>>正文


PHP db_encode_like函数代码示例

本文整理汇总了PHP中db_encode_like函数的典型用法代码示例。如果您正苦于以下问题:PHP db_encode_like函数的具体用法?PHP db_encode_like怎么用?PHP db_encode_like使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了db_encode_like函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * 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));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:41,代码来源:side_root_galleries.php

示例2: info

 /**
  * 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;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:32,代码来源:video.php

示例3: get_mail_domains

/**
 * 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;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:20,代码来源:pointstore.php

示例4: config

 /**
  * 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());
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:22,代码来源:pop3.php

示例5: run

 /**
  * 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));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:51,代码来源:galleries.php

示例6: setUp

 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);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:19,代码来源:comment.php

示例7: run

 /**
  * 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();
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:26,代码来源:image_thumbs.php

示例8: run

 /**
  * 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;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:45,代码来源:CATALOGUE_ENTRY_BACKREFS.php

示例9: render_tab

 /**
  * 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);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:47,代码来源:galleries.php

示例10: testRelationsdefined

 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);
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:22,代码来源:relations.php

示例11: run

 /**
  * 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)));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:30,代码来源:main_recent_galleries.php

示例12: get_custom_fields

 /**
  * 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;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:24,代码来源:vb.php

示例13: import_ocf_member_files

 /**
  * 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);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:80,代码来源:aef.php

示例14: get_all_image_ids_type

/**
 * 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);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:67,代码来源:themes2.php

示例15: config_set

 /**
  * 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'])));
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:admin_config.php


注:本文中的db_encode_like函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。