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


PHP reason_sql_string_escape函数代码示例

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


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

示例1: _produce_borrowing_nav

 function _produce_borrowing_nav()
 {
     $ret = '';
     $nes = new entity_selector();
     $nes->add_type(id_of('type'));
     $nes->add_right_relationship($this->admin_page->site_id, relationship_id_of('site_cannot_edit_type'));
     $nes->add_relation('`entity`.`id` = "' . reason_sql_string_escape($this->admin_page->type_id) . '"');
     $nes->set_num(1);
     $nes->limit_tables();
     $nes->limit_fields();
     $ns = $nes->run_one();
     $show_edit = reason_user_has_privs($this->admin_page->user_id, 'edit') && !$this->admin_page->is_second_level() && empty($ns) ? true : false;
     /* $type = new entity($this->admin_page->type_id);
     			$name = $type->get_value('plural_name') ? $type->get_value('plural_name') : $type->get_value('name');
     			if(function_exists('mb_strtolower'))
     				$name = mb_strtolower($name);
     			else
     				$name = strtolower($name); */
     $ret .= '<div class="borrowNav">' . "\n";
     $ret .= '<ul>';
     if ($show_edit) {
         $ret .= '<li><a href="' . $this->admin_page->get_owned_list_link($this->admin_page->type_id) . '"><img src="' . REASON_HTTP_BASE_PATH . 'silk_icons/bullet_edit.png" alt="" /> Add &amp; edit</a></li>';
     }
     $ret .= '<li class="current"><strong><img src="' . REASON_HTTP_BASE_PATH . 'silk_icons/car.png" alt="" /> Borrow</strong></li>';
     $ret .= '</ul>' . "\n";
     $ret .= '</div>' . "\n";
     // if(reason_user_has_privs($this->admin_page->user_id,'edit'))
     return $ret;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:29,代码来源:sharing.php

示例2: relationship_find_and_update

function relationship_find_and_update($a_type, $b_type, $name, $updates = array())
{
    $existing_rel_id = relationship_finder($a_type, $b_type, $name);
    if (!empty($existing_rel_id) && !empty($updates)) {
        // build criteria clause - only want to update if it is actually needed
        $set_str = $where_str_body = '';
        $where_str_start = " AND (";
        foreach ($updates as $k => $v) {
            $set_str .= !empty($set_str) ? ", " : '';
            $where_str_body .= !empty($where_str_body) ? ") OR (" : "(";
            $where_str_body .= $k . ' != "' . reason_sql_string_escape($v) . '"';
            $set_str .= $k . ' = "' . reason_sql_string_escape($v) . '"';
        }
        $where_str_end = "))";
        $q = 'UPDATE allowable_relationship SET ' . $set_str . ' WHERE ID=' . $existing_rel_id . $where_str_start . $where_str_body . $where_str_end;
        db_query($q, 'could not update the places a blog on a page relationship');
        $num_rows = mysql_affected_rows();
        if (!empty($num_rows)) {
            echo '<p>updated relationship ' . $name . '</p>';
            pray($updates);
            return true;
        } else {
            return false;
        }
    }
}
开发者ID:hunter2814,项目名称:reason_package,代码行数:26,代码来源:blog_to_publication3.php

示例3: _get_events

 function _get_events()
 {
     if (!isset($this->events)) {
         $es = new entity_selector($this->site_id);
         $es->add_type(id_of('event_type'));
         if (!in_array('archived', $this->params['show'])) {
             $es->add_relation('`last_occurence` >= "' . reason_sql_string_escape(date('Y-m-d')) . '"');
         }
         if (!in_array('upcoming', $this->params['show'])) {
             $es->add_relation('`datetime` < "' . reason_sql_string_escape(date('Y-m-d', time() + 60 * 60 * 24)) . '"');
         }
         if (!in_array('current', $this->params['show'])) {
             $es->add_relation('(`last_occurence` < "' . reason_sql_string_escape(date('Y-m-d')) . '" OR `datetime` >= "' . reason_sql_string_escape(date('Y-m-d', time() + 60 * 60 * 24)) . '")');
         }
         $es->add_relation('`show_hide` = "show"');
         $es->set_order($this->params['order']);
         $this->_modify_events_es($es);
         $events = $es->run_one();
         $class = $this->get_model_class($this->params['model']);
         foreach ($events as $id => $event) {
             $this->events[$id] = new $class($event);
         }
         if (empty($this->events)) {
             $this->events = array();
         }
     }
     return $this->events;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:28,代码来源:module.php

示例4: is_site_root

function is_site_root($page_id)
{
    $query = 'SELECT * FROM relationship WHERE entity_a="' . reason_sql_string_escape($page_id) . '" AND type="' . relationship_id_of('minisite_page_parent') . '"';
    $results = db_query($query);
    while ($row = mysql_fetch_array($results)) {
        if ($row['entity_b'] == $page_id) {
            return true;
        }
    }
    return false;
}
开发者ID:hunter2814,项目名称:reason_package,代码行数:11,代码来源:root_finder.php

示例5: run_error_checks

 function run_error_checks()
 {
     parent::run_error_checks();
     $es = new entity_selector();
     $es->add_relation('audience_integration.directory_service_value = "' . reason_sql_string_escape($this->get_value('directory_service_value')) . '"');
     $es->add_relation('entity.id != ' . $this->get_value('id'));
     $es->set_num(1);
     $conflicts = $es->run_one(id_of('audience_type'));
     if (!empty($conflicts)) {
         $this->set_error('directory_service_value', 'The Directory Service Value you entered ("' . $this->get_value('directory_service_value') . '") is already in use. Each audience must have a unique directory service value.');
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:12,代码来源:audience.php

示例6: _get_active_user_ids

 function _get_active_user_ids($since_datetime)
 {
     if (empty($since_datetime)) {
         trigger_error('Please provide a date');
         return array();
     }
     $q = 'SELECT DISTINCT `last_edited_by` FROM `entity` WHERE `last_modified` >= "' . reason_sql_string_escape($since_datetime) . '" AND `type` NOT IN ("' . id_of('comment_type') . '","' . id_of('classified_type') . '")';
     $r = db_query($q, 'Unable to get active users');
     $ids = array();
     while ($row = mysql_fetch_array($r, MYSQL_ASSOC)) {
         $ids[] = $row['last_edited_by'];
     }
     mysql_free_result($r);
     return $ids;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:15,代码来源:active_users.php

示例7: init

 function init($args = array())
 {
     parent::init($args);
     $es = new entity_selector();
     $es->description = 'Selecting images for the gallery';
     $es->add_type(id_of('image'));
     $es = $this->refine_es($es);
     if (!empty($this->request['search_image'])) {
         $es->add_relation('(entity.name LIKE "%' . reason_sql_string_escape($this->request['search_image']) . '%" OR meta.description LIKE "%' . reason_sql_string_escape($this->request['search_image']) . '%"' . ' OR meta.keywords LIKE "%' . reason_sql_string_escape($this->request['search_image']) . '%"' . ' OR chunk.content LIKE "%' . reason_sql_string_escape($this->request['search_image']) . '%"' . ')');
     }
     $this->num = $es->get_one_count();
     $this->check_bounds();
     $es->set_num($this->num_per_page);
     $es->set_start(($this->request['page'] - 1) * $this->num_per_page);
     $this->images = $es->run_one();
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:16,代码来源:gallery.php

示例8: alter_feed

 function alter_feed()
 {
     // Start with defaults
     $this->do_default_field_mapping();
     // Then change only the link field
     $this->feed->set_item_field_map('link', 'id');
     $this->feed->set_item_field_handler('link', 'make_link', true);
     $this->feed->set_item_field_map('enclosure', 'id');
     // Modify entity selector
     $num = !empty($_REQUEST['num']) ? turn_into_int($_REQUEST['num']) : '0';
     $start = !empty($_REQUEST['start']) ? turn_into_int($_REQUEST['start']) : '0';
     if (!empty($_REQUEST['q'])) {
         $this->feed->es->add_relation('(entity.name LIKE "%' . reason_sql_string_escape($_REQUEST['q']) . '%"' . ' OR meta.description LIKE "%' . reason_sql_string_escape($_REQUEST['q']) . '%"' . ' OR meta.keywords LIKE "%' . reason_sql_string_escape($_REQUEST['q']) . '%"' . ' OR chunk.content LIKE "%' . reason_sql_string_escape($_REQUEST['q']) . '%"' . ')');
     }
     $this->feed->es->set_num($num);
     $this->feed->es->set_start($start);
     $this->feed->es->set_order('entity.last_modified DESC, dated.datetime DESC, entity.name ASC');
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:18,代码来源:images.php

示例9: authenticate

 /**
  * Validate username and password 
  * @access public
  * @param string $username Userid
  * @param string $password Password
  * @return boolean
  */
 function authenticate($username, $password)
 {
     settype($username, 'string');
     settype($password, 'string');
     if (!empty($username) && !empty($password)) {
         $es = new entity_selector();
         $es->add_relation('entity.name = "' . reason_sql_string_escape($username) . '"');
         $es->add_relation('user.user_password_hash = "' . sha1($password) . '"');
         $es->add_relation($this->get_basic_limitation());
         $es->set_num(1);
         $this->open_conn();
         $users = $es->run_one(id_of('user'));
         $this->close_conn();
         if (!empty($users)) {
             return true;
         }
     }
     return false;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:26,代码来源:reason_directory_service.php

示例10: get_preview_controls

 /**
  * @return an html string contain the controls for resizing the live preview
  *
  */
 function get_preview_controls()
 {
     //get the parameters, location, and page types that use feature
     //and place the height and width as option tag values, and page type
     // and location as what the user sees when using the select box.
     $rpts =& get_reason_page_types();
     $ptypes = $rpts->get_params_of_page_types_that_use_module('feature/feature');
     $types = array();
     $contents = array();
     foreach ($ptypes as $type) {
         $types[$type['page_type']] = $type;
     }
     //		pray($types);
     if (!empty($types)) {
         $prepped = array();
         foreach ($types as $pt => $type) {
             $prepped[] = reason_sql_string_escape($pt);
         }
         $es = new entity_selector();
         $es->add_type(id_of('minisite_page'));
         $es->add_relation('custom_page IN ("' . implode('","', $prepped) . '")');
         $es->add_left_relationship($this->get_value('id'), relationship_id_of('page_to_feature'));
         $placed_pages = $es->run_one();
         //			pray($placed_pages);
         foreach ($placed_pages as $page) {
             $w = $this->width;
             $h = $this->height;
             if (!empty($types[$page->get_value('custom_page')]['params']['width'])) {
                 $w = htmlspecialchars($types[$page->get_value('custom_page')]['params']['width']);
             }
             if (!empty($types[$page->get_value('custom_page')]['params']['height'])) {
                 $h = htmlspecialchars($types[$page->get_value('custom_page')]['params']['height']);
             }
             $name = strip_tags($page->get_value('name'));
             $contents[] = array('name' => $name, 'w' => $w, 'h' => $h, 'italicize' => true);
         }
         $es = new entity_selector($this->get_value('site_id'));
         $es->add_type(id_of('minisite_page'));
         $es->add_relation('custom_page IN ("' . implode('","', $prepped) . '")');
         if (!empty($placed_pages)) {
             $es->add_relation('entity.id NOT IN ("' . implode('","', array_keys($placed_pages)) . '")');
         }
         $site_pages = $es->run_one();
         foreach ($site_pages as $page) {
             $w = $this->width;
             $h = $this->height;
             if (!empty($types[$page->get_value('custom_page')]['params']['width'])) {
                 $w = htmlspecialchars($types[$page->get_value('custom_page')]['params']['width']);
             }
             if (!empty($types[$page->get_value('custom_page')]['params']['height'])) {
                 $h = htmlspecialchars($types[$page->get_value('custom_page')]['params']['height']);
             }
             $name = strip_tags($page->get_value('name'));
             $contents[] = array('name' => $name, 'w' => $w, 'h' => $h);
         }
     }
     // end if(!empty($types))
     if (empty($contents)) {
         $contents[] = array('name' => "Default Size (No pages show features on the site yet)", 'w' => $this->width, 'h' => $this->height);
     }
     //testing with a ton O' tabs
     /*
     		for($i=100;$i<400;$i=$i+10)
     		{
     			$contents[]=array('name'=>"foo$i",'w'=>$i,'h'=>$i);
     		}
     
     
     		//testing with a ton O' pages
     		for($i=100;$i<400;$i++)
     		{
     			$contents[]=array('name'=>"foo$i",'w'=>400,'h'=>300);
     		}
     */
     $tabs = new Feature_Tabs();
     $tabs->set($contents);
     $w = $this->width;
     $h = $this->height;
     //		echo $w."x".$h;
     //		$tabs->set_active_tab($w."x".$h);
     $tab_html_str = $tabs->get_html();
     $str = "<h4 class=\"size_label\">Preview At Different Sizes </h4>";
     $str .= $tab_html_str;
     return $str;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:89,代码来源:feature.php

示例11: _param_to_sql_set

 function _param_to_sql_set($param)
 {
     if (is_array($param)) {
         array_walk($param, 'db_prep_walk');
         return implode(',', $param);
     } else {
         return '"' . reason_sql_string_escape($param) . '"';
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:9,代码来源:children.php

示例12: reason_move_table_fields

/**
 * Move all the fields of one table into another table for a specific type
 *
 * This method is for denormalizing Reason tables. For example, a type may use a common table
 * like meta, datetime, or chunk. For performance reasons, it can be desirable to collapse
 * these tables into a single table just for that type. This method will do that.
 * 
 * @param integer $type The ID of the type whose fields we are moving
 * @param string $source_table The name of the table we are moving fields FROM
 * @param string $destination_table The name of the table we are moving fields TO
 * @param integer $user_id The Reason ID of the user who is doing this move
 * @return boolean Success
 *
 * @todo Add limit to ensure fields are only created that don't already exist
 */
function reason_move_table_fields($type, $source_table, $destination_table, $user_id)
{
    // Sanity checks
    if (empty($type)) {
        trigger_error('No type provided in reason_move_table_fields()');
        return false;
    }
    if (empty($source_table)) {
        trigger_error('No source table provided in reason_move_table_fields()');
        return false;
    }
    if (!is_string($source_table)) {
        trigger_error('Source table provided not a string in reason_move_table_fields()');
        return false;
    }
    if (empty($destination_table)) {
        trigger_error('No destination table provided in reason_move_table_fields()');
        return false;
    }
    if (!is_string($destination_table)) {
        trigger_error('Destination table provided not a string in reason_move_table_fields()');
        return false;
    }
    if ('entity' == $source_table || 'entity' == $destination_table) {
        trigger_error('reason_move_table_fields() cannot move fields into or out of the entity table.');
        return false;
    }
    if (is_object($type)) {
        $type_id = $type->id();
    } elseif (is_numeric($type)) {
        $type_id = (int) $type;
    } else {
        $type_id = id_of($type);
    }
    if (empty($type_id)) {
        trigger_error('Invalid type specified in reason_move_table_fields().');
        return false;
    }
    if (is_object($type)) {
        $type_entity = $type;
    } else {
        $type_entity = new entity($type_id);
    }
    $type_vals = $type_entity->get_values();
    if (empty($type_vals)) {
        trigger_error('Type specified (id ' . $type_id . ') is not a Reason entity in reason_move_table_fields().');
        return false;
    }
    if ($type_entity->get_value('type') != id_of('type')) {
        trigger_error('Type specified (id ' . $type_id . ') is not a Type entity in reason_move_table_fields().');
        return false;
    }
    if ($type_entity->get_value('state') != 'Live') {
        trigger_error('Type specified (id ' . $type_id . ') is not a live entity in reason_move_table_fields().');
        return false;
    }
    if (empty($user_id)) {
        trigger_error('No user id specified in reason_move_table_fields().');
        return false;
    }
    $user = new entity($user_id);
    if (!$user->get_values() || $user->get_value('type') != id_of('user')) {
        trigger_error('Invalid user ID specified in reason_move_table_fields().');
        return false;
    }
    // check for table existence
    $es = new entity_selector();
    $es->add_type(id_of('content_table'));
    $es->add_relation('`name` = "' . reason_sql_string_escape($source_table) . '"');
    $source_table_result = $es->run_one();
    if (empty($source_table_result)) {
        trigger_error('Source table "' . $source_table . '" does not exist in reason_move_table_fields()');
        return false;
    }
    $es = new entity_selector();
    $es->add_type(id_of('content_table'));
    $es->add_relation('`name` = "' . reason_sql_string_escape($destination_table) . '"');
    $destination_table_result = $es->run_one();
    if (empty($destination_table_result)) {
        trigger_error('Destination table "' . $destination_table . '" does not exist in reason_move_table_fields()');
        return false;
    }
    $source_table_entity = current($source_table_result);
    $destination_table_entity = current($destination_table_result);
    // ensure type uses both tables
//.........这里部分代码省略.........
开发者ID:hunter2814,项目名称:reason_package,代码行数:101,代码来源:admin_actions.php

示例13: reason_get_allowable_relationship_info

/**
 * Gets all the relationship info about an allowable relationship
 * @param int $r_id id in ar table
 * @return mixed
 */
function reason_get_allowable_relationship_info($alrel_id)
{
    $cache = array();
    if (!isset($cache[$alrel_id])) {
        $q = 'SELECT * FROM `allowable_relationship` WHERE `id` = "' . reason_sql_string_escape($alrel_id) . '"';
        $r = db_query($q, 'error getting relationship info');
        $cache[$alrel_id] = mysql_fetch_array($r, MYSQL_ASSOC);
    }
    return $cache[$alrel_id];
}
开发者ID:hunter2814,项目名称:reason_package,代码行数:15,代码来源:util.php

示例14: check_URL_history

/**
 * Header the browser to the current location of the most recent page
 * that occupied a given URL
 *
 * How it works:
 *
 * 1. Looks for the URL in the URL_history table. 
 *
 * 2. If there is no URL, send a 404 header. 
 *    If there are URLs, send a 301 header and a Location header to the
 *    location of the live page that most recent inhabited that URL.
 *
 * Important: Because it may attempt to header the client to a different URL, 
 * this method must be called before any output is started, or in the context
 * of output buffering. 
 *
 * @param string $request_uri a URL relative to the host root (e.g. /foo/bar/)
 * @return NULL
 *
 * @todo modify to make multidomain safe
 */
function check_URL_history($request_uri)
{
    $url_arr = parse_URL($request_uri);
    // This catches links that might not have had a trailing slash
    // pages always have a trailing slash in the db
    $URL = '/' . trim_slashes($url_arr['path']) . '/';
    $URL = str_replace('//', '/', $URL);
    $query_string = !empty($url_arr['query']) ? '?' . $url_arr['query'] : '';
    $query = 'SELECT * FROM URL_history WHERE url ="' . reason_sql_string_escape($URL) . '" ORDER BY timestamp DESC';
    $results = db_query($query);
    $num_results = mysql_num_rows($results);
    if (mysql_num_rows($results) > 0) {
        while ($row = mysql_fetch_array($results)) {
            $page_id = $row['page_id'];
            $page = new entity($page_id);
            if (reason_is_entity($page, 'minisite_page') && $page->get_value('state') == 'Live' && ($redir = @reason_get_page_url($page))) {
                if ($redir == $request_uri) {
                    //Could potentially update rewrites here, solving most times this happens, perhaps.
                    trigger_error("A page should exist here, but apparently does not at the moment. A web administrator may need to run URL updating on this site.");
                } else {
                    header('Location: ' . $redir . $query_string, true, 301);
                    exit;
                }
            }
        }
    }
    // if we have gotten this far and not found a URL lets send a 404
    http_response_code(404);
}
开发者ID:hunter2814,项目名称:reason_package,代码行数:50,代码来源:URL_History.php

示例15: reason_get_current_user_entity

/**
 * Get the Reason entity that represents the current user, if one exists
 *
 * @return mixed Reason entity or false (if no user logged in or if logged-in user does not have Reason entity)
 */
function reason_get_current_user_entity()
{
    static $user;
    if (!isset($user)) {
        if ($username = reason_check_authentication()) {
            $es = new entity_selector();
            $es->add_type(id_of('user'));
            $es->add_relation('entity.name = "' . reason_sql_string_escape($username) . '"');
            $es->set_num(1);
            $result = $es->run_one();
            if (!empty($result)) {
                $user = current($result);
            }
        }
        if (empty($user)) {
            $user = false;
        }
    }
    return $user;
}
开发者ID:hunter2814,项目名称:reason_package,代码行数:25,代码来源:user_functions.php


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