X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fprofiles.php;h=75023beb64180038cc09c15b20cebaa166efba26;hb=de4a2e6fd03cd0aab94a256eba92ed593931534b;hp=bd57f106d72c451409324c920ba05c9df0e1a9d0;hpb=b9d8587f413d198b854ccb213521e47327088566;p=friendica.git diff --git a/mod/profiles.php b/mod/profiles.php index bd57f106d7..75023beb64 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -1,6 +1,16 @@ argv[2]), intval(local_user()) ); - if (! dbm::is_result($r)) { + if (! DBM::is_result($r)) { notice( t('Profile not found.') . EOL); goaway('profiles'); return; // NOTREACHED @@ -34,7 +44,7 @@ function profiles_init(App $a) { intval($a->argv[2]), intval(local_user()) ); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { info(t('Profile deleted.').EOL); } @@ -49,7 +59,7 @@ function profiles_init(App $a) { $r0 = q("SELECT `id` FROM `profile` WHERE `uid` = %d", intval(local_user())); - $num_profiles = (dbm::is_result($r0) ? count($r0) : 0); + $num_profiles = (DBM::is_result($r0) ? count($r0) : 0); $name = t('Profile-') . ($num_profiles + 1); @@ -71,7 +81,7 @@ function profiles_init(App $a) { ); info( t('New profile created.') . EOL); - if (dbm::is_result($r3) && count($r3) == 1) { + if (DBM::is_result($r3) && count($r3) == 1) { goaway('profiles/' . $r3[0]['id']); } @@ -85,14 +95,14 @@ function profiles_init(App $a) { $r0 = q("SELECT `id` FROM `profile` WHERE `uid` = %d", intval(local_user())); - $num_profiles = (dbm::is_result($r0) ? count($r0) : 0); + $num_profiles = (DBM::is_result($r0) ? count($r0) : 0); $name = t('Profile-') . ($num_profiles + 1); $r1 = q("SELECT * FROM `profile` WHERE `uid` = %d AND `id` = %d LIMIT 1", intval(local_user()), intval($a->argv[2]) ); - if(! dbm::is_result($r1)) { + if(! DBM::is_result($r1)) { notice( t('Profile unavailable to clone.') . EOL); killme(); return; @@ -103,20 +113,14 @@ function profiles_init(App $a) { $r1[0]['net-publish'] = 0; $r1[0]['profile-name'] = dbesc($name); - dbm::esc_array($r1[0], true); - - $r2 = dbq("INSERT INTO `profile` (`" - . implode("`, `", array_keys($r1[0])) - . "`) VALUES (" - . implode(", ", array_values($r1[0])) - . ")" ); + dba::insert('profile', $r1[0]); $r3 = q("SELECT `id` FROM `profile` WHERE `uid` = %d AND `profile-name` = '%s' LIMIT 1", intval(local_user()), dbesc($name) ); info( t('New profile created.') . EOL); - if ((dbm::is_result($r3)) && (count($r3) == 1)) { + if ((DBM::is_result($r3)) && (count($r3) == 1)) { goaway('profiles/'.$r3[0]['id']); } @@ -131,7 +135,7 @@ function profiles_init(App $a) { intval($a->argv[1]), intval(local_user()) ); - if (! dbm::is_result($r)) { + if (! DBM::is_result($r)) { notice( t('Profile not found.') . EOL); killme(); return; @@ -178,7 +182,7 @@ function profiles_post(App $a) { intval($a->argv[1]), intval(local_user()) ); - if (! dbm::is_result($orig)) { + if (! DBM::is_result($orig)) { notice( t('Profile not found.') . EOL); return; } @@ -272,13 +276,13 @@ function profiles_post(App $a) { dbesc($newname), intval(local_user()) ); - if (! dbm::is_result($r)) { + if (! DBM::is_result($r)) { $r = q("SELECT * FROM `contact` WHERE `nick` = '%s' AND `uid` = %d LIMIT 1", dbesc($lookup), intval(local_user()) ); } - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $prf = $r[0]['url']; $newname = $r[0]['name']; } @@ -323,7 +327,7 @@ function profiles_post(App $a) { $hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0); - set_pconfig(local_user(), 'system', 'detailled_profile', (($_POST['detailled_profile'] == 1) ? 1: 0)); + PConfig::set(local_user(), 'system', 'detailled_profile', (($_POST['detailled_profile'] == 1) ? 1: 0)); $changes = array(); $value = ''; @@ -485,7 +489,7 @@ function profiles_post(App $a) { } if ($is_default) { - $location = formatted_location(array("locality" => $locality, "region" => $region, "country-name" => $country_name)); + $location = Profile::formatLocation(array("locality" => $locality, "region" => $region, "country-name" => $country_name)); q("UPDATE `contact` SET `about` = '%s', `location` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `self` AND `uid` = %d", dbesc($about), @@ -497,15 +501,14 @@ function profiles_post(App $a) { // Update global directory in background $url = $_SESSION['my_url']; - if ($url && strlen(get_config('system', 'directory'))) { - proc_run(PRIORITY_LOW, "include/directory.php", $url); + if ($url && strlen(Config::get('system', 'directory'))) { + Worker::add(PRIORITY_LOW, "Directory", $url); } - require_once('include/profile_update.php'); - profile_change(); + Worker::add(PRIORITY_LOW, 'ProfileUpdate', local_user()); // Update the global contact for the user - update_gcontact_for_user(local_user()); + GlobalContact::updateForUser(local_user()); } } } @@ -518,21 +521,21 @@ function profile_activity($changed, $value) { return; } - if ($a->user['hidewall'] || get_config('system', 'block_public')) { + if ($a->user['hidewall'] || Config::get('system', 'block_public')) { return; } - if (! get_pconfig(local_user(), 'system', 'post_profilechange')) { + if (! PConfig::get(local_user(), 'system', 'post_profilechange')) { return; } - require_once('include/items.php'); + require_once 'include/items.php'; $self = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1", intval(local_user()) ); - if (! dbm::is_result($self)) { + if (! DBM::is_result($self)) { return; } @@ -596,7 +599,7 @@ function profile_activity($changed, $value) { $i = item_store($arr); if ($i) { - proc_run(PRIORITY_HIGH, "include/notifier.php", "activity", $i); + Worker::add(PRIORITY_HIGH, "Notifier", "activity", $i); } } @@ -615,19 +618,19 @@ function profiles_content(App $a) { intval($a->argv[1]), intval(local_user()) ); - if (! dbm::is_result($r)) { + if (! DBM::is_result($r)) { notice( t('Profile not found.') . EOL); return; } - require_once('include/profile_selectors.php'); + require_once 'include/profile_selectors.php'; $a->page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array( - '$baseurl' => App::get_baseurl(true), + '$baseurl' => System::baseUrl(true), )); $a->page['end'] .= replace_macros(get_markup_template('profed_end.tpl'), array( - '$baseurl' => App::get_baseurl(true), + '$baseurl' => System::baseUrl(true), )); $opt_tpl = get_markup_template("profile-hide-friends.tpl"); @@ -649,9 +652,9 @@ function profiles_content(App $a) { $personal_account = !(in_array($a->user["page-flags"], array(PAGE_COMMUNITY, PAGE_PRVGROUP))); - $detailled_profile = (get_pconfig(local_user(), 'system', 'detailled_profile') AND $personal_account); + $detailled_profile = (PConfig::get(local_user(), 'system', 'detailled_profile') AND $personal_account); - $f = get_config('system', 'birthday_input_format'); + $f = Config::get('system', 'birthday_input_format'); if (! $f) { $f = 'ymd'; } @@ -704,7 +707,7 @@ function profiles_content(App $a) { '$lbl_ex2' => t('Example: fishing photography software'), '$disabled' => (($is_default) ? 'onclick="return false;" style="color: #BBBBFF;"' : ''), - '$baseurl' => App::get_baseurl(true), + '$baseurl' => System::baseUrl(true), '$profile_id' => $r[0]['id'], '$profile_name' => array('profile_name', t('Profile Name:'), $r[0]['profile-name'], t('Required'), '*'), '$is_default' => $is_default, @@ -750,13 +753,12 @@ function profiles_content(App $a) { return $o; } else { - // If we don't support multi profiles, don't display this list. if (!feature_enabled(local_user(), 'multi_profiles')) { $r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default`=1", local_user() ); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { //Go to the default profile. goaway('profiles/' . $r[0]['id']); } @@ -765,7 +767,7 @@ function profiles_content(App $a) { $r = q("SELECT * FROM `profile` WHERE `uid` = %d", local_user()); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $tpl = get_markup_template('profile_entry.tpl');