]> git.mxchange.org Git - friendica-addons.git/commitdiff
Merge branch 'master' of git://github.com/friendica/friendica-addons
authorTobias Hößl <tobias@hoessl.eu>
Sat, 31 Mar 2012 08:16:12 +0000 (08:16 +0000)
committerTobias Hößl <tobias@hoessl.eu>
Sat, 31 Mar 2012 08:16:12 +0000 (08:16 +0000)
18 files changed:
.gitignore [deleted file]
facebook.tgz
facebook/facebook.php
namethingy.tgz [new file with mode: 0644]
namethingy/namethingy.php [new file with mode: 0755]
page.tgz
page/page.php
pages.tgz
pages/pages.php
showmore.tgz
showmore/showmore.php
smiley_pack.tgz
smiley_pack/.smiley_pack.php.kate-swp [deleted file]
smiley_pack/icons/disgust/fartblush.gif [new file with mode: 0644]
viewsrc.tgz
viewsrc/viewsrc.php
widgets.tgz
widgets/widgets.php

diff --git a/.gitignore b/.gitignore
deleted file mode 100755 (executable)
index 88dec63..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-favicon.*
-.htconfig.php
-\#*
-include/jquery-1.4.2.min.js
-*.log
-*.out
-*.version*
-#favicon.*
-#home.html
-#addon
-*~
-
-#ignore documentation, it should be newly built 
-#doc/api
-
-#ignore reports, should be generted with every build
-report/
-
-#ignore config files from eclipse, we don't want IDE files in our repository
-.project
-.buildpath
-.externalToolBuilders
-.settings
index 0677862048dca75dcfc94365c792288ce2b5e375..bad3991644ae0216fb308f90a30b53de536e10d3 100644 (file)
Binary files a/facebook.tgz and b/facebook.tgz differ
index e433c98ef95a8b856315a7d30f569ff687982316..33d7d187007b889e530ec5fb59fbcbcc0f87ae11 100755 (executable)
@@ -673,6 +673,7 @@ function facebook_post_hook(&$a,&$b) {
         */
 
        require_once('include/group.php');
+       require_once('include/html2plain.php');
 
        logger('Facebook post');
 
@@ -793,7 +794,7 @@ function facebook_post_hook(&$a,&$b) {
                                if($b['verb'] == ACTIVITY_DISLIKE)
                                        $msg = trim(strip_tags(bbcode($msg)));
 
-                               $search_str = $a->get_baseurl() . '/search';
+                               /*$search_str = $a->get_baseurl() . '/search';
 
                                if(preg_match("/\[url=(.*?)\](.*?)\[\/url\]/is",$msg,$matches)) {
 
@@ -822,25 +823,51 @@ function facebook_post_hook(&$a,&$b) {
                                if((strpos($link,z_root()) !== false) && (! $image))
                                        $image = $a->get_baseurl() . '/images/friendica-64.jpg';
 
-                               $msg = trim(strip_tags(bbcode($msg)));
+                               $msg = trim(strip_tags(bbcode($msg)));*/
+
+                               // Test
+
+                               // Looking for images
+                               if(preg_match("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/is",$b['body'],$matches))
+                                       $image = $matches[3];
+
+                               if(preg_match("/\[img\](.*?)\[\/img\]/is",$b['body'],$matches))
+                                       $image = $matches[1];
+
+                               $html = bbcode($b['body']);
+                               $msg = trim($b['title']." \n".html2plain($html, 0, true));
                                $msg = html_entity_decode($msg,ENT_QUOTES,'UTF-8');
 
+                               $toolong = false;
+
                                // add any attachments as text urls
 
-                           $arr = explode(',',$b['attach']);
+                               $arr = explode(',',$b['attach']);
 
-                           if(count($arr)) {
+                               if(count($arr)) {
                                        $msg .= "\n";
-                               foreach($arr as $r) {
-                               $matches = false;
+                                       foreach($arr as $r) {
+                                               $matches = false;
                                                $cnt = preg_match('|\[attach\]href=\"(.*?)\" size=\"(.*?)\" type=\"(.*?)\" title=\"(.*?)\"\[\/attach\]|',$r,$matches);
                                                if($cnt) {
-                                                       $msg .= $matches[1];
+                                                       $msg .= "\n".$matches[1];
                                                }
                                        }
                                }
 
-                               if (strlen($msg) > FACEBOOK_MAXPOSTLEN) {
+                               // To-Do: look for bookmark-bbcode and handle it with priority
+
+                               $links = collecturls($html);
+                               if (sizeof($links) > 0) {
+                                       reset($links);
+                                       $link = current($links);
+                                       /*if (strlen($msg."\n".$link) <= FACEBOOK_MAXPOSTLEN)
+                                               $msg .= "\n".$link;
+                                       else
+                                               $toolong = true;*/
+                               }
+
+                               if ((strlen($msg) > FACEBOOK_MAXPOSTLEN) or $toolong) {
                                        $shortlink = "";
                                        require_once('library/slinky.php');
 
@@ -1588,4 +1615,4 @@ function facebook_delete_url($url,$headers = null, &$redirects = 0, $timeout = 0
 
        curl_close($ch);
        return($body);
-}}
\ No newline at end of file
+}}
diff --git a/namethingy.tgz b/namethingy.tgz
new file mode 100644 (file)
index 0000000..9642e38
Binary files /dev/null and b/namethingy.tgz differ
diff --git a/namethingy/namethingy.php b/namethingy/namethingy.php
new file mode 100755 (executable)
index 0000000..0ccf106
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+
+/**
+ *
+ * Name: NameThingy
+ * Description: The Ultimate Random Name Generator
+ * Version: 1.0
+ * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
+ */
+
+
+function namethingy_install() {
+    register_hook('app_menu', 'addon/namethingy/namethingy.php', 'namethingy_app_menu');
+}
+
+function namethingy_uninstall() {
+    unregister_hook('app_menu', 'addon/namethingy/namethingy.php', 'namethingy_app_menu');
+
+}
+
+function namethingy_app_menu($a,&$b) {
+    $b['app_menu'][] = '<div class="app-title"><a href="namethingy">NameThingy</a></div>';
+}
+
+
+function namethingy_module() {}
+
+function namethingy_content(&$a) {
+
+$baseurl = $a->get_baseurl() . '/addon/namethingy';
+
+$o .= <<< EOT
+<iframe src="http://namethingy.com" width="900" height="700" />
+EOT;
+
+return $o;
+}
index aebbe4dd8c4a14d43181d8e2bc8b6f3151b67c17..84fb7b81480dc2f78f829613d5046bdf223f5f92 100644 (file)
Binary files a/page.tgz and b/page.tgz differ
index 2a65cab88cbdcb4b831c0e4f750b1cfc441113b0..72972eded43064a970d1db2962e9cac3ab64aa01 100755 (executable)
@@ -44,7 +44,7 @@ function page_page_end($a,&$b) {
 
        $page = '<div id="page-sidebar" class="widget">
                        <div class="title tool">
-                       <h3>'.t("Community Pages").'</h3></div>
+                       <h3>'.t("Forums").'</h3></div>
                        <div id="sidebar-page-list"><ul>';
 
        $contacts = page_getpage($a->user['uid']);
index 7be170afa3a968cc049ec11260e8ae8a386629ab..1a0aa4187669861309319e2b263aa6fa61bf5431 100644 (file)
Binary files a/pages.tgz and b/pages.tgz differ
index bc56d2e4e9cafc0642cb1182218652116eee6df1..d0cdc589c71487eeda976e767e71c18f1ad62e5c 100755 (executable)
@@ -82,7 +82,12 @@ function pages_page_end($a,&$b) {
                                $contact["Name"]."</a></li>";
        }
        $pages .= "</ul></div></div>";
-       if (sizeof($contacts) > 0)
-               $a->page['aside'] = $pages.$a->page['aside'];
+       if (sizeof($contacts) > 0) {
+               $pos = strpos($a->page['aside'], '<div id="saved-search-list"');
+               if ($pos > 0) {
+                       $a->page['aside'] = substr($a->page['aside'], 0, $pos).$pages.substr($a->page['aside'], $pos);
+               } else
+                       $a->page['aside'] = $pages.$a->page['aside'];
+       }
 }
 ?>
index 6c2203a15b96292b5190a255f3d90ff05a3a895d..016ad5212e616299e46e532b85a10db79717d2cb 100644 (file)
Binary files a/showmore.tgz and b/showmore.tgz differ
index 7842a58e624c8473b4970838f3d9dd800ae2c62e..6aeb6ff3ba770ae45d503708c116707ead597cad 100755 (executable)
@@ -83,7 +83,7 @@ function showmore_prepare_body(&$a,&$b) {
        if($found) {
                $rnd = random_string(8);
                $b['html'] = '<span id="showmore-teaser-'.$rnd.'" style="display: block;">'.$shortened." ".
-                               '<span id="showmore-wrap-'.$rnd.'" style="white-space:nowrap;" class="fakelink" onclick="openClose(\'showmore-'.$rnd.'\'); openClose(\'showmore-teaser-'.$rnd.'\');" >'.sprintf(t('Show More')).'</span></span>'.
+                               '<span id="showmore-wrap-'.$rnd.'" style="white-space:nowrap;" class="fakelink" onclick="openClose(\'showmore-'.$rnd.'\'); openClose(\'showmore-teaser-'.$rnd.'\');" >'.sprintf(t('show more')).'</span></span>'.
                                '<div id="showmore-'.$rnd.'" style="display: none;">'.$b['html'].'</div>';
        }
 }
index 2352811992b1596b3dc4910df280c7a5afe140a0..384c6b9b3dd3c0d8ff4af175ed6e6f37548482e8 100644 (file)
Binary files a/smiley_pack.tgz and b/smiley_pack.tgz differ
diff --git a/smiley_pack/.smiley_pack.php.kate-swp b/smiley_pack/.smiley_pack.php.kate-swp
deleted file mode 100644 (file)
index 73a77b3..0000000
Binary files a/smiley_pack/.smiley_pack.php.kate-swp and /dev/null differ
diff --git a/smiley_pack/icons/disgust/fartblush.gif b/smiley_pack/icons/disgust/fartblush.gif
new file mode 100644 (file)
index 0000000..4160a1f
Binary files /dev/null and b/smiley_pack/icons/disgust/fartblush.gif differ
index 4717ab05bf134e9d2d32822543342315101a8dbe..2ace240a6fef124011513f485166f93df404300f 100644 (file)
Binary files a/viewsrc.tgz and b/viewsrc.tgz differ
index e39fe8a6a7215b959ba339bc7789279405509a72..f165e9c5353ba73dd63bf2537bb691074eccb0d7 100644 (file)
 
 function viewsrc_install() {
        register_hook('item_photo_menu', 'addon/viewsrc/viewsrc.php', 'viewsrc_item_photo_menu');
+       register_hook('page_end', 'addon/viewsrc/viewsrc.php', 'viewsrc_page_end');
 }
 
 
 function viewsrc_uninstall() {
        unregister_hook('item_photo_menu', 'addon/viewsrc/viewsrc.php', 'viewsrc_item_photo_menu');
+       unregister_hook('page_end', 'addon/viewsrc/viewsrc.php', 'viewsrc_page_end');
+
 }
 
+function viewsrc_page_end(&$a, &$o){
+       $a->page['htmlhead'] .= <<< EOS
+       <script>
+               $(function(){
+                       $('a[href*="/viewsrc/"]').fancybox();
+               });
+       </script>
+EOS;
+}
 
 function viewsrc_item_photo_menu(&$a,&$b) {
-       if(! local_user())
+       if((! local_user()) || (local_user() != $b['item']['uid']))
                return;
        $b['menu'] = array_merge( array( t('View Source') => $a->get_baseurl() . '/viewsrc/'. $b['item']['id']), $b['menu']);
 
index c1d96048590adb215747e7cb8e85518b125f8528..47d5f588c285e211f26093c1d99cdccb23bdc093 100755 (executable)
Binary files a/widgets.tgz and b/widgets.tgz differ
index 27cabfd698cdec6580ee39d9c99b2ff0d8699fbd..47a6e48a6fe6deea6903fb25b3d8f4244206112a 100755 (executable)
@@ -19,7 +19,8 @@ function widgets_uninstall() {
 
 
 function widgets_settings_post(){
-       
+       if(! local_user())
+               return;
        if (isset($_POST['widgets-submit'])){
                del_pconfig(local_user(), 'widgets', 'key');