This merge brings back dbm::is_result() where I could find it.
Merge branch 'develop' of github.com:friendica/friendica into rhaeder-develop Signed-off-by: Roland Haeder <roland@mxchange.org>
This commit is contained in:
commit
c825cc8d0d
691 changed files with 128914 additions and 43052 deletions
189
mod/admin.php
189
mod/admin.php
|
@ -165,7 +165,7 @@ function admin_content(&$a) {
|
|||
|
||||
/* get plugins admin page */
|
||||
|
||||
$r = q("SELECT `name` FROM `addon` WHERE `plugin_admin`=1 ORDER BY `name`");
|
||||
$r = q("SELECT `name` FROM `addon` WHERE `plugin_admin` = 1 ORDER BY `name`");
|
||||
$aside_tools['plugins_admin']=array();
|
||||
foreach ($r as $h){
|
||||
$plugin =$h['name'];
|
||||
|
@ -271,7 +271,7 @@ function admin_page_federation(&$a) {
|
|||
// displayed on the stats page.
|
||||
$platforms = array('Friendica', 'Diaspora', '%%red%%', 'Hubzilla', 'GNU Social', 'StatusNet');
|
||||
$colors = array('Friendica' => '#ffc018', // orange from the logo
|
||||
'Diaspora' => '#a1a1a1', // logo is black and white, makes a gray
|
||||
'Diaspora' => '#a1a1a1', // logo is black and white, makes a gray
|
||||
'%%red%%' => '#c50001', // fire red from the logo
|
||||
'Hubzilla' => '#43488a', // blue from the logo
|
||||
'GNU Social'=> '#a22430', // dark red from the logo
|
||||
|
@ -282,17 +282,17 @@ function admin_page_federation(&$a) {
|
|||
foreach ($platforms as $p) {
|
||||
// get a total count for the platform, the name and version of the
|
||||
// highest version and the protocol tpe
|
||||
$c = q('SELECT count(*) AS total, platform, network, version FROM gserver
|
||||
WHERE platform LIKE "%s" AND last_contact > last_failure AND `version` != ""
|
||||
ORDER BY version ASC;', $p);
|
||||
$c = q('SELECT COUNT(*) AS `total`, `platform`, `network`, `version` FROM `gserver`
|
||||
WHERE `platform` LIKE "%s" AND `last_contact` > `last_failure` AND `version` != ""
|
||||
ORDER BY `version` ASC;', $p);
|
||||
$total = $total + $c[0]['total'];
|
||||
|
||||
// what versions for that platform do we know at all?
|
||||
// again only the active nodes
|
||||
$v = q('SELECT count(*) AS total, version FROM gserver
|
||||
WHERE last_contact > last_failure AND platform LIKE "%s" AND `version` != ""
|
||||
GROUP BY version
|
||||
ORDER BY version;', $p);
|
||||
$v = q('SELECT COUNT(*) AS `total`, `version` FROM `gserver`
|
||||
WHERE `last_contact` > `last_failure` AND `platform` LIKE "%s" AND `version` != ""
|
||||
GROUP BY `version`
|
||||
ORDER BY `version`;', $p);
|
||||
|
||||
//
|
||||
// clean up version numbers
|
||||
|
@ -386,7 +386,10 @@ function admin_page_federation(&$a) {
|
|||
*/
|
||||
function admin_page_queue(&$a) {
|
||||
// get content from the queue table
|
||||
$r = q("SELECT c.name,c.nurl,q.id,q.network,q.created,q.last from queue as q, contact as c where c.id=q.cid order by q.cid, q.created;");
|
||||
$r = q("SELECT `c`.`name`, `c`.`nurl`, `q`.`id`, `q`.`network`, `q`.`created`, `q`.`last`
|
||||
FROM `queue` AS `q`, `contact` AS `c`
|
||||
WHERE `c`.`id` = `q`.`cid`
|
||||
ORDER BY `q`.`cid`, `q`.`created`;");
|
||||
|
||||
$t = get_markup_template("admin_queue.tpl");
|
||||
return replace_macros($t, array(
|
||||
|
@ -416,7 +419,7 @@ function admin_page_queue(&$a) {
|
|||
* @return string
|
||||
*/
|
||||
function admin_page_summary(&$a) {
|
||||
$r = q("SELECT `page-flags`, COUNT(uid) as `count` FROM `user` GROUP BY `page-flags`");
|
||||
$r = q("SELECT `page-flags`, COUNT(`uid`) AS `count` FROM `user` GROUP BY `page-flags`");
|
||||
$accounts = array(
|
||||
array(t('Normal Account'), 0),
|
||||
array(t('Soapbox Account'), 0),
|
||||
|
@ -431,18 +434,25 @@ function admin_page_summary(&$a) {
|
|||
|
||||
logger('accounts: '.print_r($accounts,true),LOGGER_DATA);
|
||||
|
||||
$r = q("SELECT COUNT(id) as `count` FROM `register`");
|
||||
$r = q("SELECT COUNT(`id`) AS `count` FROM `register`");
|
||||
$pending = $r[0]['count'];
|
||||
|
||||
$r = q("select count(*) as total from deliverq where 1");
|
||||
$r = q("SELECT COUNT(*) AS `total` FROM `deliverq` WHERE 1");
|
||||
$deliverq = (($r) ? $r[0]['total'] : 0);
|
||||
|
||||
$r = q("select count(*) as total from queue where 1");
|
||||
$r = q("SELECT COUNT(*) AS `total` FROM `queue` WHERE 1");
|
||||
$queue = (($r) ? $r[0]['total'] : 0);
|
||||
|
||||
if (get_config('system','worker')) {
|
||||
$r = q("SELECT COUNT(*) AS `total` FROM `workerqueue` WHERE 1");
|
||||
$workerqueue = (($r) ? $r[0]['total'] : 0);
|
||||
} else {
|
||||
$workerqueue = 0;
|
||||
}
|
||||
|
||||
// We can do better, but this is a quick queue status
|
||||
|
||||
$queues = array('label' => t('Message queues'), 'deliverq' => $deliverq, 'queue' => $queue);
|
||||
$queues = array('label' => t('Message queues'), 'deliverq' => $deliverq, 'queue' => $queue, 'workerq' => $workerqueue);
|
||||
|
||||
|
||||
$t = get_markup_template("admin_summary.tpl");
|
||||
|
@ -536,10 +546,10 @@ function admin_page_site_post(&$a) {
|
|||
set_config('system','url',$new_url);
|
||||
|
||||
// send relocate
|
||||
$users = q("SELECT uid FROM user WHERE account_removed = 0 AND account_expired = 0");
|
||||
$users = q("SELECT `uid` FROM `user` WHERE `account_removed` = 0 AND `account_expired` = 0");
|
||||
|
||||
foreach ($users as $user) {
|
||||
proc_run('php', 'include/notifier.php', 'relocate', $user['uid']);
|
||||
proc_run(PRIORITY_HIGH, 'include/notifier.php', 'relocate', $user['uid']);
|
||||
}
|
||||
|
||||
info("Relocation started. Could take a while to complete.");
|
||||
|
@ -551,10 +561,10 @@ function admin_page_site_post(&$a) {
|
|||
$sitename = ((x($_POST,'sitename')) ? notags(trim($_POST['sitename'])) : '');
|
||||
$hostname = ((x($_POST,'hostname')) ? notags(trim($_POST['hostname'])) : '');
|
||||
$sender_email = ((x($_POST,'sender_email')) ? notags(trim($_POST['sender_email'])) : '');
|
||||
$banner = ((x($_POST,'banner')) ? trim($_POST['banner']) : false);
|
||||
$banner = ((x($_POST,'banner')) ? trim($_POST['banner']) : false);
|
||||
$shortcut_icon = ((x($_POST,'shortcut_icon')) ? notags(trim($_POST['shortcut_icon'])) : '');
|
||||
$touch_icon = ((x($_POST,'touch_icon')) ? notags(trim($_POST['touch_icon'])) : '');
|
||||
$info = ((x($_POST,'info')) ? trim($_POST['info']) : false);
|
||||
$info = ((x($_POST,'info')) ? trim($_POST['info']) : false);
|
||||
$language = ((x($_POST,'language')) ? notags(trim($_POST['language'])) : '');
|
||||
$theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : '');
|
||||
$theme_mobile = ((x($_POST,'theme_mobile')) ? notags(trim($_POST['theme_mobile'])) : '');
|
||||
|
@ -631,6 +641,7 @@ function admin_page_site_post(&$a) {
|
|||
$worker = ((x($_POST,'worker')) ? True : False);
|
||||
$worker_queues = ((x($_POST,'worker_queues')) ? intval($_POST['worker_queues']) : 4);
|
||||
$worker_dont_fork = ((x($_POST,'worker_dont_fork')) ? True : False);
|
||||
$worker_fastlane = ((x($_POST,'worker_fastlane')) ? True : False);
|
||||
|
||||
if($a->get_path() != "")
|
||||
$diaspora_enabled = false;
|
||||
|
@ -640,41 +651,41 @@ function admin_page_site_post(&$a) {
|
|||
|
||||
if($ssl_policy != intval(get_config('system','ssl_policy'))) {
|
||||
if($ssl_policy == SSL_POLICY_FULL) {
|
||||
q("update `contact` set
|
||||
`url` = replace(`url` , 'http:' , 'https:'),
|
||||
`photo` = replace(`photo` , 'http:' , 'https:'),
|
||||
`thumb` = replace(`thumb` , 'http:' , 'https:'),
|
||||
`micro` = replace(`micro` , 'http:' , 'https:'),
|
||||
`request` = replace(`request`, 'http:' , 'https:'),
|
||||
`notify` = replace(`notify` , 'http:' , 'https:'),
|
||||
`poll` = replace(`poll` , 'http:' , 'https:'),
|
||||
`confirm` = replace(`confirm`, 'http:' , 'https:'),
|
||||
`poco` = replace(`poco` , 'http:' , 'https:')
|
||||
where `self` = 1"
|
||||
q("UPDATE `contact` SET
|
||||
`url` = REPLACE(`url` , 'http:' , 'https:'),
|
||||
`photo` = REPLACE(`photo` , 'http:' , 'https:'),
|
||||
`thumb` = REPLACE(`thumb` , 'http:' , 'https:'),
|
||||
`micro` = REPLACE(`micro` , 'http:' , 'https:'),
|
||||
`request` = REPLACE(`request`, 'http:' , 'https:'),
|
||||
`notify` = REPLACE(`notify` , 'http:' , 'https:'),
|
||||
`poll` = REPLACE(`poll` , 'http:' , 'https:'),
|
||||
`confirm` = REPLACE(`confirm`, 'http:' , 'https:'),
|
||||
`poco` = REPLACE(`poco` , 'http:' , 'https:')
|
||||
WHERE `self` = 1"
|
||||
);
|
||||
q("update `profile` set
|
||||
`photo` = replace(`photo` , 'http:' , 'https:'),
|
||||
`thumb` = replace(`thumb` , 'http:' , 'https:')
|
||||
where 1 "
|
||||
q("UPDATE `profile` SET
|
||||
`photo` = REPLACE(`photo` , 'http:' , 'https:'),
|
||||
`thumb` = REPLACE(`thumb` , 'http:' , 'https:')
|
||||
WHERE 1 "
|
||||
);
|
||||
}
|
||||
elseif($ssl_policy == SSL_POLICY_SELFSIGN) {
|
||||
q("update `contact` set
|
||||
`url` = replace(`url` , 'https:' , 'http:'),
|
||||
`photo` = replace(`photo` , 'https:' , 'http:'),
|
||||
`thumb` = replace(`thumb` , 'https:' , 'http:'),
|
||||
`micro` = replace(`micro` , 'https:' , 'http:'),
|
||||
`request` = replace(`request`, 'https:' , 'http:'),
|
||||
`notify` = replace(`notify` , 'https:' , 'http:'),
|
||||
`poll` = replace(`poll` , 'https:' , 'http:'),
|
||||
`confirm` = replace(`confirm`, 'https:' , 'http:'),
|
||||
`poco` = replace(`poco` , 'https:' , 'http:')
|
||||
where `self` = 1"
|
||||
q("UPDATE `contact` SET
|
||||
`url` = REPLACE(`url` , 'https:' , 'http:'),
|
||||
`photo` = REPLACE(`photo` , 'https:' , 'http:'),
|
||||
`thumb` = REPLACE(`thumb` , 'https:' , 'http:'),
|
||||
`micro` = REPLACE(`micro` , 'https:' , 'http:'),
|
||||
`request` = REPLACE(`request`, 'https:' , 'http:'),
|
||||
`notify` = REPLACE(`notify` , 'https:' , 'http:'),
|
||||
`poll` = REPLACE(`poll` , 'https:' , 'http:'),
|
||||
`confirm` = REPLACE(`confirm`, 'https:' , 'http:'),
|
||||
`poco` = REPLACE(`poco` , 'https:' , 'http:')
|
||||
WHERE `self` = 1"
|
||||
);
|
||||
q("update `profile` set
|
||||
`photo` = replace(`photo` , 'https:' , 'http:'),
|
||||
`thumb` = replace(`thumb` , 'https:' , 'http:')
|
||||
where 1 "
|
||||
q("UPDATE `profile` SET
|
||||
`photo` = REPLACE(`photo` , 'https:' , 'http:'),
|
||||
`thumb` = REPLACE(`thumb` , 'https:' , 'http:')
|
||||
WHERE 1 "
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -780,6 +791,7 @@ function admin_page_site_post(&$a) {
|
|||
set_config('system','worker', $worker);
|
||||
set_config('system','worker_queues', $worker_queues);
|
||||
set_config('system','worker_dont_fork', $worker_dont_fork);
|
||||
set_config('system','worker_fastlane', $worker_fastlane);
|
||||
|
||||
if($rino==2 and !function_exists('mcrypt_create_iv')) {
|
||||
notice(t("RINO2 needs mcrypt php extension to work."));
|
||||
|
@ -869,7 +881,7 @@ function admin_page_site(&$a) {
|
|||
/* get user names to make the install a personal install of X */
|
||||
$user_names = array();
|
||||
$user_names['---'] = t('Multi user instance');
|
||||
$users = q("SELECT username, nickname FROM `user`");
|
||||
$users = q("SELECT `username`, `nickname` FROM `user`");
|
||||
foreach ($users as $user) {
|
||||
$user_names[$user['nickname']] = $user['username'];
|
||||
}
|
||||
|
@ -1010,6 +1022,7 @@ function admin_page_site(&$a) {
|
|||
'$worker' => array('worker', t("Enable 'worker' background processing"), get_config('system','worker'), t("The worker background processing limits the number of parallel background jobs to a maximum number and respects the system load.")),
|
||||
'$worker_queues' => array('worker_queues', t("Maximum number of parallel workers"), get_config('system','worker_queues'), t("On shared hosters set this to 2. On larger systems, values of 10 are great. Default value is 4.")),
|
||||
'$worker_dont_fork' => array('worker_dont_fork', t("Don't use 'proc_open' with the worker"), get_config('system','worker_dont_fork'), t("Enable this if your system doesn't allow the use of 'proc_open'. This can happen on shared hosters. If this is enabled you should increase the frequency of poller calls in your crontab.")),
|
||||
'$worker_fastlane' => array('worker_fastlane', t("Enable fastlane"), get_config('system','worker_fastlane'), t("When enabed, the fastlane mechanism starts an additional worker if processes with higher priority are blocked by processes of lower priority.")),
|
||||
|
||||
'$form_security_token' => get_form_security_token("admin_site")
|
||||
|
||||
|
@ -1077,8 +1090,8 @@ function admin_page_dbsync(&$a) {
|
|||
}
|
||||
|
||||
$failed = array();
|
||||
$r = q("select k, v from config where `cat` = 'database' ");
|
||||
if(dba::is_result($r)) {
|
||||
$r = q("SELECT `k`, `v` FROM `config` WHERE `cat` = 'database' ");
|
||||
if(dbm::is_result($r)) {
|
||||
foreach($r as $rr) {
|
||||
$upd = intval(substr($rr['k'],7));
|
||||
if($upd < 1139 || $rr['v'] === 'success')
|
||||
|
@ -1116,7 +1129,7 @@ function admin_page_users_post(&$a){
|
|||
$pending = (x($_POST, 'pending') ? $_POST['pending'] : array());
|
||||
$users = (x($_POST, 'user') ? $_POST['user'] : array());
|
||||
$nu_name = (x($_POST, 'new_user_name') ? $_POST['new_user_name'] : '');
|
||||
$nu_nickname = (x($_POST, 'new_user_nickname') ? $_POST['new_user_nickname'] : '');
|
||||
$nu_nickname = (x($_POST, 'new_user_nickname') ? $_POST['new_user_nickname'] : '');
|
||||
$nu_email = (x($_POST, 'new_user_email') ? $_POST['new_user_email'] : '');
|
||||
|
||||
check_form_security_token_redirectOnErr('/admin/users', 'admin_users');
|
||||
|
@ -1173,7 +1186,7 @@ function admin_page_users_post(&$a){
|
|||
|
||||
if(x($_POST,'page_users_block')) {
|
||||
foreach($users as $uid){
|
||||
q("UPDATE `user` SET `blocked`=1-`blocked` WHERE `uid`=%s",
|
||||
q("UPDATE `user` SET `blocked` = 1-`blocked` WHERE `uid` = %s",
|
||||
intval($uid)
|
||||
);
|
||||
}
|
||||
|
@ -1218,7 +1231,7 @@ function admin_page_users_post(&$a){
|
|||
function admin_page_users(&$a){
|
||||
if($a->argc>2) {
|
||||
$uid = $a->argv[3];
|
||||
$user = q("SELECT username, blocked FROM `user` WHERE `uid`=%d", intval($uid));
|
||||
$user = q("SELECT `username`, `blocked` FROM `user` WHERE `uid` = %d", intval($uid));
|
||||
if(count($user)==0) {
|
||||
notice('User not found'.EOL);
|
||||
goaway('admin/users');
|
||||
|
@ -1235,7 +1248,7 @@ function admin_page_users(&$a){
|
|||
}; break;
|
||||
case "block":{
|
||||
check_form_security_token_redirectOnErr('/admin/users', 'admin_users', 't');
|
||||
q("UPDATE `user` SET `blocked`=%d WHERE `uid`=%s",
|
||||
q("UPDATE `user` SET `blocked` = %d WHERE `uid` = %s",
|
||||
intval(1-$user[0]['blocked']),
|
||||
intval($uid)
|
||||
);
|
||||
|
@ -1255,12 +1268,42 @@ function admin_page_users(&$a){
|
|||
|
||||
|
||||
/* get users */
|
||||
$total = q("SELECT count(*) as total FROM `user` where 1");
|
||||
$total = q("SELECT COUNT(*) AS `total` FROM `user` WHERE 1");
|
||||
if(count($total)) {
|
||||
$a->set_pager_total($total[0]['total']);
|
||||
$a->set_pager_itemspage(100);
|
||||
}
|
||||
|
||||
/* ordering */
|
||||
$valid_orders = array(
|
||||
'contact.name',
|
||||
'user.email',
|
||||
'user.register_date',
|
||||
'user.login_date',
|
||||
'lastitem.lastitem_date',
|
||||
'user.page-flags'
|
||||
);
|
||||
|
||||
$order = "contact.name";
|
||||
$order_direction = "+";
|
||||
if (x($_GET,'o')){
|
||||
$new_order = $_GET['o'];
|
||||
if ($new_order[0]==="-") {
|
||||
$order_direction = "-";
|
||||
$new_order = substr($new_order,1);
|
||||
}
|
||||
|
||||
if (in_array($new_order, $valid_orders)){
|
||||
$order = $new_order;
|
||||
}
|
||||
if (x($_GET,'d')){
|
||||
$new_direction = $_GET['d'];
|
||||
|
||||
}
|
||||
}
|
||||
$sql_order = "`".str_replace('.','`.`',$order)."`";
|
||||
$sql_order_direction = ($order_direction==="+")?"ASC":"DESC";
|
||||
|
||||
$users = q("SELECT `user`.* , `contact`.`name` , `contact`.`url` , `contact`.`micro`, `lastitem`.`lastitem_date`, `user`.`account_expired`
|
||||
FROM
|
||||
(SELECT MAX(`item`.`changed`) as `lastitem_date`, `item`.`uid`
|
||||
|
@ -1273,12 +1316,14 @@ function admin_page_users(&$a){
|
|||
`user`.`uid` = `contact`.`uid`
|
||||
AND `user`.`verified` =1
|
||||
AND `contact`.`self` =1
|
||||
ORDER BY `contact`.`name` LIMIT %d, %d
|
||||
ORDER BY $sql_order $sql_order_direction LIMIT %d, %d
|
||||
",
|
||||
intval($a->pager['start']),
|
||||
intval($a->pager['itemspage'])
|
||||
);
|
||||
|
||||
|
||||
//echo "<pre>$users"; killme();
|
||||
|
||||
$adminlist = explode(",", str_replace(" ", "", $a->config['admin_email']));
|
||||
$_setup_users = function ($e) use ($adminlist){
|
||||
$accounts = array(
|
||||
|
@ -1325,6 +1370,11 @@ function admin_page_users(&$a){
|
|||
array_push($users, array_pop($tmp_users));
|
||||
}
|
||||
|
||||
$th_users = array_map(null,
|
||||
array(t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'), t('Account')),
|
||||
$valid_orders
|
||||
);
|
||||
|
||||
$t = get_markup_template("admin_users.tpl");
|
||||
$o = replace_macros($t, array(
|
||||
// strings //
|
||||
|
@ -1347,7 +1397,9 @@ function admin_page_users(&$a){
|
|||
'$h_users' => t('Users'),
|
||||
'$h_newuser' => t('New User'),
|
||||
'$th_deleted' => array(t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'), t('Deleted since')),
|
||||
'$th_users' => array(t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'), t('Account')),
|
||||
'$th_users' => $th_users,
|
||||
'$order_users' => $order,
|
||||
'$order_direction_users' => $order_direction,
|
||||
|
||||
'$confirm_delete_multi' => t('Selected users will be deleted!\n\nEverything these users had posted on this site will be permanently deleted!\n\nAre you sure?'),
|
||||
'$confirm_delete' => t('The user {0} will be deleted!\n\nEverything this user has posted on this site will be permanently deleted!\n\nAre you sure?'),
|
||||
|
@ -1809,12 +1861,18 @@ function admin_page_logs_post(&$a) {
|
|||
function admin_page_logs(&$a){
|
||||
|
||||
$log_choices = array(
|
||||
LOGGER_NORMAL => 'Normal',
|
||||
LOGGER_TRACE => 'Trace',
|
||||
LOGGER_DEBUG => 'Debug',
|
||||
LOGGER_DATA => 'Data',
|
||||
LOGGER_ALL => 'All'
|
||||
LOGGER_NORMAL => 'Normal',
|
||||
LOGGER_TRACE => 'Trace',
|
||||
LOGGER_DEBUG => 'Debug',
|
||||
LOGGER_DATA => 'Data',
|
||||
LOGGER_ALL => 'All'
|
||||
);
|
||||
|
||||
if (ini_get('log_errors')) {
|
||||
$phplogenabled = t('PHP log currently enabled.');
|
||||
} else {
|
||||
$phplogenabled = t('PHP log currently disabled.');
|
||||
}
|
||||
|
||||
$t = get_markup_template("admin_logs.tpl");
|
||||
|
||||
|
@ -1835,6 +1893,7 @@ function admin_page_logs(&$a){
|
|||
'$phpheader' => t("PHP logging"),
|
||||
'$phphint' => t("To enable logging of PHP errors and warnings you can add the following to the .htconfig.php file of your installation. The filename set in the 'error_log' line is relative to the friendica top-level directory and must be writeable by the web server. The option '1' for 'log_errors' and 'display_errors' is to enable these options, set to '0' to disable them."),
|
||||
'$phplogcode' => "error_reporting(E_ERROR | E_WARNING | E_PARSE);\nini_set('error_log','php.out');\nini_set('log_errors','1');\nini_set('display_errors', '1');",
|
||||
'$phplogenabled' => $phplogenabled,
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ function allfriends_content(&$a) {
|
|||
foreach($r as $rr) {
|
||||
|
||||
//get further details of the contact
|
||||
$contact_details = get_contact_details_by_url($rr['url'], $uid);
|
||||
$contact_details = get_contact_details_by_url($rr['url'], $uid, $rr);
|
||||
|
||||
$photo_menu = '';
|
||||
|
||||
|
@ -61,16 +61,18 @@ function allfriends_content(&$a) {
|
|||
}
|
||||
else {
|
||||
$connlnk = $a->get_baseurl() . '/follow/?url=' . $rr['url'];
|
||||
$photo_menu = array(array(t("View Profile"), zrl($rr['url'])));
|
||||
$photo_menu[] = array(t("Connect/Follow"), $connlnk);
|
||||
$photo_menu = array(
|
||||
'profile' => array(t("View Profile"), zrl($rr['url'])),
|
||||
'follow' => array(t("Connect/Follow"), $connlnk)
|
||||
);
|
||||
}
|
||||
|
||||
$entry = array(
|
||||
'url' => $rr['url'],
|
||||
'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']),
|
||||
'name' => htmlentities($rr['name']),
|
||||
'thumb' => proxy_url($rr['photo'], false, PROXY_SIZE_THUMB),
|
||||
'img_hover' => htmlentities($rr['name']),
|
||||
'name' => htmlentities($contact_details['name']),
|
||||
'thumb' => proxy_url($contact_details['thumb'], false, PROXY_SIZE_THUMB),
|
||||
'img_hover' => htmlentities($contact_details['name']),
|
||||
'details' => $contact_details['location'],
|
||||
'tags' => $contact_details['keywords'],
|
||||
'about' => $contact_details['about'],
|
||||
|
|
341
mod/cal.php
Normal file
341
mod/cal.php
Normal file
|
@ -0,0 +1,341 @@
|
|||
<?php
|
||||
/**
|
||||
* @file mod/cal.php
|
||||
* @brief The calendar module
|
||||
* This calendar is for profile visitors and contains only the events
|
||||
* of the profile owner
|
||||
*/
|
||||
|
||||
require_once('include/event.php');
|
||||
require_once('include/redir.php');
|
||||
|
||||
function cal_init(&$a) {
|
||||
if($a->argc > 1)
|
||||
auto_redir($a, $a->argv[1]);
|
||||
|
||||
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
|
||||
return;
|
||||
}
|
||||
|
||||
nav_set_selected('events');
|
||||
|
||||
$o = '';
|
||||
|
||||
if($a->argc > 1) {
|
||||
$nick = $a->argv[1];
|
||||
$user = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 LIMIT 1",
|
||||
dbesc($nick)
|
||||
);
|
||||
|
||||
if(! count($user))
|
||||
return;
|
||||
|
||||
$a->data['user'] = $user[0];
|
||||
$a->profile_uid = $user[0]['uid'];
|
||||
|
||||
// if it's a json request abort here becaus we don't
|
||||
// need the widget data
|
||||
if ($a->argv[2] === 'json')
|
||||
return;
|
||||
|
||||
$profile = get_profiledata_by_nick($nick, $a->profile_uid);
|
||||
|
||||
if((intval($profile['page-flags']) == PAGE_COMMUNITY) || (intval($profile['page-flags']) == PAGE_PRVGROUP))
|
||||
$account_type = t('Forum');
|
||||
else
|
||||
$account_type = "";
|
||||
|
||||
$tpl = get_markup_template("vcard-widget.tpl");
|
||||
|
||||
$vcard_widget .= replace_macros($tpl, array(
|
||||
'$name' => $profile['name'],
|
||||
'$photo' => $profile['photo'],
|
||||
'$addr' => (($profile['addr'] != "") ? $profile['addr'] : ""),
|
||||
'$account_type' => $account_type,
|
||||
'$pdesc' => (($profile['pdesc'] != "") ? $profile['pdesc'] : ""),
|
||||
));
|
||||
|
||||
$cal_widget = widget_events();
|
||||
|
||||
if(! x($a->page,'aside'))
|
||||
$a->page['aside'] = '';
|
||||
|
||||
$a->page['aside'] .= $vcard_widget;
|
||||
$a->page['aside'] .= $cal_widget;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
function cal_content(&$a) {
|
||||
nav_set_selected('events');
|
||||
|
||||
$editselect = 'none';
|
||||
if( feature_enabled(local_user(), 'richtext') )
|
||||
$editselect = 'textareas';
|
||||
|
||||
// First day of the week (0 = Sunday)
|
||||
$firstDay = get_pconfig(local_user(),'system','first_day_of_week');
|
||||
if ($firstDay === false) $firstDay=0;
|
||||
|
||||
// get the translation strings for the callendar
|
||||
$i18n = get_event_strings();
|
||||
|
||||
$htpl = get_markup_template('event_head.tpl');
|
||||
$a->page['htmlhead'] .= replace_macros($htpl,array(
|
||||
'$baseurl' => $a->get_baseurl(),
|
||||
'$module_url' => '/cal/' . $a->data['user']['nickname'],
|
||||
'$modparams' => 2,
|
||||
'$i18n' => $i18n,
|
||||
'$editselect' => $editselect
|
||||
));
|
||||
|
||||
$etpl = get_markup_template('event_end.tpl');
|
||||
$a->page['end'] .= replace_macros($etpl,array(
|
||||
'$baseurl' => $a->get_baseurl(),
|
||||
'$editselect' => $editselect
|
||||
));
|
||||
|
||||
$o ="";
|
||||
|
||||
$mode = 'view';
|
||||
$y = 0;
|
||||
$m = 0;
|
||||
$ignored = ((x($_REQUEST,'ignored')) ? intval($_REQUEST['ignored']) : 0);
|
||||
|
||||
if($a->argc == 4) {
|
||||
if($a->argv[2] == 'export') {
|
||||
$mode = 'export';
|
||||
$format = $a->argv[3];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Setup permissions structures
|
||||
//
|
||||
|
||||
$contact = null;
|
||||
$remote_contact = false;
|
||||
$contact_id = 0;
|
||||
|
||||
$owner_uid = $a->data['user']['uid'];
|
||||
$nick = $a->data['user']['nickname'];
|
||||
|
||||
if(is_array($_SESSION['remote'])) {
|
||||
foreach($_SESSION['remote'] as $v) {
|
||||
if($v['uid'] == $a->profile['profile_uid']) {
|
||||
$contact_id = $v['cid'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($contact_id) {
|
||||
$groups = init_groups_visitor($contact_id);
|
||||
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
intval($contact_id),
|
||||
intval($a->profile['profile_uid'])
|
||||
);
|
||||
if(count($r)) {
|
||||
$contact = $r[0];
|
||||
$remote_contact = true;
|
||||
}
|
||||
}
|
||||
if(! $remote_contact) {
|
||||
if(local_user()) {
|
||||
$contact_id = $_SESSION['cid'];
|
||||
$contact = $a->contact;
|
||||
}
|
||||
}
|
||||
$is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false);
|
||||
|
||||
if($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) {
|
||||
notice( t('Access to this profile has been restricted.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
// get the permissions
|
||||
$sql_perms = item_permissions_sql($owner_uid,$remote_contact,$groups);
|
||||
// we only want to have the events of the profile owner
|
||||
$sql_extra = " AND `event`.`cid` = 0 " . $sql_perms;
|
||||
|
||||
// get the tab navigation bar
|
||||
$tabs .= profile_tabs($a,false, $a->data['user']['nickname']);
|
||||
|
||||
// The view mode part is similiar to /mod/events.php
|
||||
if($mode == 'view') {
|
||||
|
||||
|
||||
$thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y');
|
||||
$thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m');
|
||||
if(! $y)
|
||||
$y = intval($thisyear);
|
||||
if(! $m)
|
||||
$m = intval($thismonth);
|
||||
|
||||
// Put some limits on dates. The PHP date functions don't seem to do so well before 1900.
|
||||
// An upper limit was chosen to keep search engines from exploring links millions of years in the future.
|
||||
|
||||
if($y < 1901)
|
||||
$y = 1900;
|
||||
if($y > 2099)
|
||||
$y = 2100;
|
||||
|
||||
$nextyear = $y;
|
||||
$nextmonth = $m + 1;
|
||||
if($nextmonth > 12) {
|
||||
$nextmonth = 1;
|
||||
$nextyear ++;
|
||||
}
|
||||
|
||||
$prevyear = $y;
|
||||
if($m > 1)
|
||||
$prevmonth = $m - 1;
|
||||
else {
|
||||
$prevmonth = 12;
|
||||
$prevyear --;
|
||||
}
|
||||
|
||||
$dim = get_dim($y,$m);
|
||||
$start = sprintf('%d-%d-%d %d:%d:%d',$y,$m,1,0,0,0);
|
||||
$finish = sprintf('%d-%d-%d %d:%d:%d',$y,$m,$dim,23,59,59);
|
||||
|
||||
|
||||
if ($a->argv[2] === 'json'){
|
||||
if (x($_GET,'start')) $start = date("Y-m-d h:i:s", $_GET['start']);
|
||||
if (x($_GET,'end')) $finish = date("Y-m-d h:i:s", $_GET['end']);
|
||||
}
|
||||
|
||||
$start = datetime_convert('UTC','UTC',$start);
|
||||
$finish = datetime_convert('UTC','UTC',$finish);
|
||||
|
||||
$adjust_start = datetime_convert('UTC', date_default_timezone_get(), $start);
|
||||
$adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish);
|
||||
|
||||
// put the event parametes in an array so we can better transmit them
|
||||
$event_params = array(
|
||||
'event_id' => (x($_GET,'id') ? $_GET["id"] : 0),
|
||||
'start' => $start,
|
||||
'finish' => $finish,
|
||||
'adjust_start' => $adjust_start,
|
||||
'adjust_finish' => $adjust_finish,
|
||||
'ignored' => $ignored,
|
||||
);
|
||||
|
||||
// get events by id or by date
|
||||
if (x($_GET,'id')){
|
||||
$r = event_by_id($owner_uid, $event_params, $sql_extra);
|
||||
} else {
|
||||
$r = events_by_date($owner_uid, $event_params, $sql_extra);
|
||||
}
|
||||
|
||||
$links = array();
|
||||
|
||||
if(count($r)) {
|
||||
$r = sort_by_date($r);
|
||||
foreach($r as $rr) {
|
||||
$j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j'));
|
||||
if(! x($links,$j))
|
||||
$links[$j] = $a->get_baseurl() . '/' . $a->cmd . '#link-' . $j;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$events=array();
|
||||
|
||||
// transform the event in a usable array
|
||||
if(count($r))
|
||||
$r = sort_by_date($r);
|
||||
$events = process_events($r);
|
||||
|
||||
if ($a->argv[2] === 'json'){
|
||||
echo json_encode($events); killme();
|
||||
}
|
||||
|
||||
// links: array('href', 'text', 'extra css classes', 'title')
|
||||
if (x($_GET,'id')){
|
||||
$tpl = get_markup_template("event.tpl");
|
||||
} else {
|
||||
// if (get_config('experimentals','new_calendar')==1){
|
||||
$tpl = get_markup_template("events-js.tpl");
|
||||
// } else {
|
||||
// $tpl = get_markup_template("events.tpl");
|
||||
// }
|
||||
}
|
||||
|
||||
// Get rid of dashes in key names, Smarty3 can't handle them
|
||||
foreach($events as $key => $event) {
|
||||
$event_item = array();
|
||||
foreach($event['item'] as $k => $v) {
|
||||
$k = str_replace('-','_',$k);
|
||||
$event_item[$k] = $v;
|
||||
}
|
||||
$events[$key]['item'] = $event_item;
|
||||
}
|
||||
|
||||
$o = replace_macros($tpl, array(
|
||||
'$baseurl' => $a->get_baseurl(),
|
||||
'$tabs' => $tabs,
|
||||
'$title' => t('Events'),
|
||||
'$view' => t('View'),
|
||||
'$previus' => array($a->get_baseurl()."/events/$prevyear/$prevmonth",t('Previous'),'',''),
|
||||
'$next' => array($a->get_baseurl()."/events/$nextyear/$nextmonth",t('Next'),'',''),
|
||||
'$calendar' => cal($y,$m,$links, ' eventcal'),
|
||||
|
||||
'$events' => $events,
|
||||
|
||||
"today" => t("today"),
|
||||
"month" => t("month"),
|
||||
"week" => t("week"),
|
||||
"day" => t("day"),
|
||||
|
||||
|
||||
));
|
||||
|
||||
if (x($_GET,'id')){ echo $o; killme(); }
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
if($mode == 'export') {
|
||||
if(! (intval($owner_uid))) {
|
||||
notice( t('User not found'));
|
||||
return;
|
||||
}
|
||||
|
||||
// Test permissions
|
||||
// Respect the export feature setting for all other /cal pages if it's not the own profile
|
||||
if( ((local_user() !== intval($owner_uid))) && ! feature_enabled($owner_uid, "export_calendar")) {
|
||||
notice( t('Permission denied.') . EOL);
|
||||
goaway('cal/' . $nick);
|
||||
}
|
||||
|
||||
// Get the export data by uid
|
||||
$evexport = event_export($owner_uid, $format);
|
||||
|
||||
if (!$evexport["success"]) {
|
||||
if($evexport["content"])
|
||||
notice( t('This calendar format is not supported') );
|
||||
else
|
||||
notice( t('No exportable data found'));
|
||||
|
||||
// If it the own calendar return to the events page
|
||||
// otherwise to the profile calendar page
|
||||
if (local_user() === intval($owner_uid))
|
||||
$return_path = "events";
|
||||
else
|
||||
$returnpath = "cal/".$nick;
|
||||
|
||||
goaway($return_path);
|
||||
}
|
||||
|
||||
// If nothing went wrong we can echo the export content
|
||||
if ($evexport["success"]) {
|
||||
header('Content-type: text/calendar');
|
||||
header('content-disposition: attachment; filename="' . t('calendar') . '-' . $nick . '.' . $evexport["extension"] . '"' );
|
||||
echo $evexport["content"];
|
||||
killme();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -57,13 +57,13 @@ function common_content(&$a) {
|
|||
dbesc(normalise_link(get_my_url())),
|
||||
intval($profile_uid)
|
||||
);
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$cid = $r[0]['id'];
|
||||
else {
|
||||
$r = q("SELECT `id` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
|
||||
dbesc(normalise_link(get_my_url()))
|
||||
);
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$zcid = $r[0]['id'];
|
||||
}
|
||||
}
|
||||
|
@ -109,14 +109,14 @@ function common_content(&$a) {
|
|||
$rr[id] = $rr[cid];
|
||||
|
||||
$photo_menu = '';
|
||||
$photo_menu = contact_photo_menu ($rr);
|
||||
$photo_menu = contact_photo_menu($rr);
|
||||
|
||||
$entry = array(
|
||||
'url' => $rr['url'],
|
||||
'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']),
|
||||
'name' => $rr['name'],
|
||||
'thumb' => proxy_url($rr['photo'], false, PROXY_SIZE_THUMB),
|
||||
'img_hover' => htmlentities($rr['name']),
|
||||
'name' => $contact_details['name'],
|
||||
'thumb' => proxy_url($contact_details['thumb'], false, PROXY_SIZE_THUMB),
|
||||
'img_hover' => htmlentities($contact_details['name']),
|
||||
'details' => $contact_details['location'],
|
||||
'tags' => $contact_details['keywords'],
|
||||
'about' => $contact_details['about'],
|
||||
|
|
|
@ -59,7 +59,7 @@ function community_content(&$a, $update = 0) {
|
|||
AND `item`.`private` = 0 AND `item`.`wall` = 1"
|
||||
);
|
||||
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$a->set_pager_total($r[0]['total']);
|
||||
|
||||
if(! $r[0]['total']) {
|
||||
|
@ -120,23 +120,18 @@ function community_getitems($start, $itemspage) {
|
|||
if (get_config('system','community_page_style') == CP_GLOBAL_COMMUNITY)
|
||||
return(community_getpublicitems($start, $itemspage));
|
||||
|
||||
$r = q("SELECT `item`.`uri`, `item`.*, `item`.`id` AS `item_id`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`,
|
||||
`user`.`nickname`, `user`.`hidewall`
|
||||
$r = q("SELECT %s
|
||||
FROM `thread` FORCE INDEX (`wall_private_received`)
|
||||
INNER JOIN `user` ON `user`.`uid` = `thread`.`uid` AND `user`.`hidewall` = 0
|
||||
INNER JOIN `user` ON `user`.`uid` = `thread`.`uid` AND NOT `user`.`hidewall`
|
||||
INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
|
||||
AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
|
||||
AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''
|
||||
INNER JOIN `contact` ON `contact`.`id` = `thread`.`contact-id`
|
||||
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`self`
|
||||
WHERE `thread`.`visible` = 1 AND `thread`.`deleted` = 0 and `thread`.`moderated` = 0
|
||||
AND `thread`.`private` = 0 AND `thread`.`wall` = 1
|
||||
ORDER BY `thread`.`received` DESC LIMIT %d, %d ",
|
||||
intval($start),
|
||||
intval($itemspage)
|
||||
%s AND `contact`.`self`
|
||||
WHERE `thread`.`visible` AND NOT `thread`.`deleted` AND NOT `thread`.`moderated`
|
||||
AND NOT `thread`.`private` AND `thread`.`wall`
|
||||
ORDER BY `thread`.`received` DESC LIMIT %d, %d",
|
||||
item_fieldlists(), item_joins(),
|
||||
intval($start), intval($itemspage)
|
||||
);
|
||||
|
||||
return($r);
|
||||
|
@ -144,15 +139,14 @@ function community_getitems($start, $itemspage) {
|
|||
}
|
||||
|
||||
function community_getpublicitems($start, $itemspage) {
|
||||
$r = q("SELECT `item`.`uri`, `item`.*, `item`.`id` AS `item_id`,
|
||||
`author-name` AS `name`, `owner-avatar` AS `photo`,
|
||||
`owner-link` AS `url`, `owner-avatar` AS `thumb`
|
||||
|
||||
$r = q("SELECT %s
|
||||
FROM `thread`
|
||||
INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
|
||||
INNER JOIN `item` ON `item`.`id` = `thread`.`iid` %s
|
||||
WHERE `thread`.`uid` = 0
|
||||
ORDER BY `thread`.`created` DESC LIMIT %d, %d",
|
||||
intval($start),
|
||||
intval($itemspage)
|
||||
item_fieldlists(), item_joins(),
|
||||
intval($start), intval($itemspage)
|
||||
);
|
||||
|
||||
return($r);
|
||||
|
|
|
@ -14,7 +14,7 @@ function contactgroup_content(&$a) {
|
|||
intval($a->argv[2]),
|
||||
intval(local_user())
|
||||
);
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$change = intval($a->argv[2]);
|
||||
}
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ function _contact_update($contact_id) {
|
|||
intval($contact_id));
|
||||
} else
|
||||
// pull feed and consume it, which should subscribe to the hub.
|
||||
proc_run('php',"include/onepoll.php","$contact_id", "force");
|
||||
proc_run(PRIORITY_MEDIUM, "include/onepoll.php", $contact_id, "force");
|
||||
}
|
||||
|
||||
function _contact_update_profile($contact_id) {
|
||||
|
@ -434,7 +434,8 @@ function contacts_content(&$a) {
|
|||
$a->page['aside'] = '';
|
||||
|
||||
return replace_macros(get_markup_template('contact_drop_confirm.tpl'), array(
|
||||
'$contact' => _contact_detail_for_template($orig_record[0]),
|
||||
'$header' => t('Drop contact'),
|
||||
'$contact' => _contact_detail_for_template($orig_record[0]),
|
||||
'$method' => 'get',
|
||||
'$message' => t('Do you really want to delete this contact?'),
|
||||
'$extra_inputs' => $inputs,
|
||||
|
@ -571,6 +572,7 @@ function contacts_content(&$a) {
|
|||
|
||||
$o .= replace_macros($tpl, array(
|
||||
//'$header' => t('Contact Editor'),
|
||||
'$header' => t("Contact"),
|
||||
'$tab_str' => $tab_str,
|
||||
'$submit' => t('Submit'),
|
||||
'$lbl_vis1' => t('Profile Visibility'),
|
||||
|
@ -604,6 +606,7 @@ function contacts_content(&$a) {
|
|||
'$ignore_text' => (($contact['readonly']) ? t('Unignore') : t('Ignore') ),
|
||||
'$insecure' => (($contact['network'] !== NETWORK_DFRN && $contact['network'] !== NETWORK_MAIL && $contact['network'] !== NETWORK_FACEBOOK && $contact['network'] !== NETWORK_DIASPORA) ? $insecure : ''),
|
||||
'$info' => $contact['info'],
|
||||
'$cinfo' => array('info', '', $contact['info'], ''),
|
||||
'$blocked' => (($contact['blocked']) ? t('Currently blocked') : ''),
|
||||
'$ignored' => (($contact['readonly']) ? t('Currently ignored') : ''),
|
||||
'$archived' => (($contact['archive']) ? t('Currently archived') : ''),
|
||||
|
@ -620,6 +623,7 @@ function contacts_content(&$a) {
|
|||
'$url' => $url,
|
||||
'$profileurllabel' => t('Profile URL'),
|
||||
'$profileurl' => $contact['url'],
|
||||
'account_type' => (($contact['forum'] || $contact['prv']) ? t('Forum') : ''),
|
||||
'$location' => bbcode($contact["location"]),
|
||||
'$location_label' => t("Location:"),
|
||||
'$about' => bbcode($contact["about"], false, false),
|
||||
|
@ -630,6 +634,7 @@ function contacts_content(&$a) {
|
|||
'$contact_actions' => $contact_actions,
|
||||
'$contact_status' => t("Status"),
|
||||
'$contact_settings_label' => t('Contact Settings'),
|
||||
'$contact_profile_label' => t("Profile"),
|
||||
|
||||
));
|
||||
|
||||
|
@ -758,7 +763,7 @@ function contacts_content(&$a) {
|
|||
$r = q("SELECT COUNT(*) AS `total` FROM `contact`
|
||||
WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ",
|
||||
intval($_SESSION['uid']));
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$a->set_pager_total($r[0]['total']);
|
||||
$total = $r[0]['total'];
|
||||
}
|
||||
|
@ -773,7 +778,7 @@ function contacts_content(&$a) {
|
|||
intval($a->pager['itemspage'])
|
||||
);
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
foreach($r as $rr) {
|
||||
$contacts[] = _contact_detail_for_template($rr);
|
||||
}
|
||||
|
@ -787,7 +792,7 @@ function contacts_content(&$a) {
|
|||
'$total' => $total,
|
||||
'$search' => $search_hdr,
|
||||
'$desc' => t('Search your contacts'),
|
||||
'$finding' => (($searching) ? t('Finding: ') . "'" . $search . "'" : ""),
|
||||
'$finding' => (($searching) ? sprintf(t('Results for: %s'),$search) : ""),
|
||||
'$submit' => t('Find'),
|
||||
'$cmd' => $a->cmd,
|
||||
'$contacts' => $contacts,
|
||||
|
@ -800,6 +805,7 @@ function contacts_content(&$a) {
|
|||
"contacts_batch_archive" => t('Archive')."/".t("Unarchive"),
|
||||
"contacts_batch_drop" => t('Delete'),
|
||||
),
|
||||
'$h_batch_actions' => t('Batch Actions'),
|
||||
'$paginate' => paginate($a),
|
||||
|
||||
));
|
||||
|
|
122
mod/content.php
122
mod/content.php
|
@ -93,7 +93,7 @@ function content_content(&$a, $update = 0) {
|
|||
);
|
||||
|
||||
$str = '';
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
foreach($r as $rr)
|
||||
$str .= '<' . $rr['id'] . '>';
|
||||
if(strlen($str))
|
||||
|
@ -141,7 +141,7 @@ function content_content(&$a, $update = 0) {
|
|||
AND `blocked` = 0 AND `pending` = 0 LIMIT 1",
|
||||
intval($cid)
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$sql_extra = " AND `item`.`parent` IN ( SELECT DISTINCT(`parent`) FROM `item` WHERE 1 $sql_options AND `contact-id` = " . intval($cid) . " and deleted = 0 ) ";
|
||||
|
||||
}
|
||||
|
@ -217,14 +217,14 @@ function content_content(&$a, $update = 0) {
|
|||
$items = q("SELECT `item`.*, `item`.`id` AS `item_id`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, `contact`.`writable`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
`contact`.`id` AS `cid`
|
||||
FROM $sql_table INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1
|
||||
AND `item`.`deleted` = 0 and `item`.`moderated` = 0
|
||||
$simple_update
|
||||
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||
$sql_extra $sql_nets
|
||||
ORDER BY `item`.`received` DESC $pager_sql ",
|
||||
ORDER BY `item`.`id` DESC $pager_sql ",
|
||||
intval($_SESSION['uid'])
|
||||
);
|
||||
|
||||
|
@ -259,7 +259,7 @@ function content_content(&$a, $update = 0) {
|
|||
$parents_arr = array();
|
||||
$parents_str = '';
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
foreach($r as $rr)
|
||||
if(! in_array($rr['item_id'],$parents_arr))
|
||||
$parents_arr[] = $rr['item_id'];
|
||||
|
@ -268,7 +268,7 @@ function content_content(&$a, $update = 0) {
|
|||
$items = q("SELECT `item`.*, `item`.`id` AS `item_id`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`, `contact`.`writable`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
`contact`.`id` AS `cid`
|
||||
FROM $sql_table INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
|
||||
AND `item`.`moderated` = 0
|
||||
|
@ -319,6 +319,15 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
|||
|
||||
$previewing = (($preview) ? ' preview ' : '');
|
||||
|
||||
$edited = false;
|
||||
if (strcmp($item['created'], $item['edited'])<>0) {
|
||||
$edited = array(
|
||||
'label' => t('This entry was edited'),
|
||||
'date' => datetime_convert('UTC', date_default_timezone_get(), $item['edited'], 'r'),
|
||||
'relative' => relative_date($item['edited'])
|
||||
);
|
||||
}
|
||||
|
||||
if($mode === 'network') {
|
||||
$profile_owner = local_user();
|
||||
$page_writeable = true;
|
||||
|
@ -349,8 +358,6 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
|||
else
|
||||
$return_url = $_SESSION['return_url'] = $a->query_string;
|
||||
|
||||
load_contact_links(local_user());
|
||||
|
||||
$cb = array('items' => $items, 'mode' => $mode, 'update' => $update, 'preview' => $preview);
|
||||
call_hooks('conversation_start',$cb);
|
||||
|
||||
|
@ -361,8 +368,10 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
|||
$wallwall = 'wallwall_item.tpl';
|
||||
$hide_comments_tpl = get_markup_template('hide_comments.tpl');
|
||||
|
||||
$alike = array();
|
||||
$dlike = array();
|
||||
$conv_responses = array(
|
||||
'like' => array('title' => t('Likes','title')), 'dislike' => array('title' => t('Dislikes','title')),
|
||||
'attendyes' => array('title' => t('Attending','title')), 'attendno' => array('title' => t('Not attending','title')), 'attendmaybe' => array('title' => t('Might attend','title'))
|
||||
);
|
||||
|
||||
|
||||
// array with html for each thread (parent+comments)
|
||||
|
@ -389,7 +398,11 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
|||
$sparkle = '';
|
||||
|
||||
if($mode === 'search' || $mode === 'community') {
|
||||
if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE)))
|
||||
if(((activity_match($item['verb'],ACTIVITY_LIKE))
|
||||
|| (activity_match($item['verb'],ACTIVITY_DISLIKE))
|
||||
|| activity_match($item['verb'],ACTIVITY_ATTEND)
|
||||
|| activity_match($item['verb'],ACTIVITY_ATTENDNO)
|
||||
|| activity_match($item['verb'],ACTIVITY_ATTENDMAYBE))
|
||||
&& ($item['id'] != $item['parent']))
|
||||
continue;
|
||||
$nickname = $item['nickname'];
|
||||
|
@ -416,11 +429,12 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
|||
else
|
||||
$profile_link = zrl($profile_link);
|
||||
|
||||
$normalised = normalise_link((strlen($item['author-link'])) ? $item['author-link'] : $item['url']);
|
||||
if(($normalised != 'mailbox') && (x($a->contacts[$normalised])))
|
||||
$profile_avatar = $a->contacts[$normalised]['thumb'];
|
||||
// Don't rely on the author-avatar. It is better to use the data from the contact table
|
||||
$author_contact = get_contact_details_by_url($item['author-link'], $profile_owner);
|
||||
if ($author_contact["thumb"])
|
||||
$profile_avatar = $author_contact["thumb"];
|
||||
else
|
||||
$profile_avatar = $a->remove_baseurl(((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']));
|
||||
$profile_avatar = $item['author-avatar'];
|
||||
|
||||
$locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
|
||||
call_hooks('render_location',$locate);
|
||||
|
@ -530,12 +544,11 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
|||
$comments[$item['parent']] = 0; // avoid notices later on
|
||||
}
|
||||
|
||||
// map all the like/dislike activities for each parent item
|
||||
// map all the like/dislike/attendance activities for each parent item
|
||||
// Store these in the $alike and $dlike arrays
|
||||
|
||||
foreach($items as $item) {
|
||||
like_puller($a,$item,$alike,'like');
|
||||
like_puller($a,$item,$dlike,'dislike');
|
||||
builtin_activity_puller($item, $conv_responses);
|
||||
}
|
||||
|
||||
$comments_collapsed = false;
|
||||
|
@ -557,7 +570,10 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
|||
// We've already parsed out like/dislike for special treatment. We can ignore them now
|
||||
|
||||
if(((activity_match($item['verb'],ACTIVITY_LIKE))
|
||||
|| (activity_match($item['verb'],ACTIVITY_DISLIKE)))
|
||||
|| (activity_match($item['verb'],ACTIVITY_DISLIKE)
|
||||
|| activity_match($item['verb'],ACTIVITY_ATTEND)
|
||||
|| activity_match($item['verb'],ACTIVITY_ATTENDNO)
|
||||
|| activity_match($item['verb'],ACTIVITY_ATTENDMAYBE)))
|
||||
&& ($item['id'] != $item['parent']))
|
||||
continue;
|
||||
|
||||
|
@ -761,6 +777,28 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
|||
'tagger' => t("add tag"),
|
||||
'classtagger' => "",
|
||||
);
|
||||
|
||||
$r = q("SELECT `ignored` FROM `thread` WHERE `uid` = %d AND `iid` = %d LIMIT 1",
|
||||
intval($item['uid']),
|
||||
intval($item['id'])
|
||||
);
|
||||
if (count($r)) {
|
||||
$ignore = array(
|
||||
'do' => t("ignore thread"),
|
||||
'undo' => t("unignore thread"),
|
||||
'toggle' => t("toggle ignore status"),
|
||||
'classdo' => (($r[0]['ignored']) ? "hidden" : ""),
|
||||
'classundo' => (($r[0]['ignored']) ? "" : "hidden"),
|
||||
'ignored' => t('ignored'),
|
||||
);
|
||||
}
|
||||
$tagger = '';
|
||||
if(feature_enabled($profile_owner,'commtag')) {
|
||||
$tagger = array(
|
||||
'add' => t("add tag"),
|
||||
'class' => "",
|
||||
);
|
||||
}
|
||||
}
|
||||
$filer = t("save to folder");
|
||||
}
|
||||
|
@ -787,14 +825,30 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
|||
else
|
||||
$profile_link = zrl($profile_link);
|
||||
|
||||
$normalised = normalise_link((strlen($item['author-link'])) ? $item['author-link'] : $item['url']);
|
||||
if(($normalised != 'mailbox') && (x($a->contacts,$normalised)))
|
||||
$profile_avatar = $a->contacts[$normalised]['thumb'];
|
||||
// Don't rely on the author-avatar. It is better to use the data from the contact table
|
||||
$author_contact = get_contact_details_by_url($item['author-link'], $profile_owner);
|
||||
if ($author_contact["thumb"])
|
||||
$profile_avatar = $author_contact["thumb"];
|
||||
else
|
||||
$profile_avatar = $a->remove_baseurl(((strlen($item['author-avatar']) && $diff_author) ? $item['author-avatar'] : $thumb));
|
||||
$profile_avatar = $item['author-avatar'];
|
||||
|
||||
$like = ((x($alike,$item['uri'])) ? format_like($alike[$item['uri']],$alike[$item['uri'] . '-l'],'like',$item['uri']) : '');
|
||||
$dislike = ((x($dlike,$item['uri'])) ? format_like($dlike[$item['uri']],$dlike[$item['uri'] . '-l'],'dislike',$item['uri']) : '');
|
||||
$like = ((x($conv_responses['like'],$item['uri'])) ? format_like($conv_responses['like'][$item['uri']],$conv_responses['like'][$item['uri'] . '-l'],'like',$item['uri']) : '');
|
||||
$dislike = ((x($conv_responses['dislike'],$item['uri'])) ? format_like($conv_responses['dislike'][$item['uri']],$conv_responses['dislike'][$item['uri'] . '-l'],'dislike',$item['uri']) : '');
|
||||
|
||||
// process action responses - e.g. like/dislike/attend/agree/whatever
|
||||
$response_verbs = array('like');
|
||||
if(feature_enabled($profile_owner,'dislike'))
|
||||
$response_verbs[] = 'dislike';
|
||||
if($item['object-type'] === ACTIVITY_OBJ_EVENT) {
|
||||
$response_verbs[] = 'attendyes';
|
||||
$response_verbs[] = 'attendno';
|
||||
$response_verbs[] = 'attendmaybe';
|
||||
if($page_writeable) {
|
||||
$isevent = true;
|
||||
$attend = array( t('I will attend'), t('I will not attend'), t('I might attend'));
|
||||
}
|
||||
}
|
||||
$responses = get_responses($conv_responses,$response_verbs,'',$item);
|
||||
|
||||
$locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
|
||||
call_hooks('render_location',$locate);
|
||||
|
@ -805,9 +859,9 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
|||
|
||||
$shiny = "";
|
||||
if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0)
|
||||
$shiny = 'shiny';
|
||||
$shiny = 'shiny';
|
||||
|
||||
//
|
||||
//
|
||||
localize_item($item);
|
||||
|
||||
|
||||
|
@ -851,6 +905,8 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
|||
'body' => $body_e,
|
||||
'text' => $text_e,
|
||||
'id' => $item['item_id'],
|
||||
'isevent' => $isevent,
|
||||
'attend' => $attend,
|
||||
'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
|
||||
'olinktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['owner-link'])) ? $item['owner-link'] : $item['url'])),
|
||||
'to' => t('to'),
|
||||
|
@ -863,7 +919,10 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
|||
'osparkle' => $osparkle,
|
||||
'sparkle' => $sparkle,
|
||||
'title' => $title_e,
|
||||
'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'),
|
||||
'ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])),
|
||||
'app' => $item['app'],
|
||||
'created' => relative_date($item['created']),
|
||||
'lock' => $lock,
|
||||
'location' => $location_e,
|
||||
'indent' => $indent,
|
||||
|
@ -875,14 +934,21 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
|||
'edpost' => $edpost,
|
||||
'isstarred' => $isstarred,
|
||||
'star' => $star,
|
||||
'filer' => $filer,
|
||||
'ignore' => ((feature_enabled($profile_owner,'ignore_posts')) ? $ignore : ''),
|
||||
'tagger' => $tagger,
|
||||
'filer' => ((feature_enabled($profile_owner,'filing')) ? $filer : ''),
|
||||
'drop' => $drop,
|
||||
'vote' => $likebuttons,
|
||||
'responses' => $responses,
|
||||
'like' => $like,
|
||||
'dislike' => $dislike,
|
||||
'switchcomment' => t('Comment'),
|
||||
'comment' => $comment,
|
||||
'previewing' => $previewing,
|
||||
'wait' => t('Please wait'),
|
||||
'edited' => $edited,
|
||||
'network' => $item["item_network"],
|
||||
'network_name' => network_to_name($item['network'], $profile_link),
|
||||
|
||||
);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ function crepair_init(&$a) {
|
|||
|
||||
if($contact_id) {
|
||||
$a->data['contact'] = $r[0];
|
||||
$contact = $r[0];
|
||||
$contact = $r[0];
|
||||
profile_load($a, "", 0, get_contact_details_by_url($contact["url"]));
|
||||
}
|
||||
}
|
||||
|
@ -150,15 +150,9 @@ function crepair_content(&$a) {
|
|||
'$return' => t('Return to contact editor'),
|
||||
'$update_profile' => update_profile,
|
||||
'$udprofilenow' => t('Refetch contact data'),
|
||||
'$label_name' => t('Name'),
|
||||
'$label_nick' => t('Account Nickname'),
|
||||
'$label_attag' => t('@Tagname - overrides Name/Nickname'),
|
||||
'$label_url' => t('Account URL'),
|
||||
'$label_request' => t('Friend Request URL'),
|
||||
'$label_confirm' => t('Friend Confirm URL'),
|
||||
'$label_notify' => t('Notification Endpoint URL'),
|
||||
'$label_poll' => t('Poll/Feed URL'),
|
||||
'$label_photo' => t('New photo from this URL'),
|
||||
'$contact_id' => $contact['id'],
|
||||
'$lbl_submit' => t('Submit'),
|
||||
|
||||
'$label_remote_self' => t('Remote Self'),
|
||||
'$allow_remote_self' => $allow_remote_self,
|
||||
'$remote_self' => array('remote_self',
|
||||
|
@ -167,16 +161,16 @@ function crepair_content(&$a) {
|
|||
t('Mark this contact as remote_self, this will cause friendica to repost new entries from this contact.'),
|
||||
$remote_self_options
|
||||
),
|
||||
'$contact_name' => htmlentities($contact['name']),
|
||||
'$contact_nick' => htmlentities($contact['nick']),
|
||||
'$contact_id' => $contact['id'],
|
||||
'$contact_url' => $contact['url'],
|
||||
'$request' => $contact['request'],
|
||||
'$confirm' => $contact['confirm'],
|
||||
'$notify' => $contact['notify'],
|
||||
'$poll' => $contact['poll'],
|
||||
'$contact_attag' => $contact['attag'],
|
||||
'$lbl_submit' => t('Submit')
|
||||
|
||||
'$name' => array('name', t('Name') , htmlentities($contact['name'])),
|
||||
'$nick' => array('nick', t('Account Nickname'), htmlentities($contact['nick'])),
|
||||
'$attag' => array('attag', t('@Tagname - overrides Name/Nickname'), $contact['attag']),
|
||||
'$url' => array('url', t('Account URL'), $contact['url']),
|
||||
'$request' => array('request', t('Friend Request URL'), $contact['request']),
|
||||
'confirm' => array('confirm', t('Friend Confirm URL'), $contact['confirm']),
|
||||
'notify' => array('notify', t('Notification Endpoint URL'), $contact['notify']),
|
||||
'poll' => array('poll', t('Poll/Feed URL'), $contact['poll']),
|
||||
'photo' => array('photo', t('New photo from this URL'), ''),
|
||||
));
|
||||
|
||||
return $o;
|
||||
|
|
|
@ -26,12 +26,12 @@ function delegate_content(&$a) {
|
|||
$r = q("select `nickname` from user where uid = %d limit 1",
|
||||
intval($id)
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$r = q("select id from contact where uid = %d and nurl = '%s' limit 1",
|
||||
intval(local_user()),
|
||||
dbesc(normalise_link($a->get_baseurl() . '/profile/' . $r[0]['nickname']))
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
q("insert into manage ( uid, mid ) values ( %d , %d ) ",
|
||||
intval($a->argv[2]),
|
||||
intval(local_user())
|
||||
|
@ -64,7 +64,7 @@ function delegate_content(&$a) {
|
|||
dbesc($a->user['email']),
|
||||
dbesc($a->user['password'])
|
||||
);
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$full_managers = $r;
|
||||
|
||||
$delegates = array();
|
||||
|
@ -75,7 +75,7 @@ function delegate_content(&$a) {
|
|||
intval(local_user())
|
||||
);
|
||||
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$delegates = $r;
|
||||
|
||||
$uids = array();
|
||||
|
@ -104,7 +104,7 @@ function delegate_content(&$a) {
|
|||
|
||||
$nicknames = array();
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
foreach($r as $rr) {
|
||||
$nicknames[] = "'" . dbesc(basename($rr['nurl'])) . "'";
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ function delegate_content(&$a) {
|
|||
|
||||
$r = q("select `uid`, `username`, `nickname` from user where nickname in ( $nicks )");
|
||||
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
foreach($r as $rr)
|
||||
if(! in_array($rr['uid'],$uids))
|
||||
$potentials[] = $rr;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
require_once('include/enotify.php');
|
||||
require_once('include/group.php');
|
||||
require_once('include/Probe.php');
|
||||
|
||||
function dfrn_confirm_post(&$a,$handsfree = null) {
|
||||
|
||||
|
@ -356,7 +357,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
|||
$poll = (($contact['poll']) ? $contact['poll'] : '');
|
||||
|
||||
if((! $contact['notify']) || (! $contact['poll'])) {
|
||||
$arr = lrdd($contact['url']);
|
||||
$arr = Probe::lrdd($contact['url']);
|
||||
if(count($arr)) {
|
||||
foreach($arr as $link) {
|
||||
if($link['@attributes']['rel'] === 'salmon')
|
||||
|
@ -418,7 +419,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
|||
$r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
|
||||
intval($contact_id)
|
||||
);
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$contact = $r[0];
|
||||
else
|
||||
$contact = null;
|
||||
|
@ -438,7 +439,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
|||
intval($uid)
|
||||
);
|
||||
|
||||
if((dba::is_result($r)) && ($r[0]['hide-friends'] == 0) && ($activity) && (! $hidden)) {
|
||||
if((dbm::is_result($r)) && ($r[0]['hide-friends'] == 0) && ($activity) && (! $hidden)) {
|
||||
|
||||
require_once('include/items.php');
|
||||
|
||||
|
@ -486,7 +487,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
|||
|
||||
$i = item_store($arr);
|
||||
if($i)
|
||||
proc_run('php',"include/notifier.php","activity","$i");
|
||||
proc_run(PRIORITY_HIGH, "include/notifier.php", "activity", $i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -624,7 +625,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
|||
$r = q("SELECT * FROM `contact` WHERE `dfrn-id` = '%s' LIMIT 1",
|
||||
dbesc($decrypted_dfrn_id)
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$message = t('The ID provided by your system is a duplicate on our system. It should work if you try again.');
|
||||
xml_status(1,$message); // Birthday paradox - duplicate dfrn-id
|
||||
// NOTREACHED
|
||||
|
@ -656,7 +657,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
|||
$r = q("SELECT `photo` FROM `contact` WHERE `id` = %d LIMIT 1",
|
||||
intval($dfrn_record));
|
||||
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$photo = $r[0]['photo'];
|
||||
else
|
||||
$photo = $a->get_baseurl() . '/images/person-175.jpg';
|
||||
|
@ -709,10 +710,10 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
|||
intval($dfrn_record)
|
||||
);
|
||||
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$combined = $r[0];
|
||||
|
||||
if((dba::is_result($r)) && ($r[0]['notify-flags'] & NOTIFY_CONFIRM)) {
|
||||
if((dbm::is_result($r)) && ($r[0]['notify-flags'] & NOTIFY_CONFIRM)) {
|
||||
$mutual = ($new_relation == CONTACT_IS_FRIEND);
|
||||
notification(array(
|
||||
'type' => NOTIFY_CONFIRM,
|
||||
|
@ -737,7 +738,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
|||
intval($local_uid)
|
||||
);
|
||||
|
||||
if((dba::is_result($r)) && ($r[0]['hide-friends'] == 0)) {
|
||||
if((dbm::is_result($r)) && ($r[0]['hide-friends'] == 0)) {
|
||||
|
||||
require_once('include/items.php');
|
||||
|
||||
|
@ -783,7 +784,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
|||
|
||||
$i = item_store($arr);
|
||||
if($i)
|
||||
proc_run('php',"include/notifier.php","activity","$i");
|
||||
proc_run(PRIORITY_HIGH, "include/notifier.php", "activity", $i);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@ function dfrn_poll_init(&$a) {
|
|||
$dfrn_id = substr($dfrn_id,2);
|
||||
}
|
||||
|
||||
$hidewall = false;
|
||||
|
||||
if(($dfrn_id === '') && (! x($_POST,'dfrn_id'))) {
|
||||
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
|
||||
http_status_exit(403);
|
||||
|
@ -35,16 +37,17 @@ function dfrn_poll_init(&$a) {
|
|||
$r = q("SELECT `hidewall`,`nickname` FROM `user` WHERE `user`.`nickname` = '%s' LIMIT 1",
|
||||
dbesc($a->argv[1])
|
||||
);
|
||||
if(! $r)
|
||||
if (!$r)
|
||||
http_status_exit(404);
|
||||
if(($r[0]['hidewall']) && (! local_user()))
|
||||
http_status_exit(403);
|
||||
|
||||
$hidewall = ($r[0]['hidewall'] && !local_user());
|
||||
|
||||
$user = $r[0]['nickname'];
|
||||
}
|
||||
|
||||
logger('dfrn_poll: public feed request from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . $user);
|
||||
header("Content-type: application/atom+xml");
|
||||
echo dfrn::feed('', $user,$last_update);
|
||||
echo dfrn::feed('', $user,$last_update, 0, $hidewall);
|
||||
killme();
|
||||
}
|
||||
|
||||
|
@ -76,7 +79,7 @@ function dfrn_poll_init(&$a) {
|
|||
dbesc($a->argv[1])
|
||||
);
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
|
||||
$s = fetch_url($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check');
|
||||
|
||||
|
@ -187,7 +190,7 @@ function dfrn_poll_init(&$a) {
|
|||
q("DELETE FROM `profile_check` WHERE `expire` < " . intval(time()));
|
||||
$r = q("SELECT * FROM `profile_check` WHERE `dfrn_id` = '%s' ORDER BY `expire` DESC",
|
||||
dbesc($dfrn_id));
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
xml_status(1);
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
@ -332,7 +335,7 @@ function dfrn_poll_post(&$a) {
|
|||
$reputation = 0;
|
||||
$text = '';
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$reputation = $r[0]['rating'];
|
||||
$text = $r[0]['reason'];
|
||||
|
||||
|
@ -445,7 +448,7 @@ function dfrn_poll_content(&$a) {
|
|||
dbesc($nickname)
|
||||
);
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
|
||||
$challenge = '';
|
||||
$encrypted_id = '';
|
||||
|
@ -492,7 +495,7 @@ function dfrn_poll_content(&$a) {
|
|||
));
|
||||
}
|
||||
|
||||
$profile = ((dba::is_result($r) && $r[0]['nickname']) ? $r[0]['nickname'] : $nickname);
|
||||
$profile = ((dbm::is_result($r) && $r[0]['nickname']) ? $r[0]['nickname'] : $nickname);
|
||||
|
||||
switch($destination_url) {
|
||||
case 'profile':
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
require_once('include/enotify.php');
|
||||
require_once('include/Scrape.php');
|
||||
require_once('include/Probe.php');
|
||||
require_once('include/group.php');
|
||||
|
||||
if(! function_exists('dfrn_request_init')) {
|
||||
|
@ -89,7 +90,7 @@ function dfrn_request_post(&$a) {
|
|||
dbesc(normalise_link($dfrn_url))
|
||||
);
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
if(strlen($r[0]['dfrn-id'])) {
|
||||
|
||||
/**
|
||||
|
@ -116,7 +117,7 @@ function dfrn_request_post(&$a) {
|
|||
* Scrape the other site's profile page to pick up the dfrn links, key, fn, and photo
|
||||
*/
|
||||
|
||||
$parms = scrape_dfrn($dfrn_url);
|
||||
$parms = Probe::profile($dfrn_url);
|
||||
|
||||
if(! count($parms)) {
|
||||
notice( t('Profile location is not valid or does not contain profile information.') . EOL );
|
||||
|
@ -127,7 +128,7 @@ function dfrn_request_post(&$a) {
|
|||
notice( t('Warning: profile location has no identifiable owner name.') . EOL );
|
||||
if(! x($parms,'photo'))
|
||||
notice( t('Warning: profile location has no profile photo.') . EOL );
|
||||
$invalid = validate_dfrn($parms);
|
||||
$invalid = Probe::valid_dfrn($parms);
|
||||
if($invalid) {
|
||||
notice( sprintf( tt("%d required parameter was not found at the given location",
|
||||
"%d required parameters were not found at the given location",
|
||||
|
@ -138,6 +139,8 @@ function dfrn_request_post(&$a) {
|
|||
|
||||
$dfrn_request = $parms['dfrn-request'];
|
||||
|
||||
$photo = $parms["photo"];
|
||||
|
||||
/********* Escape the entire array ********/
|
||||
|
||||
dbesc_array($parms);
|
||||
|
@ -180,11 +183,14 @@ function dfrn_request_post(&$a) {
|
|||
dbesc($dfrn_url),
|
||||
$parms['key'] // this was already escaped
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$def_gid = get_default_group(local_user(), $r[0]["network"]);
|
||||
if(intval($def_gid))
|
||||
group_add_member(local_user(), '', $r[0]['id'], $def_gid);
|
||||
|
||||
if (isset($photo))
|
||||
update_contact_avatar($photo, local_user(), $r[0]["id"], true);
|
||||
|
||||
$forwardurl = $a->get_baseurl()."/contacts/".$r[0]['id'];
|
||||
} else
|
||||
$forwardurl = $a->get_baseurl()."/contacts";
|
||||
|
@ -285,7 +291,7 @@ function dfrn_request_post(&$a) {
|
|||
AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 30 MINUTE ",
|
||||
dbesc(NETWORK_MAIL2)
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
foreach($r as $rr) {
|
||||
if(! $rr['rel']) {
|
||||
q("DELETE FROM `contact` WHERE `id` = %d",
|
||||
|
@ -310,7 +316,7 @@ function dfrn_request_post(&$a) {
|
|||
AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 3 DAY ",
|
||||
dbesc(NETWORK_MAIL2)
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
foreach($r as $rr) {
|
||||
if(! $rr['rel']) {
|
||||
q("DELETE FROM `contact` WHERE `id` = %d",
|
||||
|
@ -390,7 +396,7 @@ function dfrn_request_post(&$a) {
|
|||
dbesc($poll),
|
||||
intval($uid)
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$contact_id = $r[0]['id'];
|
||||
|
||||
$def_gid = get_default_group($uid, $r[0]["network"]);
|
||||
|
@ -444,7 +450,7 @@ function dfrn_request_post(&$a) {
|
|||
logger('dfrn_request: url=' . $url . ',network=' . $network . ',hcard=' . $hcard . ' - BEFORE!', LOGGER_DEBUG);
|
||||
|
||||
// Canonicalise email-style profile locator
|
||||
$url = webfinger_dfrn($url,$hcard);
|
||||
$url = Probe::webfinger_dfrn($url,$hcard);
|
||||
|
||||
logger('dfrn_request: url=' . $url . ',network=' . $network . ',hcard=' . $hcard . ' - AFTER!', LOGGER_DEBUG);
|
||||
|
||||
|
@ -510,7 +516,7 @@ function dfrn_request_post(&$a) {
|
|||
|
||||
require_once('include/Scrape.php');
|
||||
|
||||
$parms = scrape_dfrn(($hcard) ? $hcard : $url);
|
||||
$parms = Probe::profile(($hcard) ? $hcard : $url);
|
||||
|
||||
if(! count($parms)) {
|
||||
notice( t('Profile location is not valid or does not contain profile information.') . EOL );
|
||||
|
@ -521,7 +527,7 @@ function dfrn_request_post(&$a) {
|
|||
notice( t('Warning: profile location has no identifiable owner name.') . EOL );
|
||||
if(! x($parms,'photo'))
|
||||
notice( t('Warning: profile location has no profile photo.') . EOL );
|
||||
$invalid = validate_dfrn($parms);
|
||||
$invalid = Probe::valid_dfrn($parms);
|
||||
if($invalid) {
|
||||
notice( sprintf( tt("%d required parameter was not found at the given location",
|
||||
"%d required parameters were not found at the given location",
|
||||
|
@ -534,7 +540,7 @@ function dfrn_request_post(&$a) {
|
|||
|
||||
$parms['url'] = $url;
|
||||
$parms['issued-id'] = $issued_id;
|
||||
|
||||
$photo = $parms["photo"];
|
||||
|
||||
dbesc_array($parms);
|
||||
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `name`, `nick`, `issued-id`, `photo`, `site-pubkey`,
|
||||
|
@ -543,7 +549,7 @@ function dfrn_request_post(&$a) {
|
|||
intval($uid),
|
||||
dbesc(datetime_convert()),
|
||||
$parms['url'],
|
||||
dbesc(normalise_link($parms['url'])),
|
||||
dbesc(normalise_link($url)),
|
||||
$parms['addr'],
|
||||
$parms['fn'],
|
||||
$parms['nick'],
|
||||
|
@ -566,8 +572,10 @@ function dfrn_request_post(&$a) {
|
|||
$parms['url'],
|
||||
$parms['issued-id']
|
||||
);
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$contact_record = $r[0];
|
||||
update_contact_avatar($photo, $uid, $contact_record["id"], true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -715,7 +723,7 @@ function dfrn_request_content(&$a) {
|
|||
dbesc($_GET['confirm_key'])
|
||||
);
|
||||
|
||||
if(dba::is_result($intro)) {
|
||||
if(dbm::is_result($intro)) {
|
||||
|
||||
$auto_confirm = false;
|
||||
|
||||
|
@ -724,7 +732,7 @@ function dfrn_request_content(&$a) {
|
|||
intval($intro[0]['contact-id'])
|
||||
);
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
if(($r[0]['page-flags'] != PAGE_NORMAL) && ($r[0]['page-flags'] != PAGE_PRVGROUP))
|
||||
$auto_confirm = true;
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ function directory_content(&$a) {
|
|||
$r = $db->q("SELECT COUNT(*) AS `total` FROM `profile`
|
||||
LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
|
||||
WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra ");
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$a->set_pager_total($r[0]['total']);
|
||||
|
||||
$order = " ORDER BY `name` ASC ";
|
||||
|
@ -90,7 +90,7 @@ function directory_content(&$a) {
|
|||
LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
|
||||
LEFT JOIN `contact` ON `contact`.`uid` = `user`.`uid`
|
||||
WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 AND `contact`.`self` $sql_extra $order LIMIT ".$limit);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
|
||||
if(in_array('small', $a->argv))
|
||||
$photo = 'thumb';
|
||||
|
@ -159,7 +159,9 @@ function directory_content(&$a) {
|
|||
$location_e = $location;
|
||||
}
|
||||
|
||||
$photo_menu = array(array(t("View Profile"), zrl($profile_link)));
|
||||
$photo_menu = array(
|
||||
'profile' => array(t("View Profile"), zrl($profile_link))
|
||||
);
|
||||
|
||||
$entry = array(
|
||||
'id' => $rr['id'],
|
||||
|
@ -204,7 +206,7 @@ function directory_content(&$a) {
|
|||
'$gdirpath' => $gdirpath,
|
||||
'$desc' => t('Find on this site'),
|
||||
'$contacts' => $entries,
|
||||
'$finding' => t('Finding:'),
|
||||
'$finding' => t('Results for:'),
|
||||
'$findterm' => (strlen($search) ? $search : ""),
|
||||
'$title' => t('Site Directory'),
|
||||
'$submit' => t('Find'),
|
||||
|
|
|
@ -33,6 +33,7 @@ function dirfind_content(&$a, $prefix = "") {
|
|||
|
||||
if(strpos($search,'@') === 0) {
|
||||
$search = substr($search,1);
|
||||
$header = sprintf( t('People Search - %s'), $search);
|
||||
if ((valid_email($search) AND validate_email($search)) OR
|
||||
(substr(normalise_link($search), 0, 7) == "http://")) {
|
||||
$user_data = probe_url($search);
|
||||
|
@ -43,6 +44,7 @@ function dirfind_content(&$a, $prefix = "") {
|
|||
if(strpos($search,'!') === 0) {
|
||||
$search = substr($search,1);
|
||||
$community = true;
|
||||
$header = sprintf( t('Forum Search - %s'), $search);
|
||||
}
|
||||
|
||||
$o = '';
|
||||
|
@ -64,16 +66,15 @@ function dirfind_content(&$a, $prefix = "") {
|
|||
$objresult->tags = "";
|
||||
$objresult->network = $user_data["network"];
|
||||
|
||||
$contact = q("SELECT `id` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc(normalise_link($user_data["url"])), intval(local_user()));
|
||||
if ($contact)
|
||||
$objresult->cid = $contact[0]["id"];
|
||||
|
||||
$contact = get_contact_details_by_url($user_data["url"], local_user());
|
||||
$objresult->cid = $contact["cid"];
|
||||
|
||||
$j->results[] = $objresult;
|
||||
|
||||
poco_check($user_data["url"], $user_data["name"], $user_data["network"], $user_data["photo"],
|
||||
"", "", "", "", "", datetime_convert(), 0);
|
||||
// Add the contact to the global contacts if it isn't already in our system
|
||||
if (($contact["cid"] == 0) AND ($contact["zid"] == 0) AND ($contact["gid"] == 0))
|
||||
poco_check($user_data["url"], $user_data["name"], $user_data["network"], $user_data["photo"],
|
||||
"", "", "", "", "", datetime_convert(), 0);
|
||||
} elseif ($local) {
|
||||
|
||||
if ($community)
|
||||
|
@ -98,6 +99,7 @@ function dirfind_content(&$a, $prefix = "") {
|
|||
|
||||
$count = q("SELECT count(*) AS `total` FROM `gcontact`
|
||||
LEFT JOIN `contact` ON `contact`.`nurl` = `gcontact`.`nurl`
|
||||
AND `contact`.`network` = `gcontact`.`network`
|
||||
AND `contact`.`uid` = %d AND NOT `contact`.`blocked`
|
||||
AND NOT `contact`.`pending` AND `contact`.`rel` IN ('%s', '%s')
|
||||
WHERE (`contact`.`id` > 0 OR (NOT `gcontact`.`hide` AND `gcontact`.`network` IN ('%s', '%s', '%s') AND
|
||||
|
@ -112,6 +114,7 @@ function dirfind_content(&$a, $prefix = "") {
|
|||
$results = q("SELECT `contact`.`id` AS `cid`, `gcontact`.`url`, `gcontact`.`name`, `gcontact`.`photo`, `gcontact`.`network`, `gcontact`.`keywords`, `gcontact`.`addr`
|
||||
FROM `gcontact`
|
||||
LEFT JOIN `contact` ON `contact`.`nurl` = `gcontact`.`nurl`
|
||||
AND `contact`.`network` = `gcontact`.`network`
|
||||
AND `contact`.`uid` = %d AND NOT `contact`.`blocked`
|
||||
AND NOT `contact`.`pending` AND `contact`.`rel` IN ('%s', '%s')
|
||||
WHERE (`contact`.`id` > 0 OR (NOT `gcontact`.`hide` AND `gcontact`.`network` IN ('%s', '%s', '%s') AND
|
||||
|
@ -133,6 +136,8 @@ function dirfind_content(&$a, $prefix = "") {
|
|||
if (poco_alternate_ostatus_url($result["url"]))
|
||||
continue;
|
||||
|
||||
$result = get_contact_details_by_url($result["url"], local_user(), $result);
|
||||
|
||||
if ($result["name"] == "") {
|
||||
$urlparts = parse_url($result["url"]);
|
||||
$result["name"] = end(explode("/", $urlparts["path"]));
|
||||
|
@ -151,7 +156,7 @@ function dirfind_content(&$a, $prefix = "") {
|
|||
}
|
||||
|
||||
// Add found profiles from the global directory to the local directory
|
||||
proc_run('php','include/discover_poco.php', "dirsearch", urlencode($search));
|
||||
proc_run(PRIORITY_LOW, 'include/discover_poco.php', "dirsearch", urlencode($search));
|
||||
} else {
|
||||
|
||||
$p = (($a->pager['page'] != 1) ? '&p=' . $a->pager['page'] : '');
|
||||
|
@ -194,8 +199,10 @@ function dirfind_content(&$a, $prefix = "") {
|
|||
} else {
|
||||
$connlnk = $a->get_baseurl().'/follow/?url='.(($jj->connect) ? $jj->connect : $jj->url);
|
||||
$conntxt = t('Connect');
|
||||
$photo_menu = array(array(t("View Profile"), zrl($jj->url)));
|
||||
$photo_menu[] = array(t("Connect/Follow"), $connlnk);
|
||||
$photo_menu = array(
|
||||
'profile' => array(t("View Profile"), zrl($jj->url)),
|
||||
'follow' => array(t("Connect/Follow"), $connlnk)
|
||||
);
|
||||
}
|
||||
|
||||
$jj->photo = str_replace("http:///photo/", get_server()."/photo/", $jj->photo);
|
||||
|
@ -223,7 +230,7 @@ function dirfind_content(&$a, $prefix = "") {
|
|||
$tpl = get_markup_template('viewcontact_template.tpl');
|
||||
|
||||
$o .= replace_macros($tpl,array(
|
||||
'title' => sprintf( t('People Search - %s'), $search),
|
||||
'title' => $header,
|
||||
'$contacts' => $entries,
|
||||
'$paginate' => paginate($a),
|
||||
));
|
||||
|
|
132
mod/display.php
132
mod/display.php
|
@ -16,10 +16,10 @@ function display_init(&$a) {
|
|||
|
||||
// Does the local user have this item?
|
||||
if (local_user()) {
|
||||
$r = q("SELECT `id`, `parent`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid` FROM `item`
|
||||
$r = q("SELECT `id`, `parent`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid`, `owner-link` FROM `item`
|
||||
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
||||
AND `guid` = '%s' AND `uid` = %d", dbesc($a->argv[1]), local_user());
|
||||
if (dba::is_result($r)) {
|
||||
if (dbm::is_result($r)) {
|
||||
$nick = $a->user["nickname"];
|
||||
$itemuid = local_user();
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ function display_init(&$a) {
|
|||
// Or is it anywhere on the server?
|
||||
if ($nick == "") {
|
||||
$r = q("SELECT `user`.`nickname`, `item`.`id`, `item`.`parent`, `item`.`author-name`,
|
||||
`item`.`author-link`, `item`.`author-avatar`, `item`.`network`, `item`.`uid`, `item`.`body`
|
||||
`item`.`author-link`, `item`.`author-avatar`, `item`.`network`, `item`.`uid`, `item`.`owner-link`, `item`.`body`
|
||||
FROM `item` INNER JOIN `user` ON `user`.`uid` = `item`.`uid`
|
||||
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
||||
AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
|
||||
|
@ -36,7 +36,7 @@ function display_init(&$a) {
|
|||
AND NOT `item`.`private` AND NOT `user`.`hidewall`
|
||||
AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
|
||||
// AND NOT `item`.`private` AND `item`.`wall`
|
||||
if (dba::is_result($r)) {
|
||||
if (dbm::is_result($r)) {
|
||||
$nick = $r[0]["nickname"];
|
||||
$itemuid = $r[0]["uid"];
|
||||
}
|
||||
|
@ -44,8 +44,8 @@ function display_init(&$a) {
|
|||
|
||||
// Is it an item with uid=0?
|
||||
if ($nick == "") {
|
||||
$r = q("SELECT `item`.`id`, `item`.`parent`, `item`.`author-name`,
|
||||
`item`.`author-link`, `item`.`author-avatar`, `item`.`network`, `item`.`uid`, `item`.`body`
|
||||
$r = q("SELECT `item`.`id`, `item`.`parent`, `item`.`author-name`, `item`.`author-link`,
|
||||
`item`.`author-avatar`, `item`.`network`, `item`.`uid`, `item`.`owner-link`, `item`.`body`
|
||||
FROM `item` WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
||||
AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
|
||||
AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''
|
||||
|
@ -53,12 +53,34 @@ function display_init(&$a) {
|
|||
AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
|
||||
// AND NOT `item`.`private` AND `item`.`wall`
|
||||
}
|
||||
if (dba::is_result($r)) {
|
||||
if (dbm::is_result($r)) {
|
||||
if ($r[0]["id"] != $r[0]["parent"])
|
||||
$r = q("SELECT `id`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid` FROM `item`
|
||||
$r = q("SELECT `id`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid`, `owner-link` FROM `item`
|
||||
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
||||
AND `id` = %d", $r[0]["parent"]);
|
||||
|
||||
if (($itemuid != local_user()) AND local_user()) {
|
||||
// Do we know this contact but we haven't got this item?
|
||||
// Copy the wohle thread to our local storage so that we can interact.
|
||||
// We really should change this need for the future since it scales very bad.
|
||||
$contactid = get_contact($r[0]['owner-link'], local_user());
|
||||
if ($contactid) {
|
||||
$items = q("SELECT * FROM `item` WHERE `parent` = %d ORDER BY `id`", intval($r[0]["id"]));
|
||||
foreach ($items AS $item) {
|
||||
$itemcontactid = get_contact($item['owner-link'], local_user());
|
||||
if (!$itemcontactid)
|
||||
$itemcontactid = $contactid;
|
||||
|
||||
unset($item['id']);
|
||||
$item['uid'] = local_user();
|
||||
$item['origin'] = 0;
|
||||
$item['contact-id'] = $itemcontactid;
|
||||
$local_copy = item_store($item, false, false, true);
|
||||
logger("Stored local copy for post ".$item['guid']." under id ".$local_copy, LOGGER_DEBUG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$profiledata = display_fetchauthor($a, $r[0]);
|
||||
|
||||
if (strstr(normalise_link($profiledata["url"]), normalise_link($a->get_baseurl()))) {
|
||||
|
@ -70,7 +92,7 @@ function display_init(&$a) {
|
|||
WHERE `user`.`nickname` = '%s' AND `profile`.`is-default` AND `contact`.`self` LIMIT 1",
|
||||
dbesc($nickname)
|
||||
);
|
||||
if (dba::is_result($r))
|
||||
if (dbm::is_result($r))
|
||||
$profiledata = $r[0];
|
||||
|
||||
$profiledata["network"] = NETWORK_DFRN;
|
||||
|
@ -90,6 +112,8 @@ function display_init(&$a) {
|
|||
|
||||
function display_fetchauthor($a, $item) {
|
||||
|
||||
require_once("include/Contact.php");
|
||||
|
||||
$profiledata = array();
|
||||
$profiledata["uid"] = -1;
|
||||
$profiledata["nickname"] = $item["author-name"];
|
||||
|
@ -154,61 +178,9 @@ function display_fetchauthor($a, $item) {
|
|||
$profiledata["about"] = "";
|
||||
}
|
||||
|
||||
// Don't show details from Diaspora contacts if you don't follow the contact
|
||||
$showdetails = ($profiledata["network"] != NETWORK_DIASPORA);
|
||||
$profiledata = get_contact_details_by_url($profiledata["url"], local_user(), $profiledata);
|
||||
|
||||
// Fetching further contact data from the contact table
|
||||
$r = q("SELECT `uid`, `network`, `name`, `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords`
|
||||
FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `network` = '%s' AND `rel` IN (%d, %d)",
|
||||
dbesc(normalise_link($profiledata["url"])), intval(local_user()), dbesc($item["network"]),
|
||||
intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND));
|
||||
if (!count($r))
|
||||
$r = q("SELECT `uid`, `network`, `name`, `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords`
|
||||
FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `rel` IN (%d, %d)",
|
||||
dbesc(normalise_link($profiledata["url"])), intval(local_user()),
|
||||
intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND));
|
||||
|
||||
if (dba::is_result($r)) {
|
||||
$profiledata["name"] = $r[0]["name"];
|
||||
$profiledata["photo"] = $r[0]["photo"];
|
||||
$profiledata["nickname"] = $r[0]["nick"];
|
||||
$profiledata["addr"] = $r[0]["addr"];
|
||||
$profiledata["keywords"] = $r[0]["keywords"];
|
||||
$profiledata["network"] = $r[0]["network"];
|
||||
|
||||
if (local_user() OR $showdetails) {
|
||||
$showdetails = true;
|
||||
$profiledata["address"] = $r[0]["location"];
|
||||
$profiledata["about"] = $r[0]["about"];
|
||||
$profiledata["gender"] = $r[0]["gender"];
|
||||
}
|
||||
}
|
||||
|
||||
// Fetching profile data from global contacts
|
||||
if ($profiledata["network"] != NETWORK_FEED) {
|
||||
$r = q("SELECT `name`, `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords`, `network` FROM `gcontact` WHERE `nurl` = '%s'", dbesc(normalise_link($profiledata["url"])));
|
||||
if (dba::is_result($r)) {
|
||||
$profiledata["name"] = $r[0]["name"];
|
||||
$profiledata["photo"] = $r[0]["photo"];
|
||||
$profiledata["nickname"] = $r[0]["nick"];
|
||||
$profiledata["addr"] = $r[0]["addr"];
|
||||
$profiledata["network"] = $r[0]["network"];
|
||||
|
||||
if ($r[0]["keywords"])
|
||||
$profiledata["keywords"] = $r[0]["keywords"];
|
||||
|
||||
if ($showdetails) {
|
||||
if ($r[0]["location"])
|
||||
$profiledata["address"] = $r[0]["location"];
|
||||
|
||||
if ($r[0]["about"])
|
||||
$profiledata["about"] = $r[0]["about"];
|
||||
|
||||
if ($r[0]["gender"])
|
||||
$profiledata["gender"] = $r[0]["gender"];
|
||||
}
|
||||
}
|
||||
}
|
||||
$profiledata["photo"] = App::remove_baseurl($profiledata["photo"]);
|
||||
|
||||
if (local_user()) {
|
||||
if (in_array($profiledata["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS)))
|
||||
|
@ -259,7 +231,7 @@ function display_content(&$a, $update = 0) {
|
|||
$r = q("SELECT `id` FROM `item`
|
||||
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
||||
AND `guid` = '%s' AND `uid` = %d", dbesc($a->argv[1]), local_user());
|
||||
if (dba::is_result($r)) {
|
||||
if (dbm::is_result($r)) {
|
||||
$item_id = $r[0]["id"];
|
||||
$nick = $a->user["nickname"];
|
||||
}
|
||||
|
@ -273,7 +245,7 @@ function display_content(&$a, $update = 0) {
|
|||
AND NOT `item`.`private` AND NOT `user`.`hidewall`
|
||||
AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
|
||||
// AND NOT `item`.`private` AND `item`.`wall`
|
||||
if (dba::is_result($r)) {
|
||||
if (dbm::is_result($r)) {
|
||||
$item_id = $r[0]["id"];
|
||||
$nick = $r[0]["nickname"];
|
||||
}
|
||||
|
@ -286,7 +258,7 @@ function display_content(&$a, $update = 0) {
|
|||
AND NOT `item`.`private` AND `item`.`uid` = 0
|
||||
AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
|
||||
// AND NOT `item`.`private` AND `item`.`wall`
|
||||
if (dba::is_result($r)) {
|
||||
if (dbm::is_result($r)) {
|
||||
$item_id = $r[0]["id"];
|
||||
}
|
||||
}
|
||||
|
@ -331,7 +303,7 @@ function display_content(&$a, $update = 0) {
|
|||
intval($contact_id),
|
||||
intval($a->profile['uid'])
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$contact = $r[0];
|
||||
$remote_contact = true;
|
||||
}
|
||||
|
@ -347,7 +319,7 @@ function display_content(&$a, $update = 0) {
|
|||
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1",
|
||||
intval($a->profile['uid'])
|
||||
);
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$a->page_contact = $r[0];
|
||||
|
||||
$is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false);
|
||||
|
@ -390,14 +362,7 @@ function display_content(&$a, $update = 0) {
|
|||
return '';
|
||||
}
|
||||
|
||||
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
FROM `item` INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
AND NOT `contact`.`blocked` AND NOT `contact`.`pending`
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` AND NOT `item`.`deleted`
|
||||
AND NOT `item`.`moderated`
|
||||
$r = q(item_query()." AND `item`.`uid` = %d
|
||||
AND `item`.`parent` = (SELECT `parent` FROM `item` WHERE `id` = %d)
|
||||
$sql_extra
|
||||
ORDER BY `parent` DESC, `gravity` ASC, `id` ASC",
|
||||
|
@ -405,6 +370,7 @@ function display_content(&$a, $update = 0) {
|
|||
intval($item_id)
|
||||
);
|
||||
|
||||
|
||||
if(!$r && local_user()) {
|
||||
// Check if this is another person's link to a post that we have
|
||||
$r = q("SELECT `item`.uri FROM `item`
|
||||
|
@ -416,14 +382,7 @@ function display_content(&$a, $update = 0) {
|
|||
if($r) {
|
||||
$item_uri = $r[0]['uri'];
|
||||
|
||||
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
FROM `item` INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
AND NOT `contact`.`blocked` AND NOT `contact`.`pending`
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` AND NOT `item`.`deleted`
|
||||
AND NOT `item`.`moderated`
|
||||
$r = q(item_query()." AND `item`.`uid` = %d
|
||||
AND `item`.`parent` = (SELECT `parent` FROM `item` WHERE `uri` = '%s' AND uid = %d)
|
||||
ORDER BY `parent` DESC, `gravity` ASC, `id` ASC ",
|
||||
intval(local_user()),
|
||||
|
@ -433,7 +392,6 @@ function display_content(&$a, $update = 0) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if($r) {
|
||||
|
||||
if((local_user()) && (local_user() == $a->profile['uid'])) {
|
||||
|
@ -460,9 +418,7 @@ function display_content(&$a, $update = 0) {
|
|||
$title = trim(html2plain(bbcode($r[0]["title"], false, false), 0, true));
|
||||
$author_name = $r[0]["author-name"];
|
||||
|
||||
$image = "";
|
||||
if ($image == "")
|
||||
$image = $r[0]["thumb"];
|
||||
$image = $a->remove_baseurl($r[0]["thumb"]);
|
||||
|
||||
if ($title == "")
|
||||
$title = $author_name;
|
||||
|
|
|
@ -78,7 +78,7 @@ function editpost_content(&$a) {
|
|||
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
|
||||
intval(local_user())
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$mail_enabled = true;
|
||||
if(intval($r[0]['pubmail']))
|
||||
$pubmail_enabled = true;
|
||||
|
@ -146,7 +146,12 @@ function editpost_content(&$a) {
|
|||
'$jotplugins' => $jotplugins,
|
||||
'$sourceapp' => t($a->sourcename),
|
||||
'$cancel' => t('Cancel'),
|
||||
'$rand_num' => random_digits(12)
|
||||
'$rand_num' => random_digits(12),
|
||||
|
||||
//jot nav tab (used in some themes)
|
||||
'$message' => t('Message'),
|
||||
'$browser' => t('Browser'),
|
||||
'$shortpermset' => t('permissions'),
|
||||
));
|
||||
|
||||
return $o;
|
||||
|
|
198
mod/events.php
198
mod/events.php
|
@ -1,10 +1,34 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @fiel mod/events.php
|
||||
* @brief The events module
|
||||
*/
|
||||
require_once('include/bbcode.php');
|
||||
require_once('include/datetime.php');
|
||||
require_once('include/event.php');
|
||||
require_once('include/items.php');
|
||||
|
||||
function events_init(&$a) {
|
||||
if(! local_user())
|
||||
return;
|
||||
|
||||
if($a->argc == 1) {
|
||||
// if it's a json request abort here becaus we don't
|
||||
// need the widget data
|
||||
if($a->argv[1] === 'json')
|
||||
return;
|
||||
|
||||
$cal_widget = widget_events();
|
||||
|
||||
if(! x($a->page,'aside'))
|
||||
$a->page['aside'] = '';
|
||||
|
||||
$a->page['aside'] .= $cal_widget;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
function events_post(&$a) {
|
||||
|
||||
logger('post: ' . print_r($_REQUEST,true));
|
||||
|
@ -67,9 +91,9 @@ function events_post(&$a) {
|
|||
$action = ($event_id == '') ? 'new' : "event/" . $event_id;
|
||||
$onerror_url = $a->get_baseurl() . "/events/" . $action . "?summary=$summary&description=$desc&location=$location&start=$start_text&finish=$finish_text&adjust=$adjust&nofinish=$nofinish";
|
||||
|
||||
if(strcmp($finish,$start) < 0 && !$nofinish) {
|
||||
if(strcmp($finish,$start) < 0 && !$nofinish) {
|
||||
notice( t('Event can not end before it has started.') . EOL);
|
||||
if(intval($_REQUEST['preview'])) {
|
||||
if(intval($_REQUEST['preview'])) {
|
||||
echo( t('Event can not end before it has started.'));
|
||||
killme();
|
||||
}
|
||||
|
@ -124,6 +148,7 @@ function events_post(&$a) {
|
|||
|
||||
|
||||
$datarray = array();
|
||||
$datarray['guid'] = get_guid(32);
|
||||
$datarray['start'] = $start;
|
||||
$datarray['finish'] = $finish;
|
||||
$datarray['summary'] = $summary;
|
||||
|
@ -152,7 +177,7 @@ function events_post(&$a) {
|
|||
$item_id = event_store($datarray);
|
||||
|
||||
if(! $cid)
|
||||
proc_run('php',"include/notifier.php","event","$item_id");
|
||||
proc_run(PRIORITY_HIGH, "include/notifier.php", "event", $item_id);
|
||||
|
||||
goaway($_SESSION['return_url']);
|
||||
}
|
||||
|
@ -192,59 +217,14 @@ function events_content(&$a) {
|
|||
if( feature_enabled(local_user(), 'richtext') )
|
||||
$editselect = 'textareas';
|
||||
|
||||
// First day of the week (0 = Sunday)
|
||||
$firstDay = get_pconfig(local_user(),'system','first_day_of_week');
|
||||
if ($firstDay === false) $firstDay=0;
|
||||
|
||||
$i18n = array(
|
||||
"firstDay" => $firstDay,
|
||||
"Sun" => t("Sun"),
|
||||
"Mon" => t("Mon"),
|
||||
"Tue" => t("Tue"),
|
||||
"Wed" => t("Wed"),
|
||||
"Thu" => t("Thu"),
|
||||
"Fri" => t("Fri"),
|
||||
"Sat" => t("Sat"),
|
||||
"Sunday" => t("Sunday"),
|
||||
"Monday" => t("Monday"),
|
||||
"Tuesday" => t("Tuesday"),
|
||||
"Wednesday" => t("Wednesday"),
|
||||
"Thursday" => t("Thursday"),
|
||||
"Friday" => t("Friday"),
|
||||
"Saturday" => t("Saturday"),
|
||||
"Jan" => t("Jan"),
|
||||
"Feb" => t("Feb"),
|
||||
"Mar" => t("Mar"),
|
||||
"Apr" => t("Apr"),
|
||||
"May" => t("May"),
|
||||
"Jun" => t("Jun"),
|
||||
"Jul" => t("Jul"),
|
||||
"Aug" => t("Aug"),
|
||||
"Sep" => t("Sept"),
|
||||
"Oct" => t("Oct"),
|
||||
"Nov" => t("Nov"),
|
||||
"Dec" => t("Dec"),
|
||||
"January" => t("January"),
|
||||
"February" => t("February"),
|
||||
"March" => t("March"),
|
||||
"April" => t("April"),
|
||||
"May" => t("May"),
|
||||
"June" => t("June"),
|
||||
"July" => t("July"),
|
||||
"August" => t("August"),
|
||||
"September" => t("September"),
|
||||
"October" => t("October"),
|
||||
"November" => t("November"),
|
||||
"December" => t("December"),
|
||||
"today" => t("today"),
|
||||
"month" => t("month"),
|
||||
"week" => t("week"),
|
||||
"day" => t("day"),
|
||||
);
|
||||
// get the translation strings for the callendar
|
||||
$i18n = get_event_strings();
|
||||
|
||||
$htpl = get_markup_template('event_head.tpl');
|
||||
$a->page['htmlhead'] .= replace_macros($htpl,array(
|
||||
'$baseurl' => $a->get_baseurl(),
|
||||
'$module_url' => '/events',
|
||||
'$modparams' => 1,
|
||||
'$i18n' => $i18n,
|
||||
'$editselect' => $editselect
|
||||
));
|
||||
|
@ -283,6 +263,7 @@ function events_content(&$a) {
|
|||
}
|
||||
}
|
||||
|
||||
// The view mode part is similiar to /mod/cal.php
|
||||
if($mode == 'view') {
|
||||
|
||||
|
||||
|
@ -332,36 +313,26 @@ function events_content(&$a) {
|
|||
$adjust_start = datetime_convert('UTC', date_default_timezone_get(), $start);
|
||||
$adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish);
|
||||
|
||||
// put the event parametes in an array so we can better transmit them
|
||||
$event_params = array(
|
||||
'event_id' => (x($_GET,'id') ? $_GET["id"] : 0),
|
||||
'start' => $start,
|
||||
'finish' => $finish,
|
||||
'adjust_start' => $adjust_start,
|
||||
'adjust_finish' => $adjust_finish,
|
||||
'ignored' => $ignored,
|
||||
);
|
||||
|
||||
// get events by id or by date
|
||||
if (x($_GET,'id')){
|
||||
$r = q("SELECT `event`.*, `item`.`id` AS `itemid`,`item`.`plink`,
|
||||
`item`.`author-name`, `item`.`author-avatar`, `item`.`author-link` FROM `event`
|
||||
LEFT JOIN `item` ON `item`.`event-id` = `event`.`id` AND `item`.`uid` = `event`.`uid`
|
||||
WHERE `event`.`uid` = %d AND `event`.`id` = %d",
|
||||
intval(local_user()),
|
||||
intval($_GET['id'])
|
||||
);
|
||||
$r = event_by_id(local_user(), $event_params);
|
||||
} else {
|
||||
$r = q("SELECT `event`.*, `item`.`id` AS `itemid`,`item`.`plink`,
|
||||
`item`.`author-name`, `item`.`author-avatar`, `item`.`author-link` FROM `event`
|
||||
LEFT JOIN `item` ON `item`.`event-id` = `event`.`id` AND `item`.`uid` = `event`.`uid`
|
||||
WHERE `event`.`uid` = %d and event.ignore = %d
|
||||
AND ((`adjust` = 0 AND (`finish` >= '%s' OR (nofinish AND start >= '%s')) AND `start` <= '%s')
|
||||
OR (`adjust` = 1 AND (`finish` >= '%s' OR (nofinish AND start >= '%s')) AND `start` <= '%s')) ",
|
||||
intval(local_user()),
|
||||
intval($ignored),
|
||||
dbesc($start),
|
||||
dbesc($start),
|
||||
dbesc($finish),
|
||||
dbesc($adjust_start),
|
||||
dbesc($adjust_start),
|
||||
dbesc($adjust_finish)
|
||||
);
|
||||
$r = events_by_date(local_user(), $event_params);
|
||||
}
|
||||
|
||||
$links = array();
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$r = sort_by_date($r);
|
||||
foreach($r as $rr) {
|
||||
$j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j'));
|
||||
|
@ -370,60 +341,12 @@ function events_content(&$a) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
$events=array();
|
||||
|
||||
$last_date = '';
|
||||
$fmt = t('l, F j');
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
// transform the event in a usable array
|
||||
if(dbm::is_result($r)) {
|
||||
$r = sort_by_date($r);
|
||||
foreach($r as $rr) {
|
||||
|
||||
|
||||
$j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j'));
|
||||
$d = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], $fmt) : datetime_convert('UTC','UTC',$rr['start'],$fmt));
|
||||
$d = day_translate($d);
|
||||
|
||||
$start = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'c') : datetime_convert('UTC','UTC',$rr['start'],'c'));
|
||||
if ($rr['nofinish']){
|
||||
$end = null;
|
||||
} else {
|
||||
$end = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['finish'], 'c') : datetime_convert('UTC','UTC',$rr['finish'],'c'));
|
||||
}
|
||||
|
||||
|
||||
$is_first = ($d !== $last_date);
|
||||
|
||||
$last_date = $d;
|
||||
$edit = ((! $rr['cid']) ? array($a->get_baseurl().'/events/event/'.$rr['id'],t('Edit event'),'','') : null);
|
||||
$title = strip_tags(html_entity_decode(bbcode($rr['summary']),ENT_QUOTES,'UTF-8'));
|
||||
if(! $title) {
|
||||
list($title, $_trash) = explode("<br",bbcode($rr['desc']),2);
|
||||
$title = strip_tags(html_entity_decode($title,ENT_QUOTES,'UTF-8'));
|
||||
}
|
||||
$html = format_event_html($rr);
|
||||
$rr['desc'] = bbcode($rr['desc']);
|
||||
$rr['location'] = bbcode($rr['location']);
|
||||
$events[] = array(
|
||||
'id'=>$rr['id'],
|
||||
'start'=> $start,
|
||||
'end' => $end,
|
||||
'allDay' => false,
|
||||
'title' => $title,
|
||||
|
||||
'j' => $j,
|
||||
'd' => $d,
|
||||
'edit' => $edit,
|
||||
'is_first'=>$is_first,
|
||||
'item'=>$rr,
|
||||
'html'=>$html,
|
||||
'plink' => array($rr['plink'],t('link to source'),'',''),
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
$events = process_events($r);
|
||||
|
||||
if ($a->argv[1] === 'json'){
|
||||
echo json_encode($events); killme();
|
||||
|
@ -454,6 +377,7 @@ function events_content(&$a) {
|
|||
'$baseurl' => $a->get_baseurl(),
|
||||
'$tabs' => $tabs,
|
||||
'$title' => t('Events'),
|
||||
'$view' => t('View'),
|
||||
'$new_event'=> array($a->get_baseurl().'/events/new',t('Create New Event'),'',''),
|
||||
'$previus' => array($a->get_baseurl()."/events/$prevyear/$prevmonth",t('Previous'),'',''),
|
||||
'$next' => array($a->get_baseurl()."/events/$nextyear/$nextmonth",t('Next'),'',''),
|
||||
|
@ -461,6 +385,11 @@ function events_content(&$a) {
|
|||
|
||||
'$events' => $events,
|
||||
|
||||
"today" => t("today"),
|
||||
"month" => t("month"),
|
||||
"week" => t("week"),
|
||||
"day" => t("day"),
|
||||
|
||||
|
||||
));
|
||||
|
||||
|
@ -475,7 +404,7 @@ function events_content(&$a) {
|
|||
intval($event_id),
|
||||
intval(local_user())
|
||||
);
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$orig_event = $r[0];
|
||||
}
|
||||
|
||||
|
@ -554,11 +483,11 @@ function events_content(&$a) {
|
|||
'$title' => t('Event details'),
|
||||
'$desc' => t('Starting date and Title are required.'),
|
||||
'$s_text' => t('Event Starts:') . ' <span class="required" title="' . t('Required') . '">*</span>',
|
||||
'$s_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$syear+5),DateTime::createFromFormat('Y-m-d H:i',"$syear-$smonth-$sday $shour:$sminute"),'start_text',true,true,'','',true),
|
||||
'$s_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$syear+5),DateTime::createFromFormat('Y-m-d H:i',"$syear-$smonth-$sday $shour:$sminute"),t('Event Starts:'),'start_text',true,true,'','',true),
|
||||
'$n_text' => t('Finish date/time is not known or not relevant'),
|
||||
'$n_checked' => $n_checked,
|
||||
'$f_text' => t('Event Finishes:'),
|
||||
'$f_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$fyear+5),DateTime::createFromFormat('Y-m-d H:i',"$fyear-$fmonth-$fday $fhour:$fminute"),'finish_text',true,true,'start_text'),
|
||||
'$f_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$fyear+5),DateTime::createFromFormat('Y-m-d H:i',"$fyear-$fmonth-$fday $fhour:$fminute"),t('Event Finishes:'),'finish_text',true,true,'start_text'),
|
||||
'$a_text' => t('Adjust for viewer timezone'),
|
||||
'$a_checked' => $a_checked,
|
||||
'$d_text' => t('Description:'),
|
||||
|
@ -567,11 +496,18 @@ function events_content(&$a) {
|
|||
'$l_orig' => $l_orig,
|
||||
'$t_text' => t('Title:') . ' <span class="required" title="' . t('Required') . '">*</span>',
|
||||
'$t_orig' => $t_orig,
|
||||
'$summary' => array('summary', t('Title:'), $t_orig, '', '*'),
|
||||
'$sh_text' => t('Share this event'),
|
||||
'$share' => array('share', t('Share this event'), $sh_checked, ''),
|
||||
'$sh_checked' => $sh_checked,
|
||||
'$nofinish' => array('nofinish', t('Finish date/time is not known or not relevant'), $n_checked),
|
||||
'$adjust' => array('adjust', t('Adjust for viewer timezone'), $a_checked),
|
||||
'$preview' => t('Preview'),
|
||||
'$acl' => $acl,
|
||||
'$submit' => t('Submit')
|
||||
'$submit' => t('Submit'),
|
||||
'$basic' => t("Basic"),
|
||||
'$advanced' => t("Advanced"),
|
||||
'$permissions' => t('Permissions'),
|
||||
|
||||
));
|
||||
|
||||
|
|
61
mod/fetch.php
Normal file
61
mod/fetch.php
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
/*
|
||||
This file is part of the Diaspora protocol. It is used for fetching single public posts.
|
||||
*/
|
||||
require_once("include/crypto.php");
|
||||
require_once("include/diaspora.php");
|
||||
require_once("include/xml.php");
|
||||
|
||||
function fetch_init($a){
|
||||
|
||||
if (($a->argc != 3) OR (!in_array($a->argv[1], array("post", "status_message", "reshare")))) {
|
||||
header($_SERVER["SERVER_PROTOCOL"].' 404 '.t('Not Found'));
|
||||
killme();
|
||||
}
|
||||
|
||||
$guid = $a->argv[2];
|
||||
|
||||
// Fetch the item
|
||||
$item = q("SELECT `uid`, `title`, `body`, `guid`, `contact-id`, `private`, `created`, `app`, `location`, `coord`
|
||||
FROM `item` WHERE `wall` AND NOT `private` AND `guid` = '%s' AND `network` IN ('%s', '%s') AND `id` = `parent` LIMIT 1",
|
||||
dbesc($guid), NETWORK_DFRN, NETWORK_DIASPORA);
|
||||
if (!$item) {
|
||||
$r = q("SELECT `author-link`
|
||||
FROM `item` WHERE `uid` = 0 AND `guid` = '%s' AND `network` IN ('%s', '%s') AND `id` = `parent` LIMIT 1",
|
||||
dbesc($guid), NETWORK_DFRN, NETWORK_DIASPORA);
|
||||
if ($r) {
|
||||
$parts = parse_url($r[0]["author-link"]);
|
||||
$host = $parts["scheme"]."://".$parts["host"];
|
||||
|
||||
if (normalise_link($host) != normalise_link(App::get_baseurl())) {
|
||||
$location = $host."/fetch/".$a->argv[1]."/".urlencode($guid);
|
||||
|
||||
header("HTTP/1.1 301 Moved Permanently");
|
||||
header("Location:".$location);
|
||||
killme();
|
||||
}
|
||||
}
|
||||
|
||||
header($_SERVER["SERVER_PROTOCOL"].' 404 '.t('Not Found'));
|
||||
killme();
|
||||
}
|
||||
|
||||
// Fetch some data from the author (We could combine both queries - but I think this is more readable)
|
||||
$r = q("SELECT `user`.`prvkey`, `contact`.`addr`, `user`.`nickname`, `contact`.`nick` FROM `user`
|
||||
INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid`
|
||||
WHERE `user`.`uid` = %d", intval($item[0]["uid"]));
|
||||
if (!$r) {
|
||||
header($_SERVER["SERVER_PROTOCOL"].' 404 '.t('Not Found'));
|
||||
killme();
|
||||
}
|
||||
$user = $r[0];
|
||||
|
||||
$status = diaspora::build_status($item[0], $user);
|
||||
$xml = diaspora::build_post_xml($status["type"], $status["message"]);
|
||||
|
||||
// Send the envelope
|
||||
header("Content-Type: application/magic-envelope+xml; charset=utf-8");
|
||||
echo diaspora::build_magic_envelope($xml, $user);
|
||||
|
||||
killme();
|
||||
}
|
|
@ -24,7 +24,7 @@ function friendica_init(&$a) {
|
|||
$visible_plugins = array();
|
||||
if(is_array($a->plugins) && count($a->plugins)) {
|
||||
$r = q("select * from addon where hidden = 0");
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
foreach($r as $rr)
|
||||
$visible_plugins[] = $rr['name'];
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ function friendica_content(&$a) {
|
|||
$visible_plugins = array();
|
||||
if(is_array($a->plugins) && count($a->plugins)) {
|
||||
$r = q("select * from addon where hidden = 0");
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
foreach($r as $rr)
|
||||
$visible_plugins[] = $rr['name'];
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ function fsuggest_post(&$a) {
|
|||
intval($new_contact),
|
||||
intval(local_user())
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
|
||||
$x = q("INSERT INTO `fsuggest` ( `uid`,`cid`,`name`,`url`,`request`,`photo`,`note`,`created`)
|
||||
VALUES ( %d, %d, '%s','%s','%s','%s','%s','%s')",
|
||||
|
@ -50,14 +50,14 @@ function fsuggest_post(&$a) {
|
|||
dbesc($hash),
|
||||
intval(local_user())
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$fsuggest_id = $r[0]['id'];
|
||||
q("UPDATE `fsuggest` SET `note` = '%s' WHERE `id` = %d AND `uid` = %d",
|
||||
dbesc($note),
|
||||
intval($fsuggest_id),
|
||||
intval(local_user())
|
||||
);
|
||||
proc_run('php', 'include/notifier.php', 'suggest' , $fsuggest_id);
|
||||
proc_run(PRIORITY_HIGH, 'include/notifier.php', 'suggest', $fsuggest_id);
|
||||
}
|
||||
|
||||
info( t('Friend suggestion sent.') . EOL);
|
||||
|
|
|
@ -107,7 +107,7 @@ function group_content(&$a) {
|
|||
intval($a->argv[2]),
|
||||
intval(local_user())
|
||||
);
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$result = group_rmv(local_user(),$r[0]['name']);
|
||||
if($result)
|
||||
info( t('Group removed.') . EOL);
|
||||
|
@ -125,7 +125,7 @@ function group_content(&$a) {
|
|||
intval($a->argv[2]),
|
||||
intval(local_user())
|
||||
);
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$change = intval($a->argv[2]);
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ function group_content(&$a) {
|
|||
intval(local_user())
|
||||
);
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$textmode = (($switchtotext && (count($r) > $switchtotext)) ? true : false);
|
||||
foreach($r as $member) {
|
||||
if(! in_array($member['id'],$preselected)) {
|
||||
|
|
|
@ -25,7 +25,6 @@ function hostxrd_init(&$a) {
|
|||
'$zot_post' => z_root() . '/post',
|
||||
'$bigkey' => salmon_key(get_config('system','site_pubkey')),
|
||||
));
|
||||
session_write_close();
|
||||
exit();
|
||||
|
||||
}
|
||||
|
|
121
mod/hovercard.php
Normal file
121
mod/hovercard.php
Normal file
|
@ -0,0 +1,121 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Name: Frio Hovercard
|
||||
* Description: Hovercard addon for the frio theme
|
||||
* Version: 0.1
|
||||
* Author: Rabuzarus <https://github.com/rabuzarus>
|
||||
* License: GNU AFFERO GENERAL PUBLIC LICENSE (Version 3)
|
||||
*/
|
||||
|
||||
require_once("include/socgraph.php");
|
||||
require_once("include/Contact.php");
|
||||
|
||||
function hovercard_init(&$a) {
|
||||
// Just for testing purposes
|
||||
$_GET["mode"] = "minimal";
|
||||
}
|
||||
function hovercard_content() {
|
||||
$profileurl = (x($_REQUEST,'profileurl') ? $_REQUEST['profileurl'] : "");
|
||||
$datatype = (x($_REQUEST,'datatype') ?$_REQUEST['datatype'] : "json");
|
||||
|
||||
// Get out if the system doesn't have public access allowed
|
||||
if(intval(get_config('system','block_public')))
|
||||
http_status_exit(401);
|
||||
|
||||
// Return the raw content of the template. We use this to make templates usable for js functions.
|
||||
// Look at hovercard.js (function getHoverCardTemplate()).
|
||||
// This part should be moved in it's own module. Maybe we could make more templates accessabel.
|
||||
// (We need to discuss possible security lacks before doing this)
|
||||
if ($datatype == "tpl") {
|
||||
$templatecontent = get_template_content("hovercard.tpl");
|
||||
echo $templatecontent;
|
||||
killme();
|
||||
}
|
||||
|
||||
// If a contact is connected the url is internally changed to "redir/CID". We need the pure url to search for
|
||||
// the contact. So we strip out the contact id from the internal url and look in the contact table for
|
||||
// the real url (nurl)
|
||||
if(local_user() && strpos($profileurl, "redir/") === 0) {
|
||||
$cid = intval(substr($profileurl, 6));
|
||||
$r = q("SELECT `nurl`, `self` FROM `contact` WHERE `id` = '%d' LIMIT 1", intval($cid));
|
||||
$profileurl = ($r[0]["nurl"] ? $r[0]["nurl"] : "");
|
||||
$self = ($r[0]["self"] ? $r[0]["self"] : "");
|
||||
}
|
||||
|
||||
// if it's the url containing https it should be converted to http
|
||||
$nurl = normalise_link(clean_contact_url($profileurl));
|
||||
if($nurl) {
|
||||
// Search for contact data
|
||||
$contact = get_contact_details_by_url($nurl);
|
||||
}
|
||||
|
||||
if(!is_array($contact))
|
||||
return;
|
||||
|
||||
// Get the photo_menu - the menu if possible contact actions
|
||||
if(local_user())
|
||||
$actions = contact_photo_menu($contact);
|
||||
|
||||
|
||||
// Move the contact data to the profile array so we can deliver it to
|
||||
//
|
||||
$profile = array(
|
||||
'name' => $contact["name"],
|
||||
'nick' => $contact["nick"],
|
||||
'addr' => (($contact["addr"] != "") ? $contact["addr"] : $contact["url"]),
|
||||
'thumb' => proxy_url($contact["thumb"], false, PROXY_SIZE_THUMB),
|
||||
'url' => ($cid ? ("redir/".$cid) : zrl($contact["url"])),
|
||||
'nurl' => $contact["nurl"], // We additionally store the nurl as identifier
|
||||
// 'alias' => $contact["alias"],
|
||||
'location' => $contact["location"],
|
||||
'gender' => $contact["gender"],
|
||||
'about' => $contact["about"],
|
||||
'network' => format_network_name($contact["network"], $contact["url"]),
|
||||
'tags' => $contact["keywords"],
|
||||
// 'nsfw' => intval($contact["nsfw"]),
|
||||
// 'server_url' => $contact["server_url"],
|
||||
'bd' => (($contact["birthday"] == "0000-00-00") ? "" : $contact["birthday"]),
|
||||
// 'generation' => $contact["generation"],
|
||||
'account_type' => ($contact['community'] ? t("Forum") : ""),
|
||||
'actions' => $actions,
|
||||
);
|
||||
|
||||
if($datatype == "html") {
|
||||
$t = get_markup_template("hovercard.tpl");
|
||||
|
||||
$o = replace_macros($t, array(
|
||||
'$profile' => $profile,
|
||||
));
|
||||
|
||||
return $o;
|
||||
|
||||
} else {
|
||||
json_return_and_die($profile);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the raw content of a template file
|
||||
*
|
||||
* @param string $template The name of the template
|
||||
* @param string $root Directory of the template
|
||||
*
|
||||
* @return string|bool Output the raw content if existent, otherwise false
|
||||
*/
|
||||
function get_template_content($template, $root = "") {
|
||||
|
||||
// We load the whole template system to get the filename.
|
||||
// Maybe we can do it a little bit smarter if I get time.
|
||||
$t = get_markup_template($template, $root);
|
||||
$filename = $t->filename;
|
||||
|
||||
// Get the content of the template file
|
||||
if(file_exists($filename)) {
|
||||
$content = file_get_contents($filename);
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
|
@ -418,6 +418,7 @@ function check_funcs(&$checks) {
|
|||
check_add($ck_funcs, t('mb_string PHP module'), true, true, "");
|
||||
check_add($ck_funcs, t('mcrypt PHP module'), true, true, "");
|
||||
check_add($ck_funcs, t('XML PHP module'), true, true, "");
|
||||
check_add($ck_funcs, t('iconv module'), true, true, "");
|
||||
|
||||
if(function_exists('apache_get_modules')){
|
||||
if (! in_array('mod_rewrite',apache_get_modules())) {
|
||||
|
@ -451,6 +452,10 @@ function check_funcs(&$checks) {
|
|||
$ck_funcs[5]['status']= false;
|
||||
$ck_funcs[5]['help']= t('Error: mcrypt PHP module required but not installed.');
|
||||
}
|
||||
if(! function_exists('iconv_strlen')){
|
||||
$ck_funcs[7]['status']= false;
|
||||
$ck_funcs[7]['help']= t('Error: iconv PHP module required but not installed.');
|
||||
}
|
||||
|
||||
$checks = array_merge($checks, $ck_funcs);
|
||||
|
||||
|
|
48
mod/item.php
48
mod/item.php
|
@ -25,6 +25,7 @@ require_once('include/text.php');
|
|||
require_once('include/items.php');
|
||||
require_once('include/Scrape.php');
|
||||
require_once('include/diaspora.php');
|
||||
require_once('include/Contact.php');
|
||||
|
||||
function item_post(&$a) {
|
||||
|
||||
|
@ -129,7 +130,7 @@ function item_post(&$a) {
|
|||
intval($parent_item['contact-id']),
|
||||
intval($uid)
|
||||
);
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$parent_contact = $r[0];
|
||||
|
||||
// If the contact id doesn't fit with the contact, then set the contact to null
|
||||
|
@ -140,7 +141,7 @@ function item_post(&$a) {
|
|||
|
||||
$r = q("SELECT * FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
|
||||
dbesc(normalise_link($thrparent[0]["author-link"])));
|
||||
if (dba::is_result($r)) {
|
||||
if (dbm::is_result($r)) {
|
||||
$parent_contact = $r[0];
|
||||
$parent_contact["thumb"] = $parent_contact["photo"];
|
||||
$parent_contact["micro"] = $parent_contact["photo"];
|
||||
|
@ -219,7 +220,7 @@ function item_post(&$a) {
|
|||
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
|
||||
intval($profile_uid)
|
||||
);
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$user = $r[0];
|
||||
|
||||
if($orig_post) {
|
||||
|
@ -322,7 +323,7 @@ function item_post(&$a) {
|
|||
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
|
||||
intval(local_user())
|
||||
);
|
||||
if(dba::is_result($r) && intval($r[0]['pubmail']))
|
||||
if(dbm::is_result($r) && intval($r[0]['pubmail']))
|
||||
$pubmail_enabled = true;
|
||||
}
|
||||
}
|
||||
|
@ -391,7 +392,7 @@ function item_post(&$a) {
|
|||
}
|
||||
}
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$author = $r[0];
|
||||
$contact_id = $author['id'];
|
||||
}
|
||||
|
@ -405,7 +406,7 @@ function item_post(&$a) {
|
|||
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
|
||||
intval($profile_uid)
|
||||
);
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$contact_record = $r[0];
|
||||
}
|
||||
|
||||
|
@ -490,7 +491,7 @@ function item_post(&$a) {
|
|||
intval($profile_uid),
|
||||
intval($attach)
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$r = q("UPDATE `attach` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s'
|
||||
WHERE `uid` = %d AND `id` = %d",
|
||||
dbesc($str_contact_allow),
|
||||
|
@ -631,7 +632,7 @@ function item_post(&$a) {
|
|||
intval($profile_uid),
|
||||
intval($mtch)
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
if(strlen($attachments))
|
||||
$attachments .= ',';
|
||||
$attachments .= '[attach]href="' . $a->get_baseurl() . '/attach/' . $r[0]['id'] . '" length="' . $r[0]['filesize'] . '" type="' . $r[0]['filetype'] . '" title="' . (($r[0]['filename']) ? $r[0]['filename'] : '') . '"[/attach]';
|
||||
|
@ -676,9 +677,11 @@ function item_post(&$a) {
|
|||
$datarray['owner-name'] = $contact_record['name'];
|
||||
$datarray['owner-link'] = $contact_record['url'];
|
||||
$datarray['owner-avatar'] = $contact_record['thumb'];
|
||||
$datarray["owner-id"] = get_contact($datarray["owner-link"], 0);
|
||||
$datarray['author-name'] = $author['name'];
|
||||
$datarray['author-link'] = $author['url'];
|
||||
$datarray['author-avatar'] = $author['thumb'];
|
||||
$datarray["author-id"] = get_contact($datarray["author-link"], 0);
|
||||
$datarray['created'] = datetime_convert();
|
||||
$datarray['edited'] = datetime_convert();
|
||||
$datarray['commented'] = datetime_convert();
|
||||
|
@ -711,6 +714,7 @@ function item_post(&$a) {
|
|||
$datarray['moderated'] = $allow_moderated;
|
||||
$datarray['gcontact-id'] = get_gcontact_id(array("url" => $datarray['author-link'], "network" => $datarray['network'],
|
||||
"photo" => $datarray['author-avatar'], "name" => $datarray['author-name']));
|
||||
|
||||
/**
|
||||
* These fields are for the convenience of plugins...
|
||||
* 'self' if true indicates the owner is posting on their own wall
|
||||
|
@ -779,7 +783,7 @@ function item_post(&$a) {
|
|||
// update filetags in pconfig
|
||||
file_tag_update_pconfig($uid,$categories_old,$categories_new,'category');
|
||||
|
||||
proc_run('php', "include/notifier.php", 'edit_post', "$post_id");
|
||||
proc_run(PRIORITY_HIGH, "include/notifier.php", 'edit_post', $post_id);
|
||||
if((x($_REQUEST,'return')) && strlen($return_path)) {
|
||||
logger('return: ' . $return_path);
|
||||
goaway($a->get_baseurl() . "/" . $return_path );
|
||||
|
@ -790,10 +794,24 @@ function item_post(&$a) {
|
|||
$post_id = 0;
|
||||
|
||||
|
||||
$r = q("INSERT INTO `item` (`guid`, `extid`, `uid`,`type`,`wall`,`gravity`, `network`, `contact-id`,`owner-name`,`owner-link`,`owner-avatar`, `author-name`, `author-link`, `author-avatar`,
|
||||
`created`, `edited`, `commented`, `received`, `changed`, `uri`, `thr-parent`, `title`, `body`, `app`, `location`, `coord`, `tag`, `inform`, `verb`, `object-type`, `postopts`,
|
||||
`allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach`, `bookmark`,`origin`, `moderated`, `file`, `rendered-html`, `rendered-hash`)
|
||||
VALUES( '%s', '%s', %d, '%s', %d, %d, '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, %d, '%s', '%s', '%s')",
|
||||
$r = q("INSERT INTO `item` (`guid`, `extid`, `uid`,`type`,`wall`,`gravity`, `network`, `contact-id`,
|
||||
`owner-name`,`owner-link`,`owner-avatar`, `owner-id`,
|
||||
`author-name`, `author-link`, `author-avatar`, `author-id`,
|
||||
`created`, `edited`, `commented`, `received`, `changed`,
|
||||
`uri`, `thr-parent`, `title`, `body`, `app`, `location`, `coord`,
|
||||
`tag`, `inform`, `verb`, `object-type`, `postopts`,
|
||||
`allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`,
|
||||
`pubmail`, `attach`, `bookmark`,`origin`, `moderated`, `file`,
|
||||
`rendered-html`, `rendered-hash`)
|
||||
VALUES('%s', '%s', %d, '%s', %d, %d, '%s', %d,
|
||||
'%s', '%s', '%s', %d,
|
||||
'%s', '%s', '%s', %d,
|
||||
'%s', '%s', '%s', '%s', '%s',
|
||||
'%s', '%s', '%s', '%s', '%s', '%s', '%s',
|
||||
'%s', '%s', '%s', '%s', '%s',
|
||||
'%s', '%s', '%s', '%s', %d,
|
||||
%d, '%s', %d, %d, %d, '%s',
|
||||
'%s', '%s')",
|
||||
dbesc($datarray['guid']),
|
||||
dbesc($datarray['extid']),
|
||||
intval($datarray['uid']),
|
||||
|
@ -805,9 +823,11 @@ function item_post(&$a) {
|
|||
dbesc($datarray['owner-name']),
|
||||
dbesc($datarray['owner-link']),
|
||||
dbesc($datarray['owner-avatar']),
|
||||
intval($datarray['owner-id']),
|
||||
dbesc($datarray['author-name']),
|
||||
dbesc($datarray['author-link']),
|
||||
dbesc($datarray['author-avatar']),
|
||||
intval($datarray['author-id']),
|
||||
dbesc($datarray['created']),
|
||||
dbesc($datarray['edited']),
|
||||
dbesc($datarray['commented']),
|
||||
|
@ -1012,7 +1032,7 @@ function item_post(&$a) {
|
|||
// Currently the only realistic fixes are to use a reliable server - which precludes shared hosting,
|
||||
// or cut back on plugins which do remote deliveries.
|
||||
|
||||
proc_run('php', "include/notifier.php", $notify_type, "$post_id");
|
||||
proc_run(PRIORITY_HIGH, "include/notifier.php", $notify_type, $post_id);
|
||||
|
||||
logger('post_complete');
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ function lockview_content(&$a) {
|
|||
$r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
|
||||
dbesc(implode(', ', $allowed_groups))
|
||||
);
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
foreach($r as $rr)
|
||||
$l[] = '<b>' . $rr['name'] . '</b>';
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ function lockview_content(&$a) {
|
|||
$r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
|
||||
dbesc(implode(', ',$allowed_users))
|
||||
);
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
foreach($r as $rr)
|
||||
$l[] = $rr['name'];
|
||||
|
||||
|
@ -70,7 +70,7 @@ function lockview_content(&$a) {
|
|||
$r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
|
||||
dbesc(implode(', ', $deny_groups))
|
||||
);
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
foreach($r as $rr)
|
||||
$l[] = '<b><strike>' . $rr['name'] . '</strike></b>';
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ function lockview_content(&$a) {
|
|||
$r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
|
||||
dbesc(implode(', ',$deny_users))
|
||||
);
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
foreach($r as $rr)
|
||||
$l[] = '<strike>' . $rr['name'] . '</strike>';
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ function manage_post(&$a) {
|
|||
$r = q("select * from user where uid = %d limit 1",
|
||||
intval($_SESSION['submanage'])
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$uid = intval($r[0]['uid']);
|
||||
$orig_record = $r[0];
|
||||
}
|
||||
|
|
|
@ -67,8 +67,10 @@ function match_content(&$a) {
|
|||
if (!count($match)) {
|
||||
$jj->photo = str_replace("http:///photo/", get_server()."/photo/", $jj->photo);
|
||||
$connlnk = $a->get_baseurl() . '/follow/?url=' . $jj->url;
|
||||
$photo_menu = array(array(t("View Profile"), zrl($jj->url)));
|
||||
$photo_menu[] = array(t("Connect/Follow"), $connlnk);
|
||||
$photo_menu = array(
|
||||
'profile' => array(t("View Profile"), zrl($jj->url)),
|
||||
'follow' => array(t("Connect/Follow"), $connlnk)
|
||||
);
|
||||
|
||||
$contact_details = get_contact_details_by_url($jj->url, local_user());
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ function message_content(&$a) {
|
|||
return;
|
||||
}
|
||||
|
||||
$myprofile = 'profile/' . $a->user['nickname'];
|
||||
$myprofile = $a->get_baseurl().'/profile/' . $a->user['nickname'];
|
||||
|
||||
$tpl = get_markup_template('mail_head.tpl');
|
||||
$header = replace_macros($tpl, array(
|
||||
|
@ -242,7 +242,7 @@ function message_content(&$a) {
|
|||
intval($a->argv[2]),
|
||||
intval(local_user())
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$parent = $r[0]['parent-uri'];
|
||||
$convid = $r[0]['convid'];
|
||||
|
||||
|
@ -305,15 +305,31 @@ function message_content(&$a) {
|
|||
$prename = $preurl = $preid = '';
|
||||
|
||||
if($preselect) {
|
||||
$r = q("select name, url, id from contact where uid = %d and id = %d limit 1",
|
||||
$r = q("SELECT `name`, `url`, `id` FROM `contact` WHERE `uid` = %d AND `id` = %d LIMIT 1",
|
||||
intval(local_user()),
|
||||
intval($a->argv[2])
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(!dbm::is_result($r)) {
|
||||
$r = q("SELECT `name`, `url`, `id` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' LIMIT 1",
|
||||
intval(local_user()),
|
||||
dbesc(normalise_link(base64_decode($a->argv[2])))
|
||||
);
|
||||
}
|
||||
|
||||
if(!dbm::is_result($r)) {
|
||||
$r = q("SELECT `name`, `url`, `id` FROM `contact` WHERE `uid` = %d AND `addr` = '%s' LIMIT 1",
|
||||
intval(local_user()),
|
||||
dbesc(base64_decode($a->argv[2]))
|
||||
);
|
||||
}
|
||||
|
||||
if(dbm::is_result($r)) {
|
||||
$prename = $r[0]['name'];
|
||||
$preurl = $r[0]['url'];
|
||||
$preid = $r[0]['id'];
|
||||
}
|
||||
$preselect = array($preid);
|
||||
} else
|
||||
$preselect = false;
|
||||
}
|
||||
|
||||
$prefill = (($preselect) ? $prename : '');
|
||||
|
@ -342,7 +358,6 @@ function message_content(&$a) {
|
|||
'$wait' => t('Please wait'),
|
||||
'$submit' => t('Submit')
|
||||
));
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
@ -357,17 +372,16 @@ function message_content(&$a) {
|
|||
|
||||
$r = q("SELECT count(*) AS `total` FROM `mail`
|
||||
WHERE `mail`.`uid` = %d GROUP BY `parent-uri` ORDER BY `created` DESC",
|
||||
intval(local_user()),
|
||||
dbesc($myprofile)
|
||||
intval(local_user())
|
||||
);
|
||||
|
||||
if (dba::is_result($r)) {
|
||||
if (dbm::is_result($r)) {
|
||||
$a->set_pager_total($r[0]['total']);
|
||||
}
|
||||
|
||||
$r = get_messages(local_user(), $a->pager['start'], $a->pager['itemspage']);
|
||||
|
||||
if(! dba::is_result($r)) {
|
||||
if(! dbm::is_result($r)) {
|
||||
info( t('No messages.') . EOL);
|
||||
return $o;
|
||||
}
|
||||
|
@ -393,7 +407,7 @@ function message_content(&$a) {
|
|||
intval(local_user()),
|
||||
intval($a->argv[1])
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$contact_id = $r[0]['contact-id'];
|
||||
$convid = $r[0]['convid'];
|
||||
|
||||
|
@ -449,9 +463,11 @@ function message_content(&$a) {
|
|||
if($message['from-url'] == $myprofile) {
|
||||
$from_url = $myprofile;
|
||||
$sparkle = '';
|
||||
}
|
||||
else {
|
||||
$from_url = 'redir/' . $message['contact-id'];
|
||||
} elseif ($message['contact-id'] != 0) {
|
||||
$from_url = 'redir/'.$message['contact-id'];
|
||||
$sparkle = ' sparkle';
|
||||
} else {
|
||||
$from_url = $message['from-url']."?zrl=".urlencode($myprofile);
|
||||
$sparkle = ' sparkle';
|
||||
}
|
||||
|
||||
|
@ -465,20 +481,25 @@ function message_content(&$a) {
|
|||
$subject_e = template_escape($message['title']);
|
||||
$body_e = template_escape(Smilies::replace(bbcode($message['body'])));
|
||||
$to_name_e = template_escape($message['name']);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$from_name_e = $message['from-name'];
|
||||
$subject_e = $message['title'];
|
||||
$body_e = Smilies::replace(bbcode($message['body']));
|
||||
$to_name_e = $message['name'];
|
||||
}
|
||||
|
||||
$contact = get_contact_details_by_url($message['from-url']);
|
||||
if (isset($contact["thumb"]))
|
||||
$from_photo = $contact["thumb"];
|
||||
else
|
||||
$from_photo = $message['from-photo'];
|
||||
|
||||
$mails[] = array(
|
||||
'id' => $message['id'],
|
||||
'from_name' => $from_name_e,
|
||||
'from_url' => $from_url,
|
||||
'sparkle' => $sparkle,
|
||||
'from_photo' => $message['from-photo'],
|
||||
'from_photo' => proxy_url($from_photo, false, PROXY_SIZE_THUMB),
|
||||
'subject' => $subject_e,
|
||||
'body' => $body_e,
|
||||
'delete' => t('Delete message'),
|
||||
|
@ -552,19 +573,16 @@ function render_messages(array $msg, $t) {
|
|||
$tpl = get_markup_template($t);
|
||||
$rslt = '';
|
||||
|
||||
$myprofile = 'profile/' . $a->user['nickname'];
|
||||
$myprofile = $a->get_baseurl().'/profile/' . $a->user['nickname'];
|
||||
|
||||
foreach($msg as $rr) {
|
||||
|
||||
if($rr['unknown']) {
|
||||
if($rr['unknown'])
|
||||
$participants = sprintf( t("Unknown sender - %s"),$rr['from-name']);
|
||||
}
|
||||
elseif (link_compare($rr['from-url'], $myprofile)){
|
||||
elseif (link_compare($rr['from-url'], $myprofile))
|
||||
$participants = sprintf( t("You and %s"), $rr['name']);
|
||||
}
|
||||
else {
|
||||
$participants = sprintf( t("%s and You"), $rr['from-name']);
|
||||
}
|
||||
else
|
||||
$participants = sprintf(t("%s and You"), $rr['from-name']);
|
||||
|
||||
if($a->theme['template_engine'] === 'internal') {
|
||||
$subject_e = template_escape((($rr['mailseen']) ? $rr['title'] : '<strong>' . $rr['title'] . '</strong>'));
|
||||
|
@ -577,12 +595,18 @@ function render_messages(array $msg, $t) {
|
|||
$to_name_e = $rr['name'];
|
||||
}
|
||||
|
||||
$contact = get_contact_details_by_url($rr['url']);
|
||||
if (isset($contact["thumb"]))
|
||||
$from_photo = $contact["thumb"];
|
||||
else
|
||||
$from_photo = (($rr['thumb']) ? $rr['thumb'] : $rr['from-photo']);
|
||||
|
||||
$rslt .= replace_macros($tpl, array(
|
||||
'$id' => $rr['id'],
|
||||
'$from_name' => $participants,
|
||||
'$from_url' => (($rr['network'] === NETWORK_DFRN) ? 'redir/' . $rr['contact-id'] : $rr['url']),
|
||||
'$sparkle' => ' sparkle',
|
||||
'$from_photo' => (($rr['thumb']) ? $rr['thumb'] : $rr['from-photo']),
|
||||
'$from_photo' => proxy_url($from_photo, false, PROXY_SIZE_THUMB),
|
||||
'$subject' => $subject_e,
|
||||
'$delete' => t('Delete conversation'),
|
||||
'$body' => $body_e,
|
||||
|
|
|
@ -36,7 +36,7 @@ function mood_init(&$a) {
|
|||
intval($parent),
|
||||
intval($uid)
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$parent_uri = $r[0]['uri'];
|
||||
$private = $r[0]['private'];
|
||||
$allow_cid = $r[0]['allow_cid'];
|
||||
|
@ -95,13 +95,13 @@ function mood_init(&$a) {
|
|||
intval($uid),
|
||||
intval($item_id)
|
||||
);
|
||||
proc_run('php',"include/notifier.php","tag","$item_id");
|
||||
proc_run(PRIORITY_HIGH, "include/notifier.php", "tag", $item_id);
|
||||
}
|
||||
|
||||
|
||||
call_hooks('post_local_end', $arr);
|
||||
|
||||
proc_run('php',"include/notifier.php","like","$post_id");
|
||||
proc_run(PRIORITY_HIGH, "include/notifier.php", "like", $post_id);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ function msearch_post(&$a) {
|
|||
dbesc($search)
|
||||
);
|
||||
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$total = $r[0]['total'];
|
||||
|
||||
$results = array();
|
||||
|
@ -25,7 +25,7 @@ function msearch_post(&$a) {
|
|||
intval($perpage)
|
||||
);
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
foreach($r as $rr)
|
||||
$results[] = array(
|
||||
'name' => $rr['name'],
|
||||
|
|
258
mod/network.php
258
mod/network.php
|
@ -143,7 +143,7 @@ function network_init(&$a) {
|
|||
// search terms header
|
||||
if(x($_GET,'search')) {
|
||||
$a->page['content'] .= replace_macros(get_markup_template("section_title.tpl"),array(
|
||||
'$title' => sprintf( t('Search Results For: %s'), $search)
|
||||
'$title' => sprintf( t('Results for: %s'), $search)
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ function saved_searches($search) {
|
|||
|
||||
$saved = array();
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
foreach($r as $rr) {
|
||||
$saved[] = array(
|
||||
'id' => $rr['id'],
|
||||
|
@ -280,7 +280,8 @@ function network_query_get_sel_tab($a) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return selected network from query
|
||||
* @brief Return selected network from query
|
||||
* @return string Name of the selected network
|
||||
*/
|
||||
function network_query_get_sel_net() {
|
||||
$network = false;
|
||||
|
@ -348,92 +349,7 @@ function network_content(&$a, $update = 0) {
|
|||
|
||||
$o = '';
|
||||
|
||||
// item filter tabs
|
||||
/// @TODO fix this logic, reduce duplication
|
||||
/// $a->page['content'] .= '<div class="tabs-wrapper">';
|
||||
|
||||
list($no_active, $all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active) = network_query_get_sel_tab($a);
|
||||
// if no tabs are selected, defaults to comments
|
||||
if ($no_active=='active') $all_active='active';
|
||||
|
||||
$cmd = (($datequery) ? '' : $a->cmd);
|
||||
$len_naked_cmd = strlen(str_replace('/new','',$cmd));
|
||||
|
||||
// tabs
|
||||
$tabs = array(
|
||||
array(
|
||||
'label' => t('Commented Order'),
|
||||
'url' => str_replace('/new', '', $cmd) . '?f=&order=comment' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''),
|
||||
'sel' => $all_active,
|
||||
'title' => t('Sort by Comment Date'),
|
||||
'id' => 'commented-order-tab',
|
||||
'accesskey' => "e",
|
||||
),
|
||||
array(
|
||||
'label' => t('Posted Order'),
|
||||
'url' => str_replace('/new', '', $cmd) . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''),
|
||||
'sel' => $postord_active,
|
||||
'title' => t('Sort by Post Date'),
|
||||
'id' => 'posted-order-tab',
|
||||
'accesskey' => "t",
|
||||
),
|
||||
);
|
||||
|
||||
if(feature_enabled(local_user(),'personal_tab')) {
|
||||
$tabs[] = array(
|
||||
'label' => t('Personal'),
|
||||
'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&conv=1',
|
||||
'sel' => $conv_active,
|
||||
'title' => t('Posts that mention or involve you'),
|
||||
'id' => 'personal-tab',
|
||||
'accesskey' => "r",
|
||||
);
|
||||
}
|
||||
|
||||
if(feature_enabled(local_user(),'new_tab')) {
|
||||
$tabs[] = array(
|
||||
'label' => t('New'),
|
||||
'url' => str_replace('/new', '', $cmd) . ($len_naked_cmd ? '/' : '') . 'new' . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : ''),
|
||||
'sel' => $new_active,
|
||||
'title' => t('Activity Stream - by date'),
|
||||
'id' => 'activitiy-by-date-tab',
|
||||
'accesskey' => "w",
|
||||
);
|
||||
}
|
||||
|
||||
if(feature_enabled(local_user(),'link_tab')) {
|
||||
$tabs[] = array(
|
||||
'label' => t('Shared Links'),
|
||||
'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&bmark=1',
|
||||
'sel' => $bookmarked_active,
|
||||
'title' => t('Interesting Links'),
|
||||
'id' => 'shared-links-tab',
|
||||
'accesskey' => "b",
|
||||
);
|
||||
}
|
||||
|
||||
if(feature_enabled(local_user(),'star_posts')) {
|
||||
$tabs[] = array(
|
||||
'label' => t('Starred'),
|
||||
'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&star=1',
|
||||
'sel' => $starred_active,
|
||||
'title' => t('Favourite Posts'),
|
||||
'id' => 'starred-posts-tab',
|
||||
'accesskey' => "m",
|
||||
);
|
||||
}
|
||||
|
||||
// save selected tab, but only if not in search or file mode
|
||||
if(!x($_GET,'search') && !x($_GET,'file')) {
|
||||
set_pconfig( local_user(), 'network.view','tab.selected',array($all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active) );
|
||||
}
|
||||
|
||||
$arr = array('tabs' => $tabs);
|
||||
call_hooks('network_tabs', $arr);
|
||||
|
||||
$o .= replace_macros(get_markup_template('common_tabs.tpl'), array('$tabs'=> $arr['tabs']));
|
||||
|
||||
// --- end item filter tabs
|
||||
|
||||
$contact_id = $a->cid;
|
||||
|
||||
|
@ -465,7 +381,7 @@ function network_content(&$a, $update = 0) {
|
|||
);
|
||||
|
||||
$str = '';
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
foreach($r as $rr)
|
||||
$str .= '<' . $rr['id'] . '>';
|
||||
if(strlen($str))
|
||||
|
@ -474,6 +390,9 @@ function network_content(&$a, $update = 0) {
|
|||
set_pconfig(local_user(), 'network.view', 'net.selected', ($nets ? $nets : 'all'));
|
||||
|
||||
if(!$update AND !$rawmode) {
|
||||
$tabs = network_tabs($a);
|
||||
$o .= $tabs;
|
||||
|
||||
if($group) {
|
||||
if(($t = group_public_members($group)) && (! get_pconfig(local_user(),'system','nowarn_insecure'))) {
|
||||
notice( sprintf( tt('Warning: This group contains %s member from an insecure network.',
|
||||
|
@ -587,7 +506,7 @@ function network_content(&$a, $update = 0) {
|
|||
AND `blocked` = 0 AND `pending` = 0 LIMIT 1",
|
||||
intval($cid)
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$sql_extra = " AND ".$sql_table.".`contact-id` = ".intval($cid);
|
||||
|
||||
$entries[0] = array(
|
||||
|
@ -639,7 +558,7 @@ function network_content(&$a, $update = 0) {
|
|||
$search = escape_tags($_GET['search']);
|
||||
|
||||
if(strpos($search,'#') === 0) {
|
||||
$tag = true;
|
||||
$tag = true;
|
||||
$search = substr($search,1);
|
||||
}
|
||||
|
||||
|
@ -682,14 +601,14 @@ function network_content(&$a, $update = 0) {
|
|||
if(get_config('system', 'old_pager')) {
|
||||
$r = q("SELECT COUNT(*) AS `total`
|
||||
FROM $sql_table $sql_post_table INNER JOIN `contact` ON `contact`.`id` = $sql_table.`contact-id`
|
||||
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||
WHERE $sql_table.`uid` = %d AND $sql_table.`visible` = 1 AND $sql_table.`deleted` = 0
|
||||
AND NOT `contact`.`blocked` AND NOT `contact`.`pending`
|
||||
WHERE $sql_table.`uid` = %d AND $sql_table.`visible` AND NOT $sql_table.`deleted`
|
||||
$sql_extra2 $sql_extra3
|
||||
$sql_extra $sql_nets ",
|
||||
intval($_SESSION['uid'])
|
||||
);
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$a->set_pager_total($r[0]['total']);
|
||||
}
|
||||
}
|
||||
|
@ -714,23 +633,18 @@ function network_content(&$a, $update = 0) {
|
|||
}
|
||||
|
||||
if($nouveau) {
|
||||
$simple_update = (($update) ? " AND `item`.`unseen` = 1 " : '');
|
||||
$simple_update = (($update) ? " AND `item`.`unseen` " : '');
|
||||
|
||||
if ($sql_order == "")
|
||||
$sql_order = "`item`.`received`";
|
||||
|
||||
// "New Item View" - show all items unthreaded in reverse created date order
|
||||
$items = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, `contact`.`writable`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
FROM $sql_table $sql_post_table INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1
|
||||
AND `item`.`deleted` = 0 AND `item`.`moderated` = 0
|
||||
$items = q("SELECT %s FROM $sql_table $sql_post_table %s
|
||||
WHERE %s AND `item`.`uid` = %d
|
||||
$simple_update
|
||||
$sql_extra $sql_nets
|
||||
ORDER BY $sql_order DESC $pager_sql ",
|
||||
item_fieldlists(), item_joins(), item_condition(),
|
||||
intval($_SESSION['uid'])
|
||||
);
|
||||
|
||||
|
@ -758,28 +672,26 @@ function network_content(&$a, $update = 0) {
|
|||
|
||||
// Fetch a page full of parent items for this page
|
||||
if($update) {
|
||||
if (!get_config("system", "like_no_comment"))
|
||||
$sql_extra4 = "(`item`.`deleted` = 0
|
||||
OR `item`.`verb` = '".ACTIVITY_LIKE."' OR `item`.`verb` = '".ACTIVITY_DISLIKE."'
|
||||
OR `item`.`verb` = '".ACTIVITY_ATTEND."' OR `item`.`verb` = '".ACTIVITY_ATTENDNO."'
|
||||
OR `item`.`verb` = '".ACTIVITY_ATTENDMAYBE."')";
|
||||
if (get_config("system", "like_no_comment"))
|
||||
$sql_extra4 = " AND `item`.`verb` = '".ACTIVITY_POST."'";
|
||||
else
|
||||
$sql_extra4 = "`item`.`deleted` = 0 AND `item`.`verb` = '".ACTIVITY_POST."'";
|
||||
$sql_extra4 = "";
|
||||
|
||||
$r = q("SELECT `item`.`parent` AS `item_id`, `item`.`network` AS `item_network`, `contact`.`uid` AS `contact_uid`
|
||||
FROM $sql_table $sql_post_table INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND $sql_extra4
|
||||
AND `item`.`moderated` = 0 AND `item`.`unseen` = 1
|
||||
$sql_extra3 $sql_extra $sql_nets ORDER BY `item_id` DESC LIMIT 100",
|
||||
AND NOT `contact`.`blocked` AND NOT `contact`.`pending`
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` AND NOT `item`.`deleted` $sql_extra4
|
||||
AND NOT `item`.`moderated` AND `item`.`unseen`
|
||||
$sql_extra3 $sql_extra $sql_nets
|
||||
ORDER BY `item_id` DESC LIMIT 100",
|
||||
intval(local_user())
|
||||
);
|
||||
} else {
|
||||
$r = q("SELECT `thread`.`iid` AS `item_id`, `thread`.`network` AS `item_network`, `contact`.`uid` AS `contact_uid`
|
||||
FROM $sql_table $sql_post_table STRAIGHT_JOIN `contact` ON `contact`.`id` = `thread`.`contact-id`
|
||||
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||
WHERE `thread`.`uid` = %d AND `thread`.`visible` = 1 AND `thread`.`deleted` = 0
|
||||
AND `thread`.`moderated` = 0
|
||||
AND NOT `contact`.`blocked` AND NOT `contact`.`pending`
|
||||
WHERE `thread`.`uid` = %d AND `thread`.`visible` AND NOT `thread`.`deleted`
|
||||
AND NOT `thread`.`moderated`
|
||||
$sql_extra2 $sql_extra3 $sql_extra $sql_nets
|
||||
ORDER BY $sql_order DESC $pager_sql ",
|
||||
intval(local_user())
|
||||
|
@ -792,7 +704,7 @@ function network_content(&$a, $update = 0) {
|
|||
$parents_str = '';
|
||||
$date_offset = "";
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
foreach($r as $rr)
|
||||
if(! in_array($rr['item_id'],$parents_arr))
|
||||
$parents_arr[] = $rr['item_id'];
|
||||
|
@ -809,15 +721,7 @@ function network_content(&$a, $update = 0) {
|
|||
$items = array();
|
||||
|
||||
foreach ($parents_arr AS $parents) {
|
||||
// $sql_extra ORDER BY `item`.`commented` DESC LIMIT %d",
|
||||
$thread_items = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`, `contact`.`writable`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
FROM `item` INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
|
||||
AND `item`.`moderated` = 0
|
||||
$thread_items = q(item_query()." AND `item`.`uid` = %d
|
||||
AND `item`.`parent` = %d
|
||||
ORDER BY `item`.`commented` DESC LIMIT %d",
|
||||
intval(local_user()),
|
||||
|
@ -886,14 +790,110 @@ function network_content(&$a, $update = 0) {
|
|||
|
||||
if(!$update) {
|
||||
if(get_pconfig(local_user(),'system','infinite_scroll')) {
|
||||
$o .= scroll_loader();
|
||||
$o .= scroll_loader();
|
||||
} elseif(!get_config('system', 'old_pager')) {
|
||||
$o .= alt_pager($a,count($items));
|
||||
$o .= alt_pager($a,count($items));
|
||||
} else {
|
||||
$o .= paginate($a);
|
||||
$o .= paginate($a);
|
||||
}
|
||||
}
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the network tabs menu
|
||||
*
|
||||
* @param app $a The global App
|
||||
* @return string Html of the networktab
|
||||
*/
|
||||
function network_tabs($a) {
|
||||
// item filter tabs
|
||||
/// @TODO fix this logic, reduce duplication
|
||||
/// $a->page['content'] .= '<div class="tabs-wrapper">';
|
||||
|
||||
list($no_active, $all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active) = network_query_get_sel_tab($a);
|
||||
// if no tabs are selected, defaults to comments
|
||||
if ($no_active=='active') $all_active='active';
|
||||
|
||||
$cmd = (($datequery) ? '' : $a->cmd);
|
||||
$len_naked_cmd = strlen(str_replace('/new','',$cmd));
|
||||
|
||||
// tabs
|
||||
$tabs = array(
|
||||
array(
|
||||
'label' => t('Commented Order'),
|
||||
'url' => str_replace('/new', '', $cmd) . '?f=&order=comment' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''),
|
||||
'sel' => $all_active,
|
||||
'title' => t('Sort by Comment Date'),
|
||||
'id' => 'commented-order-tab',
|
||||
'accesskey' => "e",
|
||||
),
|
||||
array(
|
||||
'label' => t('Posted Order'),
|
||||
'url' => str_replace('/new', '', $cmd) . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''),
|
||||
'sel' => $postord_active,
|
||||
'title' => t('Sort by Post Date'),
|
||||
'id' => 'posted-order-tab',
|
||||
'accesskey' => "t",
|
||||
),
|
||||
);
|
||||
|
||||
if(feature_enabled(local_user(),'personal_tab')) {
|
||||
$tabs[] = array(
|
||||
'label' => t('Personal'),
|
||||
'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&conv=1',
|
||||
'sel' => $conv_active,
|
||||
'title' => t('Posts that mention or involve you'),
|
||||
'id' => 'personal-tab',
|
||||
'accesskey' => "r",
|
||||
);
|
||||
}
|
||||
|
||||
if(feature_enabled(local_user(),'new_tab')) {
|
||||
$tabs[] = array(
|
||||
'label' => t('New'),
|
||||
'url' => str_replace('/new', '', $cmd) . ($len_naked_cmd ? '/' : '') . 'new' . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : ''),
|
||||
'sel' => $new_active,
|
||||
'title' => t('Activity Stream - by date'),
|
||||
'id' => 'activitiy-by-date-tab',
|
||||
'accesskey' => "w",
|
||||
);
|
||||
}
|
||||
|
||||
if(feature_enabled(local_user(),'link_tab')) {
|
||||
$tabs[] = array(
|
||||
'label' => t('Shared Links'),
|
||||
'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&bmark=1',
|
||||
'sel' => $bookmarked_active,
|
||||
'title' => t('Interesting Links'),
|
||||
'id' => 'shared-links-tab',
|
||||
'accesskey' => "b",
|
||||
);
|
||||
}
|
||||
|
||||
if(feature_enabled(local_user(),'star_posts')) {
|
||||
$tabs[] = array(
|
||||
'label' => t('Starred'),
|
||||
'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&star=1',
|
||||
'sel' => $starred_active,
|
||||
'title' => t('Favourite Posts'),
|
||||
'id' => 'starred-posts-tab',
|
||||
'accesskey' => "m",
|
||||
);
|
||||
}
|
||||
|
||||
// save selected tab, but only if not in search or file mode
|
||||
if(!x($_GET,'search') && !x($_GET,'file')) {
|
||||
set_pconfig( local_user(), 'network.view','tab.selected',array($all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active) );
|
||||
}
|
||||
|
||||
$arr = array('tabs' => $tabs);
|
||||
call_hooks('network_tabs', $arr);
|
||||
|
||||
$tpl = get_markup_template('common_tabs.tpl');
|
||||
|
||||
return replace_macros($tpl, array('$tabs' => $arr['tabs']));
|
||||
|
||||
// --- end item filter tabs
|
||||
}
|
||||
|
|
|
@ -28,25 +28,25 @@ function nogroup_content(&$a) {
|
|||
|
||||
require_once('include/Contact.php');
|
||||
$r = contacts_not_grouped(local_user());
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$a->set_pager_total($r[0]['total']);
|
||||
}
|
||||
$r = contacts_not_grouped(local_user(),$a->pager['start'],$a->pager['itemspage']);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
foreach($r as $rr) {
|
||||
|
||||
$contact_details = get_contact_details_by_url($rr['url'], local_user());
|
||||
$contact_details = get_contact_details_by_url($rr['url'], local_user(), $rr);
|
||||
|
||||
$contacts[] = array(
|
||||
'img_hover' => sprintf( t('Visit %s\'s profile [%s]'),$rr['name'],$rr['url']),
|
||||
'img_hover' => sprintf(t('Visit %s\'s profile [%s]'), $contact_details['name'], $rr['url']),
|
||||
'edit_hover' => t('Edit contact'),
|
||||
'photo_menu' => contact_photo_menu($rr),
|
||||
'id' => $rr['id'],
|
||||
'alt_text' => $alt_text,
|
||||
'dir_icon' => $dir_icon,
|
||||
'thumb' => $rr['thumb'],
|
||||
'name' => $rr['name'],
|
||||
'username' => $rr['name'],
|
||||
'thumb' => proxy_url($contact_details['thumb'], false, PROXY_SIZE_THUMB),
|
||||
'name' => $contact_details['name'],
|
||||
'username' => $contact_details['name'],
|
||||
'details' => $contact_details['location'],
|
||||
'tags' => $contact_details['keywords'],
|
||||
'about' => $contact_details['about'],
|
||||
|
|
|
@ -15,8 +15,12 @@ function noscrape_init(&$a) {
|
|||
|
||||
profile_load($a,$which,$profile);
|
||||
|
||||
if(!$a->profile['net-publish'])
|
||||
killme();
|
||||
if (!$a->profile['net-publish'] OR $a->profile['hidewall']) {
|
||||
header('Content-type: application/json; charset=utf-8');
|
||||
$json_info = array("hide" => true);
|
||||
echo json_encode($json_info);
|
||||
exit;
|
||||
}
|
||||
|
||||
$keywords = ((x($a->profile,'pub_keywords')) ? $a->profile['pub_keywords'] : '');
|
||||
$keywords = str_replace(array('#',',',' ',',,'),array('',' ',',',','),$keywords);
|
||||
|
@ -39,7 +43,7 @@ function noscrape_init(&$a) {
|
|||
if(is_array($a->profile) AND !$a->profile['hide-friends']) {
|
||||
$r = q("SELECT `gcontact`.`updated` FROM `contact` INNER JOIN `gcontact` WHERE `gcontact`.`nurl` = `contact`.`nurl` AND `self` AND `uid` = %d LIMIT 1",
|
||||
intval($a->profile['uid']));
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$json_info["updated"] = date("c", strtotime($r[0]['updated']));
|
||||
|
||||
$r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 AND `hidden` = 0 AND `archive` = 0
|
||||
|
@ -49,7 +53,7 @@ function noscrape_init(&$a) {
|
|||
dbesc(NETWORK_DIASPORA),
|
||||
dbesc(NETWORK_OSTATUS)
|
||||
);
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$json_info["contacts"] = intval($r[0]['total']);
|
||||
}
|
||||
|
||||
|
|
|
@ -69,33 +69,30 @@ function notes_content(&$a,$update = false) {
|
|||
// Construct permissions
|
||||
|
||||
// default permissions - anonymous user
|
||||
|
||||
|
||||
$sql_extra = " AND `allow_cid` = '<" . $a->contact['id'] . ">' ";
|
||||
|
||||
$r = q("SELECT COUNT(*) AS `total`
|
||||
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 and `item`.`moderated` = 0
|
||||
AND `item`.`deleted` = 0 AND `item`.`type` = 'note'
|
||||
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`self` = 1
|
||||
AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 0
|
||||
FROM `item` %s
|
||||
WHERE %s AND `item`.`uid` = %d AND `item`.`type` = 'note'
|
||||
AND `contact`.`self` AND `item`.`id` = `item`.`parent` AND NOT `item`.`wall`
|
||||
$sql_extra ",
|
||||
item_joins(), item_condition(),
|
||||
intval(local_user())
|
||||
|
||||
);
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$a->set_pager_total($r[0]['total']);
|
||||
$a->set_pager_itemspage(40);
|
||||
}
|
||||
|
||||
$r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact-uid`
|
||||
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
|
||||
and `item`.`moderated` = 0 AND `item`.`type` = 'note'
|
||||
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`self` = 1
|
||||
AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 0
|
||||
$r = q("SELECT `item`.`id` AS `item_id` FROM `item` %s
|
||||
WHERE %s AND `item`.`uid` = %d AND `item`.`type` = 'note'
|
||||
AND `item`.`id` = `item`.`parent` AND NOT `item`.`wall`
|
||||
$sql_extra
|
||||
ORDER BY `item`.`created` DESC LIMIT %d ,%d ",
|
||||
item_joins(), item_condition(),
|
||||
intval(local_user()),
|
||||
intval($a->pager['start']),
|
||||
intval($a->pager['itemspage'])
|
||||
|
@ -105,26 +102,21 @@ function notes_content(&$a,$update = false) {
|
|||
$parents_arr = array();
|
||||
$parents_str = '';
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
foreach($r as $rr)
|
||||
$parents_arr[] = $rr['item_id'];
|
||||
$parents_str = implode(', ', $parents_arr);
|
||||
|
||||
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`network`, `contact`.`rel`,
|
||||
`contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0
|
||||
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||
AND `item`.`parent` IN ( %s )
|
||||
|
||||
$r = q("SELECT %s FROM `item` %s
|
||||
WHERE %s AND `item`.`uid` = %d AND `item`.`parent` IN (%s)
|
||||
$sql_extra
|
||||
ORDER BY `parent` DESC, `gravity` ASC, `item`.`id` ASC ",
|
||||
item_fieldlists(), item_joins(), item_condition(),
|
||||
intval(local_user()),
|
||||
dbesc($parents_str)
|
||||
);
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$items = conv_sort($r,"`commented`");
|
||||
|
||||
$o .= conversation($a,$items,'notes',$update);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
$r = q("SELECT user.nickname FROM user LEFT JOIN item ON item.uid=user.uid WHERE item.id=%d",
|
||||
intval($id)
|
||||
);
|
||||
if (dba::is_result($r)){
|
||||
if (dbm::is_result($r)){
|
||||
$nick = $r[0]['nickname'];
|
||||
$url = $a->get_baseurl()."/display/$nick/$id";
|
||||
goaway($url);
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
<?php
|
||||
include_once("include/bbcode.php");
|
||||
include_once("include/contact_selectors.php");
|
||||
include_once("include/Scrape.php");
|
||||
|
||||
/**
|
||||
* @file mod/notifications.php
|
||||
* @brief The notifications module
|
||||
*/
|
||||
|
||||
require_once("include/NotificationsManager.php");
|
||||
require_once("include/contact_selectors.php");
|
||||
require_once("include/network.php");
|
||||
|
||||
function notifications_post(&$a) {
|
||||
|
||||
|
@ -21,7 +27,7 @@ function notifications_post(&$a) {
|
|||
intval(local_user())
|
||||
);
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$intro_id = $r[0]['id'];
|
||||
$contact_id = $r[0]['contact-id'];
|
||||
}
|
||||
|
@ -59,10 +65,6 @@ function notifications_post(&$a) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function notifications_content(&$a) {
|
||||
|
||||
if(! local_user()) {
|
||||
|
@ -70,512 +72,247 @@ function notifications_content(&$a) {
|
|||
return;
|
||||
}
|
||||
|
||||
$page = (x($_REQUEST,'page') ? $_REQUEST['page'] : 1);
|
||||
$show = (x($_REQUEST,'show') ? $_REQUEST['show'] : 0);
|
||||
|
||||
nav_set_selected('notifications');
|
||||
|
||||
$json = (($a->argc > 1 && $a->argv[$a->argc - 1] === 'json') ? true : false);
|
||||
|
||||
$nm = new NotificationsManager();
|
||||
|
||||
$o = '';
|
||||
$tabs = array(
|
||||
array(
|
||||
'label' => t('System'),
|
||||
'url'=>'notifications/system',
|
||||
'sel'=> (($a->argv[1] == 'system') ? 'active' : ''),
|
||||
'accesskey' => 'y',
|
||||
),
|
||||
array(
|
||||
'label' => t('Network'),
|
||||
'url'=>'notifications/network',
|
||||
'sel'=> (($a->argv[1] == 'network') ? 'active' : ''),
|
||||
'accesskey' => 'w',
|
||||
),
|
||||
array(
|
||||
'label' => t('Personal'),
|
||||
'url'=>'notifications/personal',
|
||||
'sel'=> (($a->argv[1] == 'personal') ? 'active' : ''),
|
||||
'accesskey' => 'r',
|
||||
),
|
||||
array(
|
||||
'label' => t('Home'),
|
||||
'url' => 'notifications/home',
|
||||
'sel'=> (($a->argv[1] == 'home') ? 'active' : ''),
|
||||
'accesskey' => 'h',
|
||||
),
|
||||
array(
|
||||
'label' => t('Introductions'),
|
||||
'url' => 'notifications/intros',
|
||||
'sel'=> (($a->argv[1] == 'intros') ? 'active' : ''),
|
||||
'accesskey' => 'i',
|
||||
),
|
||||
/*array(
|
||||
'label' => t('Messages'),
|
||||
'url' => 'message',
|
||||
'sel'=> '',
|
||||
),*/ /*while I can have notifications for messages, this tablist is not place for message page link */
|
||||
);
|
||||
|
||||
$o = "";
|
||||
// Get the nav tabs for the notification pages
|
||||
$tabs = $nm->getTabs();
|
||||
$notif_content = array();
|
||||
|
||||
// Notification results per page
|
||||
$perpage = 20;
|
||||
$startrec = ($page * $perpage) - $perpage;
|
||||
|
||||
// Get introductions
|
||||
if( (($a->argc > 1) && ($a->argv[1] == 'intros')) || (($a->argc == 1))) {
|
||||
nav_set_selected('introductions');
|
||||
if(($a->argc > 2) && ($a->argv[2] == 'all'))
|
||||
$sql_extra = '';
|
||||
else
|
||||
$sql_extra = " AND `ignore` = 0 ";
|
||||
$notif_header = t('Notifications');
|
||||
|
||||
$notif_tpl = get_markup_template('notifications.tpl');
|
||||
$all = (($a->argc > 2) && ($a->argv[2] == 'all'));
|
||||
|
||||
$notif_content .= '<a href="' . ((strlen($sql_extra)) ? 'notifications/intros/all' : 'notifications/intros' ) . '" id="notifications-show-hide-link" >'
|
||||
. ((strlen($sql_extra)) ? t('Show Ignored Requests') : t('Hide Ignored Requests')) . '</a></div>' . "\r\n";
|
||||
$notifs = $nm->introNotifs($all, $startrec, $perpage);
|
||||
|
||||
$r = q("SELECT COUNT(*) AS `total` FROM `intro`
|
||||
WHERE `intro`.`uid` = %d $sql_extra AND `intro`.`blocked` = 0 ",
|
||||
intval($_SESSION['uid'])
|
||||
// Get the network notifications
|
||||
} else if (($a->argc > 1) && ($a->argv[1] == 'network')) {
|
||||
|
||||
$notif_header = t('Network Notifications');
|
||||
$notifs = $nm->networkNotifs($show, $startrec, $perpage);
|
||||
|
||||
// Get the system notifications
|
||||
} else if (($a->argc > 1) && ($a->argv[1] == 'system')) {
|
||||
|
||||
$notif_header = t('System Notifications');
|
||||
$notifs = $nm->systemNotifs($show, $startrec, $perpage);
|
||||
|
||||
// Get the personal notifications
|
||||
} else if (($a->argc > 1) && ($a->argv[1] == 'personal')) {
|
||||
|
||||
$notif_header = t('Personal Notifications');
|
||||
$notifs = $nm->personalNotifs($show, $startrec, $perpage);
|
||||
|
||||
// Get the home notifications
|
||||
} else if (($a->argc > 1) && ($a->argv[1] == 'home')) {
|
||||
|
||||
$notif_header = t('Home Notifications');
|
||||
$notifs = $nm->homeNotifs($show, $startrec, $perpage);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Set the pager
|
||||
$a->set_pager_total($notifs['total']);
|
||||
$a->set_pager_itemspage($perpage);
|
||||
|
||||
// Add additional informations (needed for json output)
|
||||
$notifs['items_page'] = $a->pager['itemspage'];
|
||||
$notifs['page'] = $a->pager['page'];
|
||||
|
||||
// Json output
|
||||
if(intval($json) === 1)
|
||||
json_return_and_die($notifs);
|
||||
|
||||
$notif_tpl = get_markup_template('notifications.tpl');
|
||||
|
||||
// Process the data for template creation
|
||||
if($notifs['ident'] === 'introductions') {
|
||||
|
||||
$sugg = get_markup_template('suggestions.tpl');
|
||||
$tpl = get_markup_template("intros.tpl");
|
||||
|
||||
// The link to switch between ignored and normal connection requests
|
||||
$notif_show_lnk = array(
|
||||
'href' => (!$all ? 'notifications/intros/all' : 'notifications/intros' ),
|
||||
'text' => (!$all ? t('Show Ignored Requests') : t('Hide Ignored Requests'))
|
||||
);
|
||||
if($r && count($r)) {
|
||||
$a->set_pager_total($r[0]['total']);
|
||||
$a->set_pager_itemspage(20);
|
||||
}
|
||||
|
||||
$r = q("SELECT `intro`.`id` AS `intro_id`, `intro`.*, `contact`.*, `fcontact`.`name` AS `fname`,`fcontact`.`url` AS `furl`,`fcontact`.`photo` AS `fphoto`,`fcontact`.`request` AS `frequest`,
|
||||
`gcontact`.`location` AS `glocation`, `gcontact`.`about` AS `gabout`,
|
||||
`gcontact`.`keywords` AS `gkeywords`, `gcontact`.`gender` AS `ggender`,
|
||||
`gcontact`.`network` AS `gnetwork`
|
||||
FROM `intro`
|
||||
LEFT JOIN `contact` ON `contact`.`id` = `intro`.`contact-id`
|
||||
LEFT JOIN `gcontact` ON `gcontact`.`nurl` = `contact`.`nurl`
|
||||
LEFT JOIN `fcontact` ON `intro`.`fid` = `fcontact`.`id`
|
||||
WHERE `intro`.`uid` = %d $sql_extra AND `intro`.`blocked` = 0 ",
|
||||
intval($_SESSION['uid']));
|
||||
// Loop through all introduction notifications.This creates an array with the output html for each
|
||||
// introduction
|
||||
foreach ($notifs['notifications'] as $it) {
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
|
||||
$sugg = get_markup_template('suggestions.tpl');
|
||||
$tpl = get_markup_template("intros.tpl");
|
||||
|
||||
foreach($r as $rr) {
|
||||
|
||||
if($rr['fid']) {
|
||||
|
||||
$return_addr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname() . (($a->path) ? '/' . $a->path : ''));
|
||||
|
||||
$notif_content .= replace_macros($sugg, array(
|
||||
// There are two kind of introduction. Contacts suggested by other contacts and normal connection requests.
|
||||
// We have to distinguish between these two because they use different data.
|
||||
switch ($it['label']) {
|
||||
case 'friend_suggestion':
|
||||
$notif_content[] = replace_macros($sugg, array(
|
||||
'$str_notifytype' => t('Notification type: '),
|
||||
'$notify_type' => t('Friend Suggestion'),
|
||||
'$intro_id' => $rr['intro_id'],
|
||||
'$madeby' => sprintf( t('suggested by %s'),$rr['name']),
|
||||
'$contact_id' => $rr['contact-id'],
|
||||
'$photo' => ((x($rr,'fphoto')) ? proxy_url($rr['fphoto'], false, PROXY_SIZE_SMALL) : "images/person-175.jpg"),
|
||||
'$fullname' => $rr['fname'],
|
||||
'$url' => zrl($rr['furl']),
|
||||
'$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''),
|
||||
'$activity' => array('activity', t('Post a new friend activity'), (intval(get_pconfig(local_user(),'system','post_newfriend')) ? '1' : 0), t('if applicable')),
|
||||
'$notify_type' => $it['notify_type'],
|
||||
'$intro_id' => $it['intro_id'],
|
||||
'$madeby' => sprintf( t('suggested by %s'),$it['madeby']),
|
||||
'$contact_id' => $it['contact-id'],
|
||||
'$photo' => $it['photo'],
|
||||
'$fullname' => $it['name'],
|
||||
'$url' => $it['url'],
|
||||
'$hidden' => array('hidden', t('Hide this contact from others'), ($it['hidden'] == 1), ''),
|
||||
'$activity' => array('activity', t('Post a new friend activity'), $it['post_newfriend'], t('if applicable')),
|
||||
|
||||
'$knowyou' => $knowyou,
|
||||
'$knowyou' => $it['knowyou'],
|
||||
'$approve' => t('Approve'),
|
||||
'$note' => $rr['note'],
|
||||
'$request' => $rr['frequest'] . '?addr=' . $return_addr,
|
||||
'$note' => $it['note'],
|
||||
'$request' => $it['request'],
|
||||
'$ignore' => t('Ignore'),
|
||||
'$discard' => t('Discard'),
|
||||
|
||||
));
|
||||
break;
|
||||
|
||||
continue;
|
||||
// Normal connection requests
|
||||
default:
|
||||
$friend_selected = (($it['network'] !== NETWORK_OSTATUS) ? ' checked="checked" ' : ' disabled ');
|
||||
$fan_selected = (($it['network'] === NETWORK_OSTATUS) ? ' checked="checked" disabled ' : '');
|
||||
$dfrn_tpl = get_markup_template('netfriend.tpl');
|
||||
|
||||
}
|
||||
$friend_selected = (($rr['network'] !== NETWORK_OSTATUS) ? ' checked="checked" ' : ' disabled ');
|
||||
$fan_selected = (($rr['network'] === NETWORK_OSTATUS) ? ' checked="checked" disabled ' : '');
|
||||
$dfrn_tpl = get_markup_template('netfriend.tpl');
|
||||
$knowyou = '';
|
||||
$dfrn_text = '';
|
||||
|
||||
$knowyou = '';
|
||||
$dfrn_text = '';
|
||||
|
||||
if($rr['network'] === NETWORK_DFRN || $rr['network'] === NETWORK_DIASPORA) {
|
||||
if($rr['network'] === NETWORK_DFRN) {
|
||||
$knowyou = t('Claims to be known to you: ') . (($rr['knowyou']) ? t('yes') : t('no'));
|
||||
$helptext = t('Shall your connection be bidirectional or not? "Friend" implies that you allow to read and you subscribe to their posts. "Fan/Admirer" means that you allow to read but you do not want to read theirs. Approve as: ');
|
||||
} else {
|
||||
$knowyou = '';
|
||||
$helptext = t('Shall your connection be bidirectional or not? "Friend" implies that you allow to read and you subscribe to their posts. "Sharer" means that you allow to read but you do not want to read theirs. Approve as: ');
|
||||
if($it['network'] === NETWORK_DFRN || $it['network'] === NETWORK_DIASPORA) {
|
||||
if($it['network'] === NETWORK_DFRN) {
|
||||
$lbl_knowyou = t('Claims to be known to you: ');
|
||||
$knowyou = (($it['knowyou']) ? t('yes') : t('no'));
|
||||
$helptext = t('Shall your connection be bidirectional or not? "Friend" implies that you allow to read and you subscribe to their posts. "Fan/Admirer" means that you allow to read but you do not want to read theirs. Approve as: ');
|
||||
} else {
|
||||
$knowyou = '';
|
||||
$helptext = t('Shall your connection be bidirectional or not? "Friend" implies that you allow to read and you subscribe to their posts. "Sharer" means that you allow to read but you do not want to read theirs. Approve as: ');
|
||||
}
|
||||
}
|
||||
|
||||
$dfrn_text = replace_macros($dfrn_tpl,array(
|
||||
'$intro_id' => $rr['intro_id'],
|
||||
'$intro_id' => $it['intro_id'],
|
||||
'$friend_selected' => $friend_selected,
|
||||
'$fan_selected' => $fan_selected,
|
||||
'$approve_as' => $helptext,
|
||||
'$as_friend' => t('Friend'),
|
||||
'$as_fan' => (($rr['network'] == NETWORK_DIASPORA) ? t('Sharer') : t('Fan/Admirer'))
|
||||
'$as_fan' => (($it['network'] == NETWORK_DIASPORA) ? t('Sharer') : t('Fan/Admirer'))
|
||||
));
|
||||
}
|
||||
|
||||
$header = $rr["name"];
|
||||
$header = $it["name"];
|
||||
|
||||
$ret = probe_url($rr["url"]);
|
||||
if ($it["addr"] != "")
|
||||
$header .= " <".$it["addr"].">";
|
||||
|
||||
if ($rr['gnetwork'] == "")
|
||||
$rr['gnetwork'] = $ret["network"];
|
||||
$header .= " (".network_to_name($it['network'], $it['url']).")";
|
||||
|
||||
if ($ret["addr"] != "")
|
||||
$header .= " <".$ret["addr"].">";
|
||||
$notif_content[] = replace_macros($tpl, array(
|
||||
'$header' => htmlentities($header),
|
||||
'$str_notifytype' => t('Notification type: '),
|
||||
'$notify_type' => $it['notify_type'],
|
||||
'$dfrn_text' => $dfrn_text,
|
||||
'$dfrn_id' => $it['dfrn_id'],
|
||||
'$uid' => $it['uid'],
|
||||
'$intro_id' => $it['intro_id'],
|
||||
'$contact_id' => $it['contact_id'],
|
||||
'$photo' => $it['photo'],
|
||||
'$fullname' => $it['name'],
|
||||
'$location' => $it['location'],
|
||||
'$lbl_location' => t('Location:'),
|
||||
'$about' => $it['about'],
|
||||
'$lbl_about' => t('About:'),
|
||||
'$keywords' => $it['keywords'],
|
||||
'$lbl_keywords' => t('Tags:'),
|
||||
'$gender' => $it['gender'],
|
||||
'$lbl_gender' => t('Gender:'),
|
||||
'$hidden' => array('hidden', t('Hide this contact from others'), ($it['hidden'] == 1), ''),
|
||||
'$activity' => array('activity', t('Post a new friend activity'), $it['post_newfriend'], t('if applicable')),
|
||||
'$url' => $it['url'],
|
||||
'$zrl' => $it['zrl'],
|
||||
'$lbl_url' => t('Profile URL'),
|
||||
'$addr' => $it['addr'],
|
||||
'$lbl_knowyou' => $lbl_knowyou,
|
||||
'$lbl_network' => t('Network:'),
|
||||
'$network' => network_to_name($it['network'], $it['url']),
|
||||
'$knowyou' => $knowyou,
|
||||
'$approve' => t('Approve'),
|
||||
'$note' => $it['note'],
|
||||
'$ignore' => t('Ignore'),
|
||||
'$discard' => t('Discard'),
|
||||
|
||||
$header .= " (".network_to_name($rr['gnetwork'], $rr['url']).")";
|
||||
|
||||
// Don't show these data until you are connected. Diaspora is doing the same.
|
||||
if($rr['gnetwork'] === NETWORK_DIASPORA) {
|
||||
$rr['glocation'] = "";
|
||||
$rr['gabout'] = "";
|
||||
$rr['ggender'] = "";
|
||||
}
|
||||
|
||||
$notif_content .= replace_macros($tpl, array(
|
||||
'$header' => htmlentities($header),
|
||||
'$str_notifytype' => t('Notification type: '),
|
||||
'$notify_type' => (($rr['network'] !== NETWORK_OSTATUS) ? t('Friend/Connect Request') : t('New Follower')),
|
||||
'$dfrn_text' => $dfrn_text,
|
||||
'$dfrn_id' => $rr['issued-id'],
|
||||
'$uid' => $_SESSION['uid'],
|
||||
'$intro_id' => $rr['intro_id'],
|
||||
'$contact_id' => $rr['contact-id'],
|
||||
'$photo' => ((x($rr,'photo')) ? proxy_url($rr['photo'], false, PROXY_SIZE_SMALL) : "images/person-175.jpg"),
|
||||
'$fullname' => $rr['name'],
|
||||
'$location' => bbcode($rr['glocation'], false, false),
|
||||
'$location_label' => t('Location:'),
|
||||
'$about' => bbcode($rr['gabout'], false, false),
|
||||
'$about_label' => t('About:'),
|
||||
'$keywords' => $rr['gkeywords'],
|
||||
'$keywords_label' => t('Tags:'),
|
||||
'$gender' => $rr['ggender'],
|
||||
'$gender_label' => t('Gender:'),
|
||||
'$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''),
|
||||
'$activity' => array('activity', t('Post a new friend activity'), (intval(get_pconfig(local_user(),'system','post_newfriend')) ? '1' : 0), t('if applicable')),
|
||||
'$url' => $rr['url'],
|
||||
'$zrl' => zrl($rr['url']),
|
||||
'$url_label' => t('Profile URL'),
|
||||
'$knowyou' => $knowyou,
|
||||
'$approve' => t('Approve'),
|
||||
'$note' => $rr['note'],
|
||||
'$ignore' => t('Ignore'),
|
||||
'$discard' => t('Discard'),
|
||||
|
||||
));
|
||||
));
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if($notifs['total'] == 0)
|
||||
info( t('No introductions.') . EOL);
|
||||
|
||||
$o .= replace_macros($notif_tpl, array(
|
||||
'$notif_header' => t('Notifications'),
|
||||
'$tabs' => $tabs,
|
||||
'$notif_content' => $notif_content,
|
||||
));
|
||||
// Normal notifications (no introductions)
|
||||
} else {
|
||||
|
||||
$o .= paginate($a);
|
||||
return $o;
|
||||
// The template files we need in different cases for formatting the content
|
||||
$tpl_item_like = 'notifications_likes_item.tpl';
|
||||
$tpl_item_dislike = 'notifications_dislikes_item.tpl';
|
||||
$tpl_item_attend = 'notifications_attend_item.tpl';
|
||||
$tpl_item_attendno = 'notifications_attend_item.tpl';
|
||||
$tpl_item_attendmaybe = 'notifications_attend_item.tpl';
|
||||
$tpl_item_friend = 'notifications_friends_item.tpl';
|
||||
$tpl_item_comment = 'notifications_comments_item.tpl';
|
||||
$tpl_item_post = 'notifications_posts_item.tpl';
|
||||
$tpl_item_notify = 'notify.tpl';
|
||||
|
||||
} else if (($a->argc > 1) && ($a->argv[1] == 'network')) {
|
||||
// Loop trough ever notification This creates an array with the output html for each
|
||||
// notification and apply the correct template according to the notificationtype (label).
|
||||
foreach ($notifs['notifications'] as $it) {
|
||||
|
||||
$notif_tpl = get_markup_template('notifications.tpl');
|
||||
// We use the notification label to get the correct template file
|
||||
$tpl_var_name = 'tpl_item_'.$it['label'];
|
||||
$tpl_notif = get_markup_template($$tpl_var_name);
|
||||
|
||||
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`,
|
||||
`item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` as `object`,
|
||||
`pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink`, `pitem`.`guid` as `pguid`
|
||||
FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent`
|
||||
WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND `pitem`.`parent` != 0 AND
|
||||
`item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 0 ORDER BY `item`.`created` DESC" ,
|
||||
intval(local_user())
|
||||
);
|
||||
|
||||
$tpl_item_likes = get_markup_template('notifications_likes_item.tpl');
|
||||
$tpl_item_dislikes = get_markup_template('notifications_dislikes_item.tpl');
|
||||
$tpl_item_friends = get_markup_template('notifications_friends_item.tpl');
|
||||
$tpl_item_comments = get_markup_template('notifications_comments_item.tpl');
|
||||
$tpl_item_posts = get_markup_template('notifications_posts_item.tpl');
|
||||
|
||||
$notif_content = '';
|
||||
|
||||
if ($r) {
|
||||
|
||||
foreach ($r as $it) {
|
||||
switch($it['verb']){
|
||||
case ACTIVITY_LIKE:
|
||||
$notif_content .= replace_macros($tpl_item_likes,array(
|
||||
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
|
||||
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
|
||||
'$item_image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
|
||||
'$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']),
|
||||
'$item_when' => relative_date($it['created'])
|
||||
));
|
||||
break;
|
||||
|
||||
case ACTIVITY_DISLIKE:
|
||||
$notif_content .= replace_macros($tpl_item_dislikes,array(
|
||||
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
|
||||
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
|
||||
'$item_image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
|
||||
'$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']),
|
||||
'$item_when' => relative_date($it['created'])
|
||||
));
|
||||
break;
|
||||
|
||||
case ACTIVITY_FRIEND:
|
||||
|
||||
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
|
||||
$obj = parse_xml_string($xmlhead.$it['object']);
|
||||
$it['fname'] = $obj->title;
|
||||
|
||||
$notif_content .= replace_macros($tpl_item_friends,array(
|
||||
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
|
||||
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
|
||||
'$item_image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
|
||||
'$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']),
|
||||
'$item_when' => relative_date($it['created'])
|
||||
));
|
||||
break;
|
||||
|
||||
default:
|
||||
$item_text = (($it['id'] == $it['parent'])
|
||||
? sprintf( t("%s created a new post"), $it['author-name'])
|
||||
: sprintf( t("%s commented on %s's post"), $it['author-name'], $it['pname']));
|
||||
$tpl = (($it['id'] == $it['parent']) ? $tpl_item_posts : $tpl_item_comments);
|
||||
|
||||
$notif_content .= replace_macros($tpl,array(
|
||||
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
|
||||
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
|
||||
'$item_image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
|
||||
'$item_text' => $item_text,
|
||||
'$item_when' => relative_date($it['created'])
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$notif_content = t('No more network notifications.');
|
||||
$notif_content[] = replace_macros($tpl_notif,array(
|
||||
'$item_label' => $it['label'],
|
||||
'$item_link' => $it['link'],
|
||||
'$item_image' => $it['image'],
|
||||
'$item_text' => htmlentities($it['text']),
|
||||
'$item_when' => $it['when'],
|
||||
'$item_seen' => $it['seen'],
|
||||
));
|
||||
}
|
||||
|
||||
$o .= replace_macros($notif_tpl, array(
|
||||
'$notif_header' => t('Network Notifications'),
|
||||
'$tabs' => $tabs,
|
||||
'$notif_content' => $notif_content,
|
||||
));
|
||||
|
||||
} else if (($a->argc > 1) && ($a->argv[1] == 'system')) {
|
||||
|
||||
$notif_tpl = get_markup_template('notifications.tpl');
|
||||
|
||||
$not_tpl = get_markup_template('notify.tpl');
|
||||
require_once('include/bbcode.php');
|
||||
|
||||
$r = q("SELECT * from notify where uid = %d and seen = 0 order by date desc",
|
||||
intval(local_user())
|
||||
);
|
||||
|
||||
if (dba::is_result($r)) {
|
||||
foreach ($r as $it) {
|
||||
$notif_content .= replace_macros($not_tpl,array(
|
||||
'$item_link' => $a->get_baseurl(true).'/notify/view/'. $it['id'],
|
||||
'$item_image' => proxy_url($it['photo'], false, PROXY_SIZE_MICRO),
|
||||
'$item_text' => strip_tags(bbcode($it['msg'])),
|
||||
'$item_when' => relative_date($it['date'])
|
||||
));
|
||||
}
|
||||
} else {
|
||||
$notif_content .= t('No more system notifications.');
|
||||
// It doesn't make sense to show the Show unread / Show all link visible if the user is on the
|
||||
// "Show all" page and there are no notifications. So we will hide it.
|
||||
if($show == 0 || intval($show) && $notifs['total'] > 0) {
|
||||
$notif_show_lnk = array(
|
||||
'href' => ($show ? 'notifications/'.$notifs['ident'] : 'notifications/'.$notifs['ident'].'?show=all' ),
|
||||
'text' => ($show ? t('Show unread') : t('Show all')),
|
||||
);
|
||||
}
|
||||
|
||||
$o .= replace_macros($notif_tpl, array(
|
||||
'$notif_header' => t('System Notifications'),
|
||||
'$tabs' => $tabs,
|
||||
'$notif_content' => $notif_content,
|
||||
));
|
||||
|
||||
} else if (($a->argc > 1) && ($a->argv[1] == 'personal')) {
|
||||
|
||||
$notif_tpl = get_markup_template('notifications.tpl');
|
||||
|
||||
$myurl = $a->get_baseurl(true) . '/profile/'. $a->user['nickname'];
|
||||
$myurl = substr($myurl,strpos($myurl,'://')+3);
|
||||
$myurl = str_replace(array('www.','.'),array('','\\.'),$myurl);
|
||||
$diasp_url = str_replace('/profile/','/u/',$myurl);
|
||||
$sql_extra .= sprintf(" AND ( `item`.`author-link` regexp '%s' or `item`.`tag` regexp '%s' or `item`.`tag` regexp '%s' ) ",
|
||||
dbesc($myurl . '$'),
|
||||
dbesc($myurl . '\\]'),
|
||||
dbesc($diasp_url . '\\]')
|
||||
);
|
||||
|
||||
|
||||
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`,
|
||||
`item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` as `object`,
|
||||
`pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink`, `pitem`.`guid` as `pguid`
|
||||
FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent`
|
||||
WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1
|
||||
$sql_extra
|
||||
AND `item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 0 ORDER BY `item`.`created` DESC" ,
|
||||
intval(local_user())
|
||||
);
|
||||
|
||||
$tpl_item_likes = get_markup_template('notifications_likes_item.tpl');
|
||||
$tpl_item_dislikes = get_markup_template('notifications_dislikes_item.tpl');
|
||||
$tpl_item_friends = get_markup_template('notifications_friends_item.tpl');
|
||||
$tpl_item_comments = get_markup_template('notifications_comments_item.tpl');
|
||||
$tpl_item_posts = get_markup_template('notifications_posts_item.tpl');
|
||||
|
||||
$notif_content = '';
|
||||
|
||||
if (dba::is_result($r)) {
|
||||
|
||||
foreach ($r as $it) {
|
||||
switch($it['verb']){
|
||||
case ACTIVITY_LIKE:
|
||||
$notif_content .= replace_macros($tpl_item_likes,array(
|
||||
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
|
||||
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
|
||||
'$item_image' => $it['author-avatar'],
|
||||
'$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']),
|
||||
'$item_when' => relative_date($it['created'])
|
||||
));
|
||||
break;
|
||||
|
||||
case ACTIVITY_DISLIKE:
|
||||
$notif_content .= replace_macros($tpl_item_dislikes,array(
|
||||
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
|
||||
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
|
||||
'$item_image' => $it['author-avatar'],
|
||||
'$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']),
|
||||
'$item_when' => relative_date($it['created'])
|
||||
));
|
||||
break;
|
||||
|
||||
case ACTIVITY_FRIEND:
|
||||
|
||||
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
|
||||
$obj = parse_xml_string($xmlhead.$it['object']);
|
||||
$it['fname'] = $obj->title;
|
||||
|
||||
$notif_content .= replace_macros($tpl_item_friends,array(
|
||||
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
|
||||
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
|
||||
'$item_image' => $it['author-avatar'],
|
||||
'$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']),
|
||||
'$item_when' => relative_date($it['created'])
|
||||
));
|
||||
break;
|
||||
|
||||
default:
|
||||
$item_text = (($it['id'] == $it['parent'])
|
||||
? sprintf( t("%s created a new post"), $it['author-name'])
|
||||
: sprintf( t("%s commented on %s's post"), $it['author-name'], $it['pname']));
|
||||
$tpl = (($it['id'] == $it['parent']) ? $tpl_item_posts : $tpl_item_comments);
|
||||
|
||||
$notif_content .= replace_macros($tpl,array(
|
||||
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
|
||||
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
|
||||
'$item_image' => $it['author-avatar'],
|
||||
'$item_text' => $item_text,
|
||||
'$item_when' => relative_date($it['created'])
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$notif_content = t('No more personal notifications.');
|
||||
}
|
||||
|
||||
$o .= replace_macros($notif_tpl, array(
|
||||
'$notif_header' => t('Personal Notifications'),
|
||||
'$tabs' => $tabs,
|
||||
'$notif_content' => $notif_content,
|
||||
));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} else if (($a->argc > 1) && ($a->argv[1] == 'home')) {
|
||||
|
||||
$notif_tpl = get_markup_template('notifications.tpl');
|
||||
|
||||
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`,
|
||||
`item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` as `object`,
|
||||
`pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink`, `pitem`.`guid` as `pguid`
|
||||
FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent`
|
||||
WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND
|
||||
`item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 1 ORDER BY `item`.`created` DESC",
|
||||
intval(local_user())
|
||||
);
|
||||
|
||||
$tpl_item_likes = get_markup_template('notifications_likes_item.tpl');
|
||||
$tpl_item_dislikes = get_markup_template('notifications_dislikes_item.tpl');
|
||||
$tpl_item_friends = get_markup_template('notifications_friends_item.tpl');
|
||||
$tpl_item_comments = get_markup_template('notifications_comments_item.tpl');
|
||||
|
||||
$notif_content = '';
|
||||
|
||||
if (dba::is_result($r)) {
|
||||
|
||||
foreach ($r as $it) {
|
||||
switch($it['verb']){
|
||||
case ACTIVITY_LIKE:
|
||||
$notif_content .= replace_macros($tpl_item_likes,array(
|
||||
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
|
||||
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
|
||||
'$item_image' => $it['author-avatar'],
|
||||
'$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']),
|
||||
'$item_when' => relative_date($it['created'])
|
||||
));
|
||||
|
||||
break;
|
||||
case ACTIVITY_DISLIKE:
|
||||
$notif_content .= replace_macros($tpl_item_dislikes,array(
|
||||
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
|
||||
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
|
||||
'$item_image' => $it['author-avatar'],
|
||||
'$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']),
|
||||
'$item_when' => relative_date($it['created'])
|
||||
));
|
||||
|
||||
break;
|
||||
case ACTIVITY_FRIEND:
|
||||
|
||||
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
|
||||
$obj = parse_xml_string($xmlhead.$it['object']);
|
||||
$it['fname'] = $obj->title;
|
||||
|
||||
$notif_content .= replace_macros($tpl_item_friends,array(
|
||||
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
|
||||
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
|
||||
'$item_image' => $it['author-avatar'],
|
||||
'$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']),
|
||||
'$item_when' => relative_date($it['created'])
|
||||
));
|
||||
|
||||
break;
|
||||
default:
|
||||
$notif_content .= replace_macros($tpl_item_comments,array(
|
||||
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
|
||||
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
|
||||
'$item_image' => $it['author-avatar'],
|
||||
'$item_text' => sprintf( t("%s commented on %s's post"), $it['author-name'], $it['pname']),
|
||||
'$item_when' => relative_date($it['created'])
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$notif_content = t('No more home notifications.');
|
||||
}
|
||||
|
||||
$o .= replace_macros($notif_tpl, array(
|
||||
'$notif_header' => t('Home Notifications'),
|
||||
'$tabs' => $tabs,
|
||||
'$notif_content' => $notif_content,
|
||||
));
|
||||
// Output if there aren't any notifications available
|
||||
if($notifs['total'] == 0)
|
||||
$notif_nocontent = sprintf( t('No more %s notifications.'), $notifs['ident']);
|
||||
}
|
||||
|
||||
$o .= paginate($a);
|
||||
$o .= replace_macros($notif_tpl, array(
|
||||
'$notif_header' => $notif_header,
|
||||
'$tabs' => $tabs,
|
||||
'$notif_content' => $notif_content,
|
||||
'$notif_nocontent' => $notif_nocontent,
|
||||
'$notif_show_lnk' => $notif_show_lnk,
|
||||
'$notif_paginate' => paginate($a)
|
||||
));
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
|
|
@ -18,17 +18,24 @@ function openid_content(&$a) {
|
|||
|
||||
if($openid->validate()) {
|
||||
|
||||
$authid = normalise_openid($_REQUEST['openid_identity']);
|
||||
$authid = $_REQUEST['openid_identity'];
|
||||
|
||||
if(! strlen($authid)) {
|
||||
logger( t('OpenID protocol error. No ID returned.') . EOL);
|
||||
goaway(z_root());
|
||||
}
|
||||
|
||||
$r = q("SELECT `user`.*, `user`.`pubkey` as `upubkey`, `user`.`prvkey` as `uprvkey`
|
||||
FROM `user` WHERE `openid` = '%s' AND `blocked` = 0
|
||||
AND `account_expired` = 0 AND `account_removed` = 0 AND `verified` = 1 LIMIT 1",
|
||||
dbesc($authid)
|
||||
// NOTE: we search both for normalised and non-normalised form of $authid
|
||||
// because the normalization step was removed from setting
|
||||
// mod/settings.php in 8367cad so it might have left mixed
|
||||
// records in the user table
|
||||
//
|
||||
$r = q("SELECT * FROM `user`
|
||||
WHERE ( `openid` = '%s' OR `openid` = '%s' )
|
||||
AND `blocked` = 0 AND `account_expired` = 0
|
||||
AND `account_removed` = 0 AND `verified` = 1
|
||||
LIMIT 1",
|
||||
dbesc($authid), dbesc(normalise_openid($authid))
|
||||
);
|
||||
|
||||
if($r && count($r)) {
|
||||
|
|
75
mod/p.php
75
mod/p.php
|
@ -19,62 +19,45 @@ function p_init($a){
|
|||
|
||||
$guid = strtolower(substr($guid, 0, -4));
|
||||
|
||||
$item = q("SELECT `title`, `body`, `guid`, `contact-id`, `private`, `created`, `app` FROM `item` WHERE `uid` = 0 AND `guid` = '%s' AND `network` IN ('%s', '%s') AND `id` = `parent` LIMIT 1",
|
||||
// Fetch the item
|
||||
$item = q("SELECT `uid`, `title`, `body`, `guid`, `contact-id`, `private`, `created`, `app`, `location`, `coord`
|
||||
FROM `item` WHERE `wall` AND NOT `private` AND `guid` = '%s' AND `network` IN ('%s', '%s') AND `id` = `parent` LIMIT 1",
|
||||
dbesc($guid), NETWORK_DFRN, NETWORK_DIASPORA);
|
||||
if (!$item) {
|
||||
$r = q("SELECT `author-link`
|
||||
FROM `item` WHERE `uid` = 0 AND `guid` = '%s' AND `network` IN ('%s', '%s') AND `id` = `parent` LIMIT 1",
|
||||
dbesc($guid), NETWORK_DFRN, NETWORK_DIASPORA);
|
||||
if ($r) {
|
||||
$parts = parse_url($r[0]["author-link"]);
|
||||
$host = $parts["scheme"]."://".$parts["host"];
|
||||
|
||||
if (normalise_link($host) != normalise_link(App::get_baseurl())) {
|
||||
$location = $host."/p/".urlencode($guid).".xml";
|
||||
|
||||
header("HTTP/1.1 301 Moved Permanently");
|
||||
header("Location:".$location);
|
||||
killme();
|
||||
}
|
||||
}
|
||||
|
||||
header($_SERVER["SERVER_PROTOCOL"].' 404 '.t('Not Found'));
|
||||
killme();
|
||||
}
|
||||
|
||||
$post = array();
|
||||
|
||||
$reshared = diaspora::is_reshare($item[0]["body"]);
|
||||
|
||||
if ($reshared) {
|
||||
$nodename = "reshare";
|
||||
$post["root_diaspora_id"] = $reshared["root_handle"];
|
||||
$post["root_guid"] = $reshared["root_guid"];
|
||||
$post["guid"] = $item[0]["guid"];
|
||||
$post["diaspora_handle"] = diaspora::handle_from_contact($item[0]["contact-id"]);
|
||||
$post["public"] = (!$item[0]["private"] ? 'true':'false');
|
||||
$post["created_at"] = datetime_convert('UTC','UTC',$item[0]["created"]);
|
||||
} else {
|
||||
|
||||
$body = bb2diaspora($item[0]["body"]);
|
||||
|
||||
if(strlen($item[0]["title"]))
|
||||
$body = "## ".html_entity_decode($item[0]["title"])."\n\n".$body;
|
||||
|
||||
$nodename = "status_message";
|
||||
$post["raw_message"] = str_replace("&", "&", $body);
|
||||
$post["guid"] = $item[0]["guid"];
|
||||
$post["diaspora_handle"] = diaspora::handle_from_contact($item[0]["contact-id"]);
|
||||
$post["public"] = (!$item[0]["private"] ? 'true':'false');
|
||||
$post["created_at"] = datetime_convert('UTC','UTC',$item[0]["created"]);
|
||||
$post["provider_display_name"] = $item[0]["app"];
|
||||
// Fetch some data from the author (We could combine both queries - but I think this is more readable)
|
||||
$r = q("SELECT `user`.`prvkey`, `contact`.`addr`, `user`.`nickname`, `contact`.`nick` FROM `user`
|
||||
INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid`
|
||||
WHERE `user`.`uid` = %d", intval($item[0]["uid"]));
|
||||
if (!dbm::is_result($r)) {
|
||||
header($_SERVER["SERVER_PROTOCOL"].' 404 '.t('Not Found'));
|
||||
killme();
|
||||
}
|
||||
$user = $r[0];
|
||||
|
||||
$dom = new DOMDocument("1.0");
|
||||
$root = $dom->createElement("XML");
|
||||
$dom->appendChild($root);
|
||||
$postelement = $dom->createElement("post");
|
||||
$root->appendChild($postelement);
|
||||
$statuselement = $dom->createElement($nodename);
|
||||
$postelement->appendChild($statuselement);
|
||||
|
||||
foreach($post AS $index => $value) {
|
||||
$postnode = $dom->createElement($index, $value);
|
||||
$statuselement->appendChild($postnode);
|
||||
}
|
||||
$status = diaspora::build_status($item[0], $user);
|
||||
$xml = diaspora::build_post_xml($status["type"], $status["message"]);
|
||||
|
||||
header("Content-Type: application/xml; charset=utf-8");
|
||||
$xml = $dom->saveXML();
|
||||
|
||||
// Diaspora doesn't send the XML header, so we remove them as well.
|
||||
// So we avoid possible compatibility problems.
|
||||
if (substr($xml, 0, 21) == '<?xml version="1.0"?>')
|
||||
$xml = trim(substr($xml, 21));
|
||||
|
||||
echo $xml;
|
||||
|
||||
killme();
|
||||
|
|
|
@ -72,8 +72,11 @@ function parseurl_getsiteinfo_cached($url, $no_guessing = false, $do_oembed = tr
|
|||
|
||||
$data = parseurl_getsiteinfo($url, $no_guessing, $do_oembed);
|
||||
|
||||
q("INSERT INTO `parsed_url` (`url`, `guessing`, `oembed`, `content`, `created`) VALUES ('%s', %d, %d, '%s', '%s')",
|
||||
dbesc(normalise_link($url)), intval(!$no_guessing), intval($do_oembed), dbesc(serialize($data)), dbesc(datetime_convert()));
|
||||
q("INSERT INTO `parsed_url` (`url`, `guessing`, `oembed`, `content`, `created`) VALUES ('%s', %d, %d, '%s', '%s')
|
||||
ON DUPLICATE KEY UPDATE `content` = '%s', `created` = '%s'",
|
||||
dbesc(normalise_link($url)), intval(!$no_guessing), intval($do_oembed),
|
||||
dbesc(serialize($data)), dbesc(datetime_convert()),
|
||||
dbesc(serialize($data)), dbesc(datetime_convert()));
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
@ -232,10 +235,9 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co
|
|||
}
|
||||
}
|
||||
|
||||
//$list = $xpath->query("head/title");
|
||||
$list = $xpath->query("//title");
|
||||
foreach ($list as $node)
|
||||
$siteinfo["title"] = html_entity_decode($node->nodeValue, ENT_QUOTES, "UTF-8");
|
||||
if ($list->length > 0)
|
||||
$siteinfo["title"] = $list->item(0)->nodeValue;
|
||||
|
||||
//$list = $xpath->query("head/meta[@name]");
|
||||
$list = $xpath->query("//meta[@name]");
|
||||
|
|
|
@ -76,7 +76,7 @@ function photo_init(&$a) {
|
|||
intval($resolution),
|
||||
intval($uid)
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$data = $r[0]['data'];
|
||||
$mimetype = $r[0]['type'];
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ function photo_init(&$a) {
|
|||
dbesc($photo),
|
||||
intval($resolution)
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
|
||||
$sql_extra = permissions_sql($r[0]['uid']);
|
||||
|
||||
|
@ -117,9 +117,9 @@ function photo_init(&$a) {
|
|||
intval($resolution)
|
||||
);
|
||||
|
||||
$public = (dba::is_result($r)) && ($r[0]['allow_cid'] == '') AND ($r[0]['allow_gid'] == '') AND ($r[0]['deny_cid'] == '') AND ($r[0]['deny_gid'] == '');
|
||||
$public = (dbm::is_result($r)) && ($r[0]['allow_cid'] == '') AND ($r[0]['allow_gid'] == '') AND ($r[0]['deny_cid'] == '') AND ($r[0]['deny_gid'] == '');
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$resolution = $r[0]['scale'];
|
||||
$data = $r[0]['data'];
|
||||
$mimetype = $r[0]['type'];
|
||||
|
|
|
@ -8,6 +8,7 @@ require_once('include/security.php');
|
|||
require_once('include/redir.php');
|
||||
require_once('include/tags.php');
|
||||
require_once('include/threads.php');
|
||||
require_once('include/Probe.php');
|
||||
|
||||
function photos_init(&$a) {
|
||||
|
||||
|
@ -159,7 +160,7 @@ function photos_post(&$a) {
|
|||
intval($cid),
|
||||
intval($page_owner_uid)
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$can_post = true;
|
||||
$visitor = $cid;
|
||||
}
|
||||
|
@ -267,7 +268,7 @@ function photos_post(&$a) {
|
|||
dbesc($album)
|
||||
);
|
||||
}
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
foreach($r as $rr) {
|
||||
$res[] = "'" . dbesc($rr['rid']) . "'" ;
|
||||
}
|
||||
|
@ -290,7 +291,7 @@ function photos_post(&$a) {
|
|||
$r = q("SELECT `parent-uri` FROM `item` WHERE `resource-id` IN ( $str_res ) AND `uid` = %d",
|
||||
intval($page_owner_uid)
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
foreach($r as $rr) {
|
||||
q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
|
||||
dbesc(datetime_convert()),
|
||||
|
@ -305,7 +306,7 @@ function photos_post(&$a) {
|
|||
// send the notification upstream/downstream as the case may be
|
||||
|
||||
if($rr['visible'])
|
||||
proc_run('php',"include/notifier.php","drop","$drop_id");
|
||||
proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -352,7 +353,7 @@ function photos_post(&$a) {
|
|||
dbesc($a->argv[2])
|
||||
);
|
||||
}
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
q("DELETE FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s'",
|
||||
intval($page_owner_uid),
|
||||
dbesc($r[0]['resource-id'])
|
||||
|
@ -375,7 +376,7 @@ function photos_post(&$a) {
|
|||
$drop_id = intval($i[0]['id']);
|
||||
|
||||
if($i[0]['visible'])
|
||||
proc_run('php',"include/notifier.php","drop","$drop_id");
|
||||
proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -408,7 +409,7 @@ function photos_post(&$a) {
|
|||
dbesc($resource_id),
|
||||
intval($page_owner_uid)
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$ph = new Photo($r[0]['data'], $r[0]['type']);
|
||||
if($ph->is_valid()) {
|
||||
$rotate_deg = ( (intval($_POST['rotate']) == 1) ? 270 : 90 );
|
||||
|
@ -525,7 +526,7 @@ function photos_post(&$a) {
|
|||
intval($page_owner_uid)
|
||||
);
|
||||
}
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$old_tag = $r[0]['tag'];
|
||||
$old_inform = $r[0]['inform'];
|
||||
}
|
||||
|
@ -552,7 +553,7 @@ function photos_post(&$a) {
|
|||
$name = substr($tag,1);
|
||||
if((strpos($name,'@')) || (strpos($name,'http://'))) {
|
||||
$newname = $name;
|
||||
$links = @lrdd($name);
|
||||
$links = @Probe::lrdd($name);
|
||||
if(count($links)) {
|
||||
foreach($links as $link) {
|
||||
if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page')
|
||||
|
@ -612,7 +613,7 @@ function photos_post(&$a) {
|
|||
intval($page_owner_uid)
|
||||
);
|
||||
}*/
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$newname = $r[0]['name'];
|
||||
$profile = $r[0]['url'];
|
||||
$notify = 'cid:' . $r[0]['id'];
|
||||
|
@ -718,7 +719,7 @@ function photos_post(&$a) {
|
|||
|
||||
$item_id = item_store($arr);
|
||||
if($item_id) {
|
||||
proc_run('php',"include/notifier.php","tag","$item_id");
|
||||
proc_run(PRIORITY_HIGH, "include/notifier.php", "tag", $item_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -934,7 +935,7 @@ function photos_post(&$a) {
|
|||
$item_id = item_store($arr);
|
||||
|
||||
if($visible)
|
||||
proc_run('php', "include/notifier.php", 'wall-new', $item_id);
|
||||
proc_run(PRIORITY_HIGH, "include/notifier.php", 'wall-new', $item_id);
|
||||
|
||||
call_hooks('photo_post_end',intval($item_id));
|
||||
|
||||
|
@ -1028,7 +1029,7 @@ function photos_content(&$a) {
|
|||
intval($contact_id),
|
||||
intval($owner_uid)
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$can_post = true;
|
||||
$contact = $r[0];
|
||||
$remote_contact = true;
|
||||
|
@ -1056,7 +1057,7 @@ function photos_content(&$a) {
|
|||
intval($contact_id),
|
||||
intval($owner_uid)
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$contact = $r[0];
|
||||
$remote_contact = true;
|
||||
}
|
||||
|
@ -1209,8 +1210,8 @@ function photos_content(&$a) {
|
|||
intval($owner_uid),
|
||||
dbesc($album)
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
$a->set_pager_total(dba::is_result($r));
|
||||
if(dbm::is_result($r)) {
|
||||
$a->set_pager_total(dbm::is_result($r));
|
||||
$a->set_pager_itemspage(20);
|
||||
}
|
||||
|
||||
|
@ -1266,7 +1267,7 @@ function photos_content(&$a) {
|
|||
|
||||
$photos = array();
|
||||
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$twist = 'rotright';
|
||||
foreach($r as $rr) {
|
||||
if($twist == 'rotright')
|
||||
|
@ -1306,11 +1307,10 @@ function photos_content(&$a) {
|
|||
'$can_post' => $can_post,
|
||||
'$upload' => array(t('Upload New Photos'), 'photos/' . $a->data['user']['nickname'] . '/upload/' . bin2hex($album)),
|
||||
'$order' => $order,
|
||||
'$edit' => $edit
|
||||
'$edit' => $edit,
|
||||
'$paginate' => paginate($a),
|
||||
));
|
||||
|
||||
$o .= paginate($a);
|
||||
|
||||
return $o;
|
||||
|
||||
}
|
||||
|
@ -1461,7 +1461,7 @@ function photos_content(&$a) {
|
|||
|
||||
);
|
||||
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$a->set_pager_total($r[0]['total']);
|
||||
|
||||
|
||||
|
@ -1638,7 +1638,7 @@ function photos_content(&$a) {
|
|||
|
||||
|
||||
// display comments
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
|
||||
foreach($r as $item) {
|
||||
builtin_activity_puller($item, $conv_responses);
|
||||
|
@ -1824,8 +1824,8 @@ function photos_content(&$a) {
|
|||
dbesc('Contact Photos'),
|
||||
dbesc( t('Contact Photos'))
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
$a->set_pager_total(dba::is_result($r));
|
||||
if(dbm::is_result($r)) {
|
||||
$a->set_pager_total(dbm::is_result($r));
|
||||
$a->set_pager_itemspage(20);
|
||||
}
|
||||
|
||||
|
@ -1842,7 +1842,7 @@ function photos_content(&$a) {
|
|||
|
||||
|
||||
$photos = array();
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$twist = 'rotright';
|
||||
foreach($r as $rr) {
|
||||
//hide profile photos to others
|
||||
|
@ -1887,10 +1887,9 @@ function photos_content(&$a) {
|
|||
'$can_post' => $can_post,
|
||||
'$upload' => array(t('Upload New Photos'), 'photos/'.$a->data['user']['nickname'].'/upload'),
|
||||
'$photos' => $photos,
|
||||
'$paginate' => paginate($a),
|
||||
));
|
||||
|
||||
|
||||
$o .= paginate($a);
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
|
204
mod/ping.php
204
mod/ping.php
|
@ -4,22 +4,18 @@ require_once('include/bbcode.php');
|
|||
require_once('include/ForumManager.php');
|
||||
require_once('include/group.php');
|
||||
require_once("mod/proxy.php");
|
||||
require_once('include/xml.php');
|
||||
|
||||
function ping_init(&$a) {
|
||||
|
||||
header("Content-type: text/xml");
|
||||
|
||||
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>
|
||||
<result>";
|
||||
|
||||
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
|
||||
|
||||
if(local_user()){
|
||||
$xmlhead = "<"."?xml version='1.0' encoding='UTF-8' ?".">";
|
||||
|
||||
if (local_user()){
|
||||
// Different login session than the page that is calling us.
|
||||
|
||||
if(intval($_GET['uid']) && intval($_GET['uid']) != local_user()) {
|
||||
echo '<invalid>1</invalid></result>';
|
||||
if (intval($_GET['uid']) && intval($_GET['uid']) != local_user()) {
|
||||
$data = array("invalid" => 1);
|
||||
header("Content-type: text/xml");
|
||||
echo xml::from_array(array("result" => $data), $xml);
|
||||
killme();
|
||||
}
|
||||
|
||||
|
@ -51,14 +47,14 @@ function ping_init(&$a) {
|
|||
intval(local_user()), intval(local_user())
|
||||
);
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if (dbm::is_result($r)) {
|
||||
|
||||
$arr = array('items' => $r);
|
||||
call_hooks('network_ping', $arr);
|
||||
|
||||
foreach ($r as $it) {
|
||||
|
||||
if($it['wall'])
|
||||
if ($it['wall'])
|
||||
$home ++;
|
||||
else
|
||||
$network ++;
|
||||
|
@ -84,20 +80,20 @@ function ping_init(&$a) {
|
|||
if ($it['parent']!=$it['id']) {
|
||||
$comments[] = $it;
|
||||
} else {
|
||||
if(! $it['wall'])
|
||||
if (!$it['wall'])
|
||||
$posts[] = $it;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($network) {
|
||||
if(intval(feature_enabled(local_user(),'groups'))) {
|
||||
if ($network) {
|
||||
if (intval(feature_enabled(local_user(),'groups'))) {
|
||||
// Find out how unseen network posts are spread across groups
|
||||
$groups_unseen = groups_count_unseen();
|
||||
}
|
||||
|
||||
if(intval(feature_enabled(local_user(),'forumlist_widget'))) {
|
||||
if (intval(feature_enabled(local_user(),'forumlist_widget'))) {
|
||||
$forums_unseen = ForumManager::count_unseen_items();
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +124,7 @@ function ping_init(&$a) {
|
|||
|
||||
if ($a->config['register_policy'] == REGISTER_APPROVE && is_site_admin()){
|
||||
$regs = q("SELECT `contact`.`name`, `contact`.`url`, `contact`.`micro`, `register`.`created`, COUNT(*) as `total` FROM `contact` RIGHT JOIN `register` ON `register`.`uid`=`contact`.`uid` WHERE `contact`.`self`=1");
|
||||
if($regs)
|
||||
if ($regs)
|
||||
$register = $regs[0]['total'];
|
||||
} else {
|
||||
$register = "0";
|
||||
|
@ -150,23 +146,23 @@ function ping_init(&$a) {
|
|||
dbesc(datetime_convert('UTC','UTC','now'))
|
||||
);
|
||||
|
||||
if(dba::is_result($ev)) {
|
||||
if (dbm::is_result($ev)) {
|
||||
$all_events = intval($ev[0]['total']);
|
||||
|
||||
if($all_events) {
|
||||
if ($all_events) {
|
||||
$str_now = datetime_convert('UTC',$a->timezone,'now','Y-m-d');
|
||||
foreach($ev as $x) {
|
||||
$bd = false;
|
||||
if($x['type'] === 'birthday') {
|
||||
if ($x['type'] === 'birthday') {
|
||||
$birthdays ++;
|
||||
$bd = true;
|
||||
}
|
||||
else {
|
||||
$events ++;
|
||||
}
|
||||
if(datetime_convert('UTC',((intval($x['adjust'])) ? $a->timezone : 'UTC'), $x['start'],'Y-m-d') === $str_now) {
|
||||
if (datetime_convert('UTC',((intval($x['adjust'])) ? $a->timezone : 'UTC'), $x['start'],'Y-m-d') === $str_now) {
|
||||
$all_events_today ++;
|
||||
if($bd)
|
||||
if ($bd)
|
||||
$birthdays_today ++;
|
||||
else
|
||||
$events_today ++;
|
||||
|
@ -175,87 +171,58 @@ function ping_init(&$a) {
|
|||
}
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$data["intro"] = $intro;
|
||||
$data["mail"] = $mail;
|
||||
$data["net"] = $network;
|
||||
$data["home"] = $home;
|
||||
|
||||
/**
|
||||
* return xml from notification array
|
||||
*
|
||||
* @param array $n Notification array:
|
||||
* 'href' => notification link
|
||||
* 'name' => subject name
|
||||
* 'url' => subject url
|
||||
* 'photo' => subject photo
|
||||
* 'date' => notification date
|
||||
* 'seen' => bool true/false
|
||||
* 'message' => notification message. "{0}" will be replaced by subject name
|
||||
**/
|
||||
function xmlize($n){
|
||||
$n['photo'] = proxy_url($n['photo'], false, PROXY_SIZE_MICRO);
|
||||
if ($register!=0)
|
||||
$data["register"] = $register;
|
||||
|
||||
$n['message'] = html_entity_decode($n['message'], ENT_COMPAT | ENT_HTML401, "UTF-8");
|
||||
$n['name'] = html_entity_decode($n['name'], ENT_COMPAT | ENT_HTML401, "UTF-8");
|
||||
$groups = array();
|
||||
|
||||
// Are the nofications calles from the regular process or via the friendica app?
|
||||
$regularnotifications = (intval($_GET['uid']) AND intval($_GET['_']));
|
||||
|
||||
$a = get_app();
|
||||
|
||||
if ($a->is_friendica_app() OR !$regularnotifications)
|
||||
$n['message'] = str_replace("{0}", $n['name'], $n['message']);
|
||||
|
||||
$local_time = datetime_convert('UTC',date_default_timezone_get(),$n['date']);
|
||||
|
||||
call_hooks('ping_xmlize', $n);
|
||||
$notsxml = '<note id="%d" href="%s" name="%s" url="%s" photo="%s" date="%s" seen="%s" timestamp="%s" >%s</note>'."\n";
|
||||
return sprintf ( $notsxml, intval($n['id']),
|
||||
xmlify($n['href']), xmlify(xmlify($n['name'])), xmlify($n['url']), xmlify($n['photo']),
|
||||
xmlify(relative_date($n['date'])), xmlify($n['seen']), xmlify(strtotime($local_time)),
|
||||
xmlify($n['message'])
|
||||
);
|
||||
}
|
||||
|
||||
echo "<intro>$intro</intro>
|
||||
<mail>$mail</mail>
|
||||
<net>$network</net>
|
||||
<home>$home</home>\r\n";
|
||||
if ($register!=0) echo "<register>$register</register>";
|
||||
|
||||
if ( dba::is_result($groups_unseen) ) {
|
||||
echo '<groups>';
|
||||
if (dbm::is_result($groups_unseen)) {
|
||||
$count = 0;
|
||||
foreach ($groups_unseen as $it)
|
||||
if ($it['count'] > 0)
|
||||
echo '<group id="'.$it['id'].'">'.$it['count']."</group>";
|
||||
|
||||
echo "</groups>";
|
||||
if ($it['count'] > 0) {
|
||||
$count++;
|
||||
$groups[$count.":group"] = $it['count'];
|
||||
$groups[$count.":@attributes"] = array("id" => $it['id']);
|
||||
}
|
||||
$data["groups"] = $groups;
|
||||
}
|
||||
|
||||
if ( dba::is_result($forums_unseen) ) {
|
||||
echo '<forums>';
|
||||
$forums = array();
|
||||
|
||||
if (dbm::is_result($forums_unseen)) {
|
||||
$count = 0;
|
||||
foreach ($forums_unseen as $it)
|
||||
if ($it['count'] > 0)
|
||||
echo '<forum id="'.$it['id'].'">'.$it['count']."</forum>";
|
||||
|
||||
echo "</forums>";
|
||||
if ($it['count'] > 0) {
|
||||
$count++;
|
||||
$forums[$count.":forum"] = $it['count'];
|
||||
$forums[$count.":@attributes"] = array("id" => $it['id']);
|
||||
}
|
||||
$data["forums"] = $forums;
|
||||
}
|
||||
|
||||
echo "<all-events>$all_events</all-events>
|
||||
<all-events-today>$all_events_today</all-events-today>
|
||||
<events>$events</events>
|
||||
<events-today>$events_today</events-today>
|
||||
<birthdays>$birthdays</birthdays>
|
||||
<birthdays-today>$birthdays_today</birthdays-today>\r\n";
|
||||
$data["all-events"] = $all_events;
|
||||
$data["all-events-today"] = $all_events_today;
|
||||
$data["events"] = $events;
|
||||
$data["events-today"] = $events_today;
|
||||
$data["birthdays"] = $birthdays;
|
||||
$data["birthdays-today"] = $birthdays_today;
|
||||
|
||||
|
||||
if (dba::is_result($notifs) && (! $sysnotify)) {
|
||||
if (dbm::is_result($notifs) && !$sysnotify) {
|
||||
foreach ($notifs as $zz) {
|
||||
if($zz['seen'] == 0)
|
||||
if ($zz['seen'] == 0)
|
||||
$sysnotify ++;
|
||||
}
|
||||
}
|
||||
|
||||
echo ' <notif count="'. ($sysnotify + $intro + $mail + $register) .'">';
|
||||
|
||||
// merge all notification types in one array
|
||||
if ( dba::is_result($intros) ) {
|
||||
if (dbm::is_result($intros)) {
|
||||
foreach ($intros as $i) {
|
||||
$n = array(
|
||||
'href' => $a->get_baseurl().'/notifications/intros/'.$i['id'],
|
||||
|
@ -270,7 +237,7 @@ function ping_init(&$a) {
|
|||
}
|
||||
}
|
||||
|
||||
if ( dba::is_result($mails) ) {
|
||||
if (dbm::is_result($mails)) {
|
||||
foreach ($mails as $i) {
|
||||
$n = array(
|
||||
'href' => $a->get_baseurl().'/message/'.$i['id'],
|
||||
|
@ -285,7 +252,7 @@ function ping_init(&$a) {
|
|||
}
|
||||
}
|
||||
|
||||
if ( dba::is_result($regs) ) {
|
||||
if (dbm::is_result($regs)) {
|
||||
foreach ($regs as $i) {
|
||||
$n = array(
|
||||
'href' => $a->get_baseurl().'/admin/users/',
|
||||
|
@ -311,34 +278,69 @@ function ping_init(&$a) {
|
|||
};
|
||||
usort($notifs, $sort_function);
|
||||
|
||||
if( dba::is_result($notifs) ) {
|
||||
if (dbm::is_result($notifs)) {
|
||||
|
||||
// Are the nofications calles from the regular process or via the friendica app?
|
||||
$regularnotifications = (intval($_GET['uid']) AND intval($_GET['_']));
|
||||
|
||||
$count = 0;
|
||||
foreach($notifs as $n) {
|
||||
echo xmlize($n);
|
||||
$count++;
|
||||
if ($a->is_friendica_app() OR !$regularnotifications)
|
||||
$n['message'] = str_replace("{0}", $n['name'], $n['message']);
|
||||
|
||||
$notifications[$count.":note"] = $n['message'];
|
||||
|
||||
$contact = get_contact_details_by_url($n['url']);
|
||||
if (isset($contact["micro"]))
|
||||
$n['photo'] = proxy_url($contact["micro"], false, PROXY_SIZE_MICRO);
|
||||
else
|
||||
$n['photo'] = proxy_url($n['photo'], false, PROXY_SIZE_MICRO);
|
||||
|
||||
$local_time = datetime_convert('UTC',date_default_timezone_get(),$n['date']);
|
||||
|
||||
call_hooks('ping_xmlize', $n);
|
||||
|
||||
$notifications[$count.":@attributes"] = array("id" => $n["id"],
|
||||
"href" => $n['href'],
|
||||
"name" => $n['name'],
|
||||
"url" => $n['url'],
|
||||
"photo" => $n['photo'],
|
||||
"date" => relative_date($n['date']),
|
||||
"seen" => $n['seen'],
|
||||
"timestamp" => strtotime($local_time));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
echo " </notif>";
|
||||
$data["notif"] = $notifications;
|
||||
$data["@attributes"] = array("count" => $sysnotify + $intro + $mail + $register);
|
||||
}
|
||||
echo " <sysmsgs>";
|
||||
|
||||
if(x($_SESSION,'sysmsg')){
|
||||
$sysmsg = array();
|
||||
|
||||
if (x($_SESSION,'sysmsg')){
|
||||
$count = 0;
|
||||
foreach ($_SESSION['sysmsg'] as $m){
|
||||
echo "<notice>".xmlify($m)."</notice>";
|
||||
$count++;
|
||||
$sysmsg[$count.":notice"] = $m;
|
||||
}
|
||||
unset($_SESSION['sysmsg']);
|
||||
}
|
||||
if(x($_SESSION,'sysmsg_info')){
|
||||
|
||||
if (x($_SESSION,'sysmsg_info')){
|
||||
$count = 0;
|
||||
foreach ($_SESSION['sysmsg_info'] as $m){
|
||||
echo "<info>".xmlify($m)."</info>";
|
||||
$count++;
|
||||
$sysmsg[$count.":info"] = $m;
|
||||
}
|
||||
unset($_SESSION['sysmsg_info']);
|
||||
}
|
||||
|
||||
echo " </sysmsgs>";
|
||||
echo"</result>
|
||||
";
|
||||
$data["sysmsgs"] = $sysmsg;
|
||||
|
||||
header("Content-type: text/xml");
|
||||
echo xml::from_array(array("result" => $data), $xml);
|
||||
killme();
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ function poco_init(&$a) {
|
|||
dbesc(NETWORK_STATUSNET)
|
||||
);
|
||||
}
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$totalResults = intval($r[0]['total']);
|
||||
else
|
||||
$totalResults = 0;
|
||||
|
@ -168,7 +168,7 @@ function poco_init(&$a) {
|
|||
}
|
||||
|
||||
if(is_array($r)) {
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
foreach($r as $rr) {
|
||||
if (!isset($rr['generation'])) {
|
||||
if ($global)
|
||||
|
|
|
@ -66,7 +66,7 @@ function poke_init(&$a) {
|
|||
intval($parent),
|
||||
intval($uid)
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$parent_uri = $r[0]['uri'];
|
||||
$private = $r[0]['private'];
|
||||
$allow_cid = $r[0]['allow_cid'];
|
||||
|
@ -131,13 +131,13 @@ function poke_init(&$a) {
|
|||
// intval($uid),
|
||||
// intval($item_id)
|
||||
//);
|
||||
proc_run('php',"include/notifier.php","tag","$item_id");
|
||||
proc_run(PRIORITY_HIGH, "include/notifier.php", "tag", $item_id);
|
||||
}
|
||||
|
||||
|
||||
call_hooks('post_local_end', $arr);
|
||||
|
||||
proc_run('php',"include/notifier.php","like","$post_id");
|
||||
proc_run(PRIORITY_HIGH, "include/notifier.php", "like", $post_id);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ function poke_content(&$a) {
|
|||
intval($_GET['c']),
|
||||
intval(local_user())
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$name = $r[0]['name'];
|
||||
$id = $r[0]['id'];
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ function profile_init(&$a) {
|
|||
$which = $a->argv[1];
|
||||
else {
|
||||
$r = q("select nickname from user where blocked = 0 and account_expired = 0 and account_removed = 0 and verified = 1 order by rand() limit 1");
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
goaway($a->get_baseurl() . '/profile/' . $r[0]['nickname']);
|
||||
}
|
||||
else {
|
||||
|
@ -136,7 +136,7 @@ function profile_content(&$a, $update = 0) {
|
|||
intval($contact_id),
|
||||
intval($a->profile['profile_uid'])
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$contact = $r[0];
|
||||
$remote_contact = true;
|
||||
}
|
||||
|
@ -216,8 +216,7 @@ function profile_content(&$a, $update = 0) {
|
|||
|
||||
if($update) {
|
||||
|
||||
$r = q("SELECT distinct(parent) AS `item_id`, `item`.`network` AS `item_network`,
|
||||
`contact`.`uid` AS `contact-uid`
|
||||
$r = q("SELECT distinct(parent) AS `item_id`, `item`.`network` AS `item_network`
|
||||
FROM `item` INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND
|
||||
|
@ -259,7 +258,7 @@ function profile_content(&$a, $update = 0) {
|
|||
intval($a->profile['profile_uid'])
|
||||
);
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$a->set_pager_total($r[0]['total']);
|
||||
}
|
||||
}
|
||||
|
@ -282,9 +281,8 @@ function profile_content(&$a, $update = 0) {
|
|||
|
||||
$pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
|
||||
|
||||
$r = q("SELECT `thread`.`iid` AS `item_id`, `thread`.`network` AS `item_network`,
|
||||
`thread`.`uid` AS `contact-uid`
|
||||
FROM `thread` INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
|
||||
$r = q("SELECT `thread`.`iid` AS `item_id`, `thread`.`network` AS `item_network`
|
||||
FROM `thread` FORCE INDEX (`uid_created`) INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
|
||||
$sql_post_table INNER JOIN `contact` ON `contact`.`id` = `thread`.`contact-id`
|
||||
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||
WHERE `thread`.`uid` = %d AND `thread`.`visible` = 1 AND `thread`.`deleted` = 0
|
||||
|
@ -300,21 +298,13 @@ function profile_content(&$a, $update = 0) {
|
|||
$parents_arr = array();
|
||||
$parents_str = '';
|
||||
|
||||
if (dba::is_result($r)) {
|
||||
if (dbm::is_result($r)) {
|
||||
foreach($r as $rr)
|
||||
$parents_arr[] = $rr['item_id'];
|
||||
$parents_str = implode(', ', $parents_arr);
|
||||
|
||||
$items = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`network`, `contact`.`rel`,
|
||||
`contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
FROM `item`, `contact`
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
|
||||
and `item`.`moderated` = 0
|
||||
AND `contact`.`id` = `item`.`contact-id`
|
||||
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||
AND `item`.`parent` IN ( %s )
|
||||
$items = q(item_query()." AND `item`.`uid` = %d
|
||||
AND `item`.`parent` IN (%s)
|
||||
$sql_extra ",
|
||||
intval($a->profile['profile_uid']),
|
||||
dbesc($parents_str)
|
||||
|
|
|
@ -32,7 +32,7 @@ function profile_photo_post(&$a) {
|
|||
intval($_REQUEST['profile']),
|
||||
intval(local_user())
|
||||
);
|
||||
if(dba::is_result($r) && (! intval($r[0]['is-default'])))
|
||||
if(dbm::is_result($r) && (! intval($r[0]['is-default'])))
|
||||
$is_default_profile = 0;
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ function profile_photo_post(&$a) {
|
|||
dbesc(local_user()),
|
||||
intval($scale));
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
|
||||
$base_image = $r[0];
|
||||
|
||||
|
@ -125,7 +125,7 @@ function profile_photo_post(&$a) {
|
|||
// Update global directory in background
|
||||
$url = $a->get_baseurl() . '/profile/' . $a->user['nickname'];
|
||||
if($url && strlen(get_config('system','directory')))
|
||||
proc_run('php',"include/directory.php","$url");
|
||||
proc_run(PRIORITY_LOW, "include/directory.php", $url);
|
||||
|
||||
require_once('include/profile_update.php');
|
||||
profile_change();
|
||||
|
@ -224,7 +224,7 @@ function profile_photo_content(&$a) {
|
|||
// Update global directory in background
|
||||
$url = $_SESSION['my_url'];
|
||||
if($url && strlen(get_config('system','directory')))
|
||||
proc_run('php',"include/directory.php","$url");
|
||||
proc_run(PRIORITY_LOW, "include/directory.php", $url);
|
||||
|
||||
goaway($a->get_baseurl() . '/profiles');
|
||||
return; // NOTREACHED
|
||||
|
|
182
mod/profiles.php
182
mod/profiles.php
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
require_once("include/Contact.php");
|
||||
require_once('include/Probe.php');
|
||||
|
||||
function profiles_init(&$a) {
|
||||
|
||||
|
@ -251,11 +252,11 @@ function profiles_post(&$a) {
|
|||
$lookup = str_replace('_',' ', $lookup);
|
||||
if(strpos($lookup,'@') || (strpos($lookup,'http://'))) {
|
||||
$newname = $lookup;
|
||||
$links = @lrdd($lookup);
|
||||
$links = @Probe::lrdd($lookup);
|
||||
if(count($links)) {
|
||||
foreach($links as $link) {
|
||||
if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page') {
|
||||
$prf = $link['@attributes']['href'];
|
||||
$prf = $link['@attributes']['href'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -285,7 +286,7 @@ function profiles_post(&$a) {
|
|||
intval(local_user())
|
||||
);
|
||||
}
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$prf = $r[0]['url'];
|
||||
$newname = $r[0]['name'];
|
||||
}
|
||||
|
@ -304,8 +305,8 @@ function profiles_post(&$a) {
|
|||
$sexual = notags(trim($_POST['sexual']));
|
||||
$homepage = notags(trim($_POST['homepage']));
|
||||
if ((strpos($homepage, 'http') !== 0) && (strlen($homepage))) {
|
||||
// neither http nor https in URL, add them
|
||||
$homepage = 'http://'.$homepage;
|
||||
// neither http nor https in URL, add them
|
||||
$homepage = 'http://'.$homepage;
|
||||
}
|
||||
$hometown = notags(trim($_POST['hometown']));
|
||||
$politic = notags(trim($_POST['politic']));
|
||||
|
@ -484,7 +485,7 @@ function profiles_post(&$a) {
|
|||
if($is_default) {
|
||||
$location = formatted_location(array("locality" => $locality, "region" => $region, "country-name" => $country_name));
|
||||
|
||||
$r = q("UPDATE `contact` SET `about` = '%s', `location` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `self` = 1 AND `uid` = %d",
|
||||
q("UPDATE `contact` SET `about` = '%s', `location` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `self` AND `uid` = %d",
|
||||
dbesc($about),
|
||||
dbesc($location),
|
||||
dbesc($pub_keywords),
|
||||
|
@ -495,10 +496,13 @@ function profiles_post(&$a) {
|
|||
// Update global directory in background
|
||||
$url = $_SESSION['my_url'];
|
||||
if($url && strlen(get_config('system','directory')))
|
||||
proc_run('php',"include/directory.php","$url");
|
||||
proc_run(PRIORITY_LOW, "include/directory.php", $url);
|
||||
|
||||
require_once('include/profile_update.php');
|
||||
profile_change();
|
||||
|
||||
// Update the global contact for the user
|
||||
update_gcontact_for_user(local_user());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -583,9 +587,8 @@ function profile_activity($changed, $value) {
|
|||
$arr['deny_gid'] = $a->user['deny_gid'];
|
||||
|
||||
$i = item_store($arr);
|
||||
if($i) {
|
||||
proc_run('php',"include/notifier.php","activity","$i");
|
||||
}
|
||||
if($i)
|
||||
proc_run(PRIORITY_HIGH, "include/notifier.php", "activity", $i);
|
||||
}
|
||||
|
||||
|
||||
|
@ -660,25 +663,29 @@ function profiles_content(&$a) {
|
|||
'$detailled_profile' => $detailled_profile,
|
||||
|
||||
'$details' => array(
|
||||
'detailled_profile', //Name
|
||||
t('Show more profile fields:'), //Label
|
||||
$detailled_profile, //Value
|
||||
'', //Help string
|
||||
array(t('No'),t('Yes')) //Off - On strings
|
||||
),
|
||||
'detailled_profile', //Name
|
||||
t('Show more profile fields:'), //Label
|
||||
$detailled_profile, //Value
|
||||
'', //Help string
|
||||
array(t('No'),t('Yes')) //Off - On strings
|
||||
),
|
||||
|
||||
'$multi_profiles' => feature_enabled(local_user(),'multi_profiles'),
|
||||
'$form_security_token' => get_form_security_token("profile_edit"),
|
||||
'$form_security_token_photo' => get_form_security_token("profile_photo"),
|
||||
'$profile_clone_link' => ((feature_enabled(local_user(),'multi_profiles')) ? 'profiles/clone/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_clone") : ""),
|
||||
'$profile_drop_link' => 'profiles/drop/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_drop"),
|
||||
|
||||
'$profile_action' => t('Profile Actions'),
|
||||
'$banner' => t('Edit Profile Details'),
|
||||
'$submit' => t('Submit'),
|
||||
'$profpic' => t('Change Profile Photo'),
|
||||
'$viewprof' => t('View this profile'),
|
||||
'$editvis' => t('Edit visibility'),
|
||||
'$cr_prof' => t('Create a new profile using these settings'),
|
||||
'$cl_prof' => t('Clone this profile'),
|
||||
'$del_prof' => t('Delete this profile'),
|
||||
|
||||
'$multi_profiles' => feature_enabled(local_user(),'multi_profiles'),
|
||||
'$form_security_token' => get_form_security_token("profile_edit"),
|
||||
'$form_security_token_photo' => get_form_security_token("profile_photo"),
|
||||
'$profile_clone_link' => 'profiles/clone/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_clone"),
|
||||
'$profile_drop_link' => 'profiles/drop/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_drop"),
|
||||
'$banner' => t('Edit Profile Details'),
|
||||
'$submit' => t('Submit'),
|
||||
'$profpic' => t('Change Profile Photo'),
|
||||
'$viewprof' => t('View this profile'),
|
||||
'$cr_prof' => t('Create a new profile using these settings'),
|
||||
'$cl_prof' => t('Clone this profile'),
|
||||
'$del_prof' => t('Delete this profile'),
|
||||
'$lbl_basic_section' => t('Basic information'),
|
||||
'$lbl_picture_section' => t('Profile picture'),
|
||||
'$lbl_location_section' => t('Location'),
|
||||
|
@ -686,81 +693,55 @@ function profiles_content(&$a) {
|
|||
'$lbl_status_section' => t('Status information'),
|
||||
'$lbl_about_section' => t('Additional information'),
|
||||
'$lbl_interests_section' => t('Interests'),
|
||||
'$lbl_personal_section' => t('Personal'),
|
||||
'$lbl_relation_section' => t('Relation'),
|
||||
'$lbl_miscellaneous_section' => t('Miscellaneous'),
|
||||
|
||||
'$lbl_profile_photo' => t('Upload Profile Photo'),
|
||||
'$lbl_profname' => t('Profile Name:'),
|
||||
'$lbl_fullname' => t('Your Full Name:'),
|
||||
'$lbl_title' => t('Title/Description:'),
|
||||
'$lbl_gender' => t('Your Gender:'),
|
||||
'$lbl_bd' => t("Birthday :"),
|
||||
'$lbl_address' => t('Street Address:'),
|
||||
'$lbl_city' => t('Locality/City:'),
|
||||
'$lbl_zip' => t('Postal/Zip Code:'),
|
||||
'$lbl_country' => t('Country:'),
|
||||
'$lbl_region' => t('Region/State:'),
|
||||
'$lbl_marital' => t('<span class="heart">♥</span> Marital Status:'),
|
||||
'$lbl_with' => t("Who: \x28if applicable\x29"),
|
||||
'$lbl_ex1' => t('Examples: cathy123, Cathy Williams, cathy@example.com'),
|
||||
'$lbl_howlong' => t('Since [date]:'),
|
||||
'$lbl_sexual' => t('Sexual Preference:'),
|
||||
'$lbl_homepage' => t('Homepage URL:'),
|
||||
'$lbl_hometown' => t('Hometown:'),
|
||||
'$lbl_politic' => t('Political Views:'),
|
||||
'$lbl_religion' => t('Religious Views:'),
|
||||
'$lbl_pubkey' => t('Public Keywords:'),
|
||||
'$lbl_prvkey' => t('Private Keywords:'),
|
||||
'$lbl_likes' => t('Likes:'),
|
||||
'$lbl_dislikes' => t('Dislikes:'),
|
||||
'$lbl_ex2' => t('Example: fishing photography software'),
|
||||
'$lbl_pubdsc' => t("\x28Used for suggesting potential friends, can be seen by others\x29"),
|
||||
'$lbl_prvdsc' => t("\x28Used for searching profiles, never shown to others\x29"),
|
||||
'$lbl_about' => t('Tell us about yourself...'),
|
||||
'$lbl_hobbies' => t('Hobbies/Interests'),
|
||||
'$lbl_social' => t('Contact information and Social Networks'),
|
||||
'$lbl_music' => t('Musical interests'),
|
||||
'$lbl_book' => t('Books, literature'),
|
||||
'$lbl_tv' => t('Television'),
|
||||
'$lbl_film' => t('Film/dance/culture/entertainment'),
|
||||
'$lbl_love' => t('Love/romance'),
|
||||
'$lbl_work' => t('Work/employment'),
|
||||
'$lbl_school' => t('School/education'),
|
||||
|
||||
'$disabled' => (($is_default) ? 'onclick="return false;" style="color: #BBBBFF;"' : ''),
|
||||
'$baseurl' => $a->get_baseurl(true),
|
||||
'$profile_id' => $r[0]['id'],
|
||||
'$profile_name' => $r[0]['profile-name'],
|
||||
'$profile_name' => array('profile_name', t('Profile Name:'), $r[0]['profile-name'], t('Required'), '*'),
|
||||
'$is_default' => $is_default,
|
||||
'$default' => (($is_default) ? '<p id="profile-edit-default-desc">' . t('This is your <strong>public</strong> profile.<br />It <strong>may</strong> be visible to anybody using the internet.') . '</p>' : ""),
|
||||
'$name' => $r[0]['name'],
|
||||
'$pdesc' => $r[0]['pdesc'],
|
||||
'$name' => array('name', t('Your Full Name:'), $r[0]['name']),
|
||||
'$pdesc' => array('pdesc', t('Title/Description:'), $r[0]['pdesc']),
|
||||
'$dob' => dob($r[0]['dob']),
|
||||
'$hide_friends' => $hide_friends,
|
||||
'$address' => $r[0]['address'],
|
||||
'$locality' => $r[0]['locality'],
|
||||
'$region' => $r[0]['region'],
|
||||
'$postal_code' => $r[0]['postal-code'],
|
||||
'$country_name' => $r[0]['country-name'],
|
||||
'$address' => array('address', t('Street Address:'), $r[0]['address']),
|
||||
'$locality' => array('locality', t('Locality/City:'), $r[0]['locality']),
|
||||
'$region' => array('region', t('Region/State:'), $r[0]['region']),
|
||||
'$postal_code' => array('postal_code', t('Postal/Zip Code:'), $r[0]['postal-code']),
|
||||
'$country_name' => array('country_name', t('Country:'), $r[0]['country-name']),
|
||||
'$age' => ((intval($r[0]['dob'])) ? '(' . t('Age: ') . age($r[0]['dob'],$a->user['timezone'],$a->user['timezone']) . ')' : ''),
|
||||
'$gender' => gender_selector($r[0]['gender']),
|
||||
'$marital' => marital_selector($r[0]['marital']),
|
||||
'$with' => strip_tags($r[0]['with']),
|
||||
'$howlong' => ($r[0]['howlong'] === '0000-00-00 00:00:00' ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong'])),
|
||||
'$with' => array('with', t("Who: \x28if applicable\x29"), strip_tags($r[0]['with']), t('Examples: cathy123, Cathy Williams, cathy@example.com')),
|
||||
'$howlong' => array('howlong', t('Since [date]:'), ($r[0]['howlong'] === '0000-00-00 00:00:00' ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong']))),
|
||||
'$sexual' => sexpref_selector($r[0]['sexual']),
|
||||
'$about' => $r[0]['about'],
|
||||
'$homepage' => $r[0]['homepage'],
|
||||
'$hometown' => $r[0]['hometown'],
|
||||
'$politic' => $r[0]['politic'],
|
||||
'$religion' => $r[0]['religion'],
|
||||
'$pub_keywords' => $r[0]['pub_keywords'],
|
||||
'$prv_keywords' => $r[0]['prv_keywords'],
|
||||
'$likes' => $r[0]['likes'],
|
||||
'$dislikes' => $r[0]['dislikes'],
|
||||
'$music' => $r[0]['music'],
|
||||
'$book' => $r[0]['book'],
|
||||
'$tv' => $r[0]['tv'],
|
||||
'$film' => $r[0]['film'],
|
||||
'$interest' => $r[0]['interest'],
|
||||
'$romance' => $r[0]['romance'],
|
||||
'$work' => $r[0]['work'],
|
||||
'$education' => $r[0]['education'],
|
||||
'$contact' => $r[0]['contact']
|
||||
'$about' => array('about', t('Tell us about yourself...'), $r[0]['about']),
|
||||
'$homepage' => array('homepage', t('Homepage URL:'), $r[0]['homepage']),
|
||||
'$hometown' => array('hometown', t('Hometown:'), $r[0]['hometown']),
|
||||
'$politic' => array('politic', t('Political Views:'), $r[0]['politic']),
|
||||
'$religion' => array('religion', t('Religious Views:'), $r[0]['religion']),
|
||||
'$pub_keywords' => array('pub_keywords', t('Public Keywords:'), $r[0]['pub_keywords'], t("\x28Used for suggesting potential friends, can be seen by others\x29")),
|
||||
'$prv_keywords' => array('prv_keywords', t('Private Keywords:'), $r[0]['prv_keywords'], t("\x28Used for searching profiles, never shown to others\x29")),
|
||||
'$likes' => array('likes', t('Likes:'), $r[0]['likes']),
|
||||
'$dislikes' => array('dislikes', t('Dislikes:'), $r[0]['dislikes']),
|
||||
'$music' => array('music', t('Musical interests'), $r[0]['music']),
|
||||
'$book' => array('book', t('Books, literature'), $r[0]['book']),
|
||||
'$tv' => array('tv', t('Television'), $r[0]['tv']),
|
||||
'$film' => array('film', t('Film/dance/culture/entertainment'), $r[0]['film']),
|
||||
'$interest' => array('interest', t('Hobbies/Interests'), $r[0]['interest']),
|
||||
'$romance' => array('romance',t('Love/romance'), $r[0]['romance']),
|
||||
'$work' => array('work', t('Work/employment'), $r[0]['work']),
|
||||
'$education' => array('education', t('School/education'), $r[0]['education']),
|
||||
'$contact' => array('contact', t('Contact information and Social Networks'), $r[0]['contact']),
|
||||
));
|
||||
|
||||
$arr = array('profile' => $r[0], 'entry' => $o);
|
||||
|
@ -778,7 +759,7 @@ function profiles_content(&$a) {
|
|||
"SELECT * FROM `profile` WHERE `uid` = %d AND `is-default`=1",
|
||||
local_user()
|
||||
);
|
||||
if(dba::is_result($r)){
|
||||
if(dbm::is_result($r)){
|
||||
//Go to the default profile.
|
||||
goaway('profiles/'.$r[0]['id']);
|
||||
}
|
||||
|
@ -786,21 +767,11 @@ function profiles_content(&$a) {
|
|||
|
||||
$r = q("SELECT * FROM `profile` WHERE `uid` = %d",
|
||||
local_user());
|
||||
if(dba::is_result($r)) {
|
||||
|
||||
$tpl_header = get_markup_template('profile_listing_header.tpl');
|
||||
$o .= replace_macros($tpl_header,array(
|
||||
'$header' => t('Edit/Manage Profiles'),
|
||||
'$chg_photo' => t('Change profile photo'),
|
||||
'$cr_new' => t('Create New Profile'),
|
||||
'$cr_new_link' => 'profiles/new?t=' . get_form_security_token("profile_new")
|
||||
));
|
||||
|
||||
if(dbm::is_result($r)) {
|
||||
|
||||
$tpl = get_markup_template('profile_entry.tpl');
|
||||
|
||||
foreach($r as $rr) {
|
||||
$o .= replace_macros($tpl, array(
|
||||
$profiles .= replace_macros($tpl, array(
|
||||
'$photo' => $a->remove_baseurl($rr['thumb']),
|
||||
'$id' => $rr['id'],
|
||||
'$alt' => t('Profile Image'),
|
||||
|
@ -809,6 +780,15 @@ function profiles_content(&$a) {
|
|||
: '<a href="'.'profperm/'.$rr['id'].'" />' . t('Edit visibility') . '</a>')
|
||||
));
|
||||
}
|
||||
|
||||
$tpl_header = get_markup_template('profile_listing_header.tpl');
|
||||
$o .= replace_macros($tpl_header,array(
|
||||
'$header' => t('Edit/Manage Profiles'),
|
||||
'$chg_photo' => t('Change profile photo'),
|
||||
'$cr_new' => t('Create New Profile'),
|
||||
'$cr_new_link' => 'profiles/new?t=' . get_form_security_token("profile_new"),
|
||||
'$profiles' => $profiles
|
||||
));
|
||||
}
|
||||
return $o;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ function profperm_content(&$a) {
|
|||
intval($a->argv[2]),
|
||||
intval(local_user())
|
||||
);
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$change = intval($a->argv[2]);
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ function profperm_content(&$a) {
|
|||
);
|
||||
|
||||
$ingroup = array();
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
foreach($r as $member)
|
||||
$ingroup[] = $member['id'];
|
||||
|
||||
|
@ -94,7 +94,7 @@ function profperm_content(&$a) {
|
|||
$members = $r;
|
||||
|
||||
$ingroup = array();
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
foreach($r as $member)
|
||||
$ingroup[] = $member['id'];
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ function profperm_content(&$a) {
|
|||
dbesc(NETWORK_DFRN)
|
||||
);
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$textmode = (($switchtotext && (count($r) > $switchtotext)) ? true : false);
|
||||
foreach($r as $member) {
|
||||
if(! in_array($member['id'],$ingroup)) {
|
||||
|
|
|
@ -136,7 +136,7 @@ function proxy_init() {
|
|||
|
||||
if (!$direct_cache AND ($cachefile == "")) {
|
||||
$r = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' LIMIT 1", $urlhash);
|
||||
if (dba::is_result($r)) {
|
||||
if (dbm::is_result($r)) {
|
||||
$img_str = $r[0]['data'];
|
||||
$mime = $r[0]["desc"];
|
||||
if ($mime == "") $mime = "image/jpeg";
|
||||
|
@ -144,7 +144,7 @@ function proxy_init() {
|
|||
} else
|
||||
$r = array();
|
||||
|
||||
if (!count($r)) {
|
||||
if (!dbm::is_result($r)) {
|
||||
// It shouldn't happen but it does - spaces in URL
|
||||
$_REQUEST['url'] = str_replace(" ", "+", $_REQUEST['url']);
|
||||
$redirects = 0;
|
||||
|
|
|
@ -132,7 +132,7 @@ function pubsubhubbub_init(&$a) {
|
|||
|
||||
// if we are just updating an old subscription, keep the
|
||||
// old values for push and last_update
|
||||
if (dba::is_result($r)) {
|
||||
if (dbm::is_result($r)) {
|
||||
$last_update = $r[0]['last_update'];
|
||||
$push_flag = $r[0]['push'];
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ function qsearch_init(&$a) {
|
|||
intval($limit)
|
||||
);
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
|
||||
foreach($r as $rr)
|
||||
$results[] = array( 0, (int) $rr['id'], $rr['name'], '', '');
|
||||
|
@ -38,7 +38,7 @@ function qsearch_init(&$a) {
|
|||
);
|
||||
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
|
||||
foreach($r as $rr)
|
||||
$results[] = array( (int) $rr['id'], 0, $rr['name'],$rr['url'],$rr['photo']);
|
||||
|
|
|
@ -64,7 +64,7 @@ function register_post(&$a) {
|
|||
|
||||
if($netpublish && $a->config['register_policy'] != REGISTER_APPROVE) {
|
||||
$url = $a->get_baseurl() . '/profile/' . $user['nickname'];
|
||||
proc_run('php',"include/directory.php","$url");
|
||||
proc_run(PRIORITY_LOW, "include/directory.php", $url);
|
||||
}
|
||||
|
||||
$using_invites = get_config('system','invitation_only');
|
||||
|
|
|
@ -34,10 +34,10 @@ function user_allow($hash) {
|
|||
$r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default` = 1",
|
||||
intval($user[0]['uid'])
|
||||
);
|
||||
if(dba::is_result($r) && $r[0]['net-publish']) {
|
||||
if(dbm::is_result($r) && $r[0]['net-publish']) {
|
||||
$url = $a->get_baseurl() . '/profile/' . $user[0]['nickname'];
|
||||
if($url && strlen(get_config('system','directory')))
|
||||
proc_run('php',"include/directory.php","$url");
|
||||
proc_run(PRIORITY_LOW, "include/directory.php", $url);
|
||||
}
|
||||
|
||||
push_lang($register[0]['language']);
|
||||
|
|
|
@ -169,8 +169,8 @@ function salmon_post(&$a) {
|
|||
// Have we ignored the person?
|
||||
// If so we can not accept this post.
|
||||
|
||||
//if((dba::is_result($r)) && (($r[0]['readonly']) || ($r[0]['rel'] == CONTACT_IS_FOLLOWER) || ($r[0]['blocked']))) {
|
||||
if(dba::is_result($r) && $r[0]['blocked']) {
|
||||
//if((dbm::is_result($r)) && (($r[0]['readonly']) || ($r[0]['rel'] == CONTACT_IS_FOLLOWER) || ($r[0]['blocked']))) {
|
||||
if(dbm::is_result($r) && $r[0]['blocked']) {
|
||||
logger('mod-salmon: Ignoring this author.');
|
||||
http_status_exit(202);
|
||||
// NOTREACHED
|
||||
|
@ -179,7 +179,7 @@ function salmon_post(&$a) {
|
|||
// Placeholder for hub discovery.
|
||||
$hub = '';
|
||||
|
||||
$contact_rec = ((dba::is_result($r)) ? $r[0] : null);
|
||||
$contact_rec = ((dbm::is_result($r)) ? $r[0] : null);
|
||||
|
||||
ostatus::import($data,$importer,$contact_rec, $hub);
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ function search_saved_searches() {
|
|||
intval(local_user())
|
||||
);
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$saved = array();
|
||||
foreach($r as $rr) {
|
||||
$saved[] = array(
|
||||
|
@ -61,7 +61,7 @@ function search_init(&$a) {
|
|||
}
|
||||
}
|
||||
if(x($_GET,'remove') && $search) {
|
||||
q("delete from `search` where `uid` = %d and `term` = '%s' limit 1",
|
||||
q("DELETE FROM `search` WHERE `uid` = %d AND `term` = '%s' LIMIT 1",
|
||||
intval(local_user()),
|
||||
dbesc($search)
|
||||
);
|
||||
|
@ -132,9 +132,6 @@ function search_content(&$a) {
|
|||
|
||||
nav_set_selected('search');
|
||||
|
||||
|
||||
$o = '<h3>' . t('Search') . '</h3>';
|
||||
|
||||
if(x($a->data,'search'))
|
||||
$search = notags(trim($a->data['search']));
|
||||
else
|
||||
|
@ -146,8 +143,13 @@ function search_content(&$a) {
|
|||
$search = ((x($_GET,'tag')) ? notags(trim(rawurldecode($_GET['tag']))) : '');
|
||||
}
|
||||
|
||||
|
||||
$o .= search($search,'search-box','search',((local_user()) ? true : false), false);
|
||||
// contruct a wrapper for the search header
|
||||
$o .= replace_macros(get_markup_template("content_wrapper.tpl"),array(
|
||||
'name' => "search-header",
|
||||
'$title' => t("Search"),
|
||||
'$title_size' => 3,
|
||||
'$content' => search($search,'search-box','search',((local_user()) ? true : false), false)
|
||||
));
|
||||
|
||||
if(strpos($search,'#') === 0) {
|
||||
$tag = true;
|
||||
|
@ -160,7 +162,7 @@ function search_content(&$a) {
|
|||
return dirfind_content($a);
|
||||
}
|
||||
|
||||
if(x($_GET,'search-option'))
|
||||
if(x($_GET,'search-option'))
|
||||
switch($_GET['search-option']) {
|
||||
case 'fulltext':
|
||||
break;
|
||||
|
@ -189,17 +191,14 @@ function search_content(&$a) {
|
|||
if($tag) {
|
||||
logger("Start tag search for '".$search."'", LOGGER_DEBUG);
|
||||
|
||||
$r = q("SELECT STRAIGHT_JOIN `item`.`uri`, `item`.*, `item`.`id` AS `item_id`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
$r = q("SELECT %s
|
||||
FROM `term`
|
||||
INNER JOIN `item` ON `item`.`id`=`term`.`oid`
|
||||
INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`
|
||||
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
||||
AND (`term`.`uid` = 0 OR (`term`.`uid` = %d AND NOT `term`.`global`)) AND `term`.`otype` = %d AND `term`.`type` = %d AND `term`.`term` = '%s'
|
||||
STRAIGHT_JOIN `item` ON `item`.`id`=`term`.`oid` %s
|
||||
WHERE %s AND (`term`.`uid` = 0 OR (`term`.`uid` = %d AND NOT `term`.`global`)) AND `term`.`otype` = %d AND `term`.`type` = %d AND `term`.`term` = '%s'
|
||||
ORDER BY term.created DESC LIMIT %d , %d ",
|
||||
intval(local_user()), intval(TERM_OBJ_POST), intval(TERM_HASHTAG), dbesc(protect_sprintf($search)),
|
||||
item_fieldlists(), item_joins(), item_condition(),
|
||||
intval(local_user()),
|
||||
intval(TERM_OBJ_POST), intval(TERM_HASHTAG), dbesc(protect_sprintf($search)),
|
||||
intval($a->pager['start']), intval($a->pager['itemspage']));
|
||||
} else {
|
||||
logger("Start fulltext search for '".$search."'", LOGGER_DEBUG);
|
||||
|
@ -210,20 +209,17 @@ function search_content(&$a) {
|
|||
$sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(protect_sprintf(preg_quote($search))));
|
||||
}
|
||||
|
||||
$r = q("SELECT STRAIGHT_JOIN `item`.`uri`, `item`.*, `item`.`id` AS `item_id`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
FROM `item`
|
||||
INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`
|
||||
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
||||
AND (`item`.`uid` = 0 OR (`item`.`uid` = %s AND NOT `item`.`global`))
|
||||
$r = q("SELECT %s
|
||||
FROM `item` %s
|
||||
WHERE %s AND (`item`.`uid` = 0 OR (`item`.`uid` = %s AND NOT `item`.`global`))
|
||||
$sql_extra
|
||||
GROUP BY `item`.`uri` ORDER BY `item`.`id` DESC LIMIT %d , %d ",
|
||||
intval(local_user()), intval($a->pager['start']), intval($a->pager['itemspage']));
|
||||
GROUP BY `item`.`uri` ORDER BY `item`.`id` DESC LIMIT %d , %d",
|
||||
item_fieldlists(), item_joins(), item_condition(),
|
||||
intval(local_user()),
|
||||
intval($a->pager['start']), intval($a->pager['itemspage']));
|
||||
}
|
||||
|
||||
if(! count($r)) {
|
||||
if(! dbm::is_result($r)) {
|
||||
info( t('No results.') . EOL);
|
||||
return $o;
|
||||
}
|
||||
|
@ -232,7 +228,7 @@ function search_content(&$a) {
|
|||
if($tag)
|
||||
$title = sprintf( t('Items tagged with: %s'), $search);
|
||||
else
|
||||
$title = sprintf( t('Search results for: %s'), $search);
|
||||
$title = sprintf( t('Results for: %s'), $search);
|
||||
|
||||
$o .= replace_macros(get_markup_template("section_title.tpl"),array(
|
||||
'$title' => $title
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
require_once('include/group.php');
|
||||
require_once('include/socgraph.php');
|
||||
|
||||
function get_theme_config_file($theme){
|
||||
$a = get_app();
|
||||
|
@ -254,7 +255,7 @@ function settings_post(&$a) {
|
|||
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
|
||||
intval(local_user())
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$eacct = $r[0];
|
||||
require_once('include/email.php');
|
||||
$mb = construct_mailbox_name($eacct);
|
||||
|
@ -351,7 +352,7 @@ function settings_post(&$a) {
|
|||
check_form_security_token_redirectOnErr('/settings', 'settings');
|
||||
|
||||
if (x($_POST,'resend_relocate')) {
|
||||
proc_run('php', 'include/notifier.php', 'relocate', local_user());
|
||||
proc_run(PRIORITY_HIGH, 'include/notifier.php', 'relocate', local_user());
|
||||
info(t("Relocate message has been send to your contacts"));
|
||||
goaway('settings');
|
||||
}
|
||||
|
@ -602,7 +603,7 @@ function settings_post(&$a) {
|
|||
|
||||
|
||||
if($name_change) {
|
||||
q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `self` = 1",
|
||||
q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `self`",
|
||||
dbesc($username),
|
||||
dbesc(datetime_convert()),
|
||||
intval(local_user())
|
||||
|
@ -613,14 +614,15 @@ function settings_post(&$a) {
|
|||
// Update global directory in background
|
||||
$url = $_SESSION['my_url'];
|
||||
if($url && strlen(get_config('system','directory')))
|
||||
proc_run('php',"include/directory.php","$url");
|
||||
|
||||
proc_run(PRIORITY_LOW, "include/directory.php", $url);
|
||||
}
|
||||
|
||||
|
||||
require_once('include/profile_update.php');
|
||||
profile_change();
|
||||
|
||||
// Update the global contact for the user
|
||||
update_gcontact_for_user(local_user());
|
||||
|
||||
//$_SESSION['theme'] = $theme;
|
||||
if($email_changed && $a->config['register_policy'] == REGISTER_VERIFY) {
|
||||
|
||||
|
@ -629,7 +631,7 @@ function settings_post(&$a) {
|
|||
|
||||
}
|
||||
|
||||
goaway('settings' );
|
||||
goaway('settings');
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -842,15 +844,15 @@ function settings_content(&$a) {
|
|||
$r = null;
|
||||
}
|
||||
|
||||
$mail_server = ((dba::is_result($r)) ? $r[0]['server'] : '');
|
||||
$mail_port = ((dba::is_result($r) && intval($r[0]['port'])) ? intval($r[0]['port']) : '');
|
||||
$mail_ssl = ((dba::is_result($r)) ? $r[0]['ssltype'] : '');
|
||||
$mail_user = ((dba::is_result($r)) ? $r[0]['user'] : '');
|
||||
$mail_replyto = ((dba::is_result($r)) ? $r[0]['reply_to'] : '');
|
||||
$mail_pubmail = ((dba::is_result($r)) ? $r[0]['pubmail'] : 0);
|
||||
$mail_action = ((dba::is_result($r)) ? $r[0]['action'] : 0);
|
||||
$mail_movetofolder = ((dba::is_result($r)) ? $r[0]['movetofolder'] : '');
|
||||
$mail_chk = ((dba::is_result($r)) ? $r[0]['last_check'] : '0000-00-00 00:00:00');
|
||||
$mail_server = ((dbm::is_result($r)) ? $r[0]['server'] : '');
|
||||
$mail_port = ((dbm::is_result($r) && intval($r[0]['port'])) ? intval($r[0]['port']) : '');
|
||||
$mail_ssl = ((dbm::is_result($r)) ? $r[0]['ssltype'] : '');
|
||||
$mail_user = ((dbm::is_result($r)) ? $r[0]['user'] : '');
|
||||
$mail_replyto = ((dbm::is_result($r)) ? $r[0]['reply_to'] : '');
|
||||
$mail_pubmail = ((dbm::is_result($r)) ? $r[0]['pubmail'] : 0);
|
||||
$mail_action = ((dbm::is_result($r)) ? $r[0]['action'] : 0);
|
||||
$mail_movetofolder = ((dbm::is_result($r)) ? $r[0]['movetofolder'] : '');
|
||||
$mail_chk = ((dbm::is_result($r)) ? $r[0]['last_check'] : '0000-00-00 00:00:00');
|
||||
|
||||
|
||||
$tpl = get_markup_template("settings_connectors.tpl");
|
||||
|
@ -987,6 +989,9 @@ function settings_content(&$a) {
|
|||
'$infinite_scroll' => array('infinite_scroll', t("Infinite scroll"), $infinite_scroll, ''),
|
||||
'$no_auto_update' => array('no_auto_update', t("Automatic updates only at the top of the network page"), $no_auto_update, 'When disabled, the network page is updated all the time, which could be confusing while reading.'),
|
||||
|
||||
'$d_tset' => t('General Theme Settings'),
|
||||
'$d_ctset' => t('Custom Theme Settings'),
|
||||
'$d_cset' => t('Content Settings'),
|
||||
'stitle' => t('Theme settings'),
|
||||
'$theme_config' => $theme_config,
|
||||
));
|
||||
|
@ -1279,7 +1284,7 @@ function settings_content(&$a) {
|
|||
'$notify7' => array('notify7', t('You are tagged in a post'), ($notify & NOTIFY_TAGSELF), NOTIFY_TAGSELF, ''),
|
||||
'$notify8' => array('notify8', t('You are poked/prodded/etc. in a post'), ($notify & NOTIFY_POKE), NOTIFY_POKE, ''),
|
||||
|
||||
'$desktop_notifications' => array('desktop_notifications', t('Activate desktop notifications') , false, t('Show desktop popup on new notifications')),
|
||||
'$desktop_notifications' => array('desktop_notifications', t('Activate desktop notifications') , false, t('Show desktop popup on new notifications')),
|
||||
|
||||
'$email_textonly' => array('email_textonly', t('Text-only notification emails'),
|
||||
get_pconfig(local_user(),'system','email_textonly'),
|
||||
|
|
|
@ -53,7 +53,7 @@ function subthread_content(&$a) {
|
|||
WHERE `contact`.`self` = 1 AND `contact`.`uid` = %d LIMIT 1",
|
||||
intval($owner_uid)
|
||||
);
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$owner = $r[0];
|
||||
|
||||
if(! $owner) {
|
||||
|
@ -75,7 +75,7 @@ function subthread_content(&$a) {
|
|||
intval($_SESSION['visitor_id']),
|
||||
intval($owner_uid)
|
||||
);
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$contact = $r[0];
|
||||
}
|
||||
if(! $contact) {
|
||||
|
|
|
@ -78,17 +78,20 @@ function suggest_content(&$a) {
|
|||
|
||||
$connlnk = $a->get_baseurl() . '/follow/?url=' . (($rr['connect']) ? $rr['connect'] : $rr['url']);
|
||||
$ignlnk = $a->get_baseurl() . '/suggest?ignore=' . $rr['id'];
|
||||
$photo_menu = array(array(t("View Profile"), zrl($rr["url"])));
|
||||
$photo_menu[] = array(t("Connect/Follow"), $connlnk);
|
||||
$photo_menu[] = array(t('Ignore/Hide'), $ignlnk);
|
||||
$contact_details = get_contact_details_by_url($rr["url"], local_user());
|
||||
$photo_menu = array(
|
||||
'profile' => array(t("View Profile"), zrl($rr["url"])),
|
||||
'follow' => array(t("Connect/Follow"), $connlnk),
|
||||
'hide' => array(t('Ignore/Hide'), $ignlnk)
|
||||
);
|
||||
|
||||
$contact_details = get_contact_details_by_url($rr["url"], local_user(), $rr);
|
||||
|
||||
$entry = array(
|
||||
'url' => zrl($rr['url']),
|
||||
'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']),
|
||||
'img_hover' => $rr['url'],
|
||||
'name' => $rr['name'],
|
||||
'thumb' => proxy_url($rr['photo'], false, PROXY_SIZE_THUMB),
|
||||
'name' => $contact_details['name'],
|
||||
'thumb' => proxy_url($contact_details['thumb'], false, PROXY_SIZE_THUMB),
|
||||
'details' => $contact_details['location'],
|
||||
'tags' => $contact_details['keywords'],
|
||||
'about' => $contact_details['about'],
|
||||
|
|
|
@ -39,7 +39,7 @@ function tagger_content(&$a) {
|
|||
$r = q("select `nickname`,`blocktags` from user where uid = %d limit 1",
|
||||
intval($owner_uid)
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$owner_nick = $r[0]['nickname'];
|
||||
$blocktags = $r[0]['blocktags'];
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ function tagger_content(&$a) {
|
|||
$r = q("select * from contact where self = 1 and uid = %d limit 1",
|
||||
intval(local_user())
|
||||
);
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$contact = $r[0];
|
||||
else {
|
||||
logger('tagger: no contact_id');
|
||||
|
@ -178,7 +178,7 @@ EOT;
|
|||
$r = q("select `tag`,`id`,`uid` from item where `origin` = 1 AND `uri` = '%s' LIMIT 1",
|
||||
dbesc($item['uri'])
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$x = q("SELECT `blocktags` FROM `user` WHERE `uid` = %d limit 1",
|
||||
intval($r[0]['uid'])
|
||||
);
|
||||
|
@ -211,7 +211,7 @@ EOT;
|
|||
|
||||
call_hooks('post_local_end', $arr);
|
||||
|
||||
proc_run('php',"include/notifier.php","tag","$post_id");
|
||||
proc_run(PRIORITY_HIGH, "include/notifier.php", "tag", $post_id);
|
||||
|
||||
killme();
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ function uexport_content(&$a){
|
|||
function _uexport_multirow($query) {
|
||||
$result = array();
|
||||
$r = q($query);
|
||||
// if(dba::is_result($r)) {
|
||||
// if(dbm::is_result($r)) {
|
||||
if ($r){
|
||||
foreach($r as $rr){
|
||||
$p = array();
|
||||
|
@ -130,7 +130,7 @@ function uexport_all(&$a) {
|
|||
$r = q("SELECT count(*) as `total` FROM `item` WHERE `uid` = %d ",
|
||||
intval(local_user())
|
||||
);
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$total = $r[0]['total'];
|
||||
|
||||
// chunk the output to avoid exhausting memory
|
||||
|
@ -142,7 +142,7 @@ function uexport_all(&$a) {
|
|||
intval($x),
|
||||
intval(500)
|
||||
);
|
||||
/*if(dba::is_result($r)) {
|
||||
/*if(dbm::is_result($r)) {
|
||||
foreach($r as $rr)
|
||||
foreach($rr as $k => $v)
|
||||
$item[][$k] = $v;
|
||||
|
|
|
@ -143,7 +143,7 @@ function videos_post(&$a) {
|
|||
dbesc($video_id)
|
||||
);
|
||||
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
q("DELETE FROM `attach` WHERE `uid` = %d AND `id` = '%s'",
|
||||
intval(local_user()),
|
||||
dbesc($video_id)
|
||||
|
@ -167,7 +167,7 @@ function videos_post(&$a) {
|
|||
$drop_id = intval($i[0]['id']);
|
||||
|
||||
if($i[0]['visible'])
|
||||
proc_run('php',"include/notifier.php","drop","$drop_id");
|
||||
proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,7 @@ function videos_content(&$a) {
|
|||
intval($contact_id),
|
||||
intval($owner_uid)
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$can_post = true;
|
||||
$contact = $r[0];
|
||||
$remote_contact = true;
|
||||
|
@ -290,7 +290,7 @@ function videos_content(&$a) {
|
|||
intval($contact_id),
|
||||
intval($owner_uid)
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$contact = $r[0];
|
||||
$remote_contact = true;
|
||||
}
|
||||
|
@ -350,8 +350,8 @@ function videos_content(&$a) {
|
|||
$sql_extra GROUP BY hash",
|
||||
intval($a->data['user']['uid'])
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
$a->set_pager_total(dba::is_result($r));
|
||||
if(dbm::is_result($r)) {
|
||||
$a->set_pager_total(dbm::is_result($r));
|
||||
$a->set_pager_itemspage(20);
|
||||
}
|
||||
|
||||
|
@ -366,7 +366,7 @@ function videos_content(&$a) {
|
|||
|
||||
|
||||
$videos = array();
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
foreach($r as $rr) {
|
||||
if($a->theme['template_engine'] === 'internal') {
|
||||
$alt_e = template_escape($rr['filename']);
|
||||
|
|
|
@ -36,16 +36,16 @@ function viewcontacts_content(&$a) {
|
|||
return;
|
||||
}
|
||||
|
||||
if(((! count($a->profile)) || ($a->profile['hide-friends']))) {
|
||||
notice( t('Permission denied.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
$o = "";
|
||||
|
||||
// tabs
|
||||
$o .= profile_tabs($a,$is_owner, $a->data['user']['nickname']);
|
||||
|
||||
if(((! count($a->profile)) || ($a->profile['hide-friends']))) {
|
||||
notice( t('Permission denied.') . EOL);
|
||||
return $o;
|
||||
}
|
||||
|
||||
$r = q("SELECT COUNT(*) AS `total` FROM `contact`
|
||||
WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0
|
||||
AND `network` IN ('%s', '%s', '%s')",
|
||||
|
@ -54,7 +54,7 @@ function viewcontacts_content(&$a) {
|
|||
dbesc(NETWORK_DIASPORA),
|
||||
dbesc(NETWORK_OSTATUS)
|
||||
);
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
$a->set_pager_total($r[0]['total']);
|
||||
|
||||
$r = q("SELECT * FROM `contact`
|
||||
|
@ -90,15 +90,15 @@ function viewcontacts_content(&$a) {
|
|||
else
|
||||
$url = zrl($url);
|
||||
|
||||
$contact_details = get_contact_details_by_url($rr['url'], $a->profile['uid']);
|
||||
$contact_details = get_contact_details_by_url($rr['url'], $a->profile['uid'], $rr);
|
||||
|
||||
$contacts[] = array(
|
||||
'id' => $rr['id'],
|
||||
'img_hover' => sprintf( t('Visit %s\'s profile [%s]'), $rr['name'], $rr['url']),
|
||||
'img_hover' => sprintf( t('Visit %s\'s profile [%s]'), $contact_details['name'], $rr['url']),
|
||||
'photo_menu' => contact_photo_menu($rr),
|
||||
'thumb' => proxy_url($rr['thumb'], false, PROXY_SIZE_THUMB),
|
||||
'name' => htmlentities(substr($rr['name'],0,20)),
|
||||
'username' => htmlentities($rr['name']),
|
||||
'thumb' => proxy_url($contact_details['thumb'], false, PROXY_SIZE_THUMB),
|
||||
'name' => htmlentities(substr($contact_details['name'],0,20)),
|
||||
'username' => htmlentities($contact_details['name']),
|
||||
'details' => $contact_details['location'],
|
||||
'tags' => $contact_details['keywords'],
|
||||
'about' => $contact_details['about'],
|
||||
|
|
|
@ -24,7 +24,7 @@ function viewsrc_content(&$a) {
|
|||
dbesc($item_id)
|
||||
);
|
||||
|
||||
if(dba::is_result($r))
|
||||
if(dbm::is_result($r))
|
||||
if(is_ajax()) {
|
||||
echo str_replace("\n",'<br />',$r[0]['body']);
|
||||
killme();
|
||||
|
|
|
@ -55,7 +55,7 @@ function wall_attach_post(&$a) {
|
|||
intval($cid),
|
||||
intval($page_owner_uid)
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$can_post = true;
|
||||
$visitor = $cid;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ function wall_upload_post(&$a, $desktopmode = true) {
|
|||
intval($cid),
|
||||
intval($page_owner_uid)
|
||||
);
|
||||
if(dba::is_result($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$can_post = true;
|
||||
$visitor = $cid;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ function wallmessage_post(&$a) {
|
|||
$body = str_replace("\r\n","\n",$body);
|
||||
$body = str_replace("\n\n","\n",$body);
|
||||
|
||||
|
||||
|
||||
$ret = send_wallmessage($user, $body, $subject, $replyto);
|
||||
|
||||
switch($ret){
|
||||
|
@ -68,8 +68,8 @@ function wallmessage_post(&$a) {
|
|||
info( t('Message sent.') . EOL );
|
||||
}
|
||||
|
||||
// goaway($a->get_baseurl() . '/profile/' . $user['nickname']);
|
||||
|
||||
goaway('profile/'.$user['nickname']);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
|
||||
|
||||
require_once("include/Probe.php");
|
||||
|
||||
function webfinger_content(&$a) {
|
||||
|
||||
|
@ -8,16 +7,13 @@ function webfinger_content(&$a) {
|
|||
|
||||
$o .= '<form action="webfinger" method="get">';
|
||||
$o .= 'Lookup address: <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] .'" />';
|
||||
$o .= '<input type="submit" name="submit" value="Submit" /></form>';
|
||||
$o .= '<input type="submit" name="submit" value="Submit" /></form>';
|
||||
|
||||
$o .= '<br /><br />';
|
||||
|
||||
if(x($_GET,'addr')) {
|
||||
$addr = trim($_GET['addr']);
|
||||
if(strpos($addr,'@' !== false))
|
||||
$res = webfinger($addr);
|
||||
else
|
||||
$res = lrdd($addr);
|
||||
$res = Probe::lrdd($addr);
|
||||
$o .= '<pre>';
|
||||
$o .= str_replace("\n",'<br />',print_r($res,true));
|
||||
$o .= '</pre>';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue