示例#1
0
 function stripslashes($post)
 {
     return get_magic_quotes_gpc() ? mosStripslashes($post) : $post;
 }
 /** Remove the sitemap from the table */
 function remove()
 {
     $db =& JFactory::getDBO();
     $query = "delete from #__xmap_sitemap where `id`=" . $this->id;
     $db->setQuery($query);
     if ($db->query() === FALSE) {
         echo _XMAP_ERR_NO_DROP_DB . "<br />\n";
         echo mosStripslashes($db->getErrorMsg());
         return false;
     }
     return true;
 }
示例#3
0
/**
* Copy the named array content into the object as properties
* only existing properties of object are filled. when undefined in hash, properties wont be deleted
* @param array the input array
* @param obj byref the object to fill of any class
* @param string
* @param boolean
*/
function mosBindArrayToObject($array, &$obj, $ignore = '', $prefix = NULL, $checkSlashes = true)
{
    if (!is_array($array) || !is_object($obj)) {
        return false;
    }
    $ignore = ' ' . $ignore . ' ';
    foreach (get_object_vars($obj) as $k => $v) {
        if (substr($k, 0, 1) != '_') {
            // internal attributes of an object are ignored
            if (strpos($ignore, ' ' . $k . ' ') === false) {
                if ($prefix) {
                    $ak = $prefix . $k;
                } else {
                    $ak = $k;
                }
                if (isset($array[$ak])) {
                    $obj->{$k} = $checkSlashes && get_magic_quotes_gpc() ? mosStripslashes($array[$ak]) : $array[$ak];
                }
            }
        }
    }
    return true;
}
示例#4
0
/**
* Strip slashes from strings or arrays of strings
* @param value the input string or array
*/
function mosStripslashes(&$value)
{
    $ret = '';
    if (is_string($value)) {
        $ret = stripslashes($value);
    } else {
        if (is_array($value)) {
            $ret = array();
            while (list($key, $val) = each($value)) {
                $ret[$key] = mosStripslashes($val);
            }
            // while
        } else {
            $ret = $value;
        }
        // if
    }
    // if
    return $ret;
}
示例#5
0
 function mosStripslashes(&$value)
 {
     $ret = '';
     if (is_string($value)) {
         $ret = stripslashes($value);
     } else {
         if (is_array($value)) {
             $ret = array();
             foreach ($value as $key => $val) {
                 $ret[$key] = mosStripslashes($val);
             }
         } else {
             $ret = $value;
         }
     }
     return $ret;
 }