Use use
instead of \
This commit is contained in:
parent
bc724f2b68
commit
39f894bd4a
5 changed files with 97 additions and 71 deletions
|
@ -1,8 +1,12 @@
|
|||
<?php
|
||||
|
||||
use DDDBL;
|
||||
|
||||
use Exception;
|
||||
|
||||
require_once('include/datetime.php');
|
||||
|
||||
$objDDDBLResultHandler = new \DDDBL\DataObjectPool('Result-Handler');
|
||||
$objDDDBLResultHandler = new DDDBL\DataObjectPool('Result-Handler');
|
||||
|
||||
/**
|
||||
* create handler, which returns just the PDOStatement object
|
||||
|
@ -10,7 +14,7 @@ $objDDDBLResultHandler = new \DDDBL\DataObjectPool('Result-Handler');
|
|||
* big result-sets
|
||||
*
|
||||
**/
|
||||
$cloPDOStatementResultHandler = function(\DDDBL\Queue $objQueue) {
|
||||
$cloPDOStatementResultHandler = function(DDDBL\Queue $objQueue) {
|
||||
|
||||
$objPDO = $objQueue->getState()->get('PDOStatement');
|
||||
$objQueue->getState()->update(array('result' => $objPDO));
|
||||
|
@ -47,7 +51,7 @@ class dba {
|
|||
$a = get_app();
|
||||
|
||||
# work around, to store the database - configuration in DDDBL
|
||||
$objDataObjectPool = new \DDDBL\DataObjectPool('Database-Definition');
|
||||
$objDataObjectPool = new DDDBL\DataObjectPool('Database-Definition');
|
||||
$objDataObjectPool->add('DEFAULT', array('CONNECTION' => "mysql:host=$server;dbname=$db",
|
||||
'USER' => $user,
|
||||
'PASS' => $pass,
|
||||
|
@ -78,10 +82,10 @@ class dba {
|
|||
}
|
||||
|
||||
# etablish connection to database and store PDO object
|
||||
\DDDBL\connect();
|
||||
$this->db = \DDDBL\getDB();
|
||||
DDDBL\connect();
|
||||
$this->db = DDDBL\getDB();
|
||||
|
||||
if (\DDDBL\isConnected()) {
|
||||
if (DDDBL\isConnected()) {
|
||||
$this->connected = true;
|
||||
}
|
||||
|
||||
|
@ -106,7 +110,7 @@ class dba {
|
|||
$strQueryAlias = md5($sql);
|
||||
$strSQLType = strtoupper(strstr($sql, ' ', true));
|
||||
|
||||
$objPreparedQueryPool = new \DDDBL\DataObjectPool('Query-Definition');
|
||||
$objPreparedQueryPool = new DDDBL\DataObjectPool('Query-Definition');
|
||||
|
||||
# check if query do not exists till now, if so create its definition
|
||||
if (!$objPreparedQueryPool->exists($strQueryAlias))
|
||||
|
@ -121,14 +125,14 @@ class dba {
|
|||
$stamp1 = microtime(true);
|
||||
|
||||
try {
|
||||
$r = \DDDBL\get($strQueryAlias);
|
||||
$r = DDDBL\get($strQueryAlias);
|
||||
|
||||
# bad workaround to emulate the bizzare behavior of mysql_query
|
||||
if (in_array($strSQLType, array('INSERT', 'UPDATE', 'DELETE', 'CREATE', 'DROP', 'SET')))
|
||||
$result = true;
|
||||
$intErrorCode = false;
|
||||
|
||||
} catch (\Exception $objException) {
|
||||
} catch (Exception $objException) {
|
||||
$result = false;
|
||||
$intErrorCode = $objPreparedQueryPool->get($strQueryAlias)->get('PDOStatement')->errorCode();
|
||||
}
|
||||
|
@ -234,7 +238,7 @@ class dba {
|
|||
|
||||
function __destruct() {
|
||||
if ($this->db)
|
||||
\DDDBL\disconnect();
|
||||
DDDBL\disconnect();
|
||||
}
|
||||
}}
|
||||
|
||||
|
|
|
@ -11,6 +11,9 @@ use Friendica\App;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Network\Probe;
|
||||
|
||||
use DomXPath;
|
||||
use DOMDocument;
|
||||
|
||||
require_once 'include/datetime.php';
|
||||
require_once 'include/probe.php';
|
||||
require_once 'include/network.php';
|
||||
|
@ -890,9 +893,9 @@ function poco_fetch_nodeinfo($server_url) {
|
|||
function poco_detect_server_type($body) {
|
||||
$server = false;
|
||||
|
||||
$doc = new \DOMDocument();
|
||||
$doc = new DOMDocument();
|
||||
@$doc->loadHTML($body);
|
||||
$xpath = new \DomXPath($doc);
|
||||
$xpath = new DomXPath($doc);
|
||||
|
||||
$list = $xpath->query("//meta[@name]");
|
||||
|
||||
|
|
21
src/App.php
21
src/App.php
|
@ -5,6 +5,13 @@ namespace Friendica;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
use Cache;
|
||||
use dbm;
|
||||
|
||||
use Detection\MobileDetect;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
*
|
||||
* class: App
|
||||
|
@ -192,7 +199,7 @@ class App {
|
|||
}
|
||||
|
||||
if (! static::directory_usable($basepath, false)) {
|
||||
throw new \Exception('Basepath ' . $basepath . ' isn\'t usable.');
|
||||
throw new Exception('Basepath ' . $basepath . ' isn\'t usable.');
|
||||
}
|
||||
|
||||
$this->basepath = rtrim($basepath, DIRECTORY_SEPARATOR);
|
||||
|
@ -276,7 +283,7 @@ class App {
|
|||
$this->pager['total'] = 0;
|
||||
|
||||
// Detect mobile devices
|
||||
$mobile_detect = new \Mobile_Detect();
|
||||
$mobile_detect = new MobileDetect();
|
||||
$this->is_mobile = $mobile_detect->isMobile();
|
||||
$this->is_tablet = $mobile_detect->isTablet();
|
||||
|
||||
|
@ -687,7 +694,7 @@ class App {
|
|||
q('START TRANSACTION');
|
||||
|
||||
$r = q('SELECT `pid` FROM `process` WHERE `pid` = %d', intval(getmypid()));
|
||||
if (!\dbm::is_result($r)) {
|
||||
if (!dbm::is_result($r)) {
|
||||
q("INSERT INTO `process` (`pid`,`command`,`created`) VALUES (%d, '%s', '%s')", intval(getmypid()), dbesc($command), dbesc(datetime_convert()));
|
||||
}
|
||||
q('COMMIT');
|
||||
|
@ -700,7 +707,7 @@ class App {
|
|||
q('START TRANSACTION');
|
||||
|
||||
$r = q('SELECT `pid` FROM `process`');
|
||||
if (\dbm::is_result($r)) {
|
||||
if (dbm::is_result($r)) {
|
||||
foreach ($r AS $process) {
|
||||
if (!posix_kill($process['pid'], 0)) {
|
||||
q('DELETE FROM `process` WHERE `pid` = %d', intval($process['pid']));
|
||||
|
@ -805,7 +812,7 @@ class App {
|
|||
}
|
||||
}
|
||||
|
||||
$processlist = \dbm::processlist();
|
||||
$processlist = dbm::processlist();
|
||||
if ($processlist['list'] != '') {
|
||||
logger('Processcheck: Processes: ' . $processlist['amount'] . ' - Processlist: ' . $processlist['list'], LOGGER_DEBUG);
|
||||
|
||||
|
@ -896,14 +903,14 @@ class App {
|
|||
// If the last worker fork was less than 10 seconds before then don't fork another one.
|
||||
// This should prevent the forking of masses of workers.
|
||||
$cachekey = 'app:proc_run:started';
|
||||
$result = \Cache::get($cachekey);
|
||||
$result = Cache::get($cachekey);
|
||||
|
||||
if (!is_null($result) AND ( time() - $result) < 10) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set the timestamp of the last proc_run
|
||||
\Cache::set($cachekey, time(), CACHE_MINUTE);
|
||||
Cache::set($cachekey, time(), CACHE_MINUTE);
|
||||
|
||||
array_unshift($args, ((x($this->config, 'php_path')) && (strlen($this->config['php_path'])) ? $this->config['php_path'] : 'php'));
|
||||
|
||||
|
|
|
@ -11,6 +11,13 @@ namespace Friendica\Network;
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
use dbm;
|
||||
use Cache;
|
||||
use xml;
|
||||
|
||||
use DomXPath;
|
||||
use DOMDocument;
|
||||
|
||||
require_once 'include/feed.php';
|
||||
require_once 'include/email.php';
|
||||
require_once 'include/network.php';
|
||||
|
@ -92,7 +99,7 @@ class Probe {
|
|||
return false;
|
||||
}
|
||||
|
||||
$links = \xml::element_to_array($xrd);
|
||||
$links = xml::element_to_array($xrd);
|
||||
if (!isset($links["xrd"]["link"])) {
|
||||
return false;
|
||||
}
|
||||
|
@ -275,7 +282,7 @@ class Probe {
|
|||
public static function uri($uri, $network = "", $uid = 0, $cache = true) {
|
||||
|
||||
if ($cache) {
|
||||
$result = \Cache::get("probe_url:".$network.":".$uri);
|
||||
$result = Cache::get("probe_url:".$network.":".$uri);
|
||||
if (!is_null($result)) {
|
||||
return $result;
|
||||
}
|
||||
|
@ -327,7 +334,7 @@ class Probe {
|
|||
|
||||
// Only store into the cache if the value seems to be valid
|
||||
if (!in_array($data['network'], array(NETWORK_PHANTOM, NETWORK_MAIL))) {
|
||||
\Cache::set("probe_url:".$network.":".$uri, $data, CACHE_DAY);
|
||||
Cache::set("probe_url:".$network.":".$uri, $data, CACHE_DAY);
|
||||
|
||||
/// @todo temporary fix - we need a real contact update function that updates only changing fields
|
||||
/// The biggest problem is the avatar picture that could have a reduced image size.
|
||||
|
@ -543,7 +550,7 @@ class Probe {
|
|||
return $webfinger;
|
||||
}
|
||||
|
||||
$xrd_arr = \xml::element_to_array($xrd);
|
||||
$xrd_arr = xml::element_to_array($xrd);
|
||||
if (!isset($xrd_arr["xrd"]["link"])) {
|
||||
return false;
|
||||
}
|
||||
|
@ -811,12 +818,12 @@ class Probe {
|
|||
return false;
|
||||
}
|
||||
|
||||
$doc = new \DOMDocument();
|
||||
$doc = new DOMDocument();
|
||||
if (!@$doc->loadHTML($content)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$xpath = new \DomXPath($doc);
|
||||
$xpath = new DomXPath($doc);
|
||||
|
||||
$vcards = $xpath->query("//div[contains(concat(' ', @class, ' '), ' vcard ')]");
|
||||
if (!is_object($vcards)) {
|
||||
|
@ -1099,12 +1106,12 @@ class Probe {
|
|||
*/
|
||||
private function pumpioProfileData($profile_link) {
|
||||
|
||||
$doc = new \DOMDocument();
|
||||
$doc = new DOMDocument();
|
||||
if (!@$doc->loadHTMLFile($profile_link)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$xpath = new \DomXPath($doc);
|
||||
$xpath = new DomXPath($doc);
|
||||
|
||||
$data = array();
|
||||
|
||||
|
@ -1186,13 +1193,13 @@ class Probe {
|
|||
* @return string feed link
|
||||
*/
|
||||
private function getFeedLink($url) {
|
||||
$doc = new \DOMDocument();
|
||||
$doc = new DOMDocument();
|
||||
|
||||
if (!@$doc->loadHTMLFile($url)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$xpath = new \DomXPath($doc);
|
||||
$xpath = new DomXPath($doc);
|
||||
|
||||
//$feeds = $xpath->query("/html/head/link[@type='application/rss+xml']");
|
||||
$feeds = $xpath->query("/html/head/link[@type='application/rss+xml' and @rel='alternate']");
|
||||
|
@ -1298,7 +1305,7 @@ class Probe {
|
|||
|
||||
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", intval($uid));
|
||||
|
||||
if (\dbm::is_result($x) && \dbm::is_result($r)) {
|
||||
if (dbm::is_result($x) && dbm::is_result($r)) {
|
||||
$mailbox = construct_mailbox_name($r[0]);
|
||||
$password = '';
|
||||
openssl_private_decrypt(hex2bin($r[0]['pass']), $password, $x[0]['prvkey']);
|
||||
|
|
|
@ -9,6 +9,11 @@ namespace Friendica;
|
|||
|
||||
use Friendica\Core\Config;
|
||||
|
||||
use xml;
|
||||
|
||||
use DomXPath;
|
||||
use DOMDocument;
|
||||
|
||||
require_once("include/network.php");
|
||||
require_once("include/Photo.php");
|
||||
require_once("include/oembed.php");
|
||||
|
@ -223,22 +228,22 @@ class ParseUrl {
|
|||
|
||||
$body = mb_convert_encoding($body, 'HTML-ENTITIES', "UTF-8");
|
||||
|
||||
$doc = new \DOMDocument();
|
||||
$doc = new DOMDocument();
|
||||
@$doc->loadHTML($body);
|
||||
|
||||
\xml::deleteNode($doc, "style");
|
||||
\xml::deleteNode($doc, "script");
|
||||
\xml::deleteNode($doc, "option");
|
||||
\xml::deleteNode($doc, "h1");
|
||||
\xml::deleteNode($doc, "h2");
|
||||
\xml::deleteNode($doc, "h3");
|
||||
\xml::deleteNode($doc, "h4");
|
||||
\xml::deleteNode($doc, "h5");
|
||||
\xml::deleteNode($doc, "h6");
|
||||
\xml::deleteNode($doc, "ol");
|
||||
\xml::deleteNode($doc, "ul");
|
||||
xml::deleteNode($doc, "style");
|
||||
xml::deleteNode($doc, "script");
|
||||
xml::deleteNode($doc, "option");
|
||||
xml::deleteNode($doc, "h1");
|
||||
xml::deleteNode($doc, "h2");
|
||||
xml::deleteNode($doc, "h3");
|
||||
xml::deleteNode($doc, "h4");
|
||||
xml::deleteNode($doc, "h5");
|
||||
xml::deleteNode($doc, "h6");
|
||||
xml::deleteNode($doc, "ol");
|
||||
xml::deleteNode($doc, "ul");
|
||||
|
||||
$xpath = new \DomXPath($doc);
|
||||
$xpath = new DomXPath($doc);
|
||||
|
||||
$list = $xpath->query("//meta[@content]");
|
||||
foreach ($list as $node) {
|
||||
|
|
Loading…
Reference in a new issue