aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-07-30 06:30:46 -0400
committerAndrew Manning <tamanning@zoho.com>2016-07-30 06:30:46 -0400
commitf17f51a9c1f62dc0229e2428cacea4e84313560e (patch)
tree7486b05738e943bf39619d06bec9d83d7795e746 /include
parent5a63ddd6457ae4dba61ff30db5b6601b22ddd1b6 (diff)
parentd858bd9265a4a0fa3589cdb2126031998310c7c3 (diff)
downloadvolse-hubzilla-f17f51a9c1f62dc0229e2428cacea4e84313560e.tar.gz
volse-hubzilla-f17f51a9c1f62dc0229e2428cacea4e84313560e.tar.bz2
volse-hubzilla-f17f51a9c1f62dc0229e2428cacea4e84313560e.zip
Merge remote-tracking branch 'upstream/dev' into website-import
Diffstat (limited to 'include')
-rw-r--r--include/api.php107
-rw-r--r--include/api_auth.php4
-rw-r--r--include/attach.php1
-rw-r--r--include/auth.php12
-rw-r--r--include/channel.php5
-rw-r--r--include/datetime.php6
-rw-r--r--include/text.php33
7 files changed, 91 insertions, 77 deletions
diff --git a/include/api.php b/include/api.php
index 8d475c5fa..f52b03240 100644
--- a/include/api.php
+++ b/include/api.php
@@ -72,7 +72,7 @@ require_once('include/api_auth.php');
* MAIN API ENTRY POINT *
**************************/
- function api_call(&$a){
+ function api_call($a){
GLOBAL $API, $called_api;
// preset
@@ -166,7 +166,7 @@ require_once('include/api_auth.php');
/**
* RSS extra info
*/
- function api_rss_extra(&$a, $arr, $user_info){
+ function api_rss_extra($a, $arr, $user_info){
if (is_null($user_info)) $user_info = api_get_user($a);
$arr['$user'] = $user_info;
$arr['$rss'] = array(
@@ -186,7 +186,7 @@ require_once('include/api_auth.php');
* Returns user info array.
*/
- function api_get_user(&$a, $contact_id = null, $contact_xchan = null){
+ function api_get_user($a, $contact_id = null, $contact_xchan = null){
global $called_api;
$user = null;
$extra_query = "";
@@ -356,7 +356,7 @@ require_once('include/api_auth.php');
}
- function api_client_register(&$a,$type) {
+ function api_client_register($a,$type) {
$ret = array();
$key = random_string(16);
@@ -389,7 +389,7 @@ require_once('include/api_auth.php');
- function api_item_get_user(&$a, $item) {
+ function api_item_get_user($a, $item) {
// The author is our direct contact, in a conversation with us.
@@ -473,7 +473,7 @@ require_once('include/api_auth.php');
* returns a 401 status code and an error message if not.
* http://developer.twitter.com/doc/get/account/verify_credentials
*/
- function api_account_verify_credentials(&$a, $type){
+ function api_account_verify_credentials($a, $type){
if (api_user()===false) return false;
$user_info = api_get_user($a);
@@ -483,7 +483,7 @@ require_once('include/api_auth.php');
api_register_func('api/account/verify_credentials','api_account_verify_credentials', true);
- function api_account_logout(&$a, $type){
+ function api_account_logout($a, $type){
require_once('include/auth.php');
App::$session->nuke();
return api_apply_template("user", $type, array('$user' => null));
@@ -507,7 +507,7 @@ require_once('include/api_auth.php');
* Red basic channel export
*/
- function api_export_basic(&$a, $type) {
+ function api_export_basic($a, $type) {
if(api_user() === false) {
logger('api_export_basic: no user');
return false;
@@ -521,7 +521,7 @@ require_once('include/api_auth.php');
api_register_func('api/red/channel/export/basic','api_export_basic', true);
- function api_channel_stream(&$a, $type) {
+ function api_channel_stream($a, $type) {
if(api_user() === false) {
logger('api_channel_stream: no user');
return false;
@@ -537,7 +537,7 @@ require_once('include/api_auth.php');
}
api_register_func('api/red/channel/stream','api_channel_stream', true);
- function api_attach_list(&$a,$type) {
+ function api_attach_list($a,$type) {
logger('api_user: ' . api_user());
json_return_and_die(attach_list_files(api_user(),get_observer_hash(),'','','','created asc'));
}
@@ -547,7 +547,7 @@ require_once('include/api_auth.php');
- function api_file_meta(&$a,$type) {
+ function api_file_meta($a,$type) {
if (api_user()===false) return false;
if(! $_REQUEST['file_id']) return false;
$r = q("select * from attach where uid = %d and hash = '%s' limit 1",
@@ -565,7 +565,7 @@ require_once('include/api_auth.php');
api_register_func('api/red/filemeta', 'api_file_meta', true);
- function api_file_data(&$a,$type) {
+ function api_file_data($a,$type) {
if (api_user()===false) return false;
if(! $_REQUEST['file_id']) return false;
$start = (($_REQUEST['start']) ? intval($_REQUEST['start']) : 0);
@@ -609,7 +609,7 @@ require_once('include/api_auth.php');
- function api_file_detail(&$a,$type) {
+ function api_file_detail($a,$type) {
if (api_user()===false) return false;
if(! $_REQUEST['file_id']) return false;
$r = q("select * from attach where uid = %d and hash = '%s' limit 1",
@@ -633,18 +633,18 @@ require_once('include/api_auth.php');
api_register_func('api/red/file', 'api_file_detail', true);
- function api_albums(&$a,$type) {
+ function api_albums($a,$type) {
json_return_and_die(photos_albums_list(App::get_channel(),App::get_observer()));
}
api_register_func('api/red/albums','api_albums', true);
- function api_photos(&$a,$type) {
+ function api_photos($a,$type) {
$album = $_REQUEST['album'];
json_return_and_die(photos_list_photos(App::get_channel(),App::get_observer(),$album));
}
api_register_func('api/red/photos','api_photos', true);
- function api_photo_detail(&$a,$type) {
+ function api_photo_detail($a,$type) {
if (api_user()===false) return false;
if(! $_REQUEST['photo_id']) return false;
$scale = ((array_key_exists('scale',$_REQUEST)) ? intval($_REQUEST['scale']) : 0);
@@ -686,7 +686,7 @@ require_once('include/api_auth.php');
api_register_func('api/red/photo', 'api_photo_detail', true);
- function api_group_members(&$a,$type) {
+ function api_group_members($a,$type) {
if(api_user() === false)
return false;
@@ -710,7 +710,7 @@ require_once('include/api_auth.php');
- function api_group(&$a,$type) {
+ function api_group($a,$type) {
if(api_user() === false)
return false;
@@ -722,7 +722,7 @@ require_once('include/api_auth.php');
api_register_func('api/red/group','api_group', true);
- function api_red_xchan(&$a,$type) {
+ function api_red_xchan($a,$type) {
logger('api_xchan');
if(api_user() === false)
@@ -740,7 +740,7 @@ require_once('include/api_auth.php');
api_register_func('api/red/xchan','api_red_xchan',true);
- function api_statuses_mediap(&$a, $type) {
+ function api_statuses_mediap($a, $type) {
if (api_user() === false) {
logger('api_statuses_update: no user');
return false;
@@ -786,7 +786,7 @@ require_once('include/api_auth.php');
}
api_register_func('api/statuses/mediap','api_statuses_mediap', true);
- function api_statuses_update(&$a, $type) {
+ function api_statuses_update($a, $type) {
if (api_user() === false) {
logger('api_statuses_update: no user');
return false;
@@ -907,7 +907,7 @@ require_once('include/api_auth.php');
api_register_func('api/statuses/update','api_statuses_update', true);
- function red_item_new(&$a, $type) {
+ function red_item_new($a, $type) {
if (api_user() === false) {
logger('api_red_item_new: no user');
@@ -941,7 +941,7 @@ require_once('include/api_auth.php');
api_register_func('api/red/item/new','red_item_new', true);
- function red_item(&$a, $type) {
+ function red_item($a, $type) {
if (api_user() === false) {
logger('api_red_item_full: no user');
@@ -1042,7 +1042,7 @@ require_once('include/api_auth.php');
return $status_info;
}
- function api_status_show(&$a, $type){
+ function api_status_show($a, $type){
$user_info = api_get_user($a);
// get last public message
@@ -1120,7 +1120,7 @@ require_once('include/api_auth.php');
// FIXME - this is essentially the same as api_status_show except for the template formatting at the end. Consolidate.
- function api_users_show(&$a, $type){
+ function api_users_show($a, $type){
$user_info = api_get_user($a);
require_once('include/security.php');
@@ -1192,7 +1192,7 @@ require_once('include/api_auth.php');
* TODO: Add reply info
*/
- function api_statuses_home_timeline(&$a, $type){
+ function api_statuses_home_timeline($a, $type){
if (api_user() === false)
return false;
@@ -1274,7 +1274,7 @@ require_once('include/api_auth.php');
api_register_func('api/statuses/home_timeline','api_statuses_home_timeline', true);
api_register_func('api/statuses/friends_timeline','api_statuses_home_timeline', true);
- function api_statuses_public_timeline(&$a, $type){
+ function api_statuses_public_timeline($a, $type){
if (api_user()===false) return false;
$user_info = api_get_user($a);
@@ -1338,7 +1338,7 @@ require_once('include/api_auth.php');
*
*/
- function api_statuses_show(&$a, $type){
+ function api_statuses_show($a, $type){
if (api_user()===false) return false;
$user_info = api_get_user($a);
@@ -1388,7 +1388,7 @@ require_once('include/api_auth.php');
/**
*
*/
- function api_statuses_repeat(&$a, $type){
+ function api_statuses_repeat($a, $type){
if (api_user()===false) return false;
$user_info = api_get_user($a);
@@ -1434,7 +1434,7 @@ require_once('include/api_auth.php');
*
*/
- function api_statuses_destroy(&$a, $type){
+ function api_statuses_destroy($a, $type){
if (api_user()===false) return false;
$user_info = api_get_user($a);
@@ -1498,7 +1498,7 @@ require_once('include/api_auth.php');
*/
- function api_statuses_mentions(&$a, $type){
+ function api_statuses_mentions($a, $type){
if (api_user()===false) return false;
$user_info = api_get_user($a);
@@ -1565,7 +1565,7 @@ require_once('include/api_auth.php');
api_register_func('api/statuses/replies','api_statuses_mentions', true);
- function api_statuses_user_timeline(&$a, $type){
+ function api_statuses_user_timeline($a, $type){
if (api_user()===false) return false;
$user_info = api_get_user($a);
@@ -1649,7 +1649,7 @@ require_once('include/api_auth.php');
*
* api v1 : https://web.archive.org/web/20131019055350/https://dev.twitter.com/docs/api/1/post/favorites/create/%3Aid
*/
- function api_favorites_create_destroy(&$a, $type){
+ function api_favorites_create_destroy($a, $type){
logger('favorites_create_destroy');
@@ -1717,7 +1717,7 @@ require_once('include/api_auth.php');
- function api_favorites(&$a, $type){
+ function api_favorites($a, $type){
if (api_user()===false)
return false;
@@ -1986,7 +1986,7 @@ require_once('include/api_auth.php');
}
- function api_account_rate_limit_status(&$a,$type) {
+ function api_account_rate_limit_status($a,$type) {
$hash = array(
'reset_time_in_seconds' => strtotime('now + 1 hour'),
@@ -2002,7 +2002,7 @@ require_once('include/api_auth.php');
}
api_register_func('api/account/rate_limit_status','api_account_rate_limit_status',true);
- function api_help_test(&$a,$type) {
+ function api_help_test($a,$type) {
if ($type == 'xml')
$ok = "true";
@@ -2019,7 +2019,7 @@ require_once('include/api_auth.php');
* This function is deprecated by Twitter
* returns: json, xml
**/
- function api_statuses_f(&$a, $type, $qtype) {
+ function api_statuses_f($a, $type, $qtype) {
if (api_user()===false) return false;
$user_info = api_get_user($a);
@@ -2040,6 +2040,7 @@ require_once('include/api_auth.php');
return false;
}
+// @fixme - update for hubzilla extensible perms using abconfig or find a better way to do it
// For Red, the closest thing we can do to figure out if you're friends is if both of you are sending each other your streams.
// This won't work if either of you send your stream to everybody on the network
if($qtype == 'friends')
@@ -2060,12 +2061,12 @@ require_once('include/api_auth.php');
return array('$users' => $ret);
}
- function api_statuses_friends(&$a, $type){
+ function api_statuses_friends($a, $type){
$data = api_statuses_f($a,$type,"friends");
if ($data===false) return false;
return api_apply_template("friends", $type, $data);
}
- function api_statuses_followers(&$a, $type){
+ function api_statuses_followers($a, $type){
$data = api_statuses_f($a,$type,"followers");
if ($data===false) return false;
return api_apply_template("friends", $type, $data);
@@ -2078,7 +2079,7 @@ require_once('include/api_auth.php');
- function api_statusnet_config(&$a,$type) {
+ function api_statusnet_config($a,$type) {
load_config('system');
@@ -2115,7 +2116,7 @@ require_once('include/api_auth.php');
api_register_func('api/friendica/config','api_statusnet_config',false);
api_register_func('api/red/config','api_statusnet_config',false);
- function api_statusnet_version(&$a,$type) {
+ function api_statusnet_version($a,$type) {
// liar
@@ -2133,7 +2134,7 @@ require_once('include/api_auth.php');
api_register_func('api/statusnet/version','api_statusnet_version',false);
- function api_friendica_version(&$a,$type) {
+ function api_friendica_version($a,$type) {
if($type === 'xml') {
header("Content-type: application/xml");
@@ -2150,7 +2151,7 @@ require_once('include/api_auth.php');
api_register_func('api/red/version','api_friendica_version',false);
- function api_ff_ids(&$a,$type,$qtype) {
+ function api_ff_ids($a,$type,$qtype) {
if(! api_user())
return false;
@@ -2186,17 +2187,17 @@ require_once('include/api_auth.php');
}
}
- function api_friends_ids(&$a,$type) {
+ function api_friends_ids($a,$type) {
api_ff_ids($a,$type,'friends');
}
- function api_followers_ids(&$a,$type) {
+ function api_followers_ids($a,$type) {
api_ff_ids($a,$type,'followers');
}
api_register_func('api/friends/ids','api_friends_ids',true);
api_register_func('api/followers/ids','api_followers_ids',true);
- function api_direct_messages_new(&$a, $type) {
+ function api_direct_messages_new($a, $type) {
if (api_user()===false) return false;
if (!x($_POST, "text") || !x($_POST,"screen_name")) return;
@@ -2254,7 +2255,7 @@ require_once('include/api_auth.php');
}
api_register_func('api/direct_messages/new','api_direct_messages_new',true);
- function api_direct_messages_box(&$a, $type, $box) {
+ function api_direct_messages_box($a, $type, $box) {
if (api_user()===false) return false;
$user_info = api_get_user($a);
@@ -2314,16 +2315,16 @@ require_once('include/api_auth.php');
}
- function api_direct_messages_sentbox(&$a, $type){
+ function api_direct_messages_sentbox($a, $type){
return api_direct_messages_box($a, $type, "sentbox");
}
- function api_direct_messages_inbox(&$a, $type){
+ function api_direct_messages_inbox($a, $type){
return api_direct_messages_box($a, $type, "inbox");
}
- function api_direct_messages_all(&$a, $type){
+ function api_direct_messages_all($a, $type){
return api_direct_messages_box($a, $type, "all");
}
- function api_direct_messages_conversation(&$a, $type){
+ function api_direct_messages_conversation($a, $type){
return api_direct_messages_box($a, $type, "conversation");
}
api_register_func('api/direct_messages/conversation','api_direct_messages_conversation',true);
@@ -2332,7 +2333,7 @@ require_once('include/api_auth.php');
api_register_func('api/direct_messages','api_direct_messages_inbox',true);
- function api_oauth_request_token(&$a, $type){
+ function api_oauth_request_token($a, $type){
try{
$oauth = new ZotOAuth1();
$req = OAuth1Request::from_request();
@@ -2347,7 +2348,7 @@ require_once('include/api_auth.php');
killme();
}
- function api_oauth_access_token(&$a, $type){
+ function api_oauth_access_token($a, $type){
try{
$oauth = new ZotOAuth1();
$req = OAuth1Request::from_request();
diff --git a/include/api_auth.php b/include/api_auth.php
index 7a71bad73..e5cd7cab3 100644
--- a/include/api_auth.php
+++ b/include/api_auth.php
@@ -64,8 +64,10 @@ function api_login(&$a){
}
}
+
+
if($record['account']) {
- authenticate_success($record);
+ authenticate_success($record['account']);
if($channel_login)
change_channel($channel_login);
diff --git a/include/attach.php b/include/attach.php
index 40410d41e..f3fb12293 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -74,6 +74,7 @@ function z_mime_content_type($filename) {
// 'webm' => 'audio/webm',
'mp4' => 'video/mp4',
// 'mp4' => 'audio/mp4',
+ 'mkv' => 'video/x-matroska',
// adobe
'pdf' => 'application/pdf',
diff --git a/include/auth.php b/include/auth.php
index f8120981a..f3592cee3 100644
--- a/include/auth.php
+++ b/include/auth.php
@@ -16,16 +16,24 @@ require_once('include/security.php');
/**
* @brief Verify login credentials.
*
- * If system <i>authlog</i> is set a log entry will be added for failed login
+ * If system.authlog is set a log entry will be added for failed login
* attempts.
*
- * @param string $email
+ * @param string $login
* The login to verify (channel address, account email or guest login token).
* @param string $pass
* The provided password to verify.
* @return array|null
* Returns account record on success, null on failure.
+ * The return array is dependent on the login mechanism.
+ * $ret['account'] will be set if either an email or channel address validation was successful (local login).
+ * $ret['channel'] will be set if a channel address validation was successful.
+ * $ret['xchan'] will be set if a guest access token validation was successful.
+ * Keys will exist for invalid return arrays but will be set to null.
+ * This function does not perform a login. It merely validates systems passwords and tokens.
+ *
*/
+
function account_verify_password($login, $pass) {
$ret = [ 'account' => null, 'channel' => null, 'xchan' => null ];
diff --git a/include/channel.php b/include/channel.php
index 708e70b1c..88dd818e6 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -1371,7 +1371,8 @@ function zat_init() {
dbesc($_REQUEST['zat'])
);
if($r) {
- atoken_login($r[0]);
+ $xchan = atoken_xchan($r[0]);
+ atoken_login($xchan);
}
}
@@ -1567,7 +1568,7 @@ function is_public_profile() {
return false;
$channel = App::get_channel();
if($channel) {
- $perm = \Zotlabs\Access\PermissionLimit::Get($channel['channel_id'],'view_profile');
+ $perm = \Zotlabs\Access\PermissionLimits::Get($channel['channel_id'],'view_profile');
if($perm == PERMS_PUBLIC)
return true;
}
diff --git a/include/datetime.php b/include/datetime.php
index 600ad6ec4..76bd6b8d6 100644
--- a/include/datetime.php
+++ b/include/datetime.php
@@ -556,13 +556,13 @@ function update_birthdays() {
$ev['uid'] = $rr['abook_channel'];
$ev['account'] = $rr['abook_account'];
$ev['event_xchan'] = $rr['xchan_hash'];
- $ev['start'] = datetime_convert('UTC', 'UTC', $rr['abook_dob']);
- $ev['finish'] = datetime_convert('UTC', 'UTC', $rr['abook_dob'] . ' + 1 day ');
+ $ev['dtstart'] = datetime_convert('UTC', 'UTC', $rr['abook_dob']);
+ $ev['dtend'] = datetime_convert('UTC', 'UTC', $rr['abook_dob'] . ' + 1 day ');
$ev['adjust'] = intval(feature_enabled($rr['abook_channel'],'smart_birthdays'));
$ev['summary'] = sprintf( t('%1$s\'s birthday'), $rr['xchan_name']);
$ev['description'] = sprintf( t('Happy Birthday %1$s'),
'[zrl=' . $rr['xchan_url'] . ']' . $rr['xchan_name'] . '[/zrl]') ;
- $ev['type'] = 'birthday';
+ $ev['etype'] = 'birthday';
$z = event_store_event($ev);
if ($z) {
diff --git a/include/text.php b/include/text.php
index a9bde8374..f81155edb 100644
--- a/include/text.php
+++ b/include/text.php
@@ -2639,32 +2639,33 @@ function getIconFromType($type) {
'application/octet-stream' => 'fa-file-o',
//Text
'text/plain' => 'fa-file-text-o',
- 'application/msword' => 'fa-file-text-o',
- 'application/pdf' => 'fa-file-text-o',
- 'application/vnd.oasis.opendocument.text' => 'fa-file-text-o',
+ 'application/msword' => 'fa-file-word-o',
+ 'application/pdf' => 'fa-file-pdf-o',
+ 'application/vnd.oasis.opendocument.text' => 'fa-file-word-o',
'application/epub+zip' => 'fa-book',
//Spreadsheet
- 'application/vnd.oasis.opendocument.spreadsheet' => 'fa-table',
- 'application/vnd.ms-excel' => 'fa-table',
+ 'application/vnd.oasis.opendocument.spreadsheet' => 'fa-file-excel-o',
+ 'application/vnd.ms-excel' => 'fa-file-excel-o',
//Image
'image/jpeg' => 'fa-picture-o',
'image/png' => 'fa-picture-o',
'image/gif' => 'fa-picture-o',
'image/svg+xml' => 'fa-picture-o',
//Archive
- 'application/zip' => 'fa-archive',
- 'application/x-rar-compressed' => 'fa-archive',
+ 'application/zip' => 'fa-file-archive-o',
+ 'application/x-rar-compressed' => 'fa-file-archive-o',
//Audio
- 'audio/mpeg' => 'fa-music',
- 'audio/wav' => 'fa-music',
- 'application/ogg' => 'fa-music',
- 'audio/ogg' => 'fa-music',
- 'audio/webm' => 'fa-music',
- 'audio/mp4' => 'fa-music',
+ 'audio/mpeg' => 'fa-file-audio-o',
+ 'audio/wav' => 'fa-file-audio-o',
+ 'application/ogg' => 'fa-file-audio-o',
+ 'audio/ogg' => 'fa-file-audio-o',
+ 'audio/webm' => 'fa-file-audio-o',
+ 'audio/mp4' => 'fa-file-audio-o',
//Video
- 'video/quicktime' => 'fa-film',
- 'video/webm' => 'fa-film',
- 'video/mp4' => 'fa-film'
+ 'video/quicktime' => 'fa-file-video-o',
+ 'video/webm' => 'fa-file-video-o',
+ 'video/mp4' => 'fa-file-video-o',
+ 'video/x-matroska' => 'fa-file-video-o'
);
$iconFromType = 'fa-file-o';