*much* more usage of App::get_baseurl() instead of $a->get_baseurl() (coding convention applied)
Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
parent
97c507e763
commit
f8a213e23b
19 changed files with 226 additions and 196 deletions
|
|
@ -85,7 +85,7 @@ function contact_remove($id) {
|
|||
|
||||
function terminate_friendship($user,$self,$contact) {
|
||||
|
||||
/// @TODO Get rid of this, include/datetime.php should care about by itself
|
||||
/// @TODO Get rid of this, include/datetime.php should care about it by itself
|
||||
$a = get_app();
|
||||
|
||||
require_once('include/datetime.php');
|
||||
|
|
|
|||
|
|
@ -135,8 +135,8 @@ function fileas_widget($baseurl,$selected = '') {
|
|||
|
||||
$matches = false;
|
||||
$terms = array();
|
||||
$cnt = preg_match_all('/\[(.*?)\]/',$saved,$matches,PREG_SET_ORDER);
|
||||
if($cnt) {
|
||||
$cnt = preg_match_all('/\[(.*?)\]/',$saved,$matches,PREG_SET_ORDER);
|
||||
if ($cnt) {
|
||||
foreach($matches as $mtch) {
|
||||
$unescaped = xmlify(file_tag_decode($mtch[1]));
|
||||
$terms[] = array('name' => $unescaped,'selected' => (($selected == $unescaped) ? 'selected' : ''));
|
||||
|
|
@ -158,12 +158,14 @@ function categories_widget($baseurl,$selected = '') {
|
|||
|
||||
$a = get_app();
|
||||
|
||||
if(! feature_enabled($a->profile['profile_uid'],'categories'))
|
||||
if (! feature_enabled($a->profile['profile_uid'],'categories')) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$saved = get_pconfig($a->profile['profile_uid'],'system','filetags');
|
||||
if(! strlen($saved))
|
||||
if (! strlen($saved)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$matches = false;
|
||||
$terms = array();
|
||||
|
|
|
|||
|
|
@ -102,8 +102,7 @@ function new_contact($uid,$url,$interactive = false) {
|
|||
if ($interactive) {
|
||||
if (strlen($a->path)) {
|
||||
$myaddr = bin2hex(App::get_baseurl() . '/profile/' . $a->user['nickname']);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$myaddr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname());
|
||||
}
|
||||
|
||||
|
|
@ -111,53 +110,45 @@ function new_contact($uid,$url,$interactive = false) {
|
|||
|
||||
// NOTREACHED
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(get_config('system','dfrn_only')) {
|
||||
} else {
|
||||
if (get_config('system','dfrn_only')) {
|
||||
$result['message'] = t('This site is not configured to allow communications with other networks.') . EOL;
|
||||
$result['message'] != t('No compatible communication protocols or feeds were discovered.') . EOL;
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// This extra param just confuses things, remove it
|
||||
if($ret['network'] === NETWORK_DIASPORA)
|
||||
if ($ret['network'] === NETWORK_DIASPORA) {
|
||||
$ret['url'] = str_replace('?absolute=true','',$ret['url']);
|
||||
|
||||
}
|
||||
|
||||
// do we have enough information?
|
||||
|
||||
if(! ((x($ret,'name')) && (x($ret,'poll')) && ((x($ret,'url')) || (x($ret,'addr'))))) {
|
||||
if (! ((x($ret,'name')) && (x($ret,'poll')) && ((x($ret,'url')) || (x($ret,'addr'))))) {
|
||||
$result['message'] .= t('The profile address specified does not provide adequate information.') . EOL;
|
||||
if(! x($ret,'poll'))
|
||||
if (! x($ret,'poll')) {
|
||||
$result['message'] .= t('No compatible communication protocols or feeds were discovered.') . EOL;
|
||||
if(! x($ret,'name'))
|
||||
}
|
||||
if (! x($ret,'name')) {
|
||||
$result['message'] .= t('An author or name was not found.') . EOL;
|
||||
if(! x($ret,'url'))
|
||||
}
|
||||
if (! x($ret,'url')) {
|
||||
$result['message'] .= t('No browser URL could be matched to this address.') . EOL;
|
||||
if(strpos($url,'@') !== false) {
|
||||
}
|
||||
if (strpos($url,'@') !== false) {
|
||||
$result['message'] .= t('Unable to match @-style Identity Address with a known protocol or email contact.') . EOL;
|
||||
$result['message'] .= t('Use mailto: in front of address to force email check.') . EOL;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
if($ret['network'] === NETWORK_OSTATUS && get_config('system','ostatus_disabled')) {
|
||||
if ($ret['network'] === NETWORK_OSTATUS && get_config('system','ostatus_disabled')) {
|
||||
$result['message'] .= t('The profile address specified belongs to a network which has been disabled on this site.') . EOL;
|
||||
$ret['notify'] = '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(! $ret['notify']) {
|
||||
if (! $ret['notify']) {
|
||||
$result['message'] .= t('Limited profile. This person will be unable to receive direct/personal notifications from you.') . EOL;
|
||||
}
|
||||
|
||||
|
|
@ -167,8 +158,9 @@ function new_contact($uid,$url,$interactive = false) {
|
|||
|
||||
$hidden = (($ret['network'] === NETWORK_MAIL) ? 1 : 0);
|
||||
|
||||
if(in_array($ret['network'], array(NETWORK_MAIL, NETWORK_DIASPORA)))
|
||||
if (in_array($ret['network'], array(NETWORK_MAIL, NETWORK_DIASPORA))) {
|
||||
$writeable = 1;
|
||||
}
|
||||
|
||||
// check if we already have a contact
|
||||
// the poll url is more reliable than the profile url, as we may have
|
||||
|
|
@ -188,7 +180,7 @@ function new_contact($uid,$url,$interactive = false) {
|
|||
|
||||
if (dbm::is_result($r)) {
|
||||
// update contact
|
||||
if($r[0]['rel'] == CONTACT_IS_FOLLOWER || ($network === NETWORK_DIASPORA && $r[0]['rel'] == CONTACT_IS_SHARING)) {
|
||||
if ($r[0]['rel'] == CONTACT_IS_FOLLOWER || ($network === NETWORK_DIASPORA && $r[0]['rel'] == CONTACT_IS_SHARING)) {
|
||||
q("UPDATE `contact` SET `rel` = %d , `subhub` = %d, `readonly` = 0 WHERE `id` = %d AND `uid` = %d",
|
||||
intval(CONTACT_IS_FRIEND),
|
||||
intval($subhub),
|
||||
|
|
@ -197,29 +189,28 @@ function new_contact($uid,$url,$interactive = false) {
|
|||
);
|
||||
}
|
||||
} else {
|
||||
|
||||
|
||||
// check service class limits
|
||||
|
||||
$r = q("select count(*) as total from contact where uid = %d and pending = 0 and self = 0",
|
||||
$r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `pending` = 0 AND `self` = 0",
|
||||
intval($uid)
|
||||
);
|
||||
if (dbm::is_result($r))
|
||||
$total_contacts = $r[0]['total'];
|
||||
|
||||
if(! service_class_allows($uid,'total_contacts',$total_contacts)) {
|
||||
if (! service_class_allows($uid,'total_contacts',$total_contacts)) {
|
||||
$result['message'] .= upgrade_message();
|
||||
return $result;
|
||||
}
|
||||
|
||||
$r = q("select count(network) as total from contact where uid = %d and network = '%s' and pending = 0 and self = 0",
|
||||
$r = q("SELECT COUNT(`network`) AS `total` FROM `contact` WHERE `uid` = %d AND `network` = '%s' AND `pending` = 0 AND `self` = 0",
|
||||
intval($uid),
|
||||
dbesc($network)
|
||||
);
|
||||
if (dbm::is_result($r))
|
||||
if (dbm::is_result($r)) {
|
||||
$total_network = $r[0]['total'];
|
||||
}
|
||||
|
||||
if(! service_class_allows($uid,'total_contacts_' . $network,$total_network)) {
|
||||
if (! service_class_allows($uid,'total_contacts_' . $network,$total_network)) {
|
||||
$result['message'] .= upgrade_message();
|
||||
return $result;
|
||||
}
|
||||
|
|
@ -268,8 +259,9 @@ function new_contact($uid,$url,$interactive = false) {
|
|||
$result['cid'] = $contact_id;
|
||||
|
||||
$def_gid = get_default_group($uid, $contact["network"]);
|
||||
if (intval($def_gid))
|
||||
if (intval($def_gid)) {
|
||||
group_add_member($uid, '', $contact_id, $def_gid);
|
||||
}
|
||||
|
||||
// Update the avatar
|
||||
update_contact_avatar($ret['photo'],$uid,$contact_id);
|
||||
|
|
@ -285,7 +277,6 @@ function new_contact($uid,$url,$interactive = false) {
|
|||
|
||||
if (dbm::is_result($r)) {
|
||||
if (($contact['network'] == NETWORK_OSTATUS) && (strlen($contact['notify']))) {
|
||||
|
||||
// create a follow slap
|
||||
$item = array();
|
||||
$item['verb'] = ACTIVITY_FOLLOW;
|
||||
|
|
|
|||
|
|
@ -231,8 +231,7 @@ function profile_sidebar($profile, $block = 0) {
|
|||
if ($connect AND local_user()) {
|
||||
if (isset($profile["url"])) {
|
||||
$profile_url = normalise_link($profile["url"]);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$profile_url = normalise_link(App::get_baseurl()."/profile/".$profile["nickname"]);
|
||||
}
|
||||
|
||||
|
|
@ -638,50 +637,87 @@ function advanced_profile(App &$a) {
|
|||
|
||||
if($a->profile['marital']) $profile['marital'] = array( t('Status:'), $a->profile['marital']);
|
||||
|
||||
|
||||
if($a->profile['with']) $profile['marital']['with'] = $a->profile['with'];
|
||||
|
||||
if(strlen($a->profile['howlong']) && $a->profile['howlong'] !== '0000-00-00 00:00:00') {
|
||||
$profile['howlong'] = relative_date($a->profile['howlong'], t('for %1$d %2$s'));
|
||||
/// @TODO Maybe use x() here, plus below?
|
||||
if ($a->profile['with']) {
|
||||
$profile['marital']['with'] = $a->profile['with'];
|
||||
}
|
||||
|
||||
if($a->profile['sexual']) $profile['sexual'] = array( t('Sexual Preference:'), $a->profile['sexual'] );
|
||||
if (strlen($a->profile['howlong']) && $a->profile['howlong'] !== '0000-00-00 00:00:00') {
|
||||
$profile['howlong'] = relative_date($a->profile['howlong'], t('for %1$d %2$s'));
|
||||
}
|
||||
|
||||
if($a->profile['homepage']) $profile['homepage'] = array( t('Homepage:'), linkify($a->profile['homepage']) );
|
||||
if ($a->profile['sexual']) {
|
||||
$profile['sexual'] = array( t('Sexual Preference:'), $a->profile['sexual'] );
|
||||
}
|
||||
|
||||
if($a->profile['hometown']) $profile['hometown'] = array( t('Hometown:'), linkify($a->profile['hometown']) );
|
||||
if ($a->profile['homepage']) {
|
||||
$profile['homepage'] = array( t('Homepage:'), linkify($a->profile['homepage']) );
|
||||
}
|
||||
|
||||
if($a->profile['pub_keywords']) $profile['pub_keywords'] = array( t('Tags:'), $a->profile['pub_keywords']);
|
||||
if ($a->profile['hometown']) {
|
||||
$profile['hometown'] = array( t('Hometown:'), linkify($a->profile['hometown']) );
|
||||
}
|
||||
|
||||
if($a->profile['politic']) $profile['politic'] = array( t('Political Views:'), $a->profile['politic']);
|
||||
if ($a->profile['pub_keywords']) {
|
||||
$profile['pub_keywords'] = array( t('Tags:'), $a->profile['pub_keywords']);
|
||||
}
|
||||
|
||||
if($a->profile['religion']) $profile['religion'] = array( t('Religion:'), $a->profile['religion']);
|
||||
if ($a->profile['politic']) {
|
||||
$profile['politic'] = array( t('Political Views:'), $a->profile['politic']);
|
||||
}
|
||||
|
||||
if($txt = prepare_text($a->profile['about'])) $profile['about'] = array( t('About:'), $txt );
|
||||
if ($a->profile['religion']) {
|
||||
$profile['religion'] = array( t('Religion:'), $a->profile['religion']);
|
||||
}
|
||||
|
||||
if($txt = prepare_text($a->profile['interest'])) $profile['interest'] = array( t('Hobbies/Interests:'), $txt);
|
||||
if ($txt = prepare_text($a->profile['about'])) {
|
||||
$profile['about'] = array( t('About:'), $txt );
|
||||
}
|
||||
|
||||
if($txt = prepare_text($a->profile['likes'])) $profile['likes'] = array( t('Likes:'), $txt);
|
||||
if ($txt = prepare_text($a->profile['interest'])) {
|
||||
$profile['interest'] = array( t('Hobbies/Interests:'), $txt);
|
||||
}
|
||||
|
||||
if($txt = prepare_text($a->profile['dislikes'])) $profile['dislikes'] = array( t('Dislikes:'), $txt);
|
||||
if ($txt = prepare_text($a->profile['likes'])) {
|
||||
$profile['likes'] = array( t('Likes:'), $txt);
|
||||
}
|
||||
|
||||
if ($txt = prepare_text($a->profile['dislikes'])) {
|
||||
$profile['dislikes'] = array( t('Dislikes:'), $txt);
|
||||
}
|
||||
|
||||
if($txt = prepare_text($a->profile['contact'])) $profile['contact'] = array( t('Contact information and Social Networks:'), $txt);
|
||||
if ($txt = prepare_text($a->profile['contact'])) {
|
||||
$profile['contact'] = array( t('Contact information and Social Networks:'), $txt);
|
||||
}
|
||||
|
||||
if($txt = prepare_text($a->profile['music'])) $profile['music'] = array( t('Musical interests:'), $txt);
|
||||
if ($txt = prepare_text($a->profile['music'])) {
|
||||
$profile['music'] = array( t('Musical interests:'), $txt);
|
||||
}
|
||||
|
||||
if($txt = prepare_text($a->profile['book'])) $profile['book'] = array( t('Books, literature:'), $txt);
|
||||
if ($txt = prepare_text($a->profile['book'])) {
|
||||
$profile['book'] = array( t('Books, literature:'), $txt);
|
||||
}
|
||||
|
||||
if($txt = prepare_text($a->profile['tv'])) $profile['tv'] = array( t('Television:'), $txt);
|
||||
if ($txt = prepare_text($a->profile['tv'])) {
|
||||
$profile['tv'] = array( t('Television:'), $txt);
|
||||
}
|
||||
|
||||
if($txt = prepare_text($a->profile['film'])) $profile['film'] = array( t('Film/dance/culture/entertainment:'), $txt);
|
||||
if ($txt = prepare_text($a->profile['film'])) {
|
||||
$profile['film'] = array( t('Film/dance/culture/entertainment:'), $txt);
|
||||
}
|
||||
|
||||
if($txt = prepare_text($a->profile['romance'])) $profile['romance'] = array( t('Love/Romance:'), $txt);
|
||||
if ($txt = prepare_text($a->profile['romance'])) {
|
||||
$profile['romance'] = array( t('Love/Romance:'), $txt);
|
||||
}
|
||||
|
||||
if($txt = prepare_text($a->profile['work'])) $profile['work'] = array( t('Work/employment:'), $txt);
|
||||
if ($txt = prepare_text($a->profile['work'])) {
|
||||
$profile['work'] = array( t('Work/employment:'), $txt);
|
||||
}
|
||||
|
||||
if ($txt = prepare_text($a->profile['education'])) {
|
||||
$profile['education'] = array( t('School/education:'), $txt );
|
||||
}
|
||||
|
||||
if($txt = prepare_text($a->profile['education'])) $profile['education'] = array( t('School/education:'), $txt );
|
||||
|
||||
//show subcribed forum if it is enabled in the usersettings
|
||||
if (feature_enabled($uid,'forumlist_profile')) {
|
||||
$profile['forumlist'] = array( t('Forums:'), ForumManager::profile_advanced($uid));
|
||||
|
|
@ -705,11 +741,13 @@ function advanced_profile(App &$a) {
|
|||
function profile_tabs($a, $is_owner=False, $nickname=Null){
|
||||
//echo "<pre>"; var_dump($a->user); killme();
|
||||
|
||||
if (is_null($nickname))
|
||||
if (is_null($nickname)) {
|
||||
$nickname = $a->user['nickname'];
|
||||
}
|
||||
|
||||
if(x($_GET,'tab'))
|
||||
if (x($_GET,'tab')) {
|
||||
$tab = notags(trim($_GET['tab']));
|
||||
}
|
||||
|
||||
$url = App::get_baseurl() . '/profile/' . $nickname;
|
||||
|
||||
|
|
|
|||
|
|
@ -541,10 +541,11 @@ function parse_xml_string($s,$strict = true) {
|
|||
libxml_use_internal_errors(true);
|
||||
|
||||
$x = @simplexml_load_string($s2);
|
||||
if(! $x) {
|
||||
if (! $x) {
|
||||
logger('libxml: parse: error: ' . $s2, LOGGER_DATA);
|
||||
foreach(libxml_get_errors() as $err)
|
||||
foreach (libxml_get_errors() as $err) {
|
||||
logger('libxml: parse: ' . $err->code." at ".$err->line.":".$err->column." : ".$err->message, LOGGER_DATA);
|
||||
}
|
||||
libxml_clear_errors();
|
||||
}
|
||||
return $x;
|
||||
|
|
@ -553,8 +554,9 @@ function parse_xml_string($s,$strict = true) {
|
|||
function scale_external_images($srctext, $include_link = true, $scale_replace = false) {
|
||||
|
||||
// Suppress "view full size"
|
||||
if (intval(get_config('system','no_view_full_size')))
|
||||
if (intval(get_config('system','no_view_full_size'))) {
|
||||
$include_link = false;
|
||||
}
|
||||
|
||||
$a = get_app();
|
||||
|
||||
|
|
@ -563,38 +565,41 @@ function scale_external_images($srctext, $include_link = true, $scale_replace =
|
|||
|
||||
$matches = null;
|
||||
$c = preg_match_all('/\[img.*?\](.*?)\[\/img\]/ism',$s,$matches,PREG_SET_ORDER);
|
||||
if($c) {
|
||||
if ($c) {
|
||||
require_once('include/Photo.php');
|
||||
foreach($matches as $mtch) {
|
||||
foreach ($matches as $mtch) {
|
||||
logger('scale_external_image: ' . $mtch[1]);
|
||||
|
||||
$hostname = str_replace('www.','',substr(App::get_baseurl(),strpos(App::get_baseurl(),'://')+3));
|
||||
if(stristr($mtch[1],$hostname))
|
||||
if (stristr($mtch[1],$hostname)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// $scale_replace, if passed, is an array of two elements. The
|
||||
// first is the name of the full-size image. The second is the
|
||||
// name of a remote, scaled-down version of the full size image.
|
||||
// This allows Friendica to display the smaller remote image if
|
||||
// one exists, while still linking to the full-size image
|
||||
if($scale_replace)
|
||||
if ($scale_replace) {
|
||||
$scaled = str_replace($scale_replace[0], $scale_replace[1], $mtch[1]);
|
||||
else
|
||||
} else {
|
||||
$scaled = $mtch[1];
|
||||
$i = @fetch_url($scaled);
|
||||
if(! $i)
|
||||
}
|
||||
$i = fetch_url($scaled);
|
||||
if (! $i) {
|
||||
return $srctext;
|
||||
}
|
||||
|
||||
// guess mimetype from headers or filename
|
||||
$type = guess_image_type($mtch[1],true);
|
||||
|
||||
if($i) {
|
||||
if ($i) {
|
||||
$ph = new Photo($i, $type);
|
||||
if($ph->is_valid()) {
|
||||
if ($ph->is_valid()) {
|
||||
$orig_width = $ph->getWidth();
|
||||
$orig_height = $ph->getHeight();
|
||||
|
||||
if($orig_width > 640 || $orig_height > 640) {
|
||||
if ($orig_width > 640 || $orig_height > 640) {
|
||||
|
||||
$ph->scaleImage(640);
|
||||
$new_width = $ph->getWidth();
|
||||
|
|
@ -620,7 +625,7 @@ function scale_external_images($srctext, $include_link = true, $scale_replace =
|
|||
function fix_contact_ssl_policy(&$contact,$new_policy) {
|
||||
|
||||
$ssl_changed = false;
|
||||
if((intval($new_policy) == SSL_POLICY_SELFSIGN || $new_policy === 'self') && strstr($contact['url'],'https:')) {
|
||||
if ((intval($new_policy) == SSL_POLICY_SELFSIGN || $new_policy === 'self') && strstr($contact['url'],'https:')) {
|
||||
$ssl_changed = true;
|
||||
$contact['url'] = str_replace('https:','http:',$contact['url']);
|
||||
$contact['request'] = str_replace('https:','http:',$contact['request']);
|
||||
|
|
@ -630,7 +635,7 @@ function fix_contact_ssl_policy(&$contact,$new_policy) {
|
|||
$contact['poco'] = str_replace('https:','http:',$contact['poco']);
|
||||
}
|
||||
|
||||
if((intval($new_policy) == SSL_POLICY_FULL || $new_policy === 'full') && strstr($contact['url'],'http:')) {
|
||||
if ((intval($new_policy) == SSL_POLICY_FULL || $new_policy === 'full') && strstr($contact['url'],'http:')) {
|
||||
$ssl_changed = true;
|
||||
$contact['url'] = str_replace('http:','https:',$contact['url']);
|
||||
$contact['request'] = str_replace('http:','https:',$contact['request']);
|
||||
|
|
@ -640,15 +645,15 @@ function fix_contact_ssl_policy(&$contact,$new_policy) {
|
|||
$contact['poco'] = str_replace('http:','https:',$contact['poco']);
|
||||
}
|
||||
|
||||
if($ssl_changed) {
|
||||
q("update contact set
|
||||
url = '%s',
|
||||
request = '%s',
|
||||
notify = '%s',
|
||||
poll = '%s',
|
||||
confirm = '%s',
|
||||
poco = '%s'
|
||||
where id = %d limit 1",
|
||||
if ($ssl_changed) {
|
||||
q("UPDATE `contact` SET
|
||||
`url` = '%s',
|
||||
`request` = '%s',
|
||||
`notify` = '%s',
|
||||
`poll` = '%s',
|
||||
`confirm` = '%s',
|
||||
`poco` = '%s'
|
||||
WHERE `id` = %d LIMIT 1",
|
||||
dbesc($contact['url']),
|
||||
dbesc($contact['request']),
|
||||
dbesc($contact['notify']),
|
||||
|
|
|
|||
|
|
@ -413,7 +413,7 @@ function get_theme_info($theme){
|
|||
function get_theme_screenshot($theme) {
|
||||
$exts = array('.png','.jpg');
|
||||
foreach($exts as $ext) {
|
||||
if(file_exists('view/theme/' . $theme . '/screenshot' . $ext)) {
|
||||
if (file_exists('view/theme/' . $theme . '/screenshot' . $ext)) {
|
||||
return(App::get_baseurl() . '/view/theme/' . $theme . '/screenshot' . $ext);
|
||||
}
|
||||
}
|
||||
|
|
@ -425,8 +425,8 @@ if (! function_exists('uninstall_theme')){
|
|||
function uninstall_theme($theme){
|
||||
logger("Addons: uninstalling theme " . $theme);
|
||||
|
||||
@include_once("view/theme/$theme/theme.php");
|
||||
if(function_exists("{$theme}_uninstall")) {
|
||||
include_once("view/theme/$theme/theme.php");
|
||||
if (function_exists("{$theme}_uninstall")) {
|
||||
$func = "{$theme}_uninstall";
|
||||
$func();
|
||||
}
|
||||
|
|
@ -436,19 +436,19 @@ if (! function_exists('install_theme')){
|
|||
function install_theme($theme) {
|
||||
// silently fail if theme was removed
|
||||
|
||||
if(! file_exists("view/theme/$theme/theme.php"))
|
||||
if (! file_exists("view/theme/$theme/theme.php")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logger("Addons: installing theme $theme");
|
||||
|
||||
@include_once("view/theme/$theme/theme.php");
|
||||
include_once("view/theme/$theme/theme.php");
|
||||
|
||||
if(function_exists("{$theme}_install")) {
|
||||
if (function_exists("{$theme}_install")) {
|
||||
$func = "{$theme}_install";
|
||||
$func();
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
logger("Addons: FAILED installing theme $theme");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -467,10 +467,9 @@ function install_theme($theme) {
|
|||
|
||||
function service_class_allows($uid,$property,$usage = false) {
|
||||
|
||||
if($uid == local_user()) {
|
||||
if ($uid == local_user()) {
|
||||
$service_class = $a->user['service_class'];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$r = q("SELECT `service_class` FROM `user` WHERE `uid` = %d LIMIT 1",
|
||||
intval($uid)
|
||||
);
|
||||
|
|
@ -478,18 +477,23 @@ function service_class_allows($uid,$property,$usage = false) {
|
|||
$service_class = $r[0]['service_class'];
|
||||
}
|
||||
}
|
||||
if(! x($service_class))
|
||||
return true; // everything is allowed
|
||||
|
||||
if (! x($service_class)) [
|
||||
// everything is allowed
|
||||
return true;
|
||||
}
|
||||
|
||||
$arr = get_config('service_class',$service_class);
|
||||
if(! is_array($arr) || (! count($arr)))
|
||||
if (! is_array($arr) || (! count($arr))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if($usage === false)
|
||||
if ($usage === false) {
|
||||
return ((x($arr[$property])) ? (bool) $arr['property'] : true);
|
||||
else {
|
||||
if(! array_key_exists($property,$arr))
|
||||
} else {
|
||||
if (! array_key_exists($property,$arr)) {
|
||||
return true;
|
||||
}
|
||||
return (((intval($usage)) < intval($arr[$property])) ? true : false);
|
||||
}
|
||||
}
|
||||
|
|
@ -497,10 +501,9 @@ function service_class_allows($uid,$property,$usage = false) {
|
|||
|
||||
function service_class_fetch($uid,$property) {
|
||||
|
||||
if($uid == local_user()) {
|
||||
if ($uid == local_user()) {
|
||||
$service_class = $a->user['service_class'];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$r = q("SELECT `service_class` FROM `user` WHERE `uid` = %d LIMIT 1",
|
||||
intval($uid)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -220,8 +220,9 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
|
|||
$r = q("SELECT `network` FROM `contact` WHERE `nurl` = '%s' AND `network` != '' AND `network` != '%s' LIMIT 1",
|
||||
dbesc(normalise_link($profile_url)), dbesc(NETWORK_STATUSNET)
|
||||
);
|
||||
if (dbm::is_result($r))
|
||||
if (dbm::is_result($r)) {
|
||||
$network = $r[0]["network"];
|
||||
}
|
||||
|
||||
if (($network == "") OR ($network == NETWORK_OSTATUS)) {
|
||||
$r = q("SELECT `network`, `url` FROM `contact` WHERE `alias` IN ('%s', '%s') AND `network` != '' AND `network` != '%s' LIMIT 1",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue