diff --git a/dav/main.php b/dav/main.php index b71ef619..b79a4779 100644 --- a/dav/main.php +++ b/dav/main.php @@ -22,6 +22,50 @@ function dav_module() { } +function dav_include_files() { + require_once (__DIR__ . "/common/dbclasses/dbclass_animexx.class.php"); + require_once (__DIR__ . "/common/dbclasses/dbclass.friendica.calendars.class.php"); + require_once (__DIR__ . "/common/dbclasses/dbclass.friendica.jqcalendar.class.php"); + require_once (__DIR__ . "/common/dbclasses/dbclass.friendica.notifications.class.php"); + require_once (__DIR__ . "/common/dbclasses/dbclass.friendica.calendarobjects.class.php"); + + /* + require_once (__DIR__ . "/SabreDAV/lib/Sabre.includes.php"); + require_once (__DIR__ . "/SabreDAV/lib/Sabre/VObject/includes.php"); + require_once (__DIR__ . "/SabreDAV/lib/Sabre/DAVACL/includes.php"); + require_once (__DIR__ . "/SabreDAV/lib/Sabre/CalDAV/includes.php"); + */ + require_once (__DIR__ . "/SabreDAV/lib/Sabre/autoload.php"); + + $tz_before = date_default_timezone_get(); + require_once (__DIR__ . "/iCalcreator/iCalcreator.class.php"); + date_default_timezone_set($tz_before); + + require_once (__DIR__ . "/common/calendar.fnk.php"); + require_once (__DIR__ . "/common/dav_caldav_backend_common.inc.php"); + require_once (__DIR__ . "/common/dav_caldav_backend.inc.php"); + require_once (__DIR__ . "/common/dav_caldav_root.inc.php"); + require_once (__DIR__ . "/common/dav_user_calendars.inc.php"); + require_once (__DIR__ . "/common/dav_carddav_root.inc.php"); + require_once (__DIR__ . "/common/dav_carddav_backend_std.inc.php"); + require_once (__DIR__ . "/common/dav_user_addressbooks.inc.php"); + require_once (__DIR__ . "/common/virtual_cal_source_backend.inc.php"); + require_once (__DIR__ . "/common/wdcal_configuration.php"); + require_once (__DIR__ . "/common/wdcal_cal_source.inc.php"); + require_once (__DIR__ . "/common/wdcal_cal_source_private.inc.php"); + + require_once (__DIR__ . "/dav_friendica_principal.inc.php"); + require_once (__DIR__ . "/dav_friendica_auth.inc.php"); + require_once (__DIR__ . "/dav_carddav_backend_friendica_community.inc.php"); + require_once (__DIR__ . "/dav_caldav_backend_friendica.inc.php"); + require_once (__DIR__ . "/virtual_cal_source_friendica.inc.php"); + require_once (__DIR__ . "/wdcal_cal_source_friendicaevents.inc.php"); + require_once (__DIR__ . "/FriendicaACLPlugin.inc.php"); + + require_once (__DIR__ . "/calendar.friendica.fnk.php"); + require_once (__DIR__ . "/layout.fnk.php"); +} + /** * @param App $a @@ -34,48 +78,8 @@ function dav_init(&$a) * ALTER TABLE `photo` ADD INDEX ( `contact-id` ) */ - require_once (__DIR__ . "/common/dbclasses/dbclass_animexx.class.php"); - require_once (__DIR__ . "/common/dbclasses/dbclass.friendica.calendars.class.php"); - require_once (__DIR__ . "/common/dbclasses/dbclass.friendica.jqcalendar.class.php"); - require_once (__DIR__ . "/common/dbclasses/dbclass.friendica.notifications.class.php"); - require_once (__DIR__ . "/common/dbclasses/dbclass.friendica.calendarobjects.class.php"); - - /* - require_once (__DIR__ . "/SabreDAV/lib/Sabre.includes.php"); - require_once (__DIR__ . "/SabreDAV/lib/Sabre/VObject/includes.php"); - require_once (__DIR__ . "/SabreDAV/lib/Sabre/DAVACL/includes.php"); - require_once (__DIR__ . "/SabreDAV/lib/Sabre/CalDAV/includes.php"); - */ - require_once (__DIR__ . "/SabreDAV/lib/Sabre/autoload.php"); - - $tz_before = date_default_timezone_get(); - require_once (__DIR__ . "/iCalcreator/iCalcreator.class.php"); - date_default_timezone_set($tz_before); - - require_once (__DIR__ . "/common/calendar.fnk.php"); - require_once (__DIR__ . "/common/dav_caldav_backend_common.inc.php"); - require_once (__DIR__ . "/common/dav_caldav_backend.inc.php"); - require_once (__DIR__ . "/common/dav_caldav_root.inc.php"); - require_once (__DIR__ . "/common/dav_user_calendars.inc.php"); - require_once (__DIR__ . "/common/dav_carddav_root.inc.php"); - require_once (__DIR__ . "/common/dav_carddav_backend_std.inc.php"); - require_once (__DIR__ . "/common/dav_user_addressbooks.inc.php"); - require_once (__DIR__ . "/common/virtual_cal_source_backend.inc.php"); - require_once (__DIR__ . "/common/wdcal_configuration.php"); - require_once (__DIR__ . "/common/wdcal_cal_source.inc.php"); - require_once (__DIR__ . "/common/wdcal_cal_source_private.inc.php"); - - require_once (__DIR__ . "/dav_friendica_principal.inc.php"); - require_once (__DIR__ . "/dav_friendica_auth.inc.php"); - require_once (__DIR__ . "/dav_carddav_backend_friendica_community.inc.php"); - require_once (__DIR__ . "/dav_caldav_backend_friendica.inc.php"); - require_once (__DIR__ . "/virtual_cal_source_friendica.inc.php"); - require_once (__DIR__ . "/wdcal_cal_source_friendicaevents.inc.php"); - require_once (__DIR__ . "/FriendicaACLPlugin.inc.php"); - - require_once (__DIR__ . "/calendar.friendica.fnk.php"); - require_once (__DIR__ . "/layout.fnk.php"); - + dav_include_files(); + if (false) { dbg(true); error_reporting(E_ALL); @@ -197,6 +201,7 @@ function dav_content() */ function dav_event_created_hook(&$a, &$b) { + dav_include_files(); // @TODO Updating the cache instead of completely invalidating and rebuilding it FriendicaVirtualCalSourceBackend::invalidateCache($a->user["uid"], CALDAV_FRIENDICA_CONTACTS); FriendicaVirtualCalSourceBackend::invalidateCache($a->user["uid"], CALDAV_FRIENDICA_MINE); @@ -208,6 +213,7 @@ function dav_event_created_hook(&$a, &$b) */ function dav_event_updated_hook(&$a, &$b) { + dav_include_files(); // @TODO Updating the cache instead of completely invalidating and rebuilding it FriendicaVirtualCalSourceBackend::invalidateCache($a->user["uid"], CALDAV_FRIENDICA_CONTACTS); FriendicaVirtualCalSourceBackend::invalidateCache($a->user["uid"], CALDAV_FRIENDICA_MINE); diff --git a/privacy_image_cache/privacy_image_cache.php b/privacy_image_cache/privacy_image_cache.php index 4153f7d9..f179a7ba 100644 --- a/privacy_image_cache/privacy_image_cache.php +++ b/privacy_image_cache/privacy_image_cache.php @@ -34,20 +34,48 @@ function privacy_image_cache_init() { $r = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' LIMIT 1", $urlhash ); if (count($r)) { $img_str = $r[0]['data']; + $mime = $r[0]["desc"]; + if ($mime == "") $mime = "image/jpeg"; } else { require_once("Photo.php"); $img_str = fetch_url($_REQUEST['url'],true); - $img = new Photo($img_str); - if($img->is_valid()) { - $img->store(0, 0, $urlhash, $_REQUEST['url'], '', 100); - $img_str = $img->imageString(); - } + if (substr($img_str, 0, 6) == "GIF89a") { + $mime = "image/gif"; + $image = @imagecreatefromstring($img_str); + + if($image === FALSE) die(); + + q("INSERT INTO `photo` + ( `uid`, `contact-id`, `guid`, `resource-id`, `created`, `edited`, `filename`, `album`, `height`, `width`, `desc`, `data`, `scale`, `profile`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid` ) + VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' )", + 0, 0, get_guid(), dbesc($urlhash), + dbesc(datetime_convert()), + dbesc(datetime_convert()), + dbesc(basename(dbesc($_REQUEST["url"]))), + dbesc(''), + intval(imagesy($image)), + intval(imagesx($image)), + 'image/gif', + dbesc($img_str), + 100, + intval(0), + dbesc(''), dbesc(''), dbesc(''), dbesc('') + ); + + } else { + $img = new Photo($img_str); + if($img->is_valid()) { + $img->store(0, 0, $urlhash, $_REQUEST['url'], '', 100); + $img_str = $img->imageString(); + } + $mime = "image/jpeg"; + } } - header("Content-type: image/jpeg"); + header("Content-type: $mime"); header("Expires: " . gmdate("D, d M Y H:i:s", time() + (3600*24)) . " GMT"); header("Cache-Control: max-age=" . (3600*24)); @@ -75,7 +103,7 @@ function privacy_image_cache_is_local_image($url) { function privacy_image_cache_img_cb($matches) { // following line changed per bug #431 if (privacy_image_cache_is_local_image($matches[2])) return $matches[1] . $matches[2] . $matches[3]; - return $matches[1] . "/privacy_image_cache/?url=" . escape_tags(addslashes(rawurlencode($matches[2]))) . $matches[3]; + return $matches[1] . get_app()->get_baseurl() . "/privacy_image_cache/?url=" . escape_tags(addslashes(rawurlencode($matches[2]))) . $matches[3]; } /** @@ -94,9 +122,9 @@ function privacy_image_cache_bbcode_hook(&$a, &$o) { function privacy_image_cache_display_item_hook(&$a, &$o) { if (isset($o["output"])) { if (isset($o["output"]["thumb"]) && !privacy_image_cache_is_local_image($o["output"]["thumb"])) - $o["output"]["thumb"] = "/privacy_image_cache/?url=" . escape_tags(addslashes(rawurlencode($o["output"]["thumb"]))); + $o["output"]["thumb"] = $a->get_baseurl() . "/privacy_image_cache/?url=" . escape_tags(addslashes(rawurlencode($o["output"]["thumb"]))); if (isset($o["output"]["author-avatar"]) && !privacy_image_cache_is_local_image($o["output"]["author-avatar"])) - $o["output"]["author-avatar"] = "/privacy_image_cache/?url=" . escape_tags(addslashes(rawurlencode($o["output"]["author-avatar"]))); + $o["output"]["author-avatar"] = $a->get_baseurl() . "/privacy_image_cache/?url=" . escape_tags(addslashes(rawurlencode($o["output"]["author-avatar"]))); } } @@ -107,7 +135,7 @@ function privacy_image_cache_display_item_hook(&$a, &$o) { */ function privacy_image_cache_ping_xmlize_hook(&$a, &$o) { if ($o["photo"] != "" && !privacy_image_cache_is_local_image($o["photo"])) - $o["photo"] = "/privacy_image_cache/?url=" . escape_tags(addslashes(rawurlencode($o["photo"]))); + $o["photo"] = $a->get_baseurl() . "/privacy_image_cache/?url=" . escape_tags(addslashes(rawurlencode($o["photo"]))); } diff --git a/smiley_pack.tgz b/smiley_pack.tgz index 7d66664c..a1358539 100644 Binary files a/smiley_pack.tgz and b/smiley_pack.tgz differ diff --git a/smiley_pack/lang/smiley_pack_fr/smiley_pack_fr.php b/smiley_pack/lang/smiley_pack_fr/smiley_pack_fr.php index fb6faee2..3ae70879 100644 --- a/smiley_pack/lang/smiley_pack_fr/smiley_pack_fr.php +++ b/smiley_pack/lang/smiley_pack_fr/smiley_pack_fr.php @@ -69,9 +69,6 @@ function smiley_pack_fr_smilies(&$a,&$b) { $b['texts'][] = ':grenouille'; $b['icons'][] = '' . ':grenouille' . ''; - $b['texts'][] = ':hamster'; - $b['icons'][] = '' . ':hamster' . ''; - $b['texts'][] = ':singe'; $b['icons'][] = '' . ':singe' . ''; @@ -81,9 +78,6 @@ function smiley_pack_fr_smilies(&$a,&$b) { $b['texts'][] = ':perroquet'; $b['icons'][] = '' . ':perroquet' . ''; - $b['texts'][] = ':tux'; - $b['icons'][] = '' . ':tux' . ''; - $b['texts'][] = ':escargot'; $b['icons'][] = '' . ':escargot' . ''; @@ -142,9 +136,6 @@ function smiley_pack_fr_smilies(&$a,&$b) { $b['texts'][] = ':afro'; $b['icons'][] = '' . ':afro' . ''; - $b['texts'][] = ':cool'; - $b['icons'][] = '' . ':cool' . ''; - #Devil/Angel Smileys $b['texts'][] = ':ange'; @@ -168,9 +159,6 @@ function smiley_pack_fr_smilies(&$a,&$b) { $b['texts'][] = ':possédé'; $b['icons'][] = '' . ':possédé' . ''; - $b['texts'][] = ':saint'; - $b['icons'][] = '' . ':saint' . ''; - $b['texts'][] = ':tombe'; $b['icons'][] = '' . ':tombe' . ''; @@ -182,9 +170,6 @@ function smiley_pack_fr_smilies(&$a,&$b) { $b['texts'][] = ':pèteaulit'; $b['icons'][] = '' . ':pèteaulit' . ''; - $b['texts'][] = ':vomit'; - $b['icons'][] = '' . ':vomit' . ''; - $b['texts'][] = ':pet'; $b['icons'][] = '' . ':pet' . ''; @@ -217,9 +202,6 @@ function smiley_pack_fr_smilies(&$a,&$b) { $b['texts'][] = ':basket'; $b['icons'][] = '' . ':basket' . ''; - $b['texts'][] = ':bowling'; - $b['icons'][] = '' . ':bowling' . ''; - $b['texts'][] = ':vélo'; $b['icons'][] = '' . ':vélo' . ''; @@ -229,9 +211,6 @@ function smiley_pack_fr_smilies(&$a,&$b) { $b['texts'][] = ':escrime'; $b['icons'][] = '' . ':escrime' . ''; - $b['texts'][] = ':golf'; - $b['icons'][] = '' . ':golf' . ''; - $b['texts'][] = ':jonglage'; $b['icons'][] = '' . ':jonglage' . ''; @@ -241,18 +220,12 @@ function smiley_pack_fr_smilies(&$a,&$b) { $b['texts'][] = ':arc'; $b['icons'][] = '' . ':arc' . ''; - $b['texts'][] = ':football'; - $b['icons'][] = '' . ':football' . ''; - $b['texts'][] = ':surf'; $b['icons'][] = '' . ':surf' . ''; $b['texts'][] = ':billard'; $b['icons'][] = '' . ':billard' . ''; - $b['texts'][] = ':tennis'; - $b['icons'][] = '' . ':tennis' . ''; - $b['texts'][] = ':équitation'; $b['icons'][] = '' . ':équitation' . ''; @@ -264,9 +237,6 @@ function smiley_pack_fr_smilies(&$a,&$b) { $b['texts'][] = ':amoureux'; $b['icons'][] = '' . ':amoureux' . ''; - $b['texts'][] = ':love'; - $b['icons'][] = '' . ':love' . ''; - $b['texts'][] = ':oursamour'; $b['icons'][] = '' . ':oursamour' . ''; @@ -298,9 +268,6 @@ function smiley_pack_fr_smilies(&$a,&$b) { $b['texts'][] = ':combatalien'; $b['icons'][] = '' . ':combatalien' . ''; - $b['texts'][] = ':alpha'; - $b['icons'][] = '' . ':alpha' . ''; - $b['texts'][] = ':armée'; $b['icons'][] = '' . ':armée' . ''; @@ -334,21 +301,6 @@ function smiley_pack_fr_smilies(&$a,&$b) { $b['texts'][] = ':mitrailleuse'; $b['icons'][] = '' . ':mitrailleuse' . ''; - $b['texts'][] = ':marine'; - $b['icons'][] = '' . ':marine' . ''; - - $b['texts'][] = ':sabre'; - $b['icons'][] = '' . ':sabre' . ''; - - $b['texts'][] = ':tank'; - $b['icons'][] = '' . ':tank' . ''; - - $b['texts'][] = ':viking'; - $b['icons'][] = '' . ':viking' . ''; - - $b['texts'][] = ':gangs'; - $b['icons'][] = '' . ':gangs' . ''; - $b['texts'][] = ':acide'; $b['icons'][] = '' . ':acide' . ''; @@ -363,9 +315,6 @@ function smiley_pack_fr_smilies(&$a,&$b) { $b['texts'][] = ':dinosaure'; $b['icons'][] = '' . ':dinosaure' . ''; - $b['texts'][] = ':dragon'; - $b['icons'][] = '' . ':dragon' . ''; - $b['texts'][] = ':petitdragon'; $b['icons'][] = '' . ':petitdragon' . ''; @@ -428,26 +377,11 @@ function smiley_pack_fr_smilies(&$a,&$b) { #Laugh smileys - $b['texts'][] = ':hahaha'; - $b['icons'][] = '' . ':hahaha' . ''; - - $b['texts'][] = ':loltv'; - $b['icons'][] = '' . ':loltv' . ''; - - $b['texts'][] = ':rofl'; - $b['icons'][] = '' . ':rofl' . ''; - #Music smileys - $b['texts'][] = ':dj'; - $b['icons'][] = '' . ':dj' . ''; - $b['texts'][] = ':batterie'; $b['icons'][] = '' . ':batterie' . ''; - $b['texts'][] = ':elvis'; - $b['icons'][] = '' . ':elivs' . ''; - $b['texts'][] = ':guitare'; $b['icons'][] = '' . ':guitare' . ''; @@ -468,24 +402,7 @@ function smiley_pack_fr_smilies(&$a,&$b) { $b['texts'][] = ':barbeblanche'; $b['icons'][] = '' . ':barbeblanche' . ''; - $b['texts'][] = ':shaka'; - $b['icons'][] = '' . ':shaka' . ''; - - $b['texts'][] = ':\\.../'; - $b['icons'][] = '' . ':\\.../' . ''; - - $b['texts'][] = ':\\ooo/'; - $b['icons'][] = '' . ':\\ooo/' . ''; - $b['texts'][] = ':tête'; $b['icons'][] = '' . ':tête' . ''; -#These two are still in core, so oldcore isn't strictly right, but we don't want too many directories - - $b['texts'][] = ':-d'; - $b['icons'][] = '' . ':-d' . ''; - - $b['texts'][] = ':-o'; - $b['icons'][] = '' . ':-o' . ''; - } diff --git a/smiley_pack/smiley_pack.php b/smiley_pack/smiley_pack.php index 74d1da06..258ade76 100644 --- a/smiley_pack/smiley_pack.php +++ b/smiley_pack/smiley_pack.php @@ -2,7 +2,7 @@ /* * Name: Smiley Pack * Description: Pack of smileys that make master too AOLish. - * Version: 1.02 + * Version: 1.04 * Author: Thomas Willingham (based on Mike Macgirvin's Adult Smile template) * All smileys from sites offering them as Public Domain */ @@ -141,9 +141,6 @@ function smiley_pack_smilies(&$a,&$b) { $b['texts'][] = ':affro'; $b['icons'][] = '' . ':affro' . ''; - $b['texts'][] = ':cool'; - $b['icons'][] = '' . ':cool' . ''; - #Devil/Angel Smileys $b['texts'][] = ':angel'; @@ -181,9 +178,6 @@ function smiley_pack_smilies(&$a,&$b) { $b['texts'][] = ':fartinbed'; $b['icons'][] = '' . ':fartinbed' . ''; - $b['texts'][] = ':vomit'; - $b['icons'][] = '' . ':vomit' . ''; - $b['texts'][] = ':fartblush'; $b['icons'][] = '' . ':fartblush' . ''; @@ -228,9 +222,6 @@ function smiley_pack_smilies(&$a,&$b) { $b['texts'][] = ':fencing'; $b['icons'][] = '' . ':fencing' . ''; - $b['texts'][] = ':golf'; - $b['icons'][] = '' . ':golf' . ''; - $b['texts'][] = ':juggling'; $b['icons'][] = '' . ':juggling' . ''; @@ -240,18 +231,12 @@ function smiley_pack_smilies(&$a,&$b) { $b['texts'][] = ':archery'; $b['icons'][] = '' . ':archery' . ''; - $b['texts'][] = ':football'; - $b['icons'][] = '' . ':football' . ''; - $b['texts'][] = ':surfing'; $b['icons'][] = '' . ':surfing' . ''; $b['texts'][] = ':snooker'; $b['icons'][] = '' . ':snooker' . ''; - $b['texts'][] = ':tennis'; - $b['icons'][] = '' . ':tennis' . ''; - $b['texts'][] = ':horseriding'; $b['icons'][] = '' . ':horseriding' . ''; @@ -297,9 +282,6 @@ function smiley_pack_smilies(&$a,&$b) { $b['texts'][] = ':alienfight'; $b['icons'][] = '' . ':alienfight' . ''; - $b['texts'][] = ':alpha'; - $b['icons'][] = '' . ':alpha' . ''; - $b['texts'][] = ':army'; $b['icons'][] = '' . ':army' . ''; @@ -333,21 +315,6 @@ function smiley_pack_smilies(&$a,&$b) { $b['texts'][] = ':machinegun'; $b['icons'][] = '' . ':machinegun' . ''; - $b['texts'][] = ':marine'; - $b['icons'][] = '' . ':marine' . ''; - - $b['texts'][] = ':sabre'; - $b['icons'][] = '' . ':sabre' . ''; - - $b['texts'][] = ':tank'; - $b['icons'][] = '' . ':tank' . ''; - - $b['texts'][] = ':viking'; - $b['icons'][] = '' . ':viking' . ''; - - $b['texts'][] = ':gangs'; - $b['icons'][] = '' . ':gangs' . ''; - $b['texts'][] = ':acid'; $b['icons'][] = '' . ':acid' . ''; @@ -438,14 +405,9 @@ function smiley_pack_smilies(&$a,&$b) { #Music smileys - $b['texts'][] = ':dj'; - $b['icons'][] = '' . ':dj' . ''; - $b['texts'][] = ':drums'; $b['icons'][] = '' . ':drums' . ''; - $b['texts'][] = ':elvis'; - $b['icons'][] = '' . ':elivs' . ''; $b['texts'][] = ':guitar'; $b['icons'][] = '' . ':guitar' . ''; @@ -453,9 +415,6 @@ function smiley_pack_smilies(&$a,&$b) { $b['texts'][] = ':trumpet'; $b['icons'][] = '' . ':trumpet' . ''; - $b['texts'][] = ':violin'; - $b['icons'][] = '' . ':violin' . ''; - #Smileys that used to be in core $b['texts'][] = ':headbang'; @@ -487,7 +446,50 @@ function smiley_pack_smilies(&$a,&$b) { $b['texts'][] = ':-o'; $b['icons'][] = '' . ':-o' . ''; +# Regex killers - stick these at the bottom so they appear at the end of the English and +# at the start of $OtherLanguage. + + $b['texts'][] = ':cool'; + $b['icons'][] = '' . ':cool' . ''; + + $b['texts'][] = ':vomit'; + $b['icons'][] = '' . ':vomit' . ''; + + $b['texts'][] = ':golf'; + $b['icons'][] = '' . ':golf' . ''; + + $b['texts'][] = ':football'; + $b['icons'][] = '' . ':football' . ''; + + $b['texts'][] = ':tennis'; + $b['icons'][] = '' . ':tennis' . ''; + + $b['texts'][] = ':alpha'; + $b['icons'][] = '' . ':alpha' . ''; + + $b['texts'][] = ':marine'; + $b['icons'][] = '' . ':marine' . ''; + + $b['texts'][] = ':sabre'; + $b['icons'][] = '' . ':sabre' . ''; + + $b['texts'][] = ':tank'; + $b['icons'][] = '' . ':tank' . ''; + + $b['texts'][] = ':viking'; + $b['icons'][] = '' . ':viking' . ''; + + $b['texts'][] = ':gangs'; + $b['icons'][] = '' . ':gangs' . ''; + $b['texts'][] = ':dj'; + $b['icons'][] = '' . ':dj' . ''; + + $b['texts'][] = ':elvis'; + $b['icons'][] = '' . ':elivs' . ''; + + $b['texts'][] = ':violin'; + $b['icons'][] = '' . ':violin' . ''; }