<?php
+
/**
* @file mod/contacts.php
*/
+
use Friendica\App;
use Friendica\Content\ContactSelector;
use Friendica\Core\System;
$a->page['aside'] = '';
}
+ $contact_id = null;
$contact = null;
if ((($a->argc == 2) && intval($a->argv[1])) || (($a->argc == 3) && intval($a->argv[1]) && ($a->argv[2] == "posts"))) {
$contact_id = intval($a->argv[1]);
return;
}
- $orig_record = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
- intval($contact_id),
- intval(local_user())
- );
- if (!DBM::is_result($orig_record)) {
+ if (!DBM::exists('contact', ['id' => $contact_id, 'uid' => local_user()])) {
notice(t('Could not access contact record.') . EOL);
goaway('contacts');
return; // NOTREACHED
$profile_id = intval($_POST['profile-assign']);
if ($profile_id) {
- $r = q("SELECT `id` FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
- intval($profile_id),
- intval(local_user())
- );
- if (!DBM::is_result($r)) {
+ if (!DBM::exists('profile', ['id' => $profile_id, 'uid' => local_user()])) {
notice(t('Could not locate selected profile.') . EOL);
return;
}
return;
}
+
/* contact actions */
function _contact_update($contact_id)
$total = 0;
$searching = false;
$search_hdr = null;
- $search_txt = '';
if ($search) {
$searching = true;
$search_hdr = $search;
* (only contributors to the git repositories for friendica core and the
* addons repository will be listed though ATM)
*/
-
use Friendica\App;
-function credits_content(App $a) {
+function credits_content()
+{
/* fill the page with credits */
- $f = fopen('util/credits.txt', 'r');
- $names = fread($f, filesize('util/credits.txt'));
- $arr = explode("\n", htmlspecialchars($names));
- fclose($f);
+ $credits_string = file_get_contents('util/credits.txt');
+ $names = explode("\n", htmlspecialchars($credits_string));
$tpl = get_markup_template('credits.tpl');
- return replace_macros($tpl, array(
+ return replace_macros($tpl, [
'$title' => t('Credits'),
'$thanks' => t('Friendica is a community project, that would not be possible without the help of many people. Here is a list of those who have contributed to the code or the translation of Friendica. Thank you all!'),
- '$names' => $arr,
- ));
+ '$names' => $names,
+ ]);
}
return;
}
- $contact_id = 0;
-
+ $contact = null;
if (($a->argc == 2) && intval($a->argv[1])) {
- $contact_id = intval($a->argv[1]);
- $r = q("SELECT * FROM `contact` WHERE `uid` = %d and `id` = %d LIMIT 1",
- intval(local_user()),
- intval($contact_id)
- );
- if (!DBM::is_result($r)) {
- $contact_id = 0;
- }
+ $contact = dba::selectFirst('contact', [], ['uid' => local_user(), 'id' => $a->argv[1]]);
}
if (!x($a->page, 'aside')) {
$a->page['aside'] = '';
}
- if ($contact_id) {
- $a->data['contact'] = $r[0];
- $contact = $r[0];
+ if (DBM::is_result($contact)) {
+ $a->data['contact'] = $contact;
profile_load($a, "", 0, Contact::getDetailsByURL($contact["url"]));
}
}
$cid = (($a->argc > 1) ? intval($a->argv[1]) : 0);
+ $contact = null;
if ($cid) {
- $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
- intval($cid),
- intval(local_user())
- );
+ $contact = dba::selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]);
}
- if (!DBM::is_result($r)) {
+ if (!DBM::is_result($contact)) {
return;
}
- $contact = $r[0];
-
$name = defaults($_POST, 'name' , $contact['name']);
$nick = defaults($_POST, 'nick' , '');
$url = defaults($_POST, 'url' , '');
$cid = (($a->argc > 1) ? intval($a->argv[1]) : 0);
+ $contact = null;
if ($cid) {
- $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
- intval($cid),
- intval(local_user())
- );
+ $contact = dba::selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]);
}
- if (!DBM::is_result($r)) {
+ if (!DBM::is_result($contact)) {
notice(t('Contact not found.') . EOL);
return;
}
- $contact = $r[0];
-
$warning = t('<strong>WARNING: This is highly advanced</strong> and if you enter incorrect information your communications with this contact may stop working.');
$info = t('Please use your browser \'Back\' button <strong>now</strong> if you are uncertain what to do on this page.');