X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fidentity.php;h=f336891a3cb5cc1f9aead47723f37b4fb697a595;hb=9e99066fd70a9dd9a291a523afba1a390f0e3a0b;hp=bc18319b2d91c01718e71b4e72f188ef53732c0a;hpb=2ecd5a55b79f6eff65a9855b83a3382319693f3d;p=friendica.git diff --git a/include/identity.php b/include/identity.php index bc18319b2d..f336891a3c 100644 --- a/include/identity.php +++ b/include/identity.php @@ -4,6 +4,11 @@ */ use Friendica\App; +use Friendica\Core\Config; +use Friendica\Core\PConfig; +use Friendica\Core\System; +use Friendica\Core\Worker; +use Friendica\Database\DBM; require_once 'include/ForumManager.php'; require_once 'include/bbcode.php'; @@ -69,12 +74,12 @@ function profile_load(App $a, $nickname, $profile = 0, $profiledata = array()) { $a->profile = $pdata; $a->profile_uid = $pdata['profile_uid']; - $a->profile['mobile-theme'] = get_pconfig($a->profile['profile_uid'], 'system', 'mobile_theme'); + $a->profile['mobile-theme'] = PConfig::get($a->profile['profile_uid'], 'system', 'mobile_theme'); $a->profile['network'] = NETWORK_DFRN; $a->page['title'] = $a->profile['name'] . " @ " . $a->config['sitename']; - if (!$profiledata && !get_pconfig(local_user(),'system','always_my_theme')) + if (!$profiledata && !PConfig::get(local_user(),'system','always_my_theme')) $_SESSION['theme'] = $a->profile['theme']; $_SESSION['mobile-theme'] = $a->profile['mobile-theme']; @@ -100,7 +105,7 @@ function profile_load(App $a, $nickname, $profile = 0, $profiledata = array()) { )); } - $block = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false); + $block = (((Config::get('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false); /** * @todo @@ -139,7 +144,7 @@ function get_profiledata_by_nick($nickname, $uid = 0, $profile = 0) { foreach ($_SESSION['remote'] as $visitor) { if ($visitor['uid'] == $uid) { $r = dba::select('contact', array('profile-id'), array('id' => $visitor['cid']), array('limit' => 1)); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $profile = $r['profile-id']; } break; @@ -163,7 +168,7 @@ function get_profiledata_by_nick($nickname, $uid = 0, $profile = 0) { $profile_int ); } - if (!dbm::is_result($r)) { + if (!DBM::is_result($r)) { $r = dba::fetch_first("SELECT `contact`.`id` AS `contact_id`, `contact`.`photo` as `contact_photo`, `contact`.`thumb` AS `contact_thumb`, `contact`.`micro` AS `contact_micro`, `profile`.`uid` AS `profile_uid`, `profile`.*, @@ -242,7 +247,7 @@ function profile_sidebar($profile, $block = 0) { if (isset($profile["url"])) { $profile_url = normalise_link($profile["url"]); } else { - $profile_url = normalise_link(App::get_baseurl()."/profile/".$profile["nickname"]); + $profile_url = normalise_link(System::baseUrl()."/profile/".$profile["nickname"]); } if (dba::exists('contact', array('pending' => false, 'uid' => local_user(), 'nurl' => $profile_url))) { @@ -289,7 +294,7 @@ function profile_sidebar($profile, $block = 0) { // show edit profile to yourself if (!$is_contact && $profile['uid'] == local_user() && feature_enabled(local_user(),'multi_profiles')) { - $profile['edit'] = array(App::get_baseurl(). '/profiles', t('Profiles'),"", t('Manage/edit profiles')); + $profile['edit'] = array(System::baseUrl(). '/profiles', t('Profiles'),"", t('Manage/edit profiles')); $r = q("SELECT * FROM `profile` WHERE `uid` = %d", local_user()); @@ -299,7 +304,7 @@ function profile_sidebar($profile, $block = 0) { 'entries' => array(), ); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { foreach ($r as $rr) { $profile['menu']['entries'][] = array( @@ -318,7 +323,7 @@ function profile_sidebar($profile, $block = 0) { } } if (!$is_contact && $profile['uid'] == local_user() && !feature_enabled(local_user(),'multi_profiles')) { - $profile['edit'] = array(App::get_baseurl(). '/profiles/'.$profile['id'], t('Edit profile'),"", t('Edit profile')); + $profile['edit'] = array(System::baseUrl(). '/profiles/'.$profile['id'], t('Edit profile'),"", t('Edit profile')); $profile['menu'] = array( 'chg_photo' => t('Change profile photo'), 'cr_new' => null, @@ -359,7 +364,7 @@ function profile_sidebar($profile, $block = 0) { if ($profile['guid'] != "") $diaspora = array( 'guid' => $profile['guid'], - 'podloc' => App::get_baseurl(), + 'podloc' => System::baseUrl(), 'searchable' => (($profile['publish'] && $profile['net-publish']) ? 'true' : 'false' ), 'nickname' => $profile['nickname'], 'fullname' => $profile['name'], @@ -378,7 +383,7 @@ function profile_sidebar($profile, $block = 0) { if (is_array($a->profile) && !$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 (dbm::is_result($r)) + if (DBM::is_result($r)) $updated = date("c", strtotime($r[0]['updated'])); $r = q("SELECT COUNT(*) AS `total` FROM `contact` @@ -391,7 +396,7 @@ function profile_sidebar($profile, $block = 0) { dbesc(NETWORK_DIASPORA), dbesc(NETWORK_OSTATUS) ); - if (dbm::is_result($r)) + if (DBM::is_result($r)) $contacts = intval($r[0]['total']); } } @@ -475,12 +480,12 @@ function get_birthdays() { datetime_convert('UTC','UTC','now + 6 days'), datetime_convert('UTC','UTC','now') ); - if (dbm::is_result($s)) { + if (DBM::is_result($s)) { $r = dba::inArray($s); Cache::set($cachekey, $r, CACHE_HOUR); } } - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $total = 0; $now = strtotime('now'); $cids = array(); @@ -509,7 +514,7 @@ function get_birthdays() { $url = $rr['url']; if ($rr['network'] === NETWORK_DFRN) { $sparkle = " sparkle"; - $url = App::get_baseurl() . '/redir/' . $rr['cid']; + $url = System::baseUrl() . '/redir/' . $rr['cid']; } $rr['link'] = $url; @@ -523,7 +528,7 @@ function get_birthdays() { } $tpl = get_markup_template("birthdays_reminder.tpl"); return replace_macros($tpl, array( - '$baseurl' => App::get_baseurl(), + '$baseurl' => System::baseUrl(), '$classtoday' => $classtoday, '$count' => $total, '$event_reminders' => t('Birthday Reminders'), @@ -565,7 +570,7 @@ function get_events() { $r = array(); - if (dbm::is_result($s)) { + if (DBM::is_result($s)) { $now = strtotime('now'); $istoday = false; @@ -611,7 +616,7 @@ function get_events() { } $tpl = get_markup_template("events_reminder.tpl"); return replace_macros($tpl, array( - '$baseurl' => App::get_baseurl(), + '$baseurl' => System::baseUrl(), '$classtoday' => $classtoday, '$count' => count($r), '$event_reminders' => t('Event Reminders'), @@ -751,7 +756,7 @@ function advanced_profile(App $a) { } if ($a->profile['uid'] == local_user()) { - $profile['edit'] = array(App::get_baseurl(). '/profiles/'.$a->profile['id'], t('Edit profile'),"", t('Edit profile')); + $profile['edit'] = array(System::baseUrl(). '/profiles/'.$a->profile['id'], t('Edit profile'),"", t('Edit profile')); } return replace_macros($tpl, array( @@ -776,7 +781,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null) { $tab = notags(trim($_GET['tab'])); } - $url = App::get_baseurl() . '/profile/' . $nickname; + $url = System::baseUrl() . '/profile/' . $nickname; $tabs = array( array( @@ -797,7 +802,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null) { ), array( 'label' => t('Photos'), - 'url' => App::get_baseurl() . '/photos/' . $nickname, + 'url' => System::baseUrl() . '/photos/' . $nickname, 'sel' => ((!isset($tab) && $a->argv[0]=='photos') ? 'active' : ''), 'title' => t('Photo Albums'), 'id' => 'photo-tab', @@ -805,7 +810,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null) { ), array( 'label' => t('Videos'), - 'url' => App::get_baseurl() . '/videos/' . $nickname, + 'url' => System::baseUrl() . '/videos/' . $nickname, 'sel' => ((!isset($tab) && $a->argv[0]=='videos') ? 'active' : ''), 'title' => t('Videos'), 'id' => 'video-tab', @@ -817,7 +822,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null) { if ($is_owner && $a->theme_events_in_profile) { $tabs[] = array( 'label' => t('Events'), - 'url' => App::get_baseurl() . '/events', + 'url' => System::baseUrl() . '/events', 'sel' =>((!isset($tab) && $a->argv[0]=='events') ? 'active' : ''), 'title' => t('Events and Calendar'), 'id' => 'events-tab', @@ -828,7 +833,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null) { } elseif (! $is_owner) { $tabs[] = array( 'label' => t('Events'), - 'url' => App::get_baseurl() . '/cal/' . $nickname, + 'url' => System::baseUrl() . '/cal/' . $nickname, 'sel' =>((!isset($tab) && $a->argv[0]=='cal') ? 'active' : ''), 'title' => t('Events and Calendar'), 'id' => 'events-tab', @@ -839,7 +844,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null) { if ($is_owner) { $tabs[] = array( 'label' => t('Personal Notes'), - 'url' => App::get_baseurl() . '/notes', + 'url' => System::baseUrl() . '/notes', 'sel' =>((!isset($tab) && $a->argv[0]=='notes') ? 'active' : ''), 'title' => t('Only You Can See This'), 'id' => 'notes-tab', @@ -850,7 +855,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null) { if ((! $is_owner) && ((count($a->profile)) || (! $a->profile['hide-friends']))) { $tabs[] = array( 'label' => t('Contacts'), - 'url' => App::get_baseurl() . '/viewcontacts/' . $nickname, + 'url' => System::baseUrl() . '/viewcontacts/' . $nickname, 'sel' => ((!isset($tab) && $a->argv[0]=='viewcontacts') ? 'active' : ''), 'title' => t('Contacts'), 'id' => 'viewcontacts-tab', @@ -887,7 +892,7 @@ function zrl_init(App $a) { return; } - proc_run(PRIORITY_LOW, 'include/gprobe.php', $tmp_str); + Worker::add(PRIORITY_LOW, 'gprobe', $tmp_str); $arr = array('zrl' => $tmp_str, 'url' => $a->cmd); call_hooks('zrl_init', $arr); } @@ -927,7 +932,7 @@ function zrl($s, $force = false) { */ function get_theme_uid() { $uid = ((!empty($_REQUEST['puid'])) ? intval($_REQUEST['puid']) : 0); - if ((local_user()) && ((get_pconfig(local_user(), 'system', 'always_my_theme')) || (! $uid))) { + if ((local_user()) && ((PConfig::get(local_user(), 'system', 'always_my_theme')) || (! $uid))) { return local_user(); }