aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/admin.php23
-rw-r--r--mod/connedit.php2
-rw-r--r--mod/frphotos.php87
-rw-r--r--mod/settings.php8
4 files changed, 118 insertions, 2 deletions
diff --git a/mod/admin.php b/mod/admin.php
index d9ca998ac..230ef3011 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -65,6 +65,11 @@ function admin_post(&$a){
case 'dbsync':
admin_page_dbsync_post($a);
break;
+
+ case 'profs':
+ admin_page_profs_post($a);
+ break;
+
}
}
@@ -95,6 +100,7 @@ function admin_content(&$a) {
'plugins' => Array($a->get_baseurl(true)."/admin/plugins/", t("Plugins") , "plugins"),
'themes' => Array($a->get_baseurl(true)."/admin/themes/", t("Themes") , "themes"),
'hubloc' => Array($a->get_baseurl(true)."/admin/hubloc/", t("Server") , "server"),
+ 'profs' => array(z_root() . '/admin/profs', t('Profile Config'), 'profs'),
'dbsync' => Array($a->get_baseurl(true)."/admin/dbsync/", t('DB updates'), "dbsync")
);
@@ -155,6 +161,9 @@ function admin_content(&$a) {
case 'dbsync':
$o = admin_page_dbsync($a);
break;
+ case 'profs':
+ $o = admin_page_profs($a);
+ break;
default:
notice( t("Item not found.") );
}
@@ -1317,3 +1326,17 @@ readable.");
));
}
+function admin_page_profs_post(&$a) {
+
+
+}
+
+function admin_page_profs(&$a) {
+
+
+}
+
+
+
+
+
diff --git a/mod/connedit.php b/mod/connedit.php
index b7535550d..b2de42343 100644
--- a/mod/connedit.php
+++ b/mod/connedit.php
@@ -121,7 +121,7 @@ function connedit_post(&$a) {
if($orig_record[0]['abook_profile'] != $profile_id) {
//Update profile photo permissions
- logger('As a new profile was assigned updateing profile photos');
+ logger('As a new profile was assigned updating profile photos');
require_once('mod/profile_photo.php');
profile_photo_set_profile_perms($profile_id);
diff --git a/mod/frphotos.php b/mod/frphotos.php
new file mode 100644
index 000000000..8d6197fa3
--- /dev/null
+++ b/mod/frphotos.php
@@ -0,0 +1,87 @@
+<?php
+
+
+
+function frphotos_init(&$a) {
+
+ if(! local_user())
+ return;
+
+ if(intval(get_pconfig(local_user(),'frphotos','complete')))
+ return;
+
+ $channel = $a->get_channel();
+
+ $fr_server = $_REQUEST['fr_server'];
+ $fr_username = $_REQUEST['fr_username'];
+ $fr_password = $_REQUEST['fr_password'];
+
+ $cookies = 'store/[data]/frphoto_cookie_' . $channel['channel_address'];
+
+ if($fr_server && $fr_username && $fr_password) {
+
+ $ch = curl_init($fr_server . '/api/friendica/photos/list');
+
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt ($ch, CURLOPT_COOKIEFILE, $cookies);
+ curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookies);
+ curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
+ curl_setopt($ch, CURLOPT_USERPWD, $fr_username . ':' . $fr_password);
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
+ curl_setopt($ch, CURLOPT_USERAGENT, 'RedMatrix');
+
+ $output = curl_exec($ch);
+ curl_close($ch);
+
+ $j = json_decode($output,true);
+
+// echo print_r($j,true);
+
+ $total = 0;
+ if(count($j)) {
+ foreach($j as $jj) {
+
+ $r = q("select uid from photo where resource_id = '%s' and uid = %d limit 1",
+ dbesc($jj),
+ intval($channel['channel_id'])
+ );
+ if($r)
+ continue;
+
+ $total ++;
+ proc_run('php','util/frphotohelper.php',$jj, $channel['channel_address'], urlencode($fr_server));
+ sleep(3);
+ }
+ }
+ if($total) {
+ set_pconfig(local_user(),'frphotos','complete','1');
+ }
+ @unlink($cookies);
+ goaway(z_root() . '/photos/' . $channel['channel_address']);
+ }
+}
+
+
+function frphotos_content(&$a) {
+
+ if(! local_user()) {
+ notice( t('Permission denied') . EOL);
+ return;
+ }
+
+ if(intval(get_pconfig(local_user(),'frphotos','complete'))) {
+ info('Friendica photos have already been imported into this channel.');
+ return;
+ }
+
+ $o = replace_macros(get_markup_template('frphotos.tpl'),array(
+ '$header' => t('Friendica Photo Album Import'),
+ '$desc' => t('This will import all your Friendica photo albums to this Red channel.'),
+ '$fr_server' => array('fr_server', t('Friendica Server base URL'),'',''),
+ '$fr_username' => array('fr_username', t('Friendica Login Username'),'',''),
+ '$fr_password' => array('fr_password', t('Friendica Login Password'),'',''),
+ '$submit' => t('Submit'),
+ ));
+ return $o;
+}
diff --git a/mod/settings.php b/mod/settings.php
index 6c11fbc9b..631ceb3c2 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -135,6 +135,7 @@ function settings_post(&$a) {
$theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : $a->channel['channel_theme']);
$mobile_theme = ((x($_POST,'mobile_theme')) ? notags(trim($_POST['mobile_theme'])) : '');
+ $user_scalable = ((x($_POST,'user_scalable')) ? intval($_POST['user_scalable']) : 0);
$nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0);
$browser_update = ((x($_POST,'browser_update')) ? intval($_POST['browser_update']) : 0);
$browser_update = $browser_update * 1000;
@@ -151,7 +152,7 @@ function settings_post(&$a) {
}
// $chanview_full = ((x($_POST,'chanview_full')) ? intval($_POST['chanview_full']) : 0);
-
+ set_pconfig(local_user(),'system','user_scalable',$user_scalable);
set_pconfig(local_user(),'system','update_interval', $browser_update);
set_pconfig(local_user(),'system','itemspage', $itemspage);
set_pconfig(local_user(),'system','no_smilies',$nosmile);
@@ -727,6 +728,9 @@ function settings_content(&$a) {
}
$theme_selected = (!x($_SESSION,'theme')? $default_theme : $_SESSION['theme']);
$mobile_theme_selected = (!x($_SESSION,'mobile_theme')? $default_mobile_theme : $_SESSION['mobile_theme']);
+
+ $user_scalable = get_pconfig(local_user(),'system','user_scalable');
+ $user_scalable = (($user_scalable===false)? '1': $user_scalable); // default if not set: 1
$browser_update = intval(get_pconfig(local_user(), 'system','update_interval'));
$browser_update = (($browser_update == 0) ? 40 : $browser_update / 1000); // default if not set: 40 seconds
@@ -753,11 +757,13 @@ function settings_content(&$a) {
'$theme' => array('theme', t('Display Theme:'), $theme_selected, '', $themes, 'preview'),
'$mobile_theme' => array('mobile_theme', t('Mobile Theme:'), $mobile_theme_selected, '', $mobile_themes, ''),
+ '$user_scalable' => array('user_scalable', t("Enable user zoom on mobile devices"), $user_scalable, ''),
'$ajaxint' => array('browser_update', t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds, no maximum')),
'$itemspage' => array('itemspage', t("Maximum number of conversations to load at any time:"), $itemspage, t('Maximum of 100 items')),
'$nosmile' => array('nosmile', t("Don't show emoticons"), $nosmile, ''),
'$layout_editor' => t('System Page Layout Editor - (advanced)'),
'$theme_config' => $theme_config,
+ '$expert' => feature_enabled(local_user(),'expert'),
));
return $o;