diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/conversation.php | 12 | ||||
-rw-r--r-- | include/import.php | 38 | ||||
-rwxr-xr-x | include/plugin.php | 33 | ||||
-rw-r--r-- | include/wiki.php | 2 |
4 files changed, 61 insertions, 24 deletions
diff --git a/include/conversation.php b/include/conversation.php index 518193b08..bf29048b6 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1143,6 +1143,8 @@ function status_editor($a, $x, $popup = false) { $weblink = (($mimetype === 'text/bbcode') ? t('Insert web link') : false); if(x($x, 'hide_weblink')) $weblink = false; + + $embedPhotos = t('Embed image from photo albums'); $writefiles = (($mimetype === 'text/bbcode') ? perm_is_allowed($x['profile_uid'], get_observer_hash(), 'write_storage') : false); if(x($x, 'hide_attach')) @@ -1178,6 +1180,12 @@ function status_editor($a, $x, $popup = false) { '$whereareu' => t('Where are you right now?'), '$editor_autocomplete'=> ((x($x,'editor_autocomplete')) ? $x['editor_autocomplete'] : ''), '$bbco_autocomplete'=> ((x($x,'bbco_autocomplete')) ? $x['bbco_autocomplete'] : ''), + '$modalchooseimages' => t('Choose images to embed'), + '$modalchoosealbum' => t('Choose an album'), + '$modaldiffalbum' => t('Choose a different album...'), + '$modalerrorlist' => t('Error getting album list'), + '$modalerrorlink' => t('Error getting photo link'), + '$modalerroralbum' => t('Error getting album'), )); $tpl = get_markup_template('jot.tpl'); @@ -1219,6 +1227,10 @@ function status_editor($a, $x, $popup = false) { '$code' => t('Code'), '$attach' => t('Attach file'), '$weblink' => $weblink, + '$embedPhotos' => $embedPhotos, + '$embedPhotosModalTitle' => t('Embed an image from your albums'), + '$embedPhotosModalCancel' => t('Cancel'), + '$embedPhotosModalOK' => t('OK'), '$setloc' => $setloc, '$voting' => t('Toggle voting'), '$feature_voting' => $feature_voting, diff --git a/include/import.php b/include/import.php index 6fcb08416..be456bfa9 100644 --- a/include/import.php +++ b/include/import.php @@ -122,6 +122,11 @@ function import_profiles($channel,$profiles) { $profile['aid'] = get_account_id(); $profile['uid'] = $channel['channel_id']; + convert_oldfields($profile,'name','fullname'); + convert_oldfields($profile,'with','partner'); + convert_oldfields($profile,'work','employment'); + + // we are going to reset all profile photos to the original // somebody will have to fix this later and put all the applicable photos into the export @@ -644,6 +649,10 @@ function import_events($channel,$events) { unset($event['id']); $event['aid'] = $channel['channel_account_id']; $event['uid'] = $channel['channel_id']; + convert_oldfields($event,'start','dtstart'); + convert_oldfields($event,'finish','dtend'); + convert_oldfields($event,'type','etype'); + convert_oldfields($event,'ignore','dismissed'); dbesc_array($event); $r = dbq("INSERT INTO event (`" @@ -677,6 +686,12 @@ function sync_events($channel,$events) { $event['aid'] = $channel['channel_account_id']; $event['uid'] = $channel['channel_id']; + convert_oldfields($event,'start','dtstart'); + convert_oldfields($event,'finish','dtend'); + convert_oldfields($event,'type','etype'); + convert_oldfields($event,'ignore','dismissed'); + + $exists = false; $x = q("select * from event where event_hash = '%s' and uid = %d limit 1", @@ -974,10 +989,7 @@ function sync_files($channel,$files) { $attachment_stored = false; foreach($f['attach'] as $att) { - if(array_key_exists('data',$att)) { - $att['content'] = $att['data']; - unset($att['data']); - } + convert_oldfields($att,'data','content'); if($att['deleted']) { attach_delete($channel,$att['hash']); @@ -1130,14 +1142,10 @@ function sync_files($channel,$files) { $p['aid'] = $channel['channel_account_id']; $p['uid'] = $channel['channel_id']; - if(array_key_exists('data',$p)) { - $p['content'] = $p['data']; - unset($p['data']); - } - if(array_key_exists('scale',$p)) { - $p['imgscale'] = $p['scale']; - unset($p['scale']); - } + convert_oldfields($p,'data','content'); + convert_oldfields($p,'scale','imgscale'); + convert_oldfields($p,'size','filesize'); + convert_oldfields($p,'type','mimetype'); // if this is a profile photo, undo the profile photo bit // for any other photo which previously held it. @@ -1228,3 +1236,9 @@ function sync_files($channel,$files) { } +function convert_oldfields(&$arr,$old,$new) { + if(array_key_exists($old,$arr)) { + $arr[$new] = $arr[$old]; + unset($arr[$old]); + } +} diff --git a/include/plugin.php b/include/plugin.php index be4e92f03..9b84039a6 100755 --- a/include/plugin.php +++ b/include/plugin.php @@ -593,26 +593,37 @@ function script_path() { return $scheme . '://' . $hostname; } -function head_add_js($src) { - App::$js_sources[] = $src; +function head_add_js($src, $priority = 0) { + if(! is_array(App::$js_sources[$priority])) + App::$js_sources[$priority] = array(); + App::$js_sources[$priority][] = $src; } -function head_remove_js($src) { +function head_remove_js($src, $priority = 0) { - $index = array_search($src, App::$js_sources); + $index = array_search($src, App::$js_sources[$priority]); if($index !== false) - unset(App::$js_sources[$index]); + unset(App::$js_sources[$priority][$index]); } +// We should probably try to register main.js with a high priority, but currently we handle it +// separately and put it at the end of the html head block in case any other javascript is +// added outside the head_add_js construct. + function head_get_js() { + $str = ''; - $sources = App::$js_sources; - if(count($sources)) - foreach($sources as $source) { - if($source === 'main.js') - continue; - $str .= format_js_if_exists($source); + if(App::$js_sources) { + foreach(App::$js_sources as $sources) { + if(count($sources)) { + foreach($sources as $source) { + if($src === 'main.js') + continue; + $str .= format_js_if_exists($source); + } + } } + } return $str; } diff --git a/include/wiki.php b/include/wiki.php index f0785d549..4aa3fc1b4 100644 --- a/include/wiki.php +++ b/include/wiki.php @@ -279,7 +279,7 @@ function wiki_page_history($arr) { function wiki_save_page($arr) { $pageUrlName = ((array_key_exists('pageUrlName',$arr)) ? $arr['pageUrlName'] : ''); - $content = ((array_key_exists('content',$arr)) ? $arr['content'] : ''); + $content = ((array_key_exists('content',$arr)) ? purify_html($arr['content']) : ''); $resource_id = ((array_key_exists('resource_id',$arr)) ? $arr['resource_id'] : ''); $w = wiki_get_wiki($resource_id); if (!$w['path']) { |