mirror of
https://github.com/friendica/friendica
synced 2024-11-19 03:03:41 +00:00
4d39164c1e
* Rewrite to Proxy class: - introduced new Friendica\Network\Proxy class for in exchange of proxy_*() functions - moved also all PROXY_* constants there as Proxy::* - removed now no longer needed mod/proxy.php loading as composer's auto-load will do this for us - renamed those proxy_*() functions to better names: + proxy_init() -> Proxy::init() (public) + proxy_url() -> Proxy::proxifyUrl() (public) + proxy_parse_html() -> Proxy::proxifyHtml() (public) + proxy_is_local_image() -> Proxy::isLocalImage() (private) + proxy_parse_query() -> Proxy::parseQuery() (private) + proxy_img_cb() -> Proxy::replaceUrl() (private) * Ops, need to set $a here ... * CR request: - moved Proxy class to Friendica\Module - extended BaseModule * Ops, no need for own instance of $a when self::getApp() is around. * Proxy-rewrite: - proxy_url() and proxy_parse_html() are both non-module functions (now methods) - so they must be splitted into a seperate class - also the SIZE_* and DEFAULT_TIME constants are both not relevant to module * No instances from utility classes * Fixed error: - proxify*() is now located in `Friendica\Util\ProxyUtils` * Moved back to original place, ops? How did they move here? Well, it was not intended by me. * Removed duplicate (left-over from split) constants and static array. Thank to MrPetovan finding it. * Renamed ProxyUtils -> Proxy and aliased it back to ProxyUtils.
44 lines
790 B
PHP
44 lines
790 B
PHP
<?php
|
|
|
|
use Friendica\Database\DBA;
|
|
|
|
/**
|
|
* @brief execute SQL query with printf style args - deprecated
|
|
*
|
|
* Please use the dba:: functions instead:
|
|
* dba::select, dba::exists, dba::insert
|
|
* dba::delete, dba::update, dba::p, dba::e
|
|
*
|
|
* @param $args Query parameters (1 to N parameters of different types)
|
|
* @return array|bool Query array
|
|
* @deprecated
|
|
*/
|
|
function q($sql) {
|
|
$args = func_get_args();
|
|
unset($args[0]);
|
|
|
|
if (!DBA::$connected) {
|
|
return false;
|
|
}
|
|
|
|
$sql = DBA::cleanQuery($sql);
|
|
$sql = DBA::anyValueFallback($sql);
|
|
|
|
$stmt = @vsprintf($sql, $args);
|
|
|
|
$ret = DBA::p($stmt);
|
|
|
|
if (is_bool($ret)) {
|
|
return $ret;
|
|
}
|
|
|
|
$columns = DBA::columnCount($ret);
|
|
|
|
$data = DBA::toArray($ret);
|
|
|
|
if ((count($data) == 0) && ($columns == 0)) {
|
|
return true;
|
|
}
|
|
|
|
return $data;
|
|
}
|