use Friendica\Core\Pconfig;
use Friendica\Core\System;
use Friendica\Database\DBM;
+use Friendica\Object\Contact;
require_once 'include/html2plain.php';
require_once 'include/datetime.php';
require_once 'include/bbcode.php';
-require_once 'include/Contact.php';
/**
* @brief Methods for read and write notifications from/to database
'link' => System::baseUrl(true).'/display/'.$it['pguid'],
'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
'url' => $it['author-link'],
- 'text' => sprintf( t("%s is not attending %s's event"), $it['author-name'], $it['pname']),
+ 'text' => sprintf(t("%s is not attending %s's event"), $it['author-name'], $it['pname']),
'when' => $default_item_when,
'ago' => $default_item_ago,
'seen' => $it['seen']
/**
* @brief Total number of network notifications
- * @param int|string $seen
- * If 0 only include notifications into the query
- * which aren't marked as "seen"
+ * @param int|string $seen If 0 only include notifications into the query
+ * which aren't marked as "seen"
+ *
* @return int Number of network notifications
*/
private function networkTotal($seen = 0)
/**
* @brief Get network notifications
*
- * @param int|string $seen
- * If 0 only include notifications into the query
- * which aren't marked as "seen"
+ * @param int|string $seen If 0 only include notifications into the query
+ * which aren't marked as "seen"
* @param int $start Start the query at this point
* @param int $limit Maximum number of query results
*
/**
* @brief Total number of system notifications
- * @param int|string $seen
- * If 0 only include notifications into the query
- * which aren't marked as "seen"
+ * @param int|string $seen If 0 only include notifications into the query
+ * which aren't marked as "seen"
+ *
* @return int Number of system notifications
*/
private function systemTotal($seen = 0)
/**
* @brief Get system notifications
*
- * @param int|string $seen
- * If 0 only include notifications into the query
- * which aren't marked as "seen"
+ * @param int|string $seen If 0 only include notifications into the query
+ * which aren't marked as "seen"
* @param int $start Start the query at this point
* @param int $limit Maximum number of query results
*
*
* @return string The additional sql query
*/
- private function _personal_sql_extra()
+ private function personalSqlExtra()
{
$myurl = System::baseUrl(true) . '/profile/'. $this->a->user['nickname'];
$myurl = substr($myurl, strpos($myurl, '://') + 3);
/**
* @brief Total number of personal notifications
- * @param int|string $seen
- * If 0 only include notifications into the query
- * which aren't marked as "seen"
+ * @param int|string $seen If 0 only include notifications into the query
+ * which aren't marked as "seen"
+ *
* @return int Number of personal notifications
*/
private function personalTotal($seen = 0)
{
$sql_seen = "";
- $sql_extra = $this->_personal_sql_extra();
+ $sql_extra = $this->personalSqlExtra();
if ($seen === 0) {
$sql_seen = " AND `item`.`unseen` = 1 ";
WHERE `item`.`visible` = 1
$sql_extra
$sql_seen
- AND `item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 0 " ,
+ AND `item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 0 ",
intval(local_user())
);
/**
* @brief Get personal notifications
*
- * @param int|string $seen
- * If 0 only include notifications into the query
- * which aren't marked as "seen"
+ * @param int|string $seen If 0 only include notifications into the query
+ * which aren't marked as "seen"
* @param int $start Start the query at this point
* @param int $limit Maximum number of query results
*
{
$ident = 'personal';
$total = $this->personalTotal($seen);
- $sql_extra = $this->_personal_sql_extra();
+ $sql_extra = $this->personalSqlExtra();
$notifs = array();
$sql_seen = "";
/**
* @brief Total number of home notifications
- * @param int|string $seen
- * If 0 only include notifications into the query
- * which aren't marked as "seen"
+ * @param int|string $seen If 0 only include notifications into the query
+ * which aren't marked as "seen"
+ *
* @return int Number of home notifications
*/
private function homeTotal($seen = 0)
/**
* @brief Get home notifications
*
- * @param int|string $seen
- * If 0 only include notifications into the query
- * which aren't marked as "seen"
+ * @param int|string $seen If 0 only include notifications into the query
+ * which aren't marked as "seen"
* @param int $start Start the query at this point
* @param int $limit Maximum number of query results
*
/**
* @brief Total number of introductions
- * @param bool $all
- * If false only include introductions into the query
- * which aren't marked as ignored
+ * @param bool $all If false only include introductions into the query
+ * which aren't marked as ignored
+ *
* @return int Number of introductions
*/
private function introTotal($all = false)
/**
* @brief Get introductions
*
- * @param bool $all
- * If false only include introductions into the query
- * which aren't marked as ignored
- * @param int $start Start the query at this point
- * @param int $limit Maximum number of query results
+ * @param bool $all If false only include introductions into the query
+ * which aren't marked as ignored
+ * @param int $start Start the query at this point
+ * @param int $limit Maximum number of query results
*
* @return array with
* string 'ident' => Notification identifier
* int 'total' => Total number of available introductions
* array 'notifications' => Introductions
*/
- public function introNotifs($all = false, $start = 0, $limit = 80) {
+ public function introNotifs($all = false, $start = 0, $limit = 80)
+ {
$ident = 'introductions';
$total = $this->introTotal($seen);
$notifs = array();
$sql_extra = " AND `ignore` = 0 ";
}
- /// @todo Fetch contact details by "get_contact_details_by_url" instead of queries to contact, fcontact and gcontact
+ /// @todo Fetch contact details by "Contact::getDetailsByUrl" instead of queries to contact, fcontact and gcontact
$r = q(
"SELECT `intro`.`id` AS `intro_id`, `intro`.*, `contact`.*,
`fcontact`.`name` AS `fname`, `fcontact`.`url` AS `furl`,
// If the network and addr is still not available
// get the missing data data from other sources
if ($arr['gnetwork'] == "" || $arr['gaddr'] == "") {
- $ret = get_contact_details_by_url($arr['url']);
+ $ret = Contact::getDetailsByURL($arr['url']);
if ($arr['gnetwork'] == "" && $ret['network'] != "") {
$arr['gnetwork'] = $ret['network'];