diff --git a/conf/nginx.conf b/conf/nginx.conf index cc966b89..abdbbefe 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,4 +1,4 @@ -location YNH_WWW_PATH / { +location YNH_WWW_PATH { # Path to source alias YNH_WWW_ALIAS/ ; diff --git a/sources/addon/adultphotoflag b/sources/addon/adultphotoflag deleted file mode 120000 index 024e70fd..00000000 --- a/sources/addon/adultphotoflag +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/adultphotoflag \ No newline at end of file diff --git a/sources/addon/bbmath b/sources/addon/bbmath deleted file mode 120000 index 8e149947..00000000 --- a/sources/addon/bbmath +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/bbmath \ No newline at end of file diff --git a/sources/addon/bookmarker b/sources/addon/bookmarker deleted file mode 120000 index 5ded7cf2..00000000 --- a/sources/addon/bookmarker +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/bookmarker \ No newline at end of file diff --git a/sources/addon/buglink b/sources/addon/buglink deleted file mode 120000 index 2d77f27a..00000000 --- a/sources/addon/buglink +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/buglink \ No newline at end of file diff --git a/sources/addon/calc b/sources/addon/calc deleted file mode 120000 index 44461b0f..00000000 --- a/sources/addon/calc +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/calc \ No newline at end of file diff --git a/sources/addon/chords b/sources/addon/chords deleted file mode 120000 index 9b5afa56..00000000 --- a/sources/addon/chords +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/chords \ No newline at end of file diff --git a/sources/addon/custom_home b/sources/addon/custom_home deleted file mode 120000 index bcf608f3..00000000 --- a/sources/addon/custom_home +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/custom_home \ No newline at end of file diff --git a/sources/addon/diaspora b/sources/addon/diaspora deleted file mode 120000 index 18fe8f4e..00000000 --- a/sources/addon/diaspora +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/diaspora \ No newline at end of file diff --git a/sources/addon/diaspost b/sources/addon/diaspost deleted file mode 120000 index c9ae3e9e..00000000 --- a/sources/addon/diaspost +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/diaspost \ No newline at end of file diff --git a/sources/addon/dirstats b/sources/addon/dirstats deleted file mode 120000 index 2b3a3bd5..00000000 --- a/sources/addon/dirstats +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/dirstats \ No newline at end of file diff --git a/sources/addon/donate b/sources/addon/donate deleted file mode 120000 index 2c392ad6..00000000 --- a/sources/addon/donate +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/donate \ No newline at end of file diff --git a/sources/addon/dwpost b/sources/addon/dwpost deleted file mode 120000 index 435ef3a1..00000000 --- a/sources/addon/dwpost +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/dwpost \ No newline at end of file diff --git a/sources/addon/embedly b/sources/addon/embedly deleted file mode 120000 index 2bf8e1e6..00000000 --- a/sources/addon/embedly +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/embedly \ No newline at end of file diff --git a/sources/addon/extcron b/sources/addon/extcron deleted file mode 120000 index 0e8d5b10..00000000 --- a/sources/addon/extcron +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/extcron \ No newline at end of file diff --git a/sources/addon/flattrwidget b/sources/addon/flattrwidget deleted file mode 120000 index fc9233d8..00000000 --- a/sources/addon/flattrwidget +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/flattrwidget \ No newline at end of file diff --git a/sources/addon/fortunate b/sources/addon/fortunate deleted file mode 120000 index 9b6e449b..00000000 --- a/sources/addon/fortunate +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/fortunate \ No newline at end of file diff --git a/sources/addon/frphotos b/sources/addon/frphotos deleted file mode 120000 index a48db497..00000000 --- a/sources/addon/frphotos +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/frphotos \ No newline at end of file diff --git a/sources/addon/hexit b/sources/addon/hexit deleted file mode 120000 index 003aeca3..00000000 --- a/sources/addon/hexit +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/hexit \ No newline at end of file diff --git a/sources/addon/ijpost b/sources/addon/ijpost deleted file mode 120000 index a2c28c85..00000000 --- a/sources/addon/ijpost +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/ijpost \ No newline at end of file diff --git a/sources/addon/irc b/sources/addon/irc deleted file mode 120000 index 96bb702f..00000000 --- a/sources/addon/irc +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/irc \ No newline at end of file diff --git a/sources/addon/jappixmini b/sources/addon/jappixmini deleted file mode 120000 index 57a425f2..00000000 --- a/sources/addon/jappixmini +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/jappixmini \ No newline at end of file diff --git a/sources/addon/js_upload b/sources/addon/js_upload deleted file mode 120000 index 954a68cb..00000000 --- a/sources/addon/js_upload +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/js_upload \ No newline at end of file diff --git a/sources/addon/ldapauth b/sources/addon/ldapauth deleted file mode 120000 index 9110cc08..00000000 --- a/sources/addon/ldapauth +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/ldapauth \ No newline at end of file diff --git a/sources/addon/libertree b/sources/addon/libertree deleted file mode 120000 index ad355bb4..00000000 --- a/sources/addon/libertree +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/libertree \ No newline at end of file diff --git a/sources/addon/likebanner b/sources/addon/likebanner deleted file mode 120000 index bcaf7710..00000000 --- a/sources/addon/likebanner +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/likebanner \ No newline at end of file diff --git a/sources/addon/ljpost b/sources/addon/ljpost deleted file mode 120000 index 2912d56a..00000000 --- a/sources/addon/ljpost +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/ljpost \ No newline at end of file diff --git a/sources/addon/mahjongg b/sources/addon/mahjongg deleted file mode 120000 index aed1a8be..00000000 --- a/sources/addon/mahjongg +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/mahjongg \ No newline at end of file diff --git a/sources/addon/mailhost b/sources/addon/mailhost deleted file mode 120000 index 926de865..00000000 --- a/sources/addon/mailhost +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/mailhost \ No newline at end of file diff --git a/sources/addon/morechoice b/sources/addon/morechoice deleted file mode 120000 index eede88f3..00000000 --- a/sources/addon/morechoice +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/morechoice \ No newline at end of file diff --git a/sources/addon/moremoods b/sources/addon/moremoods deleted file mode 120000 index 26462449..00000000 --- a/sources/addon/moremoods +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/moremoods \ No newline at end of file diff --git a/sources/addon/nofed b/sources/addon/nofed deleted file mode 120000 index e47fa5f9..00000000 --- a/sources/addon/nofed +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/nofed \ No newline at end of file diff --git a/sources/addon/nsabait b/sources/addon/nsabait deleted file mode 120000 index dbc91b1f..00000000 --- a/sources/addon/nsabait +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/nsabait \ No newline at end of file diff --git a/sources/addon/nsfw b/sources/addon/nsfw deleted file mode 120000 index 45f9d6e5..00000000 --- a/sources/addon/nsfw +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/nsfw \ No newline at end of file diff --git a/sources/addon/openclipatar b/sources/addon/openclipatar deleted file mode 120000 index 1aca7361..00000000 --- a/sources/addon/openclipatar +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/openclipatar \ No newline at end of file diff --git a/sources/addon/openstreetmap b/sources/addon/openstreetmap deleted file mode 120000 index 502e623f..00000000 --- a/sources/addon/openstreetmap +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/openstreetmap \ No newline at end of file diff --git a/sources/addon/piwik b/sources/addon/piwik deleted file mode 120000 index 1c02b005..00000000 --- a/sources/addon/piwik +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/piwik \ No newline at end of file diff --git a/sources/addon/planets b/sources/addon/planets deleted file mode 120000 index 623f5cf0..00000000 --- a/sources/addon/planets +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/planets \ No newline at end of file diff --git a/sources/addon/pumpio b/sources/addon/pumpio deleted file mode 120000 index 8d2db101..00000000 --- a/sources/addon/pumpio +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/pumpio \ No newline at end of file diff --git a/sources/addon/qrator b/sources/addon/qrator deleted file mode 120000 index dfc52e0a..00000000 --- a/sources/addon/qrator +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/qrator \ No newline at end of file diff --git a/sources/addon/rainbowtag b/sources/addon/rainbowtag deleted file mode 120000 index 382135e6..00000000 --- a/sources/addon/rainbowtag +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/rainbowtag \ No newline at end of file diff --git a/sources/addon/randpost b/sources/addon/randpost deleted file mode 120000 index 7d19da3e..00000000 --- a/sources/addon/randpost +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/randpost \ No newline at end of file diff --git a/sources/addon/redphotos b/sources/addon/redphotos deleted file mode 120000 index 5f4aade9..00000000 --- a/sources/addon/redphotos +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/redphotos \ No newline at end of file diff --git a/sources/addon/redred b/sources/addon/redred deleted file mode 120000 index 3970fca4..00000000 --- a/sources/addon/redred +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/redred \ No newline at end of file diff --git a/sources/addon/rtof b/sources/addon/rtof deleted file mode 120000 index 1571f258..00000000 --- a/sources/addon/rtof +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/rtof \ No newline at end of file diff --git a/sources/addon/sendzid b/sources/addon/sendzid deleted file mode 120000 index e1b1d238..00000000 --- a/sources/addon/sendzid +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/sendzid \ No newline at end of file diff --git a/sources/addon/smiley_pack b/sources/addon/smiley_pack deleted file mode 120000 index 971efecf..00000000 --- a/sources/addon/smiley_pack +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/smiley_pack \ No newline at end of file diff --git a/sources/addon/smileybutton b/sources/addon/smileybutton deleted file mode 120000 index 51d06824..00000000 --- a/sources/addon/smileybutton +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/smileybutton \ No newline at end of file diff --git a/sources/addon/startpage b/sources/addon/startpage deleted file mode 120000 index be49638d..00000000 --- a/sources/addon/startpage +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/startpage \ No newline at end of file diff --git a/sources/addon/statistics_json b/sources/addon/statistics_json deleted file mode 120000 index cdd6ca3e..00000000 --- a/sources/addon/statistics_json +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/statistics_json \ No newline at end of file diff --git a/sources/addon/statusnet b/sources/addon/statusnet deleted file mode 120000 index 3297a173..00000000 --- a/sources/addon/statusnet +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/statusnet \ No newline at end of file diff --git a/sources/addon/superblock b/sources/addon/superblock deleted file mode 120000 index f2b1ef07..00000000 --- a/sources/addon/superblock +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/superblock \ No newline at end of file diff --git a/sources/addon/tictac b/sources/addon/tictac deleted file mode 120000 index a65e7d37..00000000 --- a/sources/addon/tictac +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/tictac \ No newline at end of file diff --git a/sources/addon/torch b/sources/addon/torch deleted file mode 120000 index 10bbde90..00000000 --- a/sources/addon/torch +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/torch \ No newline at end of file diff --git a/sources/addon/tour b/sources/addon/tour deleted file mode 120000 index 2e83e52d..00000000 --- a/sources/addon/tour +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/tour \ No newline at end of file diff --git a/sources/addon/twitter b/sources/addon/twitter deleted file mode 120000 index 6286a41c..00000000 --- a/sources/addon/twitter +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/twitter \ No newline at end of file diff --git a/sources/addon/upload_limits b/sources/addon/upload_limits deleted file mode 120000 index ad196540..00000000 --- a/sources/addon/upload_limits +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/upload_limits \ No newline at end of file diff --git a/sources/addon/visage b/sources/addon/visage deleted file mode 120000 index 9ba0502a..00000000 --- a/sources/addon/visage +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/visage \ No newline at end of file diff --git a/sources/addon/wppost b/sources/addon/wppost deleted file mode 120000 index 2f23099f..00000000 --- a/sources/addon/wppost +++ /dev/null @@ -1 +0,0 @@ -../extend/addon/official/wppost \ No newline at end of file diff --git a/sources/addons/.gitignore b/sources/addons/.gitignore new file mode 100644 index 00000000..5dade782 --- /dev/null +++ b/sources/addons/.gitignore @@ -0,0 +1,24 @@ +favicon.* +.htconfig.php +\#* +*.log +*.out +*.version* +favicon.* +*~ + +#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 +#ignore OSX .DS_Store files +.DS_Store + +/nbproject/private/ + +#Kdevelop project files +*.kdev4 diff --git a/sources/addons/README.md b/sources/addons/README.md new file mode 100644 index 00000000..ffb55595 --- /dev/null +++ b/sources/addons/README.md @@ -0,0 +1,6 @@ +hubzilla-addons +================ + +These are addons for hubzilla sites (see https://github.com/redmatrix/hubzilla ) + + diff --git a/sources/addons/adultphotoflag/adultphotoflag.php b/sources/addons/adultphotoflag/adultphotoflag.php new file mode 100755 index 00000000..a8b1371a --- /dev/null +++ b/sources/addons/adultphotoflag/adultphotoflag.php @@ -0,0 +1,28 @@ + + + */ + +function adultphotoflag_load() { + register_hook('get_features','addon/adultphotoflag/adultphotoflag.php','adultphotoflag_get_features'); +} + +function adultphotoflag_unload() { + unregister_hook('get_features','addon/adultphotoflag/adultphotoflag.php','adultphotoflag_get_features'); +} + +function adultphotoflag_get_features(&$a,&$b) { + + $b['tools'][] = array( + 'adult_photo_flagging', + t('Flag Adult Photos'), + t('Provide photo edit option to hide inappropriate photos from default album view'),false); + +} + diff --git a/sources/addons/bbmath/README b/sources/addons/bbmath/README new file mode 100644 index 00000000..e2e9f62c --- /dev/null +++ b/sources/addons/bbmath/README @@ -0,0 +1,3 @@ +Adds a new tag, [tex] that can be used in bbcode. Note that you still also have to use $...$ to get equations correct, i.e. [tex] doesn't eneter math-mode by default. + +Requires images and tmp directory in your Red root directory (e.g. /var/www/red). Must be writable by server (e.g chown -R www-data tmp images). Also requires latex and imagemagick to be installed. diff --git a/sources/addons/bbmath/bbmath.php b/sources/addons/bbmath/bbmath.php new file mode 100644 index 00000000..118772dd --- /dev/null +++ b/sources/addons/bbmath/bbmath.php @@ -0,0 +1,22 @@ + + * + */ + +require_once('phplatex.php'); +function bbmath_load() { + register_hook('bbcode','addon/bbmath/bbmath.php','bbmath_bbcode'); + +} +function bbmath_unload() { + unregister_hook('bbcode','addon/bbmath/bbmath.php','bbmath_bbcode'); +} + +function bbmath_bbcode($a,&$text) { + $text = preg_replace_callback('|\[tex\](.*?)\[/tex\]|',function($m) { return texify($m[1]); },$text); +} diff --git a/sources/addons/bbmath/gpl.txt b/sources/addons/bbmath/gpl.txt new file mode 100644 index 00000000..d511905c --- /dev/null +++ b/sources/addons/bbmath/gpl.txt @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/sources/addons/bbmath/phplatex.php b/sources/addons/bbmath/phplatex.php new file mode 100644 index 00000000..cf10cd94 --- /dev/null +++ b/sources/addons/bbmath/phplatex.php @@ -0,0 +1,139 @@ +300) $dpi=300; + + $back=phplatex_colorhex($br,$bg,$bb); + $fore=phplatex_colorhex($r,$g,$b); + + # Figure out TeX, either to get the right cache entry or to, you know, compile + # Semi-common (ams) symbol packages are included. + $totex = "\\documentclass[14pt,landscape]{extarticle}\n". + "\\usepackage{color}\n". + "\\usepackage{amsmath}\n\\usepackage{amsfonts}\n\\usepackage{amssymb}\n". + $extraprelude."\n". + "\\pagestyle{empty}\n". #removes header/footer; necessary for trim + "\\begin{document}\n". + "\\color[rgb]{".$r.",".$g.",".$b."}\n". + "\\pagecolor[rgb]{".$br.",".$bg.",".$bb."}\n". + $string."\n". + "\\end{document}\n"; + + $strhash = sha1($totex).'.'.$dpi; #file cache entry string: 40-char hash string plus size + $stralt = str_replace("&","&", preg_replace("/[\"\n]/","",$string)); #stuck in the alt and title attributes + #May need some extra safety. + $heredir=getcwd(); + + #Experiment: Tries to adjust vertical positioning, so that rendered TeX text looks natural enough inline with HTML text + #Only descenders are really a problem since HTML's leeway is upwards. + #TODO: This can always use more work. + # Avoid using characters that are part of TeX commands. + # Some things vary per font, e.g. the slash. In the default CM it is a descender, in Times and others it isn't. + $ascenders ="/(b|d|f|h|i|j|k|l|t|A|B|C|D|E|F|G|H|I|J|L|K|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|\[|\]|\\{|\\}|\(|\)|\/|0|1|2|3|4|5|6|7|8|9|\\#|\*|\?|'|\\\\'|\\\\`|\\\\v)/"; + $monoliners="/(a|c|e|m|n|o|r|s|u|v|w|x|z|-|=|\+|:|.)/"; + $descenders="/(g|j|p|\/|q|y|Q|,|;|\[|\]|\\{|\\}|\(|\)|\#|\\\\LaTeX|\\\\TeX|\\\\c\{)/"; + $deepdescenders="/(\[|\]|\\{|\\}|\(|\)|\\int)/"; + + $ba = preg_match_all($ascenders, $string,$m); + $bm = preg_match_all($monoliners, $string,$m); + $bd = preg_match_all($descenders, $string,$m); + $dd = preg_match_all($deepdescenders, $string,$m); + if ($dd>0) $verticalalign="vertical-align: -25%"; # deep descenders: move down + else if ($bd>0 && $ba==0) $verticalalign="vertical-align: -15%"; # descenders: move down + else if ($bd==0 && $ba>0) $verticalalign="vertical-align: 0%"; # ascenders only: move up/do nothing? + else if ($bd==0 && $ba==0) $verticalalign="vertical-align: 0%"; # neither vertical-align: 0% + else $verticalalign="vertical-align: -15%"; # both ascender and regular descender + + #check image cache, return link if exists + #the vertical-align is to fix text baseline/descender(/tail) details in and on-average sort of way + if (file_exists($heredir.'/images/'.$strhash.'.'.$imgfmt)) + return ''.$stralt.''; + + + #chdir to have superfluous files be created in tmp. (you stiill have to empty this yourself) + error_reporting(0); # not checking existence myself, that would be double. + if (chdir("tmp")===FALSE) { return '[directory access error, fix permissions]'; } #I should chech whether file creation is allowed to give a nice error for that problem case + error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); # TODO: set old value + + $tfn = tempnam(getcwd(), 'PTX'); #file in tmp dir + + #write temporary .tex file + if ( ($tex = fopen($tfn.'.tex', "w"))==FALSE) { return '[file access error] '.phplatex_cleantmp($tfn,$heredir); } + fwrite($tex, $totex); + fclose($tex); + + + #Run latex to create a .dvi. Have it try to fix minor errors instead of breaking/pausing on them. + exec($path_to_latex.' --interaction=nonstopmode '.$tfn.'.tex'); + if (!file_exists($tfn.".dvi")) { + $log = file_get_contents($tfn.'.log'); #The log always exists, but now it's actually interesting since it'll contain an error + return '[latex error, code follows]
'.$totex.'

Log file:

'.$log.'

'.phplatex_cleantmp($tfn,$heredir); + } + + + #DVI -> PostScript. Since dvips uses lpr, which may be configured to actually print by default, force writing to a file with -o + exec($path_to_dvips.' '.$tfn.'.dvi -o '.$tfn.'.ps'); + if ( !file_exists($tfn.'.ps')) { + return '[dvi2ps error] '.phplatex_cleantmp($tfn,$heredir); + } + + + #PostScript -> image. Trim based on corner pixel, and set transparent color. + exec($path_to_convert.' -transparent-color "#'.$back.'" -colorspace RGB -density '.$dpi.' -trim +page '.$tfn.'.ps -transparent "#'.$back.'" '.$tfn.'.'.$imgfmt); + #Note: +page OR -page +0+0 OR +repage moves the image to the cropped area (kills offset) + #Older code tried: exec('/usr/bin/mogrify -density 90 -trim +page -format $imgfmt '.$tfn.'.ps'); + # It seems some versions of convert may not have -trim. Old versions? + + if (!file_exists($tfn.'.'.$imgfmt)) { + return '[image convert error] '.phplatex_cleantmp($tfn,$heredir); + } + + #Copy result image to chache. + copy($tfn.'.'.$imgfmt, $heredir.'/images/'.$strhash.'.'.$imgfmt); + + #Clean up temporary files, and return link to just-created image + return phplatex_cleantmp($tfn,$heredir).'LaTeX formula: '.$stralt.''; +} +?> diff --git a/sources/addons/bookmarker/bookmarker.php b/sources/addons/bookmarker/bookmarker.php new file mode 100755 index 00000000..41a86350 --- /dev/null +++ b/sources/addons/bookmarker/bookmarker.php @@ -0,0 +1,41 @@ + + * + */ + +function bookmarker_install() { + register_hook('prepare_body', 'addon/bookmarker/bookmarker.php', 'bookmarker_prepare_body', 10); +} + + +function bookmarker_uninstall() { + unregister_hook('prepare_body', 'addon/bookmarker/bookmarker.php', 'bookmarker_prepare_body'); +} + +function bookmarker_prepare_body(&$a,&$b) { + + + if(get_pconfig(local_channel(),'bookmarker','disable')) + return; + + if(! strpos($b['html'],'bookmark-identifier')) + return; + + if(! function_exists('redbasic_init')) + return; + + $id = $b['item']['id']; + if(local_channel()) + $link = ' '; + else + $link = ' '; + + $b['html'] = str_replace('#^',$link,$b['html']); + +} diff --git a/sources/addons/buglink/bug-x.gif b/sources/addons/buglink/bug-x.gif new file mode 100755 index 00000000..10936caa Binary files /dev/null and b/sources/addons/buglink/bug-x.gif differ diff --git a/sources/addons/buglink/buglink.php b/sources/addons/buglink/buglink.php new file mode 100755 index 00000000..a237601b --- /dev/null +++ b/sources/addons/buglink/buglink.php @@ -0,0 +1,15 @@ + + */ + + +function buglink_load() { register_hook('page_end', 'addon/buglink/buglink.php', 'buglink_active'); } + + +function buglink_unload() { unregister_hook('page_end', 'addon/buglink/buglink.php', 'buglink_active'); } + +function buglink_active(&$a,&$b) { $b .= ''; } diff --git a/sources/addons/buglink/lang/C/messages.po b/sources/addons/buglink/lang/C/messages.po new file mode 100644 index 00000000..260c583a --- /dev/null +++ b/sources/addons/buglink/lang/C/messages.po @@ -0,0 +1,22 @@ +# ADDON buglink +# Copyright (C) +# This file is distributed under the same license as the Friendica buglink addon package. +# +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-02-27 05:01-0500\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: buglink.php:15 +msgid "Report Bug" +msgstr "" diff --git a/sources/addons/buglink/lang/ca/strings.php b/sources/addons/buglink/lang/ca/strings.php new file mode 100644 index 00000000..01fc9adb --- /dev/null +++ b/sources/addons/buglink/lang/ca/strings.php @@ -0,0 +1,3 @@ +strings["Report Bug"] = "Informar de problema"; diff --git a/sources/addons/buglink/lang/cs/strings.php b/sources/addons/buglink/lang/cs/strings.php new file mode 100644 index 00000000..a1cd51f4 --- /dev/null +++ b/sources/addons/buglink/lang/cs/strings.php @@ -0,0 +1,3 @@ +strings["Report Bug"] = "Nahlásit chybu"; diff --git a/sources/addons/buglink/lang/de/strings.php b/sources/addons/buglink/lang/de/strings.php new file mode 100644 index 00000000..cf96a178 --- /dev/null +++ b/sources/addons/buglink/lang/de/strings.php @@ -0,0 +1,3 @@ +strings["Report Bug"] = "Fehlerreport erstellen"; diff --git a/sources/addons/buglink/lang/eo/strings.php b/sources/addons/buglink/lang/eo/strings.php new file mode 100644 index 00000000..00d95a40 --- /dev/null +++ b/sources/addons/buglink/lang/eo/strings.php @@ -0,0 +1,3 @@ +strings["Report Bug"] = "Skribi cimraporton"; diff --git a/sources/addons/buglink/lang/es/strings.php b/sources/addons/buglink/lang/es/strings.php new file mode 100644 index 00000000..fe632488 --- /dev/null +++ b/sources/addons/buglink/lang/es/strings.php @@ -0,0 +1,3 @@ +strings["Report Bug"] = "Informe de errores"; diff --git a/sources/addons/buglink/lang/fr/strings.php b/sources/addons/buglink/lang/fr/strings.php new file mode 100644 index 00000000..0075fb0d --- /dev/null +++ b/sources/addons/buglink/lang/fr/strings.php @@ -0,0 +1,3 @@ +strings["Report Bug"] = "Signaler un bug"; diff --git a/sources/addons/buglink/lang/is/strings.php b/sources/addons/buglink/lang/is/strings.php new file mode 100644 index 00000000..7b3823a6 --- /dev/null +++ b/sources/addons/buglink/lang/is/strings.php @@ -0,0 +1,3 @@ +strings["Report Bug"] = "Tilkynna bilun"; diff --git a/sources/addons/buglink/lang/it/strings.php b/sources/addons/buglink/lang/it/strings.php new file mode 100644 index 00000000..90df28fe --- /dev/null +++ b/sources/addons/buglink/lang/it/strings.php @@ -0,0 +1,3 @@ +strings["Report Bug"] = "Segnala un Bug"; diff --git a/sources/addons/buglink/lang/nb-no/strings.php b/sources/addons/buglink/lang/nb-no/strings.php new file mode 100644 index 00000000..ec212e9a --- /dev/null +++ b/sources/addons/buglink/lang/nb-no/strings.php @@ -0,0 +1,3 @@ +strings["Report Bug"] = ""; diff --git a/sources/addons/buglink/lang/pl/strings.php b/sources/addons/buglink/lang/pl/strings.php new file mode 100644 index 00000000..8229e7a6 --- /dev/null +++ b/sources/addons/buglink/lang/pl/strings.php @@ -0,0 +1,3 @@ +strings["Report Bug"] = "Zgłoś problem"; diff --git a/sources/addons/buglink/lang/pt-br/strings.php b/sources/addons/buglink/lang/pt-br/strings.php new file mode 100644 index 00000000..6283d77e --- /dev/null +++ b/sources/addons/buglink/lang/pt-br/strings.php @@ -0,0 +1,3 @@ +strings["Report Bug"] = "Relate um Bug"; diff --git a/sources/addons/buglink/lang/ru/strings.php b/sources/addons/buglink/lang/ru/strings.php new file mode 100644 index 00000000..c4223648 --- /dev/null +++ b/sources/addons/buglink/lang/ru/strings.php @@ -0,0 +1,3 @@ +strings["Report Bug"] = "Сообщить об ошибке"; diff --git a/sources/addons/buglink/lang/sv/strings.php b/sources/addons/buglink/lang/sv/strings.php new file mode 100644 index 00000000..ab4fa67a --- /dev/null +++ b/sources/addons/buglink/lang/sv/strings.php @@ -0,0 +1,2 @@ +strings["Report Bug"] = "报案程序错误"; diff --git a/sources/addons/calc/calc.apd b/sources/addons/calc/calc.apd new file mode 100644 index 00000000..8171ce06 --- /dev/null +++ b/sources/addons/calc/calc.apd @@ -0,0 +1,3 @@ +url: $baseurl/calc +name: Calculator +photo: $baseurl/addon/calc/calc.png diff --git a/sources/addons/calc/calc.php b/sources/addons/calc/calc.php new file mode 100755 index 00000000..2935b4a2 --- /dev/null +++ b/sources/addons/calc/calc.php @@ -0,0 +1,368 @@ + + */ + + +function calc_load() { + register_hook('app_menu', 'addon/calc/calc.php', 'calc_app_menu'); +} + +function calc_unload() { + unregister_hook('app_menu', 'addon/calc/calc.php', 'calc_app_menu'); + +} + +function calc_app_menu($a,&$b) { + $b['app_menu'][] = ''; +} + + +function calc_module() {} + + + + +function calc_init($a) { + +$x = <<< EOT + + + +EOT; +$a->page['htmlhead'] .= $x; +} + +function calc_content($app) { + +$o = ''; + +$o .= <<< EOT + + +

Calculator

+

+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + +
+ +EOT; +return $o; + +} diff --git a/sources/addons/calc/calc.png b/sources/addons/calc/calc.png new file mode 100644 index 00000000..e7d15c8c Binary files /dev/null and b/sources/addons/calc/calc.png differ diff --git a/sources/addons/chords/README.md b/sources/addons/chords/README.md new file mode 100644 index 00000000..a45e9730 --- /dev/null +++ b/sources/addons/chords/README.md @@ -0,0 +1,9 @@ +Chord Generator +=============== + +Before enabling the plugin compile the chord generator binary. + + g++ chord-generator.cpp -o chord + +The example is for Linux. Compilation instructions may vary on Windows or other platforms. + diff --git a/sources/addons/chords/chord b/sources/addons/chords/chord new file mode 100755 index 00000000..b6c8a495 Binary files /dev/null and b/sources/addons/chords/chord differ diff --git a/sources/addons/chords/chord-generator.cpp b/sources/addons/chords/chord-generator.cpp new file mode 100755 index 00000000..6a7f2c09 --- /dev/null +++ b/sources/addons/chords/chord-generator.cpp @@ -0,0 +1,1133 @@ +// +// I have been messing around with this program now for a couple weeks +// and thought it might be useful to someone. Given a chord by name, +// it generates all possible ways to play that chord on a guitar and +// scores them based on things like finger span, root as bass note, +// number of open strings, etc (see below). Then it prints the top +// 50 it found (or more, you can set it). The program is pretty +// configurable if you can stand to read the stuff at the top where +// all the #define's are. Currently it prints out the score, and the +// pieces that made up the score...you may want to get rid of the +// extra info, but I found it interesting. +// +// It generates some wild chords and some interesting versions that +// I have NEVER seen before. Probably a great program to find inversions +// and stuff (especially if you lower the score given for having a root +// note 1st). The program could easily be modified to do Drop D tuning +// or any other alternate tuning, and I think it could do other instruments +// without much change, but I have not tried. +// +// I have been having fun playing with this, if you make a changes or +// fixes I would appreciate a copy. Other than that, this is public +// domain, have a party. Oh yeah, the code is C++... +// +// Thanks, +// Rick Eesley +// re@warren.mentorg.com +// +// +// +// Chords can be built like: | = seperate fields, [ ... ] = range of values +// <> = nothing +// +// [<--optional--->] +// [<--repeating-->] +// [A...G] | <> | <> | <> | # | +// | # | min | maj | | +// | b | m | add | | +// | | sus2 | aug | | +// | | sus4 | dim | | +// | | dim | + | | +// | | aug | - | | +// | | | # | +// | | | b | +// | | | / | +// +// Legal chord names: A A7 Amaj7 Amaj9 Ammaj7 Aadd4 Asus2Add4 E7b13b11 ... +// Does not do: C/G which is a c chord with a g root, just find a c +// chord and pick out a g root you like for those... +// Does not do: E5 (that's not a chord, just 2 notes) +// +// + + +#undef DEBUG +int lefty = 0; + +////////////////////////////////////////////////////////////////////// +// Scoring a chord is influenced by these multipliers, change them around +// to your own preferences +////////////////////////////////////////////////////////////////////// + +// +// Score for where this lands on the fretboard (Lower is better) +// score += (15 - AverageFret) * POSITION_SCORE; +#define POSITION_SCORE 20 + +// Score for minimal span (ie: chord covering from fret 2 to fret 4 has +// a span of 2. Open strings do NOT count in span, this is a measure +// of whether a chord is playable +// The maximum span allowed is set by the #define MAXSPAN +// score += (MAXSPAN - span) * SPAN_SCORE; +#define SPAN_SCORE 12 + +// This score is for total Span (ie: includes open strings, which span +// does not. +// score += (15 - tspan) * TSPAN_SCORE; +#define TSPAN_SCORE 3 + +// This score is for number of open strings (I like them). +// score += numberOfOpens * OPENS_SCORE +#define OPENS_SCORE 10 + +// This score multiplier is the score to add if the most bass string +// is the root note +// score += ROOT_SCORE +#define ROOT_SCORE 50 + +// This score multipier is used to penalize for adjacent notes +// score += ADJ_SCORE * (5-adjNotes) +// THe five is the max number of adjacent strings possible (duh...) +#define ADJ_SCORE 9 + +// This is the maximum finger reach, if this is bumped up to five or +// more you get a zillion more fingers (mainly 'cause 5 takes you to +// the notes on the next string...so leave it probably +#define MAXSPAN 4 + +// This is number of top scores to keep, something < 20 leaves out +// too much, 100 is a lot to look at...but I am going with it... +#define CHORDSTACK 250 + +// +// These are different types of scores, NUMSCORETYPES MUST be set to the +// number of these types, so if any are added change it TOO! +// Add any new scores onto the end, the total MUST be the 0th element +// +#define NUMSCORETYPES 7 + +#define SCORE_TOTAL 0 +#define SCORE_SPAN 1 +#define SCORE_TOTALSPAN 2 +#define SCORE_OPENSTRINGS 3 +#define SCORE_FIRSTROOT 4 +#define SCORE_LOWONNECK 5 +#define SCORE_ADJNOTES 6 + +// Just in case someone wants to port this to banjo or mandolin or something +#define NUM_STRINGS 6 + + +#include +#include +#include +#include + +/* A A# B C C# D D# E F F# G G# */ +/* A Bb B C Db D Eb E F Gb G Ab */ +/* 0 1 2 3 4 5 6 7 8 9 10 11 */ + +/* STRINGS ARE: E=0, A=1, D=2, G=3, B=4, E=5 IN ORDER */ + +// This can be reset for alternate tunings, this is EADGBE tuning +// here: + + int openStrings[NUM_STRINGS] = { 7, 0, 5, 10, 2, 7 }; + +static char *strNotes[] = { "A ", "A#", "B ", "C ", "C#", "D ", + "D#", "E ", "F ", "F#", "G ", "G#" }; + +// +// This class contains a decode chord, and can take a string and turn +// it into a chord. A chord is a triad or greater here. The code is +// decoded from a string into notes in the c array (notes: are A=0, A#=1, +// and so on. The longest chord you can possibly have is 12 notes which +// would be every note in an octave, since chords are typical 3 to 5 +// notes, remaining notes in the c[] array are set to -1 +// +class Chord +{ + public: + // String set to last error + char errorStr[64]; + + // Notes that are in the chord -1 should be ignored + int notes[12]; + + // NOtes that are optional have a 1, otherwise a zero + int optional[12]; + + // ------------------ MEMBER FUNCTIONS ---------------------------- + + // Clears last chord + void clear(); + + // Decodes input string into notes[] array, return error string + int findChord(char *s); + + // Print last error message from chord parse + void printError(); + + // Prints out notes[] array to screen + void print(char *chordName); + + // Is the note note in the chord + int inChord(int note); + + // Is this chord covered by the array of notes (ie: Does the + // array contain all the notes of the chord + int covered(int *noteArray); + + // Return the root note of the chord + int getRoot() { return notes[0]; } + + // Given a chord string, return the note that starts it (and recognize + // sharps and flats (b and #) + int get_base(char *s); + + // Get a note offset from another... + int note_offset(int base, int offset) { + if((! base) && (offset == (-1))) + return(11); + return ((base + offset) % 12); + } +} ; + +// +// This class holds a fingering for a chord, as well as a score for that +// fingering. This class also keeps the CHORDSTACK (ie: 100) best version +// of that chord to print out in sorted order (best score 1st). +// +class Fretboard +{ + public: + + // Score of current chord, held in an array so we can track the + // components of the score (see the SCORE_ defines in the begining + // of this file + int score[NUMSCORETYPES]; + + // Fretboard of the current chord, fretboard[0] is the low (bass) E + // string. A fretboard value of 0 is an open string, -1 is an + // X'ed out string (not strung) + int fretboard[NUM_STRINGS]; + + // Notes of the current fretboard fingering for a chord + int notes[NUM_STRINGS]; + + // The best fret layouts so far based on score + int bestFrets[CHORDSTACK][NUM_STRINGS]; + + // The best fret layout note sets so far based on score + int bestNotes[CHORDSTACK][NUM_STRINGS]; + + // The best scores + int bestScores[CHORDSTACK][NUMSCORETYPES]; + + // Keep track of stack sDepth to speed it up! + int sDepth; + + // ------------------ MEMBER FUNCTIONS ---------------------------- + + // Construct one + Fretboard(); + + // Given a chord (and the current fretboard state) score this doggie + // and leave the score value in score + void getScore(Chord &chord); + + // Print the current Fretboard state (not the stack) + void print(); + + // Print the fretboard stack + void printStack(); + + // Iterate over different fretboard variations for a chord + void iterate(Chord &chord); + + // Take the current fretboard state and put it into the stack + void addToBest(); + + // Get the span of the current chord, excluding open string + int getSpan(); + + // Get the span of the current chord, INCLUDING open string + int getTotalSpan(); +}; + +// +// Before building a chord, clear the notes and optional arrays +// +void +Chord::clear() +{ + for (int i = 0; i < 12; i++) + { + notes[i] = -1; + optional[i] = 0; + } +} + +// +// Print out the last error string +// +void +Chord::printError() +{ + printf("Error: %s\n", errorStr); +} + +// +// I dunno, our C++ compiler at work did not have strupr, so heres mine +// +void +myStrupr(char *s) +{ + while (*s) + { + if (islower(*s)) + *s = toupper(*s); + s++; + } +} + +// +// Decodes input string into notes[] array, return error string +// always: 0 = root, 1 = 3rd, 2 = 5th +// Also sets the optional array in parallel with the notes[] +// +int +Chord::findChord(char *s) +{ + clear(); + + // up case the string + myStrupr(s); + + // DECODE ROOT NOTE : A - G + notes[0] = get_base(s); + s++; + + // CHECK FOR SHARP OR FLAT ROOT NOTE + if (*s == '#') s++; + if (*s == 'B') s++; + + // MODIFY THE ROOT BY M, MIN, SUS2, SUS4, or diminished + if (!strncmp(s, "MIN", 3 )) + { + notes[1] = note_offset(notes[0], 3); + s += 3; + optional[2] = 1; + } + else if (!strncmp(s, "MAJ", 3)) + { + // Do nothing, but stops program from seeing the + // first m in maj as a minor (see next line)...so give a normal 3rd + notes[1] = note_offset(notes[0], 4); + optional[2] = 1; + } + else if (!strncmp(s, "M", 1)) + { + notes[1] = note_offset(notes[0], 3); + s += 1; + optional[2] = 1; + } + else if (!strncmp(s, "SUS", 1)) + { + s += 3; // go past sus + if (*s == '2') + notes[1] = note_offset(notes[0], 2); + else if (*s == '4') + notes[1] = note_offset(notes[0], 5); + else + { + strcpy(errorStr, "sus must be followed by 2 or 4"); + return 1; + } + s++; // Go past 2 or 4 + optional[2] = 1; + } + else if ((!strncmp(s, "DIM", 3 )) && (!isdigit(s[3]))) + { + // If it is diminished, just return (no other stuff allowed)/ + notes[1] = note_offset(notes[0], 3); + notes[2] = note_offset(notes[0], 6); + notes[3] = note_offset(notes[0], 9); + return 0; + } + else if ((!strncmp(s, "AUG", 3 )) && (!isdigit(s[3]))) + { + // If it is diminished, just return (no other stuff allowed)/ + notes[1] = note_offset(notes[0], 4); + notes[2] = note_offset(notes[0], 8); + return 0; + } + else + { + notes[1] = note_offset(notes[0], 4); + // optional[1] = 1; + // optional[2] = 1; + } + + notes[2] = note_offset(notes[0], 7); + + + // At this point, the 1,3,5 triad or variant is built, now add onto + // it until the string end is reached... + // Next note to add is index = 3... + int index = 3; + enum homeboy { NORMAL, MAJ, ADD, AUG, DIM } mtype ; + char lbuf[10]; + + while (*s) + { + // FIrst, check the mtype of modifier, ie: Aug, Maj, etc... + mtype = NORMAL; + if (!strncmp(s, "MAJ", 3)) + { + mtype = MAJ; + s += 3; + } + else if (!strncmp(s, "ADD", 3)) + { + mtype = ADD; + s += 3; + } + else if (!strncmp(s, "AUG", 3)) + { + mtype = AUG ; + s += 3; + } + else if (!strncmp(s, "DIM", 3)) + { + mtype = DIM; + s += 3; + } + else if ( *s == '+' ) + { + mtype = AUG; + s += 1; + } + else if ( *s == '-' ) + { + mtype = DIM; + s += 1; + } + else if ( *s == '#' ) + { + mtype = AUG; + s += 1; + } + else if ( *s == 'B' ) + { + mtype = DIM; + s += 1; + } + else if ( *s == '/' ) + { + mtype = ADD; + s += 1; + } + // Now find the number... + if (isdigit(*s)) + { + lbuf[0] = *s++; + lbuf[1] = '\0'; + } + else + { + sprintf(errorStr, "Expecting number, got %s", s); + return 1; + } + // 2nd digit? + if (isdigit(*s)) + { + lbuf[1] = *s++; + lbuf[2] = '\0'; + } + + int number = atoi(lbuf); + + switch (number) + { + case 7 : + notes[index] = note_offset(notes[0], 10); + break; + case 9 : + notes[index] = note_offset(notes[0], 2); + + // put the 7th in 2nd so it can be maj'ed if need be... + if ((mtype == NORMAL) || (mtype == MAJ)) + { + index++; + notes[index] = note_offset(notes[0], 10); + optional[index] = 1; // 7th is optional, unless it is maj! + } + + break; + case 11 : + notes[index] = note_offset(notes[0], 5); + + // put the 7th in 2nd so it can be maj'ed if need be... + if ((mtype == NORMAL) || (mtype == MAJ)) + { + index++; + notes[index] = note_offset(notes[0], 10); + optional[index] = 1; // 7th is optional, unless it is maj! + } + + break; + case 13 : + notes[index] = note_offset(notes[0], 9); + index++; + notes[index] = note_offset(notes[0], 5); + optional[index] = 1; // 7th is optional, unless it is maj! + index++; + notes[index] = note_offset(notes[0], 2); + optional[index] = 1; // 7th is optional, unless it is maj! + + // put the 7th in 2nd so it can be maj'ed if need be... + if ((mtype == NORMAL) || (mtype == MAJ)) + { + index++; + notes[index] = note_offset(notes[0], 10); + optional[index] = 1; // 7th is optional, unless it is maj! + } + + break; + case 2: + notes[index] = note_offset(notes[0], 2); + break; + case 4: + notes[index] = note_offset(notes[0], 5); + break; + case 6: + notes[index] = note_offset(notes[0], 9); + break; + case 5: + notes[index] = note_offset(notes[0], 7); + break; + default: + sprintf(errorStr, "Cannot do number: %d\n", number); + return 1; + } + + switch (mtype) + { + case DIM: + notes[index] = note_offset(notes[index], -1); + break; + case MAJ: + // It is a major, so not optional + optional[index] = 0; + case AUG : + notes[index] = note_offset(notes[index], 1); + break; + case NORMAL: + case ADD: + break; + default: + break; + } + + index++; + } + return 0; +} + +// +// Print out chord by name +// +void +Chord::print(char *cname) +{ + printf("Notes for chord '%s': ", cname); + for (int i = 0; i < 12; i++) + { + if (notes[i] != -1) + printf("%s ", strNotes[notes[i]]); + } + printf("\n\n"); +} + +// +// Are all the notes in this chord covered by the notes in the +// noteArray, it is not necessary to cover the notes in the optional +// array of the chord +// +int +Chord::covered(int *noteArray) +{ + // noteArray is an array of notes this chord has, it is NUM_STRINGS notes + // long (like a guitar fretboard dude...unused notes may be set + // to -1 (which wont compare since -1 is tossed... + + for (int i = 0; i < 12; i++) + { + if (notes[i] != -1) + { + int gotIt = 0; + for (int j = 0; j < NUM_STRINGS; j++) + { + if (noteArray[j] == notes[i]) + { + gotIt = 1; + break; + } + } + // If it was not found, and it is NOT optional, then it is + // not covered + if ((gotIt == 0) && (optional[i] == 0)) + return 0; + } + } + return 1; +} + + +// +// Is the given note in the chord +// +int +Chord::inChord(int note) +{ + for (int i = 0; i < 12; i++) + { + // Check if we are off the end of the notes set + if (notes[i] == -1) + return 0; + // Check if the note was found + if (note == notes[i]) + return 1; + } + // Did not find out, return 0 + return 0; +} + +// +// Given a chord string, pick off the root (either C or C# or Cb)...and +// return that integer value (A = 0) +// +int +Chord::get_base(char *s) +{ + + static int halfsteps[] = { 0, 2, 3, 5, 7, 8, 10 }; + + if ((*s < 'A') || (*s > 'G')) + return 0; + + if (s[1] == '#') + return ( note_offset(halfsteps[s[0] - 'A'], 1)); + else if (s[1] == 'B') + return ( note_offset(halfsteps[s[0] - 'A'], -1)); + else + return ( halfsteps[s[0] - 'A']); +} + + +// +// Print out the current fretboard +// +void +Fretboard::print() +{ + printf("SCORE: %3d ", score[SCORE_TOTAL]); + printf( + " SPN: %2d TSPN: %2d OS: %2d ROOT: %2d LOW %2d ADJ %2d", + score[SCORE_SPAN], score[SCORE_TOTALSPAN], score[SCORE_OPENSTRINGS], + score[SCORE_FIRSTROOT], score[SCORE_LOWONNECK], + score[SCORE_ADJNOTES]); + + printf(" FB: "); + for (int i = 0; i < NUM_STRINGS; i++) + { + if (fretboard[i] != -1) + printf(" %2d", fretboard[i]); + else + printf(" X"); + } + + printf(" NT: "); + for (int i = 0; i < NUM_STRINGS; i++) + if (notes[i] != -1) + printf(" %s", strNotes[notes[i]]); + else + printf(" X "); + printf("\n"); +} + +// +// Construct a fretboard -- reset to the openStrings, clear the stack +// and reset all the bestScores to -1 +// +Fretboard::Fretboard() +{ + sDepth = 0; + score[0] = 0; + for (int i = 0; i < NUM_STRINGS; i++) + { + notes[i] = openStrings[i]; + fretboard[i] = 0; + } + for (int i = 0; i < CHORDSTACK; i++) + { + bestScores[i][0] = -1; + } +} + +// +// Get the span of this chord, don't count open strings +// +int +Fretboard::getSpan() +{ + int min = 100, max = 0; + for (int i = 0; i < NUM_STRINGS; i++) + { + // Dont count X strings or open strings + if (fretboard[i] <= 0) + continue; + if (fretboard[i] > max) max = fretboard[i]; + if (fretboard[i] < min) min = fretboard[i]; + } + if (min == 100) + // All open strings, took awhile to catch this bug + return 0; + else + return (max - min); +} + +// +// Get the span of this chord, DO count open strings +// +int +Fretboard::getTotalSpan() +{ + int min = 100, max = 0; + for (int i = 0; i < NUM_STRINGS; i++) + { + // Dont count X strings + if (fretboard[i] < 0) + continue; + if (fretboard[i] > max) max = fretboard[i]; + if (fretboard[i] < min) min = fretboard[i]; + } + if (min == -1) + min = 0; + return (max - min); +} + +// +// Add this chord to the best (if there is room in the stack) +// +void +Fretboard::addToBest() +{ + // CHORDSTACK is the sDepth of keepers... +#ifdef DEBUG + printf("ATB: "); + this->print(); +#endif + + int i; + + // NOTE: at the start, bestScores is full of -1's, so any reall + // real score will be better (worst score is 0) + for (i = 0; i < sDepth; i++) + { + if (score[0] > bestScores[i][0]) + break; + } + + // If score was not better than any in the stack just return + if (i >= CHORDSTACK) + return ; + // MOve down old guys to make room for the new guy + for (int j = CHORDSTACK - 1; j >= i; j--) + { + for (int q = 0; q < NUM_STRINGS; q++) + { + bestFrets[j][q] = bestFrets[j - 1][q]; + bestNotes[j][q] = bestNotes[j - 1][q]; + } + for (int q = 0; q < NUMSCORETYPES; q++) + bestScores[j][q] = bestScores[j - 1][q]; + } + + for (int q = 0; q < NUM_STRINGS; q++) + { + bestFrets[i][q] = fretboard[q]; + bestNotes[i][q] = notes[q]; + } + for (int q = 0; q < NUMSCORETYPES; q++) + bestScores[i][q] = score[q]; + + sDepth++; + if (sDepth > CHORDSTACK) + sDepth--; +} + +// +// Print out the stack to the screen +// +void +Fretboard::printStack() +{ + static char *strNotes[] = { "A ", "A#", "B ", "C ", "C#", "D ", + "D#", "E ", "F ", "F#", "G ", "G#" }; + + + for (int f = 0; f < sDepth; f++) + { + printf("\n\n "); + + if(lefty) { + for (int i = NUM_STRINGS - 1; i >= 0; i--) + if (bestNotes[f][i] != -1) + printf(" %s", strNotes[bestNotes[f][i]]); + else + printf(" X "); + } + else { + for (int i = 0; i < NUM_STRINGS; i++) + if (bestNotes[f][i] != -1) + printf(" %s", strNotes[bestNotes[f][i]]); + else + printf(" X "); + } + printf("\n"); + if(lefty) { + for (int i = NUM_STRINGS - 1; i >= 0; i--) + if (bestFrets[f][i] != -1) + printf(" %2d", bestFrets[f][i]); + else + printf(" X"); + + } + else { + for (int i = 0; i < NUM_STRINGS; i++) + + if (bestFrets[f][i] != -1) + printf(" %2d", bestFrets[f][i]); + else + printf(" X"); + } + + printf("\n\n"); + + + int highest = 0; + + for(int i = 0; i < NUM_STRINGS; i++) + if(bestFrets[f][i] > highest) + highest = bestFrets[f][i]; + + printf("\n"); + + for(int i = 0; i <= (highest + 1); i ++) { + if(lefty) { + for (int x = NUM_STRINGS-1; x >= 0; x--) { + if(i == 0) { + if(bestFrets[f][x] == -1) + printf(" X"); + else + if(bestFrets[f][x] == 0) + printf(" 0"); + else + printf(" "); + } + else { + if(bestFrets[f][x] == i) + printf(" *"); + else + printf(" |"); + } + } + } + else { + + for (int x = 0; x < NUM_STRINGS; x++) { + if(i == 0) { + if(bestFrets[f][x] == -1) + printf(" X"); + else + if(bestFrets[f][x] == 0) + printf(" 0"); + else + printf(" "); + } + else { + if(bestFrets[f][x] == i) + printf(" *"); + else + printf(" |"); + } + } + } + printf("\n ---------------- %2d\n",i); + + + + + } + } +} + + +// +// Get the score for this chord +// +void +Fretboard::getScore(Chord &chord) +{ + + // First, points for small span (excluding opens) + score[SCORE_SPAN] = (MAXSPAN - getSpan()) * SPAN_SCORE; + + // Then, points for small total span + score[SCORE_TOTALSPAN] = (15 - getTotalSpan()) * 3; + + score[SCORE_OPENSTRINGS] = 0; + // Points for open strings + for (int i = 0; i < NUM_STRINGS; i++) + { + if (fretboard[i] == 0) + { + score[SCORE_OPENSTRINGS] += OPENS_SCORE; + } + } + + // Points for first string being the root ... + score[SCORE_FIRSTROOT] = 0; + int i; + for (i = 0; (fretboard[i] == -1) && (i < NUM_STRINGS) ; i++) + ; + if (notes[i] == chord.getRoot()) + { + score[SCORE_FIRSTROOT] = ROOT_SCORE; + } + + // Points for being low on the neck... + int sum = 0, cnt = 0; + for (i = 0; i < NUM_STRINGS; i++) + { + // Don't count X strings or open strings + if (fretboard[i] > 0) + { + sum += fretboard[i]; + cnt++; + } + } + if (cnt) + score[SCORE_LOWONNECK] = (int)(15 - ((double) sum / (double) cnt)) + * POSITION_SCORE; + else + score[SCORE_LOWONNECK] = 15 * POSITION_SCORE; + + + int adjNotes = 0; + for (i = 0; i < 5; i++) + { + if ((notes[i] != -1) && (notes[i] == notes[i + 1])) + adjNotes++; + } + score[SCORE_ADJNOTES] = (ADJ_SCORE * (5 - adjNotes)); + + // FInally, total up the score + score[SCORE_TOTAL] = 0; + for (i = 1; i < NUMSCORETYPES; i++) + score[SCORE_TOTAL] += score[i]; +} + + +// +// Iterate over all fretboard config's for this chord, call addToBest +// with any good ones (ie: < span, etc etc...) +// +void +Fretboard::iterate(Chord &chord) +{ + int string = 0; + + // Start notes setup, increment up the neck for each string until + // you find a note that is in this chord (may be an open note) + for (int i = 0; i < NUM_STRINGS; i++) + { + while (! chord.inChord(notes[i])) + { + fretboard[i]++; + notes[i] = ( notes[i] + 1 ) % 12; + } + } + + // Back up the first note one...so the loop will work + fretboard[0] = -1; + + // While we are still on the fretboard! + while (string < NUM_STRINGS) + { + + // increment the current string + fretboard[string]++; + if (fretboard[string] == 0) + notes[string] = openStrings[string]; + else + notes[string] = ( notes[string] + 1 ) % 12; + + while (! chord.inChord(notes[string])) + { + fretboard[string]++; + notes[string] = ( notes[string] + 1 ) % 12; + } + + if (fretboard[string] > 15) + { + + // Before turning over the 3rd string from the bass, try + // to make a chord with the bass string, and 2nd from + // bass string X'ed out...(ie: set to -1) + if (string == 0) + { + + notes[0] = fretboard[0] = -1; + int span = getSpan(); + if ((span < MAXSPAN) && chord.covered(notes)) + { + getScore(chord); + addToBest(); + } + } + + if (string == 1) + { + int store = notes[0]; + int fstore = fretboard[0]; + notes[1] = fretboard[1] = -1; + notes[0] = fretboard[0] = -1; + int span = getSpan(); + if ((span < MAXSPAN) && chord.covered(notes)) + { + getScore(chord); + addToBest(); + } + // Restore the notes you X'ed out + notes[0] = store; + fretboard[0] = fstore; + } + + fretboard[string] = 0; + notes[string] = openStrings[string]; + while (! chord.inChord(notes[string])) + { + fretboard[string]++; + notes[string] = chord.note_offset(notes[string], 1); + } + string++; + continue; + } + +#ifdef DEBUG + printf("TRY: "); this->print(); +#endif + + string = 0; + int span = getSpan(); + if (span >= MAXSPAN) + { +#ifdef DEBUG + printf("Rejected for span\n"); +#endif + continue; + } + if (!chord.covered(notes)) + { +#ifdef DEBUG + printf("Rejected for coverage\n"); +#endif + continue; + } + + getScore(chord); + + addToBest(); + } +} + +// +// uh, main +// +int main(int argc, char **argv) +{ + char buf[256], buf2[256]; + + if(argc > 1) + { + strcpy(buf, argv[1]); + if(argc > 3) { + if(! strcmp(argv[3],"lefty")) { + lefty = 1; + + } + + + } + + if(argc > 2) { + if(! strcmp(argv[2],"dadgad")) { + openStrings[0] = 5; + openStrings[1] = 0; + openStrings[2] = 5; + openStrings[3] = 10; + openStrings[4] = 0; + openStrings[5] = 5; + } + if(! strcmp(argv[2],"openg")) { + openStrings[0] = 5; + openStrings[1] = 10; + openStrings[2] = 5; + openStrings[3] = 10; + openStrings[4] = 2; + openStrings[5] = 5; + + } + if(! strcmp(argv[2],"opene")) { + openStrings[0] = 7; + openStrings[1] = 2; + openStrings[2] = 7; + openStrings[3] = 11; + openStrings[4] = 2; + openStrings[5] = 7; + + } + if(! strcmp(argv[2],"lefty")) { + lefty = 1; + + } + } + + + // Allocate it for DOS/WINDOWS, to avoid stack overflow (weak) + Fretboard *fb = new Fretboard; ; + Chord chord; + + + // findChord upppercases the input string, so save a copy + strcpy(buf2, buf); + + if (chord.findChord(buf)) + { + chord.printError(); + + } + else { + chord.print(buf2); + fb->iterate(chord); + + fb->printStack(); + } + delete fb; + } + return 0; +} + diff --git a/sources/addons/chords/chords.apd b/sources/addons/chords/chords.apd new file mode 100644 index 00000000..2ab5b99d --- /dev/null +++ b/sources/addons/chords/chords.apd @@ -0,0 +1,3 @@ +url: $baseurl/chords +name: Guitar Chords +photo: $baseurl/addon/chords/chords.png diff --git a/sources/addons/chords/chords.php b/sources/addons/chords/chords.php new file mode 100755 index 00000000..93bdbd94 --- /dev/null +++ b/sources/addons/chords/chords.php @@ -0,0 +1,129 @@ + + */ + + +function chords_load() { + register_hook('app_menu', 'addon/chords/chords.php', 'chords_app_menu'); +} + +function chords_unload() { + unregister_hook('app_menu', 'addon/chords/chords.php', 'chords_app_menu'); + +} + +function chords_app_menu($a,&$b) { + $b['app_menu'][] = ''; +} + + +function chords_module() {} + + +function chords_content($a) { + + +$o .= '

Guitar Chords

'; +$o .= 'The complete online guitar chord dictionary
'; +$args = ''; +$l = ''; + +if($_SERVER['REQUEST_METHOD'] == 'POST') { + if(isset($_POST['chord']) && strlen($_POST['chord'])) + $args .= escapeshellarg(ucfirst(trim($_POST['chord']))); + if((strlen($args)) && (isset($_POST['tuning'])) && (strlen($_POST['tuning']))) + $args .= ' '.escapeshellarg($_POST['tuning']); + if((strlen($args)) && (isset($_POST['lefty']))) + $args .= ' lefty'; +} + +if((! strlen($args)) && (! stristr(basename($_SERVER['QUERY_STRING']),'chords')) && strlen(basename($_SERVER['QUERY_STRING']))) + $args = escapeshellarg(ucfirst(basename($_SERVER['QUERY_STRING']))); + +$tunings = array("","openg", "opene", "dadgad"); +$tnames = array("Em11 [Standard] (EADGBE)", + "G/D [Drop D] (DGDGBD)","Open E (EBEG#BE)","Dsus4 (DADGAD)"); +$t = ((isset($_POST['tuning'])) ? $_POST['tuning'] : ''); +if(isset($_POST['lefty']) && $_POST['lefty'] == '1') + $l = 'checked="checked"'; + + $ch = ((isset($_POST['chord'])) ? $_POST['chord'] : ''); +$o .= <<< EOT + +
+Chord name: (ex: Em7) +  Tuning: +Left-Handed: +
+ +
+

+EOT; + +if(strlen($args)) { + $o .= '
';
+  $o .= shell_exec("addon/chords/chord ".$args);
+  $o .=  '
'; +} +else { + +$o .= <<< EOT + +

+This is a fairly comprehensive and complete guitar chord dictionary which will list most of the available ways to play a certain chord, starting from the base of the fingerboard up to a few frets beyond the twelfth fret (beyond which everything repeats). A couple of non-standard tunings are provided for the benefit of slide players, etc. +

+

+Chord names start with a root note (A-G) and may include sharps (#) and flats (b). This software will parse most of the standard naming conventions such as maj, min, dim, sus(2 or 4), aug, with optional repeating elements. +

+

+Valid examples include A, A7, Am7, Amaj7, Amaj9, Ammaj7, Aadd4, Asus2Add4, E7b13b11 ... +

+Quick Reference:
+ +EOT; + +$keys = array('A','Bb','B', 'C','Db','D','Eb','E','F','Gb','G','Ab'); +$o .= ''; +$o .= ""; +foreach($keys as $k) + $o .= ""; +$o .= ""; +foreach($keys as $k) + $o .= ""; +$o .= ""; +foreach($keys as $k) + $o .= ""; +$o .= ""; +$o .= "
$k
{$k}m
{$k}7
"; + +} + +return $o; + +} + + + + + + + + + + diff --git a/sources/addons/chords/chords.png b/sources/addons/chords/chords.png new file mode 100644 index 00000000..9427943f Binary files /dev/null and b/sources/addons/chords/chords.png differ diff --git a/sources/addons/custom_home/README.md b/sources/addons/custom_home/README.md new file mode 100644 index 00000000..10f8f867 --- /dev/null +++ b/sources/addons/custom_home/README.md @@ -0,0 +1,12 @@ +Configure a custom page to be used for a logged out user when viewing the home page. + +util/config system custom_home landingpage + +landingpage is a relative link. + +EG, util/config system custom_home channel/me will send logged out users to example.com/channel/me + +To set a random channel (replacing random_channel_home) use: + +util/config system custom_home random + diff --git a/sources/addons/custom_home/custom_home.php b/sources/addons/custom_home/custom_home.php new file mode 100644 index 00000000..5335f8a2 --- /dev/null +++ b/sources/addons/custom_home/custom_home.php @@ -0,0 +1,40 @@ + + */ + + +function custom_home_load() { + register_hook('home_mod_content', 'addon/custom_home/custom_home.php', 'custom_home_home'); + logger("loaded custom_home"); +} + +function custom_home_unload() { + unregister_hook('home_mod_content', 'addon/custom_home/custom_home.php', 'custom_home_home'); + unregister_hook('home_content', 'addon/custom_home/custom_home.php', 'custom_home_home'); + logger("removed custom_home"); +} + +function custom_home_home(&$a, &$o){ + + $x = get_config('system','custom_home'); + if($x) { + if ($x == "random") { + $rand = db_getfunc('rand'); + $r = q("select channel_address from channel where channel_r_stream = 1 and channel_address != 'sys' order by $rand limit 1"); + $x = z_root() . '/channel/' . $r[0]['channel_address']; + } + else { + $x = z_root() . '/' . $x; + } + + goaway(zid($x)); + } + +//If nothing is set + return $o; +} + diff --git a/sources/addons/dfedfix/dfedfix.php b/sources/addons/dfedfix/dfedfix.php new file mode 100644 index 00000000..af7b3837 --- /dev/null +++ b/sources/addons/dfedfix/dfedfix.php @@ -0,0 +1,30 @@ +',' +' . z_root() . '/channel/' . $b['user']['channel_address'] . '',$x); + $x = str_replace('.AQAB" />','.AQAB "/> +',$x); + $b['xml'] = $x; + +} + \ No newline at end of file diff --git a/sources/addons/diaspora/diaspora.php b/sources/addons/diaspora/diaspora.php new file mode 100755 index 00000000..b2e21013 --- /dev/null +++ b/sources/addons/diaspora/diaspora.php @@ -0,0 +1,3397 @@ +',''), + array('',''), + $msg['message']); + + + $parsed_xml = parse_xml_string($msg['message'],false); + + $xmlbase = $parsed_xml->post; + +// logger('diaspora_dispatch: ' . print_r($xmlbase,true), LOGGER_DATA); + + + if($xmlbase->request) { + $ret = diaspora_request($importer,$xmlbase->request); + } + elseif($xmlbase->status_message) { + $ret = diaspora_post($importer,$xmlbase->status_message,$msg); + } + elseif($xmlbase->profile) { + $ret = diaspora_profile($importer,$xmlbase->profile,$msg); + } + elseif($xmlbase->comment) { + $ret = diaspora_comment($importer,$xmlbase->comment,$msg); + } + elseif($xmlbase->like) { + $ret = diaspora_like($importer,$xmlbase->like,$msg); + } + elseif($xmlbase->asphoto) { + $ret = diaspora_asphoto($importer,$xmlbase->asphoto,$msg); + } + elseif($xmlbase->reshare) { + $ret = diaspora_reshare($importer,$xmlbase->reshare,$msg); + } + elseif($xmlbase->retraction) { + $ret = diaspora_retraction($importer,$xmlbase->retraction,$msg); + } + elseif($xmlbase->signed_retraction) { + $ret = diaspora_signed_retraction($importer,$xmlbase->signed_retraction,$msg); + } + elseif($xmlbase->relayable_retraction) { + $ret = diaspora_signed_retraction($importer,$xmlbase->relayable_retraction,$msg); + } + elseif($xmlbase->photo) { + $ret = diaspora_photo($importer,$xmlbase->photo,$msg); + } + elseif($xmlbase->conversation) { + $ret = diaspora_conversation($importer,$xmlbase->conversation,$msg); + } + elseif($xmlbase->message) { + $ret = diaspora_message($importer,$xmlbase->message,$msg); + } + else { + logger('diaspora_dispatch: unknown message type: ' . print_r($xmlbase,true)); + } + return $ret; +} + + +function diaspora_is_blacklisted($s) { + + if(! check_siteallowed($s)) { + logger('blacklisted site: ' . $s); + return true; + } + + return false; +} + +function diaspora_process_outbound(&$a, &$arr) { + +/* + + We are passed the following array from the notifier, providing everything we need to make delivery decisions. + + $arr = array( + 'channel' => $channel, + 'env_recips' => $env_recips, + 'recipients' => $recipients, + 'item' => $item, + 'target_item' => $target_item, + 'hub' => $hub, + 'top_level_post' => $top_level_post, + 'private' => $private, + 'followup' => $followup, + 'relay_to_owner' => $relay_to_owner, + 'uplink' => $uplink, + 'cmd' => $cmd, + 'expire' => $expire, + 'mail' => $mail, + 'location' => $location, + 'fsuggest' => $fsuggest, + 'normal_mode' => $normal_mode, + 'packet_type' => $packet_type, + 'walltowall' => $walltowall, + 'queued' => pass these queued items (outq_hash) back to notifier.php for delivery + ); +*/ + + + // allow this to be set per message + + if(strpos($arr['target_item']['postopts'],'nodspr') !== false) + return; + + $allowed = get_pconfig($arr['channel']['channel_id'],'system','diaspora_allowed'); + + if(! intval($allowed)) { + logger('mod-diaspora: disallowed for channel ' . $arr['channel']['channel_name']); + return; + } + + + if($arr['location']) + return; + + + $target_item = $arr['target_item']; + + if($target_item && array_key_exists('item_obscured',$target_item) && intval($target_item['item_obscured'])) { + $key = get_config('system','prvkey'); + if($target_item['title']) + $target_item['title'] = crypto_unencapsulate(json_decode($target_item['title'],true),$key); + if($target_item['body']) + $target_item['body'] = crypto_unencapsulate(json_decode($target_item['body'],true),$key); + } + + + + if($arr['env_recips']) { + $hashes = array(); + + // re-explode the recipients, but only for this hub/pod + + foreach($arr['env_recips'] as $recip) + $hashes[] = "'" . $recip['hash'] . "'"; + + $r = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_url = '%s' + and xchan_hash in (" . implode(',', $hashes) . ") and xchan_network in ('diaspora', 'friendica-over-diaspora') ", + dbesc($arr['hub']['hubloc_url']) + ); + + if(! $r) { + logger('diaspora_process_outbound: no recipients'); + return; + } + + foreach($r as $contact) { + + if($arr['mail']) { + $qi = diaspora_send_mail($arr['item'],$arr['channel'],$contact); + if($qi) + $arr['queued'][] = $qi; + continue; + } + + if(! $arr['normal_mode']) + continue; + + // special handling for followup to public post + // all other public posts processed as public batches further below + + if((! $arr['private']) && ($arr['followup'])) { + $qi = diaspora_send_followup($target_item,$arr['channel'],$contact, true); + if($qi) + $arr['queued'][] = $qi; + continue; + } + + if(! $contact['xchan_pubkey']) + continue; + + if(intval($target_item['item_deleted']) + && (($target_item['mid'] === $target_item['parent_mid']) || $arr['followup'])) { + // send both top-level retractions and relayable retractions for owner to relay + $qi = diaspora_send_retraction($target_item,$arr['channel'],$contact); + if($qi) + $arr['queued'][] = $qi; + continue; + } + elseif($arr['followup']) { + // send comments and likes to owner to relay + $qi = diaspora_send_followup($target_item,$arr['channel'],$contact); + if($qi) + $arr['queued'][] = $qi; + continue; + } + + elseif($target_item['mid'] !== $target_item['parent_mid']) { + // we are the relay - send comments, likes and relayable_retractions + // (of comments and likes) to our conversants + $qi = diaspora_send_relay($target_item,$arr['channel'],$contact); + if($qi) + $arr['queued'][] = $qi; + continue; + } + elseif($arr['top_level_post']) { + $qi = diaspora_send_status($target_item,$arr['channel'],$contact); + if($qi) + $arr['queued'][] = $qi; + continue; + } + } + } + else { + // public message + + $contact = $arr['hub']; + + if(intval($target_item['item_deleted']) + && ($target_item['mid'] === $target_item['parent_mid'])) { + // top-level retraction + logger('delivery: diaspora retract: ' . $loc); + $qi = diaspora_send_retraction($target_item,$arr['channel'],$contact,true); + if($qi) + $arr['queued'][] = $qi; + return; + } + elseif($target_item['mid'] !== $target_item['parent_mid']) { + // we are the relay - send comments, likes and relayable_retractions to our conversants + logger('delivery: diaspora relay: ' . $loc); + $qi = diaspora_send_relay($target_item,$arr['channel'],$contact,true); + if($qi) + $arr['queued'][] = $qi; + return; + } + elseif($arr['top_level_post']) { + logger('delivery: diaspora status: ' . $loc); + $qi = diaspora_send_status($target_item,$arr['channel'],$contact,true); + if($qi) + $arr['queued'][] = $qi; + return; + } + + } + + +} + + +function diaspora_handle_from_contact($contact_hash) { + + logger("diaspora_handle_from_contact: contact id is " . $contact_hash, LOGGER_DEBUG); + + $r = q("SELECT xchan_addr from xchan where xchan_hash = '%s' limit 1", + dbesc($contact_hash) + ); + if($r) { + return $r[0]['xchan_addr']; + } + return false; +} + +function diaspora_get_contact_by_handle($uid,$handle) { + + if(diaspora_is_blacklisted($handle)) + return false; + require_once('include/identity.php'); + + $sys = get_sys_channel(); + if(($sys) && ($sys['channel_id'] == $uid)) { + $r = q("SELECT * FROM xchan where xchan_addr = '%s' limit 1", + dbesc($handle) + ); + } + else { + $r = q("SELECT * FROM abook left join xchan on xchan_hash = abook_xchan where xchan_addr = '%s' and abook_channel = %d limit 1", + dbesc($handle), + intval($uid) + ); + } + + return (($r) ? $r[0] : false); +} + +function find_diaspora_person_by_handle($handle) { + + $person = false; + $refresh = false; + + if(diaspora_is_blacklisted($handle)) + return false; + + $r = q("select * from xchan where xchan_addr = '%s' limit 1", + dbesc($handle) + ); + if($r) { + $person = $r[0]; + logger('find_diaspora_person_by handle: in cache ' . print_r($r,true), LOGGER_DATA); + if($person['xchan_name_date'] < datetime_convert('UTC','UTC', 'now - 1 month')) { + logger('Updating Diaspora cached record for ' . $handle); + $refresh = true; + } + } + + if((! $person) || ($refresh)) { + + // try webfinger. Make sure to distinguish between diaspora, + // hubzilla w/diaspora protocol and friendica w/diaspora protocol. + + $result = discover_by_webbie($handle); + if($result) { + $r = q("select * from xchan where xchan_addr = '%s' limit 1", + dbesc(str_replace('acct:','',$handle)) + ); + if($r) { + $person = $r[0]; + logger('find_diaspora_person_by handle: discovered ' . print_r($r,true), LOGGER_DATA); + } + } + } + + return $person; +} + + +function get_diaspora_key($handle) { + logger('Fetching diaspora key for: ' . $handle, LOGGER_DEBUG); + $r = find_diaspora_person_by_handle($handle); + return(($r) ? $r['xchan_pubkey'] : ''); +} + + +function diaspora_pubmsg_build($msg,$channel,$contact,$prvkey,$pubkey) { + + $a = get_app(); + + logger('diaspora_pubmsg_build: ' . $msg, LOGGER_DATA); + + $handle = $channel['channel_address'] . '@' . get_app()->get_hostname(); + + + $b64url_data = base64url_encode($msg,false); + + $data = str_replace(array("\n","\r"," ","\t"),array('','','',''),$b64url_data); + + $type = 'application/xml'; + $encoding = 'base64url'; + $alg = 'RSA-SHA256'; + + $signable_data = $data . '.' . base64url_encode($type,false) . '.' + . base64url_encode($encoding,false) . '.' . base64url_encode($alg,false) ; + + $signature = rsa_sign($signable_data,$prvkey); + $sig = base64url_encode($signature,false); + +$magic_env = <<< EOT + + +
+ $handle +
+ + base64url + RSA-SHA256 + $data + $sig + +
+EOT; + + logger('diaspora_pubmsg_build: magic_env: ' . $magic_env, LOGGER_DATA); + return $magic_env; + +} + + + + +function diaspora_msg_build($msg,$channel,$contact,$prvkey,$pubkey,$public = false) { + $a = get_app(); + + if($public) + return diaspora_pubmsg_build($msg,$channel,$contact,$prvkey,$pubkey); + + logger('diaspora_msg_build: ' . $msg, LOGGER_DATA); + + // without a public key nothing will work + + if(! $pubkey) { + logger('diaspora_msg_build: pubkey missing: contact id: ' . $contact['abook_id']); + return ''; + } + + $inner_aes_key = random_string(32); + $b_inner_aes_key = base64_encode($inner_aes_key); + $inner_iv = random_string(16); + $b_inner_iv = base64_encode($inner_iv); + + $outer_aes_key = random_string(32); + $b_outer_aes_key = base64_encode($outer_aes_key); + $outer_iv = random_string(16); + $b_outer_iv = base64_encode($outer_iv); + + $handle = $channel['channel_address'] . '@' . get_app()->get_hostname(); + + $padded_data = pkcs5_pad($msg,16); + $inner_encrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $inner_aes_key, $padded_data, MCRYPT_MODE_CBC, $inner_iv); + + $b64_data = base64_encode($inner_encrypted); + + + $b64url_data = base64url_encode($b64_data,false); + $data = str_replace(array("\n","\r"," ","\t"),array('','','',''),$b64url_data); + + $type = 'application/xml'; + $encoding = 'base64url'; + $alg = 'RSA-SHA256'; + + $signable_data = $data . '.' . base64url_encode($type,false) . '.' + . base64url_encode($encoding,false) . '.' . base64url_encode($alg,false) ; + + logger('diaspora_msg_build: signable_data: ' . $signable_data, LOGGER_DATA); + + $signature = rsa_sign($signable_data,$prvkey); + $sig = base64url_encode($signature,false); + +$decrypted_header = <<< EOT + + $b_inner_iv + $b_inner_aes_key + $handle + +EOT; + + $decrypted_header = pkcs5_pad($decrypted_header,16); + + $ciphertext = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $outer_aes_key, $decrypted_header, MCRYPT_MODE_CBC, $outer_iv); + + $outer_json = json_encode(array('iv' => $b_outer_iv,'key' => $b_outer_aes_key)); + + $encrypted_outer_key_bundle = ''; + openssl_public_encrypt($outer_json,$encrypted_outer_key_bundle,$pubkey); + + $b64_encrypted_outer_key_bundle = base64_encode($encrypted_outer_key_bundle); + + logger('outer_bundle: ' . $b64_encrypted_outer_key_bundle . ' key: ' . $pubkey, LOGGER_DATA); + + $encrypted_header_json_object = json_encode(array('aes_key' => base64_encode($encrypted_outer_key_bundle), + 'ciphertext' => base64_encode($ciphertext))); + $cipher_json = base64_encode($encrypted_header_json_object); + + $encrypted_header = '' . $cipher_json . ''; + +$magic_env = <<< EOT + + + $encrypted_header + + base64url + RSA-SHA256 + $data + $sig + + +EOT; + + logger('diaspora_msg_build: magic_env: ' . $magic_env, LOGGER_DATA); + return $magic_env; + +} + +/** + * + * diaspora_decode($importer,$xml) + * array $importer -> from user table + * string $xml -> urldecoded Diaspora salmon + * + * Returns array + * 'message' -> decoded Diaspora XML message + * 'author' -> author diaspora handle + * 'key' -> author public key (converted to pkcs#8) + * + * Author and key are used elsewhere to save a lookup for verifying replies and likes + */ + + +function diaspora_decode($importer,$xml) { + + $public = false; + $basedom = parse_xml_string($xml); + + $children = $basedom->children('https://joindiaspora.com/protocol'); + + if($children->header) { + $public = true; + $author_link = str_replace('acct:','',$children->header->author_id); + } + else { + + $encrypted_header = json_decode(base64_decode($children->encrypted_header)); + + $encrypted_aes_key_bundle = base64_decode($encrypted_header->aes_key); + $ciphertext = base64_decode($encrypted_header->ciphertext); + + $outer_key_bundle = ''; + openssl_private_decrypt($encrypted_aes_key_bundle,$outer_key_bundle,$importer['channel_prvkey']); + + $j_outer_key_bundle = json_decode($outer_key_bundle); + + $outer_iv = base64_decode($j_outer_key_bundle->iv); + $outer_key = base64_decode($j_outer_key_bundle->key); + + $decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $outer_key, $ciphertext, MCRYPT_MODE_CBC, $outer_iv); + + + $decrypted = pkcs5_unpad($decrypted); + + /** + * $decrypted now contains something like + * + * + * 8e+G2+ET8l5BPuW0sVTnQw== + * UvSMb4puPeB14STkcDWq+4QE302Edu15oaprAQSkLKU= + +***** OBSOLETE + + * + * Ryan Hughes + * acct:galaxor@diaspora.pirateship.org + * + +***** CURRENT + + * galaxor@diaspora.priateship.org + +***** END DIFFS + + * + */ + + logger('decrypted: ' . $decrypted, LOGGER_DATA); + $idom = parse_xml_string($decrypted,false); + + $inner_iv = base64_decode($idom->iv); + $inner_aes_key = base64_decode($idom->aes_key); + + $author_link = str_replace('acct:','',$idom->author_id); + + } + + $dom = $basedom->children(NAMESPACE_SALMON_ME); + + // figure out where in the DOM tree our data is hiding + + if($dom->provenance->data) + $base = $dom->provenance; + elseif($dom->env->data) + $base = $dom->env; + elseif($dom->data) + $base = $dom; + + if(! $base) { + logger('mod-diaspora: unable to locate salmon data in xml '); + http_status_exit(400); + } + + + // Stash the signature away for now. We have to find their key or it won't be good for anything. + $signature = base64url_decode($base->sig); + + // unpack the data + + // strip whitespace so our data element will return to one big base64 blob + $data = str_replace(array(" ","\t","\r","\n"),array("","","",""),$base->data); + + + // stash away some other stuff for later + + $type = $base->data[0]->attributes()->type[0]; + $keyhash = $base->sig[0]->attributes()->keyhash[0]; + $encoding = $base->encoding; + $alg = $base->alg; + + $signed_data = $data . '.' . base64url_encode($type,false) . '.' . base64url_encode($encoding,false) . '.' . base64url_encode($alg,false); + + + // decode the data + $data = base64url_decode($data); + + + if($public) { + $inner_decrypted = $data; + } + else { + + // Decode the encrypted blob + + $inner_encrypted = base64_decode($data); + $inner_decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $inner_aes_key, $inner_encrypted, MCRYPT_MODE_CBC, $inner_iv); + $inner_decrypted = pkcs5_unpad($inner_decrypted); + } + + if(! $author_link) { + logger('mod-diaspora: Could not retrieve author URI.'); + http_status_exit(400); + } + + // Once we have the author URI, go to the web and try to find their public key + // (first this will look it up locally if it is in the fcontact cache) + // This will also convert diaspora public key from pkcs#1 to pkcs#8 + + logger('mod-diaspora: Fetching key for ' . $author_link ); + $key = get_diaspora_key($author_link); + + if(! $key) { + logger('mod-diaspora: Could not retrieve author key.'); + http_status_exit(400); + } + + $verify = rsa_verify($signed_data,$signature,$key); + + if(! $verify) { + logger('mod-diaspora: Message did not verify. Discarding.'); + http_status_exit(400); + } + + logger('mod-diaspora: Message verified.'); + + return array('message' => $inner_decrypted, 'author' => $author_link, 'key' => $key); + +} + + +/* sender is now sharing with recipient */ + +function diaspora_request($importer,$xml) { + + $a = get_app(); + + $sender_handle = unxmlify($xml->sender_handle); + $recipient_handle = unxmlify($xml->recipient_handle); + + if(! $sender_handle || ! $recipient_handle) + return; + + + // Do we already have an abook record? + + $contact = diaspora_get_contact_by_handle($importer['channel_id'],$sender_handle); + + if($contact && $contact['abook_id']) { + + // perhaps we were already sharing with this person. Now they're sharing with us. + // That makes us friends. Maybe. + + // Please note some of these permissions such as PERMS_R_PAGES are impossible for Disapora. + // They cannot authenticate to our system. + + $newperms = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK|PERMS_W_STREAM|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT|PERMS_R_STORAGE|PERMS_R_PAGES; + + $r = q("update abook set abook_their_perms = %d where abook_id = %d and abook_channel = %d", + intval($newperms), + intval($contact['abook_id']), + intval($importer['channel_id']) + ); + + return; + } + + $ret = find_diaspora_person_by_handle($sender_handle); + + if((! $ret) || (! strstr($ret['xchan_network'],'diaspora'))) { + logger('diaspora_request: Cannot resolve diaspora handle ' . $sender_handle . ' for ' . $recipient_handle); + return; + } + + +//FIXME +/* + if(feature_enabled($channel['channel_id'],'premium_channel')) { + $myaddr = $importer['channel_address'] . '@' . get_app()->get_hostname(); + $cnv = random_string(); + $mid = random_string(); + + $msg = t('You have started sharing with a $Projectname premium channel.'); + $msg .= t('$Projectname premium channels are not available for sharing with Diaspora members. This sharing request has been blocked.') . "\r"; + + $msg .= t('Please do not reply to this message, as this channel is not sharing with you and any reply will not be seen by the recipient.') . "\r"; + + $created = datetime_convert('UTC','UTC',$item['created'],'Y-m-d H:i:s \U\T\C'); + $signed_text = $mid . ';' . $cnv . ';' . $msg . ';' + . $created . ';' . $myaddr . ';' . $cnv; + + $sig = base64_encode(rsa_sign($signed_text,$importer['channel_prvkey'],'sha256')); + + $conv = array( + 'guid' => xmlify($cnv), + 'subject' => xmlify(t('Sharing request failed.')), + 'created_at' => xmlify($created), + 'diaspora_handle' => xmlify($myaddr), + 'participant_handles' => xmlify($myaddr . ';' . $sender_handle) + ); + + $msg = array( + 'guid' => xmlify($mid), + 'parent_guid' => xmlify($cnv), + 'parent_author_signature' => xmlify($sig), + 'author_signature' => xmlify($sig), + 'text' => xmlify($msg), + 'created_at' => xmlify($created), + 'diaspora_handle' => xmlify($myaddr), + 'conversation_guid' => xmlify($cnv) + ); + + $conv['messages'] = array($msg); + $tpl = get_markup_template('diaspora_conversation.tpl'); + $xmsg = replace_macros($tpl, array('$conv' => $conv)); + + $slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($xmsg,$importer,$ret,$importer['channel_prvkey'],$ret['xchan_pubkey'],false))); + + $qi = diaspora_queue($importer,$ret,$slap,false); + return $qi; + } + +*/ +// End FIXME + + + $role = get_pconfig($channel['channel_id'],'system','permissions_role'); + if($role) { + $x = get_role_perms($role); + if($x['perms_auto']) + $default_perms = $x['perms_accept']; + } + if(! $default_perms) + $default_perms = intval(get_pconfig($importer['channel_id'],'system','autoperms')); + + $their_perms = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK|PERMS_W_STREAM|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT|PERMS_R_STORAGE|PERMS_R_PAGES; + + + $closeness = get_pconfig($importer['channel_id'],'system','new_abook_closeness'); + if($closeness === false) + $closeness = 80; + + + $r = q("insert into abook ( abook_account, abook_channel, abook_xchan, abook_my_perms, abook_their_perms, abook_closeness, abook_created, abook_updated, abook_connected, abook_dob, abook_pending) values ( %d, %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', %d )", + intval($importer['channel_account_id']), + intval($importer['channel_id']), + dbesc($ret['xchan_hash']), + intval($default_perms), + intval($their_perms), + intval($closeness), + dbesc(datetime_convert()), + dbesc(datetime_convert()), + dbesc(datetime_convert()), + dbesc(NULL_DATE), + intval(($default_perms) ? 0 : 1) + ); + + + if($r) { + logger("New Diaspora introduction received for {$importer['channel_name']}"); + + $new_connection = q("select * from abook left join xchan on abook_xchan = xchan_hash left join hubloc on hubloc_hash = xchan_hash where abook_channel = %d and abook_xchan = '%s' order by abook_created desc limit 1", + intval($importer['channel_id']), + dbesc($ret['xchan_hash']) + ); + if($new_connection) { + require_once('include/enotify.php'); + notification(array( + 'type' => NOTIFY_INTRO, + 'from_xchan' => $ret['xchan_hash'], + 'to_xchan' => $importer['channel_hash'], + 'link' => z_root() . '/connedit/' . $new_connection[0]['abook_id'], + )); + + + if($default_perms) { + // Send back a sharing notification to them + $x = diaspora_share($importer,$new_connection[0]); + if($x) + proc_run('php','include/deliver.php',$x); + + } + + $clone = array(); + foreach($new_connection[0] as $k => $v) { + if(strpos($k,'abook_') === 0) { + $clone[$k] = $v; + } + } + unset($clone['abook_id']); + unset($clone['abook_account']); + unset($clone['abook_channel']); + + build_sync_packet($importer['channel_id'], array('abook' => array($clone))); + + } + } + + // find the abook record we just created + + $contact_record = diaspora_get_contact_by_handle($importer['channel_id'],$sender_handle); + + if(! $contact_record) { + logger('diaspora_request: unable to locate newly created contact record.'); + return; + } + + /** If there is a default group for this channel, add this member to it */ + + if($importer['channel_default_group']) { + require_once('include/group.php'); + $g = group_rec_byhash($importer['channel_id'],$importer['channel_default_group']); + if($g) + group_add_member($importer['channel_id'],'',$contact_record['xchan_hash'],$g['id']); + } + + return; +} + + + +function diaspora_post($importer,$xml,$msg) { + + $a = get_app(); + $guid = notags(unxmlify($xml->guid)); + $diaspora_handle = notags(unxmlify($xml->diaspora_handle)); + $app = notags(xmlify($xml->provider_display_name)); + + + if($diaspora_handle != $msg['author']) { + logger('diaspora_post: Potential forgery. Message handle is not the same as envelope sender.'); + return 202; + } + + $contact = diaspora_get_contact_by_handle($importer['channel_id'],$diaspora_handle); + if(! $contact) + return; + + + + if(! $app) { + if(strstr($contact['xchan_network'],'friendica')) + $app = 'Friendica'; + else + $app = 'Diaspora'; + } + + + $search_guid = ((strlen($guid) == 64) ? $guid . '%' : $guid); + + $r = q("SELECT id FROM item WHERE uid = %d AND mid like '%s' LIMIT 1", + intval($importer['channel_id']), + dbesc($search_guid) + ); + + if($r) { + // check dates if post editing is implemented + logger('diaspora_post: message exists: ' . $guid); + return; + } + + $created = unxmlify($xml->created_at); + $private = ((unxmlify($xml->public) == 'false') ? 1 : 0); + + $body = diaspora2bb($xml->raw_message); + + if($xml->photo) { + $body = '[img]' . $xml->photo->remote_photo_path . $xml->photo->remote_photo_name . '[/img]' . "\n\n" . $body; + $body = scale_external_images($body); + } + + $maxlen = get_max_import_size(); + + if($maxlen && mb_strlen($body) > $maxlen) { + $body = mb_substr($body,0,$maxlen,'UTF-8'); + logger('message length exceeds max_import_size: truncated'); + } + +//WTF? FIXME + // Add OEmbed and other information to the body +// $body = add_page_info_to_body($body, false, true); + + $datarray = array(); + + + // Look for tags and linkify them + $results = linkify_tags(get_app(), $body, $importer['channel_id'], true); + + $datarray['term'] = array(); + + if($results) { + foreach($results as $result) { + $success = $result['success']; + if($success['replaced']) { + $datarray['term'][] = array( + 'uid' => $importer['channel_id'], + 'type' => $success['termtype'], + 'otype' => TERM_OBJ_POST, + 'term' => $success['term'], + 'url' => $success['url'] + ); + } + } + } + + $cnt = preg_match_all('/@\[url=(.*?)\](.*?)\[\/url\]/ism',$body,$matches,PREG_SET_ORDER); + if($cnt) { + foreach($matches as $mtch) { + $datarray['term'][] = array( + 'uid' => $importer['channel_id'], + 'type' => TERM_MENTION, + 'otype' => TERM_OBJ_POST, + 'term' => $mtch[2], + 'url' => $mtch[1] + ); + } + } + + $cnt = preg_match_all('/@\[zrl=(.*?)\](.*?)\[\/zrl\]/ism',$body,$matches,PREG_SET_ORDER); + if($cnt) { + foreach($matches as $mtch) { + // don't include plustags in the term + $term = ((substr($mtch[2],-1,1) === '+') ? substr($mtch[2],0,-1) : $mtch[2]); + $datarray['term'][] = array( + 'uid' => $importer['channel_id'], + 'type' => TERM_MENTION, + 'otype' => TERM_OBJ_POST, + 'term' => $term, + 'url' => $mtch[1] + ); + } + } + + + + + $plink = service_plink($contact,$guid); + + $datarray['aid'] = $importer['channel_account_id']; + $datarray['uid'] = $importer['channel_id']; + + $datarray['verb'] = ACTIVITY_POST; + $datarray['mid'] = $datarray['parent_mid'] = $guid; + + $datarray['changed'] = $datarray['created'] = $datarray['edited'] = datetime_convert('UTC','UTC',$created); + $datarray['item_private'] = $private; + + $datarray['plink'] = $plink; + + $datarray['author_xchan'] = $contact['xchan_hash']; + $datarray['owner_xchan'] = $contact['xchan_hash']; + + $datarray['body'] = $body; + + $datarray['app'] = $app; + + $datarray['item_unseen'] = 1; + $datarray['item_thread_top'] = 1; + + $tgroup = tgroup_check($importer['channel_id'],$datarray); + + if((! $importer['system']) && (! perm_is_allowed($importer['channel_id'],$contact['xchan_hash'],'send_stream')) && (! $tgroup)) { + logger('diaspora_post: Ignoring this author.'); + return 202; + } + + if($importer['system']) { + $datarray['comment_policy'] = 'network: diaspora'; + } + + if(! post_is_importable($datarray,$contact)) { + logger('diaspora_post: filtering this author.'); + return 202; + } + + $result = item_store($datarray); + return; + +} + + +function get_diaspora_reshare_xml($url,$recurse = 0) { + + $x = z_fetch_url($url); + if(! $x['success']) + $x = z_fetch_url(str_replace('https://','http://',$url)); + if(! $x['success']) { + logger('get_diaspora_reshare_xml: unable to fetch source url ' . $url); + return; + } + logger('get_diaspora_reshare_xml: source: ' . $x['body'], LOGGER_DEBUG); + + $source_xml = parse_xml_string($x['body'],false); + + if(! $source_xml) { + logger('get_diaspora_reshare_xml: unparseable result from ' . $url); + return ''; + } + + if($source_xml->post->status_message) { + return $source_xml; + } + + // see if it's a reshare of a reshare + + if($source_xml->post->reshare) + $xml = $source_xml->post->reshare; + else + return false; + + if($xml->root_diaspora_id && $xml->root_guid && $recurse < 15) { + $orig_author = notags(unxmlify($xml->root_diaspora_id)); + $orig_guid = notags(unxmlify($xml->root_guid)); + $source_url = 'https://' . substr($orig_author,strpos($orig_author,'@')+1) . '/p/' . $orig_guid . '.xml'; + $y = get_diaspora_reshare_xml($source_url,$recurse+1); + if($y) + return $y; + } + return false; +} + + + +function diaspora_reshare($importer,$xml,$msg) { + + logger('diaspora_reshare: init: ' . print_r($xml,true), LOGGER_DATA); + + $a = get_app(); + $guid = notags(unxmlify($xml->guid)); + $diaspora_handle = notags(unxmlify($xml->diaspora_handle)); + + + if($diaspora_handle != $msg['author']) { + logger('diaspora_post: Potential forgery. Message handle is not the same as envelope sender.'); + return 202; + } + + $contact = diaspora_get_contact_by_handle($importer['channel_id'],$diaspora_handle); + if(! $contact) + return; + + $search_guid = ((strlen($guid) == 64) ? $guid . '%' : $guid); + $r = q("SELECT id FROM item WHERE uid = %d AND mid like '%s' LIMIT 1", + intval($importer['channel_id']), + dbesc($search_guid) + ); + if($r) { + logger('diaspora_reshare: message exists: ' . $guid); + return; + } + + $orig_author = notags(unxmlify($xml->root_diaspora_id)); + $orig_guid = notags(unxmlify($xml->root_guid)); + + $source_url = 'https://' . substr($orig_author,strpos($orig_author,'@')+1) . '/p/' . $orig_guid . '.xml'; + $orig_url = 'https://'.substr($orig_author,strpos($orig_author,'@')+1).'/posts/'.$orig_guid; + + $source_xml = get_diaspora_reshare_xml($source_url); + + if($source_xml->post->status_message) { + $body = diaspora2bb($source_xml->post->status_message->raw_message); + + $orig_author = notags(unxmlify($source_xml->post->status_message->diaspora_handle)); + $orig_guid = notags(unxmlify($source_xml->post->status_message->guid)); + + + // Checking for embedded pictures + if($source_xml->post->status_message->photo->remote_photo_path && + $source_xml->post->status_message->photo->remote_photo_name) { + + $remote_photo_path = notags(unxmlify($source_xml->post->status_message->photo->remote_photo_path)); + $remote_photo_name = notags(unxmlify($source_xml->post->status_message->photo->remote_photo_name)); + + $body = '[img]'.$remote_photo_path.$remote_photo_name.'[/img]'."\n".$body; + + logger('diaspora_reshare: embedded picture link found: '.$body, LOGGER_DEBUG); + } + + $body = scale_external_images($body); + + // Add OEmbed and other information to the body +// $body = add_page_info_to_body($body, false, true); + } + else { + // Maybe it is a reshare of a photo that will be delivered at a later time (testing) + logger('diaspora_reshare: no reshare content found: ' . print_r($source_xml,true)); + $body = ""; + //return; + } + + $maxlen = get_max_import_size(); + + if($maxlen && mb_strlen($body) > $maxlen) { + $body = mb_substr($body,0,$maxlen,'UTF-8'); + logger('message length exceeds max_import_size: truncated'); + } + + $person = find_diaspora_person_by_handle($orig_author); + + if($person) { + $orig_author_name = $person['xchan_name']; + $orig_author_link = $person['xchan_url']; + $orig_author_photo = $person['xchan_photo_m']; + } + + + $created = unxmlify($xml->created_at); + $private = ((unxmlify($xml->public) == 'false') ? 1 : 0); + + $datarray = array(); + + // Look for tags and linkify them + $results = linkify_tags(get_app(), $body, $importer['channel_id'], true); + + $datarray['term'] = array(); + + if($results) { + foreach($results as $result) { + $success = $result['success']; + if($success['replaced']) { + $datarray['term'][] = array( + 'uid' => $importer['channel_id'], + 'type' => $success['termtype'], + 'otype' => TERM_OBJ_POST, + 'term' => $success['term'], + 'url' => $success['url'] + ); + } + } + } + + $cnt = preg_match_all('/@\[url=(.*?)\](.*?)\[\/url\]/ism',$body,$matches,PREG_SET_ORDER); + if($cnt) { + foreach($matches as $mtch) { + $datarray['term'][] = array( + 'uid' => $importer['channel_id'], + 'type' => TERM_MENTION, + 'otype' => TERM_OBJ_POST, + 'term' => $mtch[2], + 'url' => $mtch[1] + ); + } + } + + $cnt = preg_match_all('/@\[zrl=(.*?)\](.*?)\[\/zrl\]/ism',$body,$matches,PREG_SET_ORDER); + if($cnt) { + foreach($matches as $mtch) { + // don't include plustags in the term + $term = ((substr($mtch[2],-1,1) === '+') ? substr($mtch[2],0,-1) : $mtch[2]); + $datarray['term'][] = array( + 'uid' => $importer['channel_id'], + 'type' => TERM_MENTION, + 'otype' => TERM_OBJ_POST, + 'term' => $term, + 'url' => $mtch[1] + ); + } + } + + + + + + $newbody = "[share author='" . urlencode($orig_author_name) + . "' profile='" . $orig_author_link + . "' avatar='" . $orig_author_photo + . "' link='" . $orig_url + . "' posted='" . datetime_convert('UTC','UTC',unxmlify($source_xml->post->status_message->created_at)) + . "' message_id='" . unxmlify($source_xml->post->status_message->guid) + . "']" . $body . "[/share]"; + + + $plink = service_plink($contact,$guid); + $datarray['aid'] = $importer['channel_account_id']; + $datarray['uid'] = $importer['channel_id']; + $datarray['mid'] = $datarray['parent_mid'] = $guid; + $datarray['changed'] = $datarray['created'] = $datarray['edited'] = datetime_convert('UTC','UTC',$created); + $datarray['item_private'] = $private; + $datarray['plink'] = $plink; + $datarray['owner_xchan'] = $contact['xchan_hash']; + $datarray['author_xchan'] = $contact['xchan_hash']; + + $datarray['body'] = $newbody; + $datarray['app'] = 'Diaspora'; + + + $tgroup = tgroup_check($importer['channel_id'],$datarray); + + if((! $importer['system']) && (! perm_is_allowed($importer['channel_id'],$contact['xchan_hash'],'send_stream')) && (! $tgroup)) { + logger('diaspora_reshare: Ignoring this author.'); + return 202; + } + + if(! post_is_importable($datarray,$contact)) { + logger('diaspora_reshare: filtering this author.'); + return 202; + } + + $result = item_store($datarray); + + return; + +} + + +function diaspora_asphoto($importer,$xml,$msg) { + logger('diaspora_asphoto called'); + + $a = get_app(); + $guid = notags(unxmlify($xml->guid)); + $diaspora_handle = notags(unxmlify($xml->diaspora_handle)); + + if($diaspora_handle != $msg['author']) { + logger('diaspora_post: Potential forgery. Message handle is not the same as envelope sender.'); + return 202; + } + + $contact = diaspora_get_contact_by_handle($importer['channel_id'],$diaspora_handle); + if(! $contact) + return; + + if((! $importer['system']) && (! perm_is_allowed($importer['channel_id'],$contact['xchan_hash'],'send_stream'))) { + logger('diaspora_asphoto: Ignoring this author.'); + return 202; + } + + $message_id = $diaspora_handle . ':' . $guid; + $r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `uri` = '%s' AND `guid` = '%s' LIMIT 1", + intval($importer['channel_id']), + dbesc($message_id), + dbesc($guid) + ); + if(count($r)) { + logger('diaspora_asphoto: message exists: ' . $guid); + return; + } + + // allocate a guid on our system - we aren't fixing any collisions. + // we're ignoring them + + $g = q("select * from guid where guid = '%s' limit 1", + dbesc($guid) + ); + if(! count($g)) { + q("insert into guid ( guid ) values ( '%s' )", + dbesc($guid) + ); + } + + $created = unxmlify($xml->created_at); + $private = ((unxmlify($xml->public) == 'false') ? 1 : 0); + + if(strlen($xml->objectId) && ($xml->objectId != 0) && ($xml->image_url)) { + $body = '[url=' . notags(unxmlify($xml->image_url)) . '][img]' . notags(unxmlify($xml->objectId)) . '[/img][/url]' . "\n"; + $body = scale_external_images($body,false); + } + elseif($xml->image_url) { + $body = '[img]' . notags(unxmlify($xml->image_url)) . '[/img]' . "\n"; + $body = scale_external_images($body); + } + else { + logger('diaspora_asphoto: no photo url found.'); + return; + } + + $plink = service_plink($contact,$guid); + + $datarray = array(); + + $datarray['uid'] = $importer['channel_id']; + $datarray['contact-id'] = $contact['id']; + $datarray['wall'] = 0; + $datarray['network'] = NETWORK_DIASPORA; + $datarray['guid'] = $guid; + $datarray['uri'] = $datarray['parent-uri'] = $message_id; + $datarray['changed'] = $datarray['created'] = $datarray['edited'] = datetime_convert('UTC','UTC',$created); + $datarray['private'] = $private; + $datarray['parent'] = 0; + $datarray['plink'] = $plink; + $datarray['owner-name'] = $contact['name']; + $datarray['owner-link'] = $contact['url']; + //$datarray['owner-avatar'] = $contact['thumb']; + $datarray['owner-avatar'] = ((x($contact,'thumb')) ? $contact['thumb'] : $contact['photo']); + $datarray['author-name'] = $contact['name']; + $datarray['author-link'] = $contact['url']; + $datarray['author-avatar'] = $contact['thumb']; + $datarray['body'] = $body; + + $datarray['app'] = 'Diaspora/Cubbi.es'; + + $message_id = item_store($datarray); + + //if($message_id) { + // q("update item set plink = '%s' where id = %d", + // dbesc($a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $message_id), + // intval($message_id) + // ); + //} + + return; + +} + + + + + + +function diaspora_comment($importer,$xml,$msg) { + + $a = get_app(); + $guid = notags(unxmlify($xml->guid)); + $parent_guid = notags(unxmlify($xml->parent_guid)); + $diaspora_handle = notags(unxmlify($xml->diaspora_handle)); + $target_type = notags(unxmlify($xml->target_type)); + $text = unxmlify($xml->text); + $author_signature = notags(unxmlify($xml->author_signature)); + + $parent_author_signature = (($xml->parent_author_signature) ? notags(unxmlify($xml->parent_author_signature)) : ''); + + $contact = diaspora_get_contact_by_handle($importer['channel_id'],$msg['author']); + if(! $contact) { + logger('diaspora_comment: cannot find contact: ' . $msg['author']); + return; + } + + + + $pubcomment = get_pconfig($importer['channel_id'],'system','diaspora_public_comments'); + + // by default comments on public posts are allowed from anybody on Diaspora. That is their policy. + // Once this setting is set to something we'll track your preference and it will over-ride the default. + + if($pubcomment === false) + $pubcomment = 1; + + // Friendica is currently truncating guids at 64 chars + $search_guid = $parent_guid; + if(strlen($parent_guid) == 64) + $search_guid = $parent_guid . '%'; + + $r = q("SELECT * FROM item WHERE uid = %d AND mid LIKE '%s' LIMIT 1", + intval($importer['channel_id']), + dbesc($search_guid) + ); + if(! $r) { + logger('diaspora_comment: parent item not found: parent: ' . $parent_guid . ' item: ' . $guid); + return; + } + + $parent_item = $r[0]; + + if(intval($parent_item['item_private'])) + $pubcomment = 0; + + $search_guid = $guid; + if(strlen($guid) == 64) + $search_guid = $guid . '%'; + + + $r = q("SELECT * FROM item WHERE uid = %d AND mid like '%s' LIMIT 1", + intval($importer['channel_id']), + dbesc($search_guid) + ); + if($r) { + logger('diaspora_comment: our comment just got relayed back to us (or there was a guid collision) : ' . $guid); + return; + } + + + + /* How Diaspora performs comment signature checking: + + - If an item has been sent by the comment author to the top-level post owner to relay on + to the rest of the contacts on the top-level post, the top-level post owner should check + the author_signature, then create a parent_author_signature before relaying the comment on + - If an item has been relayed on by the top-level post owner, the contacts who receive it + check only the parent_author_signature. Basically, they trust that the top-level post + owner has already verified the authenticity of anything he/she sends out + - In either case, the signature that get checked is the signature created by the person + who sent the psuedo-salmon + */ + + $signed_data = $guid . ';' . $parent_guid . ';' . $text . ';' . $diaspora_handle; + $key = $msg['key']; + + if($parent_author_signature) { + // If a parent_author_signature exists, then we've received the comment + // relayed from the top-level post owner. There's no need to check the + // author_signature if the parent_author_signature is valid + + $parent_author_signature = base64_decode($parent_author_signature); + + if(! rsa_verify($signed_data,$parent_author_signature,$key,'sha256')) { + logger('diaspora_comment: top-level owner verification failed.'); + return; + } + } + else { + // If there's no parent_author_signature, then we've received the comment + // from the comment creator. In that case, the person is commenting on + // our post, so he/she must be a contact of ours and his/her public key + // should be in $msg['key'] + + if($importer['system']) { + // don't relay to the sys channel + logger('diaspora_comment: relay to sys channel blocked.'); + return; + } + + $author_signature = base64_decode($author_signature); + + if(! rsa_verify($signed_data,$author_signature,$key,'sha256')) { + logger('diaspora_comment: comment author verification failed.'); + return; + } + } + + // Phew! Everything checks out. Now create an item. + + // Find the original comment author information. + // We need this to make sure we display the comment author + // information (name and avatar) correctly. + + if(strcasecmp($diaspora_handle,$msg['author']) == 0) + $person = $contact; + else { + $person = find_diaspora_person_by_handle($diaspora_handle); + + if(! is_array($person)) { + logger('diaspora_comment: unable to find author details'); + return; + } + } + + + $body = diaspora2bb($text); + + + $maxlen = get_max_import_size(); + + if($maxlen && mb_strlen($body) > $maxlen) { + $body = mb_substr($body,0,$maxlen,'UTF-8'); + logger('message length exceeds max_import_size: truncated'); + } + + + $datarray = array(); + + // Look for tags and linkify them + $results = linkify_tags(get_app(), $body, $importer['channel_id'], true); + + $datarray['term'] = array(); + + if($results) { + foreach($results as $result) { + $success = $result['success']; + if($success['replaced']) { + $datarray['term'][] = array( + 'uid' => $importer['channel_id'], + 'type' => $success['termtype'], + 'otype' => TERM_OBJ_POST, + 'term' => $success['term'], + 'url' => $success['url'] + ); + } + } + } + + $cnt = preg_match_all('/@\[url=(.*?)\](.*?)\[\/url\]/ism',$body,$matches,PREG_SET_ORDER); + if($cnt) { + foreach($matches as $mtch) { + $datarray['term'][] = array( + 'uid' => $importer['channel_id'], + 'type' => TERM_MENTION, + 'otype' => TERM_OBJ_POST, + 'term' => $mtch[2], + 'url' => $mtch[1] + ); + } + } + + $cnt = preg_match_all('/@\[zrl=(.*?)\](.*?)\[\/zrl\]/ism',$body,$matches,PREG_SET_ORDER); + if($cnt) { + foreach($matches as $mtch) { + // don't include plustags in the term + $term = ((substr($mtch[2],-1,1) === '+') ? substr($mtch[2],0,-1) : $mtch[2]); + $datarray['term'][] = array( + 'uid' => $importer['channel_id'], + 'type' => TERM_MENTION, + 'otype' => TERM_OBJ_POST, + 'term' => $term, + 'url' => $mtch[1] + ); + } + } + + $datarray['aid'] = $importer['channel_account_id']; + $datarray['uid'] = $importer['channel_id']; + $datarray['verb'] = ACTIVITY_POST; + $datarray['mid'] = $guid; + $datarray['parent_mid'] = $parent_item['mid']; + + // set the route to that of the parent so downstream hubs won't reject it. + $datarray['route'] = $parent_item['route']; + + // No timestamps for comments? OK, we'll the use current time. + $datarray['changed'] = $datarray['created'] = $datarray['edited'] = datetime_convert(); + $datarray['item_private'] = $parent_item['item_private']; + + $datarray['owner_xchan'] = $parent_item['owner_xchan']; + $datarray['author_xchan'] = $person['xchan_hash']; + + $datarray['body'] = $body; + + if(strstr($person['xchan_network'],'friendica')) + $app = 'Friendica'; + else + $app = 'Diaspora'; + + $datarray['app'] = $app; + + if(! $parent_author_signature) { + $key = get_config('system','pubkey'); + $x = array('signer' => $diaspora_handle, 'body' => $text, + 'signed_text' => $signed_data, 'signature' => base64_encode($author_signature)); + $datarray['diaspora_meta'] = json_encode($x); + } + + + + // So basically if something arrives at the sys channel it's by definition public and we allow it. + // If $pubcomment and the parent was public, we allow it. + // In all other cases, honour the permissions for this Diaspora connection + + $tgroup = tgroup_check($importer['channel_id'],$datarray); + + if((! $importer['system']) && (! $pubcomment) && (! perm_is_allowed($importer['channel_id'],$contact['xchan_hash'],'post_comments')) && (! $tgroup)) { + logger('diaspora_comment: Ignoring this author.'); + return 202; + } + + + + + $result = item_store($datarray); + + if($result && $result['success']) + $message_id = $result['item_id']; + + if(intval($parent_item['item_origin']) && (! $parent_author_signature)) { + // if the message isn't already being relayed, notify others + // the existence of parent_author_signature means the parent_author or owner + // is already relaying. + + proc_run('php','include/notifier.php','comment-import',$message_id); + } + + if($result['item_id']) { + $r = q("select * from item where id = %d limit 1", + intval($result['item_id']) + ); + if($r) + send_status_notifications($result['item_id'],$r[0]); + } + + return; +} + + + + +function diaspora_conversation($importer,$xml,$msg) { + + $a = get_app(); + + $guid = notags(unxmlify($xml->guid)); + $subject = notags(unxmlify($xml->subject)); + $diaspora_handle = notags(unxmlify($xml->diaspora_handle)); + $participant_handles = notags(unxmlify($xml->participant_handles)); + $created_at = datetime_convert('UTC','UTC',notags(unxmlify($xml->created_at))); + + $parent_uri = $diaspora_handle . ':' . $guid; + + $messages = $xml->message; + + if(! count($messages)) { + logger('diaspora_conversation: empty conversation'); + return; + } + + $contact = diaspora_get_contact_by_handle($importer['channel_id'],$msg['author']); + if(! $contact) { + logger('diaspora_conversation: cannot find contact: ' . $msg['author']); + return; + } + + + if(! perm_is_allowed($importer['channel_id'],$contact['xchan_hash'],'post_mail')) { + logger('diaspora_conversation: Ignoring this author.'); + return 202; + } + + $conversation = null; + + $c = q("select * from conv where uid = %d and guid = '%s' limit 1", + intval($importer['channel_id']), + dbesc($guid) + ); + if(count($c)) + $conversation = $c[0]; + else { + if($subject) + $nsubject = str_rot47(base64url_encode($subject)); + + $r = q("insert into conv (uid,guid,creator,created,updated,subject,recips) values(%d, '%s', '%s', '%s', '%s', '%s', '%s') ", + intval($importer['channel_id']), + dbesc($guid), + dbesc($diaspora_handle), + dbesc(datetime_convert('UTC','UTC',$created_at)), + dbesc(datetime_convert()), + dbesc($nsubject), + dbesc($participant_handles) + ); + if($r) + $c = q("select * from conv where uid = %d and guid = '%s' limit 1", + intval($importer['channel_id']), + dbesc($guid) + ); + if(count($c)) + $conversation = $c[0]; + } + if(! $conversation) { + logger('diaspora_conversation: unable to create conversation.'); + return; + } + + $conversation['subject'] = base64url_decode(str_rot47($conversation['subject'])); + + foreach($messages as $mesg) { + + $reply = 0; + + $msg_guid = notags(unxmlify($mesg->guid)); + $msg_parent_guid = notags(unxmlify($mesg->parent_guid)); + $msg_parent_author_signature = notags(unxmlify($mesg->parent_author_signature)); + $msg_author_signature = notags(unxmlify($mesg->author_signature)); + $msg_text = unxmlify($mesg->text); + $msg_created_at = datetime_convert('UTC','UTC',notags(unxmlify($mesg->created_at))); + $msg_diaspora_handle = notags(unxmlify($mesg->diaspora_handle)); + $msg_conversation_guid = notags(unxmlify($mesg->conversation_guid)); + if($msg_conversation_guid != $guid) { + logger('diaspora_conversation: message conversation guid does not belong to the current conversation. ' . $xml); + continue; + } + + $body = diaspora2bb($msg_text); + + + $maxlen = get_max_import_size(); + + if($maxlen && mb_strlen($body) > $maxlen) { + $body = mb_substr($body,0,$maxlen,'UTF-8'); + logger('message length exceeds max_import_size: truncated'); + } + + + $author_signed_data = $msg_guid . ';' . $msg_parent_guid . ';' . $msg_text . ';' . unxmlify($mesg->created_at) . ';' . $msg_diaspora_handle . ';' . $msg_conversation_guid; + + $author_signature = base64_decode($msg_author_signature); + + if(strcasecmp($msg_diaspora_handle,$msg['author']) == 0) { + $person = $contact; + $key = $msg['key']; + } + else { + $person = find_diaspora_person_by_handle($msg_diaspora_handle); + + if(is_array($person) && x($person,'xchan_pubkey')) + $key = $person['xchan_pubkey']; + else { + logger('diaspora_conversation: unable to find author details'); + continue; + } + } + + if(! rsa_verify($author_signed_data,$author_signature,$key,'sha256')) { + logger('diaspora_conversation: verification failed.'); + continue; + } + + if($msg_parent_author_signature) { + $owner_signed_data = $msg_guid . ';' . $msg_parent_guid . ';' . $msg_text . ';' . unxmlify($mesg->created_at) . ';' . $msg_diaspora_handle . ';' . $msg_conversation_guid; + + $parent_author_signature = base64_decode($msg_parent_author_signature); + + $key = $msg['key']; + + if(! rsa_verify($owner_signed_data,$parent_author_signature,$key,'sha256')) { + logger('diaspora_conversation: owner verification failed.'); + continue; + } + } + + $r = q("select id from mail where mid = '%s' limit 1", + dbesc($message_id) + ); + if(count($r)) { + logger('diaspora_conversation: duplicate message already delivered.', LOGGER_DEBUG); + continue; + } + + if($subject) + $subject = str_rot47(base64url_encode($subject)); + if($body) + $body = str_rot47(base64url_encode($body)); + + q("insert into mail ( `channel_id`, `convid`, `conv_guid`, `from_xchan`,`to_xchan`,`title`,`body`,`mail_obscured`,`mid`,`parent_mid`,`created`) values ( %d, %d, '%s', '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s')", + intval($importer['channel_id']), + intval($conversation['id']), + intval($conversation['guid']), + dbesc($person['xchan_hash']), + dbesc($importer['channel_hash']), + dbesc($subject), + dbesc($body), + intval(1), + dbesc($msg_guid), + dbesc($parent_uri), + dbesc($msg_created_at) + ); + + q("update conv set updated = '%s' where id = %d", + dbesc(datetime_convert()), + intval($conversation['id']) + ); + + require_once('include/enotify.php'); +/****** +//FIXME + + notification(array( + 'type' => NOTIFY_MAIL, + 'notify_flags' => $importer['notify-flags'], + 'language' => $importer['language'], + 'to_name' => $importer['username'], + 'to_email' => $importer['email'], + 'uid' =>$importer['importer_uid'], + 'item' => array('subject' => $subject, 'body' => $body), + 'source_name' => $person['name'], + 'source_link' => $person['url'], + 'source_photo' => $person['thumb'], + 'verb' => ACTIVITY_POST, + 'otype' => 'mail' + )); +*******/ + + } + + return; +} + +function diaspora_message($importer,$xml,$msg) { + + $a = get_app(); + + $msg_guid = notags(unxmlify($xml->guid)); + $msg_parent_guid = notags(unxmlify($xml->parent_guid)); + $msg_parent_author_signature = notags(unxmlify($xml->parent_author_signature)); + $msg_author_signature = notags(unxmlify($xml->author_signature)); + $msg_text = unxmlify($xml->text); + $msg_created_at = datetime_convert('UTC','UTC',notags(unxmlify($xml->created_at))); + $msg_diaspora_handle = notags(unxmlify($xml->diaspora_handle)); + $msg_conversation_guid = notags(unxmlify($xml->conversation_guid)); + + $parent_uri = $msg_parent_guid; + + $contact = diaspora_get_contact_by_handle($importer['channel_id'],$msg_diaspora_handle); + if(! $contact) { + logger('diaspora_message: cannot find contact: ' . $msg_diaspora_handle); + return; + } + + if(($contact['rel'] == CONTACT_IS_FOLLOWER) || ($contact['blocked']) || ($contact['readonly'])) { + logger('diaspora_message: Ignoring this author.'); + return 202; + } + + $conversation = null; + + $c = q("select * from conv where uid = %d and guid = '%s' limit 1", + intval($importer['channel_id']), + dbesc($msg_conversation_guid) + ); + if($c) + $conversation = $c[0]; + else { + logger('diaspora_message: conversation not available.'); + return; + } + + $reply = 0; + + $subject = $conversation['subject']; + $body = diaspora2bb($msg_text); + + + $maxlen = get_max_import_size(); + + if($maxlen && mb_strlen($body) > $maxlen) { + $body = mb_substr($body,0,$maxlen,'UTF-8'); + logger('message length exceeds max_import_size: truncated'); + } + + + + $message_id = $msg_diaspora_handle . ':' . $msg_guid; + + $author_signed_data = $msg_guid . ';' . $msg_parent_guid . ';' . $msg_text . ';' . unxmlify($xml->created_at) . ';' . $msg_diaspora_handle . ';' . $msg_conversation_guid; + + + $author_signature = base64_decode($msg_author_signature); + + $person = find_diaspora_person_by_handle($msg_diaspora_handle); + if(is_array($person) && x($person,'xchan_pubkey')) + $key = $person['xchan_pubkey']; + else { + logger('diaspora_message: unable to find author details'); + return; + } + + if(! rsa_verify($author_signed_data,$author_signature,$key,'sha256')) { + logger('diaspora_message: verification failed.'); + return; + } + + $r = q("select id from mail where mid = '%s' and channel_id = %d limit 1", + dbesc($message_id), + intval($importer['channel_id']) + ); + if($r) { + logger('diaspora_message: duplicate message already delivered.', LOGGER_DEBUG); + return; + } + + $key = get_config('system','pubkey'); + if($subject) + $subject = str_rot47(base64url_encode($subject)); + if($body) + $body = str_rot47(base64url_encode($body)); + + q("insert into mail ( `channel_id`, `convid`, `conv_guid`, `from_xchan`,`to_xchan`,`title`,`body`,`mail_obscured`,`mid`,`parent_mid`,`created`) values ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%d','%s','%s','%s')", + intval($importer['channel_id']), + intval($conversation['id']), + intval($conversation['guid']), + dbesc($person['xchan_hash']), + dbesc($importer['xchan_hash']), + dbesc($subject), + dbesc($body), + intval(1), + dbesc($msg_guid), + dbesc($parent_uri), + dbesc($msg_created_at) + ); + + q("update conv set updated = '%s' where id = %d", + dbesc(datetime_convert()), + intval($conversation['id']) + ); + + return; +} + + +function diaspora_photo($importer,$xml,$msg) { + + $a = get_app(); + + logger('diaspora_photo: init',LOGGER_DEBUG); + + $remote_photo_path = notags(unxmlify($xml->remote_photo_path)); + + $remote_photo_name = notags(unxmlify($xml->remote_photo_name)); + + $status_message_guid = notags(unxmlify($xml->status_message_guid)); + + $guid = notags(unxmlify($xml->guid)); + + $diaspora_handle = notags(unxmlify($xml->diaspora_handle)); + + $public = notags(unxmlify($xml->public)); + + $created_at = notags(unxmlify($xml_created_at)); + + logger('diaspora_photo: status_message_guid: ' . $status_message_guid, LOGGER_DEBUG); + + $contact = diaspora_get_contact_by_handle($importer['channel_id'],$msg['author']); + if(! $contact) { + logger('diaspora_photo: contact record not found: ' . $msg['author'] . ' handle: ' . $diaspora_handle); + return; + } + + if((! $importer['system']) && (! perm_is_allowed($importer['channel_id'],$contact['xchan_hash'],'send_stream'))) { + logger('diaspora_photo: Ignoring this author.'); + return 202; + } + + $r = q("SELECT * FROM `item` WHERE `uid` = %d AND `mid` = '%s' LIMIT 1", + intval($importer['channel_id']), + dbesc($status_message_guid) + ); + if(! $r) { + logger('diaspora_photo: attempt = ' . $attempt . '; status message not found: ' . $status_message_guid . ' for photo: ' . $guid); + return; + } + +// $parent_item = $r[0]; + +// $link_text = '[img]' . $remote_photo_path . $remote_photo_name . '[/img]' . "\n"; + +// $link_text = scale_external_images($link_text, true, +// array($remote_photo_name, 'scaled_full_' . $remote_photo_name)); + +// if(strpos($parent_item['body'],$link_text) === false) { +// $r = q("update item set `body` = '%s', `visible` = 1 where `id` = %d and `uid` = %d", +// dbesc($link_text . $parent_item['body']), +// intval($parent_item['id']), +// intval($parent_item['uid']) +// ); +// } + + return; +} + + + + +function diaspora_like($importer,$xml,$msg) { + + $a = get_app(); + $guid = notags(unxmlify($xml->guid)); + $parent_guid = notags(unxmlify($xml->parent_guid)); + $diaspora_handle = notags(unxmlify($xml->diaspora_handle)); + $target_type = notags(unxmlify($xml->target_type)); + $positive = notags(unxmlify($xml->positive)); + $author_signature = notags(unxmlify($xml->author_signature)); + + $parent_author_signature = (($xml->parent_author_signature) ? notags(unxmlify($xml->parent_author_signature)) : ''); + + // likes on comments not supported here and likes on photos not supported by Diaspora + +// if($target_type !== 'Post') +// return; + + $contact = diaspora_get_contact_by_handle($importer['channel_id'],$msg['author']); + if(! $contact) { + logger('diaspora_like: cannot find contact: ' . $msg['author'] . ' for channel ' . $importer['channel_name']); + return; + } + + + if((! $importer['system']) && (! perm_is_allowed($importer['channel_id'],$contact['xchan_hash'],'post_comments'))) { + logger('diaspora_like: Ignoring this author.'); + return 202; + } + + $r = q("SELECT * FROM `item` WHERE `uid` = %d AND `mid` = '%s' LIMIT 1", + intval($importer['channel_id']), + dbesc($parent_guid) + ); + if(! count($r)) { + logger('diaspora_like: parent item not found: ' . $guid); + return; + } + + $parent_item = $r[0]; + + $r = q("SELECT * FROM `item` WHERE `uid` = %d AND `mid` = '%s' LIMIT 1", + intval($importer['channel_id']), + dbesc($guid) + ); + if(count($r)) { + if($positive === 'true') { + logger('diaspora_like: duplicate like: ' . $guid); + return; + } + // Note: I don't think "Like" objects with positive = "false" are ever actually used + // It looks like "RelayableRetractions" are used for "unlike" instead + if($positive === 'false') { + logger('diaspora_like: received a like with positive set to "false"...ignoring'); + // perhaps call drop_item() + // FIXME--actually don't unless it turns out that Diaspora does indeed send out "false" likes + // send notification via proc_run() + return; + } + } + + $i = q("select * from xchan where xchan_hash = '%s' limit 1", + dbesc($parent_item['author_xchan']) + ); + if($i) + $item_author = $i[0]; + + // Note: I don't think "Like" objects with positive = "false" are ever actually used + // It looks like "RelayableRetractions" are used for "unlike" instead + if($positive === 'false') { + logger('diaspora_like: received a like with positive set to "false"'); + logger('diaspora_like: unlike received with no corresponding like...ignoring'); + return; + } + + + /* How Diaspora performs "like" signature checking: + + - If an item has been sent by the like author to the top-level post owner to relay on + to the rest of the contacts on the top-level post, the top-level post owner should check + the author_signature, then create a parent_author_signature before relaying the like on + - If an item has been relayed on by the top-level post owner, the contacts who receive it + check only the parent_author_signature. Basically, they trust that the top-level post + owner has already verified the authenticity of anything he/she sends out + - In either case, the signature that get checked is the signature created by the person + who sent the salmon + */ + + // 2014-09-10 let's try this: signatures are failing. I'll try and make a signable string from + // the parameters in the order they were presented in the post. This is how D* creates the signable string. + + + $signed_data = $positive . ';' . $guid . ';' . $target_type . ';' . $parent_guid . ';' . $diaspora_handle; + + $key = $msg['key']; + + if($parent_author_signature) { + // If a parent_author_signature exists, then we've received the like + // relayed from the top-level post owner. There's no need to check the + // author_signature if the parent_author_signature is valid + + $parent_author_signature = base64_decode($parent_author_signature); + + if(! rsa_verify($signed_data,$parent_author_signature,$key,'sha256')) { + if (intval(get_config('system','ignore_diaspora_like_signature'))) + logger('diaspora_like: top-level owner verification failed. Proceeding anyway.'); + else { + logger('diaspora_like: top-level owner verification failed.'); + return; + } + } + } + else { + // If there's no parent_author_signature, then we've received the like + // from the like creator. In that case, the person is "like"ing + // our post, so he/she must be a contact of ours and his/her public key + // should be in $msg['key'] + + $author_signature = base64_decode($author_signature); + + if(! rsa_verify($signed_data,$author_signature,$key,'sha256')) { + if (intval(get_config('system','ignore_diaspora_like_signature'))) + logger('diaspora_like: like creator verification failed. Proceeding anyway'); + else { + logger('diaspora_like: like creator verification failed.'); + return; + } + } + } + + logger('diaspora_like: signature check complete.',LOGGER_DEBUG); + + // Phew! Everything checks out. Now create an item. + + // Find the original comment author information. + // We need this to make sure we display the comment author + // information (name and avatar) correctly. + if(strcasecmp($diaspora_handle,$msg['author']) == 0) + $person = $contact; + else { + $person = find_diaspora_person_by_handle($diaspora_handle); + + if(! is_array($person)) { + logger('diaspora_like: unable to find author details'); + return; + } + } + + $uri = $diaspora_handle . ':' . $guid; + + $activity = ACTIVITY_LIKE; + + $post_type = (($parent_item['resource_type'] === 'photo') ? t('photo') : t('status')); + + $links = array(array('rel' => 'alternate','type' => 'text/html', 'href' => $parent_item['plink'])); + $objtype = (($parent_item['resource_type'] === 'photo') ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE ); + + $body = $parent_item['body']; + + + $object = json_encode(array( + 'type' => $post_type, + 'id' => $parent_item['mid'], + 'parent' => (($parent_item['thr_parent']) ? $parent_item['thr_parent'] : $parent_item['parent_mid']), + 'link' => $links, + 'title' => $parent_item['title'], + 'content' => $parent_item['body'], + 'created' => $parent_item['created'], + 'edited' => $parent_item['edited'], + 'author' => array( + 'name' => $item_author['xchan_name'], + 'address' => $item_author['xchan_addr'], + 'guid' => $item_author['xchan_guid'], + 'guid_sig' => $item_author['xchan_guid_sig'], + 'link' => array( + array('rel' => 'alternate', 'type' => 'text/html', 'href' => $item_author['xchan_url']), + array('rel' => 'photo', 'type' => $item_author['xchan_photo_mimetype'], 'href' => $item_author['xchan_photo_m'])), + ), + )); + + + $bodyverb = t('%1$s likes %2$s\'s %3$s'); + + $arr = array(); + + $arr['uid'] = $importer['channel_id']; + $arr['aid'] = $importer['channel_account_id']; + $arr['mid'] = $guid; + $arr['parent_mid'] = $parent_item['mid']; + $arr['owner_xchan'] = $parent_item['owner_xchan']; + $arr['author_xchan'] = $person['xchan_hash']; + + $ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]'; + $alink = '[url=' . $parent_item['author-link'] . ']' . $parent_item['author-name'] . '[/url]'; + $plink = '[url='. z_root() .'/display/'.$guid.']'.$post_type.'[/url]'; + $arr['body'] = sprintf( $bodyverb, $ulink, $alink, $plink ); + + $arr['app'] = 'Diaspora'; + + // set the route to that of the parent so downstream hubs won't reject it. + $arr['route'] = $parent_item['route']; + + $arr['item_private'] = $parent_item['item_private']; + $arr['verb'] = $activity; + $arr['obj_type'] = $objtype; + $arr['object'] = $object; + + if(! $parent_author_signature) { + $key = get_config('system','pubkey'); + $x = array('signer' => $diaspora_handle, 'body' => $text, + 'signed_text' => $signed_data, 'signature' => base64_encode($author_signature)); + $arr['diaspora_meta'] = json_encode($x); + } + + $x = item_store($arr); + + if($x) + $message_id = $x['item_id']; + + // if the message isn't already being relayed, notify others + // the existence of parent_author_signature means the parent_author or owner + // is already relaying. The parent_item['origin'] indicates the message was created on our system + + if(intval($parent_item['item_origin']) && (! $parent_author_signature)) + proc_run('php','include/notifier.php','comment-import',$message_id); + + return; +} + +function diaspora_retraction($importer,$xml) { + + + $guid = notags(unxmlify($xml->guid)); + $diaspora_handle = notags(unxmlify($xml->diaspora_handle)); + $type = notags(unxmlify($xml->type)); + + $contact = diaspora_get_contact_by_handle($importer['channel_id'],$diaspora_handle); + if(! $contact) + return; + + if($type === 'Person') { + require_once('include/Contact.php'); + contact_remove($importer['channel_id'],$contact['abook_id']); + } + elseif($type === 'Post') { + $r = q("select * from item where mid = '%s' and uid = %d limit 1", + dbesc('guid'), + intval($importer['channel_id']) + ); + if(count($r)) { + if(link_compare($r[0]['author_xchan'],$contact['xchan_hash'])) { + drop_item($r[0]['id'],false); + } + } + } + + return 202; + // NOTREACHED +} + +function diaspora_signed_retraction($importer,$xml,$msg) { + + + $guid = notags(unxmlify($xml->target_guid)); + $diaspora_handle = notags(unxmlify($xml->sender_handle)); + $type = notags(unxmlify($xml->target_type)); + $sig = notags(unxmlify($xml->target_author_signature)); + + $parent_author_signature = (($xml->parent_author_signature) ? notags(unxmlify($xml->parent_author_signature)) : ''); + + $contact = diaspora_get_contact_by_handle($importer['channel_id'],$diaspora_handle); + if(! $contact) { + logger('diaspora_signed_retraction: no contact ' . $diaspora_handle . ' for ' . $importer['channel_id']); + return; + } + + + $signed_data = $guid . ';' . $type ; + $key = $msg['key']; + + /* How Diaspora performs relayable_retraction signature checking: + + - If an item has been sent by the item author to the top-level post owner to relay on + to the rest of the contacts on the top-level post, the top-level post owner checks + the author_signature, then creates a parent_author_signature before relaying the item on + - If an item has been relayed on by the top-level post owner, the contacts who receive it + check only the parent_author_signature. Basically, they trust that the top-level post + owner has already verified the authenticity of anything he/she sends out + - In either case, the signature that get checked is the signature created by the person + who sent the salmon + */ + + if($parent_author_signature) { + + $parent_author_signature = base64_decode($parent_author_signature); + + if(! rsa_verify($signed_data,$parent_author_signature,$key,'sha256')) { + logger('diaspora_signed_retraction: top-level post owner verification failed'); + return; + } + + } + else { + + $sig_decode = base64_decode($sig); + + if(! rsa_verify($signed_data,$sig_decode,$key,'sha256')) { + logger('diaspora_signed_retraction: retraction owner verification failed.' . print_r($msg,true)); + return; + } + } + + if($type === 'StatusMessage' || $type === 'Comment' || $type === 'Like') { + $r = q("select * from item where mid = '%s' and uid = %d limit 1", + dbesc($guid), + intval($importer['channel_id']) + ); + if($r) { + if($r[0]['author_xchan'] == $contact['xchan_hash']) { + + drop_item($r[0]['id'],false, DROPITEM_PHASE1); + + // Now check if the retraction needs to be relayed by us + // + // The first item in the `item` table with the parent id is the parent. However, MySQL doesn't always + // return the items ordered by `item`.`id`, in which case the wrong item is chosen as the parent. + // The only item with `parent` and `id` as the parent id is the parent item. + $p = q("select item_flags from item where parent = %d and id = %d limit 1", + $r[0]['parent'], + $r[0]['parent'] + ); + if($p) { + if(intval($p[0]['item_origin']) && (! $parent_author_signature)) { + + // the existence of parent_author_signature would have meant the parent_author or owner + // is already relaying. + + logger('diaspora_signed_retraction: relaying relayable_retraction'); + proc_run('php','include/notifier.php','drop',$r[0]['id']); + } + } + } + } + } + else + logger('diaspora_signed_retraction: unknown type: ' . $type); + + return 202; + // NOTREACHED +} + +function diaspora_profile($importer,$xml,$msg) { + + $a = get_app(); + $diaspora_handle = notags(unxmlify($xml->diaspora_handle)); + + + if($diaspora_handle != $msg['author']) { + logger('diaspora_post: Potential forgery. Message handle is not the same as envelope sender.'); + return 202; + } + + $contact = diaspora_get_contact_by_handle($importer['channel_id'],$diaspora_handle); + if(! $contact) + return; + + if($contact['blocked']) { + logger('diaspora_post: Ignoring this author.'); + return 202; + } + + $name = unxmlify($xml->first_name) . ((strlen($xml->last_name)) ? ' ' . unxmlify($xml->last_name) : ''); + $image_url = unxmlify($xml->image_url); + $birthday = unxmlify($xml->birthday); + + + $handle_parts = explode("@", $diaspora_handle); + if($name === '') { + $name = $handle_parts[0]; + } + + if( preg_match("|^https?://|", $image_url) === 0) { + $image_url = "http://" . $handle_parts[1] . $image_url; + } + + require_once('include/photo/photo_driver.php'); + + $images = import_xchan_photo($image_url,$contact['xchan_hash']); + + // Generic birthday. We don't know the timezone. The year is irrelevant. + + $birthday = str_replace('1000','1901',$birthday); + + $birthday = datetime_convert('UTC','UTC',$birthday,'Y-m-d'); + + // this is to prevent multiple birthday notifications in a single year + // if we already have a stored birthday and the 'm-d' part hasn't changed, preserve the entry, which will preserve the notify year + + if(substr($birthday,5) === substr($contact['bd'],5)) + $birthday = $contact['bd']; + + $r = q("update xchan set xchan_name = '%s', xchan_name_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s' where xchan_hash = '%s' ", + dbesc($name), + dbesc(datetime_convert()), + dbesc($images[0]), + dbesc($images[1]), + dbesc($images[2]), + dbesc($images[3]), + dbesc(datetime_convert()), + intval($contact['xchan_hash']) + ); + + return; + +} + +function diaspora_share($owner,$contact) { + $a = get_app(); + + $allowed = get_pconfig($owner['channel_id'],'system','diaspora_allowed'); + if($allowed === false) + $allowed = 1; + + if(! intval($allowed)) { + logger('diaspora_share: disallowed for channel ' . $importer['channel_name']); + return; + } + + + + $myaddr = $owner['channel_address'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3); + + if(! array_key_exists('xchan_hash',$contact)) { + $c = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where xchan_hash = '%s' limit 1", + dbesc($contact['hubloc_hash']) + ); + if(! $c) { + logger('diaspora_share: ' . $contact['hubloc_hash'] . ' not found.'); + return; + } + $contact = $c[0]; + } + + $theiraddr = $contact['xchan_addr']; + + $tpl = get_markup_template('diaspora_share.tpl'); + $msg = replace_macros($tpl, array( + '$sender' => $myaddr, + '$recipient' => $theiraddr + )); + + $slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['channel_prvkey'],$contact['xchan_pubkey']))); + return(diaspora_queue($owner,$contact,$slap, false)); +} + +function diaspora_unshare($owner,$contact) { + + $a = get_app(); + $myaddr = $owner['channel_address'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3); + + $tpl = get_markup_template('diaspora_retract.tpl'); + $msg = replace_macros($tpl, array( + '$guid' => $owner['channel_guid'] . str_replace('.','',get_app()->get_hostname()), + '$type' => 'Person', + '$handle' => $myaddr + )); + + $slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['channel_prvkey'],$contact['xchan_pubkey']))); + + return(diaspora_queue($owner,$contact,$slap, false)); +} + + +function diaspora_send_status($item,$owner,$contact,$public_batch = false) { + + $a = get_app(); + $myaddr = $owner['channel_address'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3); + + if(intval($item['id']) != intval($item['parent'])) { + logger('attempted to send a comment as a top-level post'); + return; + } + + $images = array(); + + $title = $item['title']; + $body = bb2diaspora_itembody($item,true); + +/* + // We're trying to match Diaspora's split message/photo protocol but + // all the photos are displayed on D* as links and not img's - even + // though we're sending pretty much precisely what they send us when + // doing the same operation. + // Commented out for now, we'll use bb2diaspora to convert photos to markdown + // which seems to get through intact. + + $cnt = preg_match_all('|\[img\](.*?)\[\/img\]|',$body,$matches,PREG_SET_ORDER); + if($cnt) { + foreach($matches as $mtch) { + $detail = array(); + $detail['str'] = $mtch[0]; + $detail['path'] = dirname($mtch[1]) . '/'; + $detail['file'] = basename($mtch[1]); + $detail['guid'] = $item['guid']; + $detail['handle'] = $myaddr; + $images[] = $detail; + $body = str_replace($detail['str'],$mtch[1],$body); + } + } +*/ + + if(intval($item['item_consensus'])) { + $poll = replace_macros(get_markup_template('diaspora_consensus.tpl'), array( + '$guid_q' => '10000000', + '$question' => t('Please choose'), + '$guid_y' => '00000001', + '$agree' => t('Agree'), + '$guid_n' => '0000000F', + '$disagree' => t('Disagree'), + '$guid_a' => '00000000', + '$abstain' => t('Abstain') + )); + } + elseif($item['resource_type'] === 'event' && $item['resource_id']) { + $poll = replace_macros(get_markup_template('diaspora_consensus.tpl'), array( + '$guid_q' => '1000000', + '$question' => t('Please choose'), + '$guid_y' => '0000001', + '$agree' => t('I will attend'), + '$guid_n' => '000000F', + '$disagree' => t('I will not attend'), + '$guid_a' => '0000000', + '$abstain' => t('I may attend') + )); + } + else + $poll = ''; + + $public = (($item['item_private']) ? 'false' : 'true'); + + require_once('include/datetime.php'); + $created = datetime_convert('UTC','UTC',$item['created'],'Y-m-d H:i:s \U\T\C'); + + // Detect a share element and do a reshare + // see: https://github.com/Raven24/diaspora-federation/blob/master/lib/diaspora-federation/entities/reshare.rb + if (!$item['item_private'] AND ($ret = diaspora_is_reshare($item["body"]))) { + $tpl = get_markup_template('diaspora_reshare.tpl'); + $msg = replace_macros($tpl, array( + '$root_handle' => xmlify($ret['root_handle']), + '$root_guid' => $ret['root_guid'], + '$guid' => $item['mid'], + '$handle' => xmlify($myaddr), + '$public' => $public, + '$created' => $created, + '$provider' => (($item['app']) ? $item['app'] : t('$projectname')) + )); + } else { + $tpl = get_markup_template('diaspora_post.tpl'); + $msg = replace_macros($tpl, array( + '$body' => xmlify($body), + '$guid' => $item['mid'], + '$poll' => $poll, + '$handle' => xmlify($myaddr), + '$public' => $public, + '$created' => $created, + '$provider' => (($item['app']) ? $item['app'] : t('$projectname')) + )); + } + + logger('diaspora_send_status: '.$owner['channel_name'].' -> '.$contact['xchan_name'].' base message: ' . $msg, LOGGER_DATA); + + $slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['channel_prvkey'],$contact['xchan_pubkey'],$public_batch))); + + $qi = diaspora_queue($owner,$contact,$slap,$public_batch,$item['mid']); + +// logger('diaspora_send_status: guid: '.$item['mid'].' result '.$return_code, LOGGER_DEBUG); + + if(count($images)) { + diaspora_send_images($item,$owner,$contact,$images,$public_batch,$item['mid']); + } + + return $qi; +} + +function diaspora_is_reshare($body) { + + $body = trim($body); + + // Skip if it isn't a pure repeated messages + // Does it start with a share? + if(strpos($body, "[share") > 0) + return(false); + + // Does it end with a share? + if(strlen($body) > (strrpos($body, "[/share]") + 8)) + return(false); + + $attributes = preg_replace("/\[share(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism","$1",$body); + // Skip if there is no shared message in there + if ($body == $attributes) + return(false); + + $profile = ""; + preg_match("/profile='(.*?)'/ism", $attributes, $matches); + if ($matches[1] != "") + $profile = $matches[1]; + + preg_match('/profile="(.*?)"/ism', $attributes, $matches); + if ($matches[1] != "") + $profile = $matches[1]; + + $ret= array(); + + $ret["root_handle"] = preg_replace("=https?://(.*)/u/(.*)=ism", "$2@$1", $profile); + if (($ret["root_handle"] == $profile) OR ($ret["root_handle"] == "")) + return(false); + + $link = ""; + preg_match("/link='(.*?)'/ism", $attributes, $matches); + if ($matches[1] != "") + $link = $matches[1]; + + preg_match('/link="(.*?)"/ism', $attributes, $matches); + if ($matches[1] != "") + $link = $matches[1]; + + $ret["root_guid"] = preg_replace("=https?://(.*)/posts/(.*)=ism", "$2", $link); + if (($ret["root_guid"] == $link) OR ($ret["root_guid"] == "")) + return(false); + + return($ret); +} + +function diaspora_send_images($item,$owner,$contact,$images,$public_batch = false) { + $a = get_app(); + if(! count($images)) + return; + $mysite = substr($a->get_baseurl(),strpos($a->get_baseurl(),'://') + 3) . '/photo'; + + $tpl = get_markup_template('diaspora_photo.tpl'); + foreach($images as $image) { + if(! stristr($image['path'],$mysite)) + continue; + $resource = str_replace('.jpg','',$image['file']); + $resource = substr($resource,0,strpos($resource,'-')); + + $r = q("select * from photo where `resource_id` = '%s' and `uid` = %d limit 1", + dbesc($resource), + intval($owner['uid']) + ); + if(! $r) + continue; + $public = (($r[0]['allow_cid'] || $r[0]['allow_gid'] || $r[0]['deny_cid'] || $r[0]['deny_gid']) ? 'false' : 'true' ); + $msg = replace_macros($tpl,array( + '$path' => xmlify($image['path']), + '$filename' => xmlify($image['file']), + '$msg_guid' => xmlify($image['guid']), + '$guid' => xmlify($r[0]['resource_id']), + '$handle' => xmlify($image['handle']), + '$public' => xmlify($public), + '$created_at' => xmlify(datetime_convert('UTC','UTC',$r[0]['created'],'Y-m-d H:i:s \U\T\C')) + )); + + + logger('diaspora_send_photo: base message: ' . $msg, LOGGER_DATA); + $slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['channel_prvkey'],$contact['xchan_pubkey'],$public_batch))); + + return(diaspora_queue($owner,$contact,$slap,$public_batch,$item['mid'])); + } + +} + +function diaspora_send_followup($item,$owner,$contact,$public_batch = false) { + + $a = get_app(); + $myaddr = $owner['channel_address'] . '@' . get_app()->get_hostname(); + $theiraddr = $contact['xchan_addr']; + + // Diaspora doesn't support threaded comments, but some + // versions of Diaspora (i.e. Diaspora-pistos) support + // likes on comments + if(($item['verb'] === ACTIVITY_LIKE || $item['verb'] === ACTIVITY_DISLIKE) && $item['thr_parent']) { + $p = q("select mid, parent_mid from item where mid = '%s' limit 1", + dbesc($item['thr_parent']) + ); + } + else { + // The first item in the `item` table with the parent id is the parent. However, MySQL doesn't always + // return the items ordered by `item`.`id`, in which case the wrong item is chosen as the parent. + // The only item with `parent` and `id` as the parent id is the parent item. + $p = q("select * from item where parent = %d and id = %d limit 1", + intval($item['parent']), + intval($item['parent']) + ); + } + if($p) + $parent = $p[0]; + else + return; + + + if(($item['verb'] === ACTIVITY_LIKE) && ($parent['mid'] === $parent['parent_mid'])) { + $tpl = get_markup_template('diaspora_like.tpl'); + $like = true; + $target_type = 'Post'; + $positive = 'true'; + + if(intval($item['item_deleted'])) + logger('diaspora_send_followup: received deleted "like". Those should go to diaspora_send_retraction'); + } + else { + $tpl = get_markup_template('diaspora_comment.tpl'); + $like = false; + } + + if($item['diaspora_meta'] && ! $like) { + $diaspora_meta = json_decode($item['diaspora_meta'],true); + if($diaspora_meta) { + if(array_key_exists('iv',$diaspora_meta)) { + $key = get_config('system','prvkey'); + $meta = json_decode(crypto_unencapsulate($diaspora_meta,$key),true); + } + else + $meta = $diaspora_meta; + } + $signed_text = $meta['signed_text']; + $authorsig = $meta['signature']; + $signer = $meta['signer']; + $text = $meta['body']; + } + else { + $text = bb2diaspora_itembody($item); + + // sign it + + if($like) + $signed_text = $item['mid'] . ';' . $target_type . ';' . $parent['mid'] . ';' . $positive . ';' . $myaddr; + else + $signed_text = $item['mid'] . ';' . $parent['mid'] . ';' . $text . ';' . $myaddr; + + $authorsig = base64_encode(rsa_sign($signed_text,$owner['channel_prvkey'],'sha256')); + + } + + $msg = replace_macros($tpl,array( + '$guid' => xmlify($item['mid']), + '$parent_guid' => xmlify($parent['mid']), + '$target_type' =>xmlify($target_type), + '$authorsig' => xmlify($authorsig), + '$body' => xmlify($text), + '$positive' => xmlify($positive), + '$handle' => xmlify($myaddr) + )); + + logger('diaspora_followup: base message: ' . $msg, LOGGER_DATA); + + $slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['channel_prvkey'],$contact['xchan_pubkey'],$public_batch))); + + + return(diaspora_queue($owner,$contact,$slap,$public_batch,$item['mid'])); +} + + +function diaspora_send_relay($item,$owner,$contact,$public_batch = false) { + + + $a = get_app(); + $myaddr = $owner['channel_address'] . '@' . get_app()->get_hostname(); + + $text = bb2diaspora_itembody($item); + + $body = $text; + + // Diaspora doesn't support threaded comments, but some + // versions of Diaspora (i.e. Diaspora-pistos) support + // likes on comments + + // That version is now dead so detect a "sublike" and + // just send it as an activity. + + $sublike = false; + + if($item['verb'] === ACTIVITY_LIKE) { + if(($item['thr_parent']) && ($item['thr_parent'] !== $item['parent_mid'])) { + $sublike = true; + } + } + + // The first item in the `item` table with the parent id is the parent. However, MySQL doesn't always + // return the items ordered by `item`.`id`, in which case the wrong item is chosen as the parent. + // The only item with `parent` and `id` as the parent id is the parent item. + + $p = q("select * from item where parent = %d and id = %d limit 1", + intval($item['parent']), + intval($item['parent']) + ); + + + if($p) + $parent = $p[0]; + else { + logger('diaspora_send_relay: no parent'); + return; + } + + $like = false; + $relay_retract = false; + $sql_sign_id = 'iid'; + + if( intval($item['item_deleted'])) { + $relay_retract = true; + + $target_type = ( ($item['verb'] === ACTIVITY_LIKE && (! $sublike)) ? 'Like' : 'Comment'); + + $sql_sign_id = 'retract_iid'; + $tpl = get_markup_template('diaspora_relayable_retraction.tpl'); + } + elseif(($item['verb'] === ACTIVITY_LIKE) && (! $sublike)) { + $like = true; + + $target_type = ( $parent['mid'] === $parent['parent_mid'] ? 'Post' : 'Comment'); +// $positive = (intval($item['item_deleted']) ? 'false' : 'true'); + $positive = 'true'; + + $tpl = get_markup_template('diaspora_like_relay.tpl'); + } + else { // item is a comment + $tpl = get_markup_template('diaspora_comment_relay.tpl'); + } + + $diaspora_meta = (($item['diaspora_meta']) ? json_decode($item['diaspora_meta'],true) : ''); + if($diaspora_meta) { + if(array_key_exists('iv',$diaspora_meta)) { + $key = get_config('system','prvkey'); + $meta = json_decode(crypto_unencapsulate($diaspora_meta,$key),true); + } + else + $meta = $diaspora_meta; + $sender_signed_text = $meta['signed_text']; + $authorsig = $meta['signature']; + $handle = $meta['signer']; + $text = $meta['body']; + } + else + logger('diaspora_send_relay: original author signature not found'); + + /* Since the author signature is only checked by the parent, not by the relay recipients, + * I think it may not be necessary for us to do so much work to preserve all the original + * signatures. The important thing that Diaspora DOES need is the original creator's handle. + * Let's just generate that and forget about all the original author signature stuff. + * + * Note: this might be more of an problem if we want to support likes on comments for older + * versions of Diaspora (diaspora-pistos), but since there are a number of problems with + * doing that, let's ignore it for now. + * + * + */ +// bug - nomadic identity may/will affect diaspora_handle_from_contact + if(! $handle) { + if($item['author_xchan'] === $owner['channel_hash']) + $handle = $owner['channel_address'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3); + else + $handle = diaspora_handle_from_contact($item['author_xchan']); + } + if(! $handle) { + logger('diaspora_send_relay: no handle'); + return; + } + + if(! $sender_signed_text) { + if($relay_retract) + $sender_signed_text = $item['mid'] . ';' . $target_type; + elseif($like) + $sender_signed_text = $positive . ';' . $item['mid'] . ';' . $target_type . ';' . $parent['mid'] . ';' . $handle; + else + $sender_signed_text = $item['mid'] . ';' . $parent['mid'] . ';' . $text . ';' . $handle; + } + + // Sign the relayable with the top-level owner's signature + // + // We'll use the $sender_signed_text that we just created, instead of the $signed_text + // stored in the database, because that provides the best chance that Diaspora will + // be able to reconstruct the signed text the same way we did. This is particularly a + // concern for the comment, whose signed text includes the text of the comment. The + // smallest change in the text of the comment, including removing whitespace, will + // make the signature verification fail. Since we translate from BB code to Diaspora's + // markup at the top of this function, which is AFTER we placed the original $signed_text + // in the database, it's hazardous to trust the original $signed_text. + + $parentauthorsig = base64_encode(rsa_sign($sender_signed_text,$owner['channel_prvkey'],'sha256')); + + if(! $text) + logger('diaspora_send_relay: no text'); + + $msg = replace_macros($tpl,array( + '$guid' => xmlify($item['mid']), + '$parent_guid' => xmlify($parent['mid']), + '$target_type' =>xmlify($target_type), + '$authorsig' => xmlify($authorsig), + '$parentsig' => xmlify($parentauthorsig), + '$body' => xmlify($text), + '$positive' => xmlify($positive), + '$handle' => xmlify($handle) + )); + + logger('diaspora_send_relay: base message: ' . $msg, LOGGER_DATA); + + $slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['channel_prvkey'],$contact['xchan_pubkey'],$public_batch))); + + return(diaspora_queue($owner,$contact,$slap,$public_batch,$item['mid'])); + +} + + + +function diaspora_send_retraction($item,$owner,$contact,$public_batch = false) { + + $a = get_app(); + $myaddr = $owner['channel_address'] . '@' . get_app()->get_hostname(); + + // Check whether the retraction is for a top-level post or whether it's a relayable + if( $item['mid'] !== $item['parent_mid'] ) { + + $tpl = get_markup_template('diaspora_relay_retraction.tpl'); + $target_type = (($item['verb'] === ACTIVITY_LIKE) ? 'Like' : 'Comment'); + } + else { + + $tpl = get_markup_template('diaspora_signed_retract.tpl'); + $target_type = 'StatusMessage'; + } + + $signed_text = $item['mid'] . ';' . $target_type; + + $msg = replace_macros($tpl, array( + '$guid' => xmlify($item['mid']), + '$type' => xmlify($target_type), + '$handle' => xmlify($myaddr), + '$signature' => xmlify(base64_encode(rsa_sign($signed_text,$owner['channel_prvkey'],'sha256'))) + )); + + $slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['channel_prvkey'],$contact['xchan_pubkey'],$public_batch))); + + return(diaspora_queue($owner,$contact,$slap,$public_batch,$item['mid'])); +} + +function diaspora_send_mail($item,$owner,$contact) { + + $a = get_app(); + $myaddr = $owner['channel_address'] . '@' . get_app()->get_hostname(); + + $r = q("select * from conv where guid = '%s' and uid = %d limit 1", + intval($item['conv_guid']), + intval($item['channel_id']) + ); + + if(! count($r)) { + logger('diaspora_send_mail: conversation not found.'); + return; + } + $cnv = $r[0]; + $cnv['subject'] = base64url_decode(str_rot47($cnv['subject'])); + + $conv = array( + 'guid' => xmlify($cnv['guid']), + 'subject' => xmlify($cnv['subject']), + 'created_at' => xmlify(datetime_convert('UTC','UTC',$cnv['created'],'Y-m-d H:i:s \U\T\C')), + 'diaspora_handle' => xmlify($cnv['creator']), + 'participant_handles' => xmlify($cnv['recips']) + ); + + if(array_key_exists('mail_obscured',$item) && intval($item['mail_obscured'])) { + if($item['title']) + $item['title'] = base64url_decode(str_rot47($item['title'])); + if($item['body']) + $item['body'] = base64url_decode(str_rot47($item['body'])); + } + + + $body = bb2diaspora($item['body']); + $created = datetime_convert('UTC','UTC',$item['created'],'Y-m-d H:i:s \U\T\C'); + + $signed_text = $item['mid'] . ';' . $cnv['guid'] . ';' . $body . ';' + . $created . ';' . $myaddr . ';' . $cnv['guid']; + + $sig = base64_encode(rsa_sign($signed_text,$owner['channel_prvkey'],'sha256')); + + $msg = array( + 'guid' => xmlify($item['mid']), + 'parent_guid' => xmlify($cnv['guid']), + 'parent_author_signature' => (($item['reply']) ? null : xmlify($sig)), + 'author_signature' => xmlify($sig), + 'text' => xmlify($body), + 'created_at' => xmlify($created), + 'diaspora_handle' => xmlify($myaddr), + 'conversation_guid' => xmlify($cnv['guid']) + ); + + if($item['reply']) { + $tpl = get_markup_template('diaspora_message.tpl'); + $xmsg = replace_macros($tpl, array('$msg' => $msg)); + } + else { + $conv['messages'] = array($msg); + $tpl = get_markup_template('diaspora_conversation.tpl'); + $xmsg = replace_macros($tpl, array('$conv' => $conv)); + } + + logger('diaspora_conversation: ' . print_r($xmsg,true), LOGGER_DATA); + + $slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($xmsg,$owner,$contact,$owner['channel_prvkey'],$contact['xchan_pubkey'],false))); + + return(diaspora_queue($owner,$contact,$slap,false,$item['mid'])); + + +} + +function diaspora_queue($owner,$contact,$slap,$public_batch,$message_id = '') { + + + $allowed = get_pconfig($owner['channel_id'],'system','diaspora_allowed'); + if($allowed === false) + $allowed = 1; + + if(! intval($allowed)) { + return false; + } + + if($public_batch) + $dest_url = $contact['hubloc_callback'] . '/public'; + else + $dest_url = $contact['hubloc_callback'] . '/users/' . $contact['hubloc_guid']; + + logger('diaspora_queue: URL: ' . $dest_url, LOGGER_DEBUG); + + if(intval(get_config('system','diaspora_test'))) + return false; + + $a = get_app(); + $logid = random_string(4); + + logger('diaspora_queue: ' . $logid . ' ' . $dest_url, LOGGER_DEBUG); + + $hash = random_string(); + + q("insert into outq ( outq_hash, outq_account, outq_channel, outq_driver, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', '%s', %d, '%s', '%s', '%s', '%s' )", + dbesc($hash), + intval($owner['account_id']), + intval($owner['channel_id']), + dbesc('post'), + dbesc($dest_url), + intval(1), + dbesc(datetime_convert()), + dbesc(datetime_convert()), + dbesc(''), + dbesc($slap) + ); + + if($message_id) { + q("insert into dreport ( dreport_mid, dreport_site, dreport_recip, dreport_result, dreport_time, dreport_xchan, dreport_queue ) values ( '%s','%s','%s','%s','%s','%s','%s' ) ", + dbesc($message_id), + dbesc($dest_url), + dbesc($dest_url), + dbesc('queued'), + dbesc(datetime_convert()), + dbesc($owner['channel_hash']), + dbesc($hash) + ); + } + + return $hash; + +} + + +function diaspora_follow_allow(&$a, &$b) { + + if($b['xchan']['xchan_network'] !== 'diaspora' && $b['xchan']['xchan_network'] !== 'friendica-over-diaspora') + return; + + $allowed = get_pconfig($b['channel_id'],'system','diaspora_allowed'); + if($allowed === false) + $allowed = 1; + $b['allowed'] = $allowed; + +} + + +function diaspora_discover(&$a,&$b) { + + require_once('include/network.php'); + + $result = array(); + $network = null; + $diaspora = false; + + $diaspora_base = ''; + $diaspora_guid = ''; + $diaspora_key = ''; + $dfrn = false; + + $x = old_webfinger($webbie); + if($x) { + logger('old_webfinger: ' . print_r($x,true)); + foreach($x as $link) { + if($link['@attributes']['rel'] === NAMESPACE_DFRN) + $dfrn = unamp($link['@attributes']['href']); + if($link['@attributes']['rel'] === 'salmon') + $notify = unamp($link['@attributes']['href']); + if($link['@attributes']['rel'] === NAMESPACE_FEED) + $poll = unamp($link['@attributes']['href']); + if($link['@attributes']['rel'] === 'http://microformats.org/profile/hcard') + $hcard = unamp($link['@attributes']['href']); + if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page') + $profile = unamp($link['@attributes']['href']); + if($link['@attributes']['rel'] === 'http://portablecontacts.net/spec/1.0') + $poco = unamp($link['@attributes']['href']); + if($link['@attributes']['rel'] === 'http://joindiaspora.com/seed_location') { + $diaspora_base = unamp($link['@attributes']['href']); + $diaspora = true; + } + if($link['@attributes']['rel'] === 'http://joindiaspora.com/guid') { + $diaspora_guid = unamp($link['@attributes']['href']); + $diaspora = true; + } + if($link['@attributes']['rel'] === 'diaspora-public-key') { + $diaspora_key = base64_decode(unamp($link['@attributes']['href'])); + if(strstr($diaspora_key,'RSA ')) + $pubkey = rsatopem($diaspora_key); + else + $pubkey = $diaspora_key; + $diaspora = true; + } + } + + if($diaspora && $diaspora_base && $diaspora_guid) { + $guid = $diaspora_guid; + $diaspora_base = trim($diaspora_base,'/'); + + $notify = $diaspora_base . '/receive'; + + if(strpos($webbie,'@')) { + $addr = str_replace('acct:', '', $webbie); + $hostname = substr($webbie,strpos($webbie,'@')+1); + } + $network = 'diaspora'; + // until we get a dfrn layer, we'll use diaspora protocols for Friendica, + // but give it a different network so we can go back and fix these when we get proper support. + // It really should be just 'friendica' but we also want to distinguish + // between Friendica sites that we can use D* protocols with and those we can't. + // Some Friendica sites will have Diaspora disabled. + if($dfrn) + $network = 'friendica-over-diaspora'; + if($hcard) { + $vcard = scrape_vcard($hcard); + $vcard['nick'] = substr($webbie,0,strpos($webbie,'@')); + if(! $vcard['fn']) + $vcard['fn'] = $webbie; + } + + $r = q("select * from xchan where xchan_hash = '%s' limit 1", + dbesc($addr) + ); + + /** + * + * Diaspora communications are notoriously unreliable and receiving profile update messages (indeed any messages) + * are pretty much random luck. We'll check the timestamp of the xchan_name_date at a higher level and refresh + * this record once a month; because if you miss a profile update message and they update their profile photo or name + * you're otherwise stuck with stale info until they change their profile again - which could be years from now. + * + */ + + if($r) { + $r = q("update xchan set xchan_name = '%s', xchan_network = '%s', xchan_name_date = '%s' where xchan_hash = '%s' limit 1", + dbesc($vcard['fn']), + dbesc($network), + dbesc(datetime_convert()), + dbesc($addr) + ); + } + else { + + $r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_pubkey, xchan_addr, xchan_url, xchan_name, xchan_network, xchan_name_date ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') ", + dbesc($addr), + dbesc($guid), + dbesc($pubkey), + dbesc($addr), + dbesc($profile), + dbesc($vcard['fn']), + dbesc($network), + dbescdate(datetime_convert()) + ); + } + + $r = q("select * from hubloc where hubloc_hash = '%s' limit 1", + dbesc($webbie) + ); + + if(! $r) { + + $r = q("insert into hubloc ( hubloc_guid, hubloc_hash, hubloc_addr, hubloc_network, hubloc_url, hubloc_host, hubloc_callback, hubloc_updated, hubloc_primary ) values ('%s','%s','%s','%s','%s','%s','%s','%s', 1)", + dbesc($guid), + dbesc($addr), + dbesc($addr), + dbesc($network), + dbesc(trim($diaspora_base,'/')), + dbesc($hostname), + dbesc($notify), + dbescdate(datetime_convert()) + ); + } + $photos = import_xchan_photo($vcard['photo'],$addr); + $r = q("update xchan set xchan_photo_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s' where xchan_hash = '%s'", + dbescdate(datetime_convert('UTC','UTC',$arr['photo_updated'])), + dbesc($photos[0]), + dbesc($photos[1]), + dbesc($photos[2]), + dbesc($photos[3]), + dbesc($addr) + ); + return true; + + } + + return false; + +/* + $vcard['fn'] = notags($vcard['fn']); + $vcard['nick'] = str_replace(' ','',notags($vcard['nick'])); + + $result['name'] = $vcard['fn']; + $result['nick'] = $vcard['nick']; + $result['guid'] = $guid; + $result['url'] = $profile; + $result['hostname'] = $hostname; + $result['addr'] = $addr; + $result['batch'] = $batch; + $result['notify'] = $notify; + $result['poll'] = $poll; + $result['request'] = $request; + $result['confirm'] = $confirm; + $result['poco'] = $poco; + $result['photo'] = $vcard['photo']; + $result['priority'] = $priority; + $result['network'] = $network; + $result['alias'] = $alias; + $result['pubkey'] = $pubkey; + + logger('probe_url: ' . print_r($result,true), LOGGER_DEBUG); + + return $result; + +*/ + +/* Sample Diaspora result. + +Array +( + [name] => Mike Macgirvin + [nick] => macgirvin + [guid] => a9174a618f8d269a + [url] => https://joindiaspora.com/u/macgirvin + [hostname] => joindiaspora.com + [addr] => macgirvin@joindiaspora.com + [batch] => + [notify] => https://joindiaspora.com/receive + [poll] => https://joindiaspora.com/public/macgirvin.atom + [request] => + [confirm] => + [poco] => + [photo] => https://joindiaspora.s3.amazonaws.com/uploads/images/thumb_large_fec4e6eef13ae5e56207.jpg + [priority] => + [network] => diaspora + [alias] => + [pubkey] => -----BEGIN PUBLIC KEY----- +MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtihtyIuRDWkDpCA+I1UaQ +jI4S7k625+A7EEJm+pL2ZVSJxeCKiFeEgHBQENjLMNNm8l8F6blxgQqE6ZJ9Spa7f +tlaXYTRCrfxKzh02L3hR7sNA+JS/nXJaUAIo+IwpIEspmcIRbD9GB7Wv/rr+M28uH +31EeYyDz8QL6InU/bJmnCdFvmEMBQxJOw1ih9tQp7UNJAbUMCje0WYFzBz7sfcaHL +OyYcCOqOCBLdGucUoJzTQ9iDBVzB8j1r1JkIHoEb2moUoKUp+tkCylNfd/3IVELF9 +7w1Qjmit3m50OrJk2DQOXvCW9KQxaQNdpRPSwhvemIt98zXSeyZ1q/YjjOwG0DWDq +AF8aLj3/oQaZndTPy/6tMiZogKaijoxj8xFLuPYDTw5VpKquriVC0z8oxyRbv4t9v +8JZZ9BXqzmayvY3xZGGp8NulrfjW+me2bKh0/df1aHaBwpZdDTXQ6kqAiS2FfsuPN +vg57fhfHbL1yJ4oDbNNNeI0kJTGchXqerr8C20khU/cQ2Xt31VyEZtnTB665Ceugv +kp3t2qd8UpAVKl430S5Quqx2ymfUIdxdW08CEjnoRNEL3aOWOXfbf4gSVaXmPCR4i +LSIeXnd14lQYK/uxW/8cTFjcmddsKxeXysoQxbSa9VdDK+KkpZdgYXYrTTofXs6v+ +4afAEhRaaY+MCAwEAAQ== +-----END PUBLIC KEY----- + +) +*/ + + + + + } +} + + +function diaspora_feature_settings_post(&$a,&$b) { + + if($_POST['diaspora-submit']) { + set_pconfig(local_channel(),'system','diaspora_allowed',intval($_POST['dspr_allowed'])); + set_pconfig(local_channel(),'system','diaspora_public_comments',intval($_POST['dspr_pubcomment'])); + set_pconfig(local_channel(),'system','prevent_tag_hijacking',intval($_POST['dspr_hijack'])); + info( t('Diaspora Protocol Settings updated.') . EOL); + } +} + + +function diaspora_feature_settings(&$a,&$s) { + $dspr_allowed = get_pconfig(local_channel(),'system','diaspora_allowed'); + if($dspr_allowed === false) + $dspr_allowed = get_config('diaspora','allowed'); + $pubcomments = get_pconfig(local_channel(),'system','diaspora_public_comments'); + if($pubcomments === false) + $pubcomments = 1; + $hijacking = get_pconfig(local_channel(),'system','prevent_tag_hijacking'); + + $sc .= replace_macros(get_markup_template('field_checkbox.tpl'), array( + '$field' => array('dspr_allowed', t('Enable the (experimental) Diaspora protocol for this channel'), $dspr_allowed, '', $yes_no), + )); + + $sc .= replace_macros(get_markup_template('field_checkbox.tpl'), array( + '$field' => array('dspr_pubcomment', t('Allow any Diaspora member to comment on your public posts'), $pubcomments, '', $yes_no), + )); + + $sc .= replace_macros(get_markup_template('field_checkbox.tpl'), array( + '$field' => array('dspr_hijack', t('Prevent your hashtags from being redirected to other sites'), $hijacking, '', $yes_no), + )); + + + $s .= replace_macros(get_markup_template('generic_addon_settings.tpl'), array( + '$addon' => array('diaspora', '' . t('Diaspora Protocol Settings'), '', t('Submit')), + '$content' => $sc + )); + + return; + +} diff --git a/sources/addons/diaspora/p.php b/sources/addons/diaspora/p.php new file mode 100644 index 00000000..3df8cd55 --- /dev/null +++ b/sources/addons/diaspora/p.php @@ -0,0 +1,52 @@ +get_hostname(); + + $item = $r[0]; + + $title = $item['title']; + $body = bb2diaspora_itembody($item); + $created = datetime_convert('UTC','UTC',$item['created'],'Y-m-d H:i:s \U\T\C'); + + $tpl = get_markup_template('diaspora_post.tpl'); + $msg = replace_macros($tpl, array( + '$body' => xmlify($body), + '$guid' => $item['mid'], + '$handle' => xmlify($myaddr), + '$public' => 'true', + '$created' => $created, + '$provider' => (($item['app']) ? $item['app'] : t('$projectname')) + )); + + header('Content-type: text/xml'); + echo $msg; + killme(); +} \ No newline at end of file diff --git a/sources/addons/diaspora/receive.php b/sources/addons/diaspora/receive.php new file mode 100644 index 00000000..fad4ae71 --- /dev/null +++ b/sources/addons/diaspora/receive.php @@ -0,0 +1,75 @@ +argv, true), LOGGER_DEBUG); + + if((argc() == 2) && (argv(1) === 'public')) { + $public = true; + } + else { + + if(argc() != 3 || argv(1) !== 'users') + http_status_exit(500); + + $guid = argv(2); + $hn = str_replace('.','',$a->get_hostname()); + if(($x = strpos($guid,$hn)) > 0) + $guid = substr($guid,0,$x); + + // Diaspora sites *may* provide a truncated guid. + + $r = q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_guid like '%s' AND channel_removed = 0 LIMIT 1", + dbesc($guid . '%') + ); + + if(! $r) + http_status_exit(500); + + $importer = $r[0]; + } + + // It is an application/x-www-form-urlencoded that has been urlencoded twice. + + logger('mod-diaspora: receiving post', LOGGER_DEBUG); + + $xml = urldecode($_POST['xml']); + + logger('mod-diaspora: new salmon ' . $xml, LOGGER_DATA); + + if(! $xml) + http_status_exit(500); + + logger('mod-diaspora: message is okay', LOGGER_DEBUG); + + $msg = diaspora_decode($importer,$xml); + + logger('mod-diaspora: decoded', LOGGER_DEBUG); + + logger('mod-diaspora: decoded msg: ' . print_r($msg,true), LOGGER_DATA); + + if(! is_array($msg)) + http_status_exit(500); + + logger('mod-diaspora: dispatching', LOGGER_DEBUG); + + $ret = 0; + if($public) + diaspora_dispatch_public($msg); + else + $ret = diaspora_dispatch($importer,$msg); + + http_status_exit(($ret) ? $ret : 200); + // NOTREACHED +} + diff --git a/sources/addons/diaspost/diasphp.php b/sources/addons/diaspost/diasphp.php new file mode 100644 index 00000000..d4c31b47 --- /dev/null +++ b/sources/addons/diaspost/diasphp.php @@ -0,0 +1,107 @@ +token_regex = '/content="(.*?)" name="csrf-token/'; + + $this->pod = $pod; + $this->cookiejar = tempnam(sys_get_temp_dir(), 'cookies'); + } + + function _fetch_token() { + $ch = curl_init(); + + curl_setopt ($ch, CURLOPT_URL, $this->pod . "/stream"); + curl_setopt ($ch, CURLOPT_COOKIEFILE, $this->cookiejar); + curl_setopt ($ch, CURLOPT_COOKIEJAR, $this->cookiejar); + curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, true); + curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt ($ch, CURLOPT_TIMEOUT, 60); + + + $output = curl_exec ($ch); + curl_close($ch); + + // Token holen und zurückgeben + preg_match($this->token_regex, $output, $matches); + return $matches[1]; + } + + function login($username, $password) { + $datatopost = array( + 'user[username]' => $username, + 'user[password]' => $password, + 'authenticity_token' => $this->_fetch_token() + ); + + $poststr = http_build_query($datatopost); + + // Adresse per cURL abrufen + $ch = curl_init(); + + curl_setopt ($ch, CURLOPT_URL, $this->pod . "/users/sign_in"); + curl_setopt ($ch, CURLOPT_COOKIEFILE, $this->cookiejar); + curl_setopt ($ch, CURLOPT_COOKIEJAR, $this->cookiejar); + curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, false); + curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt ($ch, CURLOPT_POST, true); + curl_setopt ($ch, CURLOPT_POSTFIELDS, $poststr); + curl_setopt ($ch, CURLOPT_TIMEOUT, 60); + + curl_exec ($ch); + $info = curl_getinfo($ch); + curl_close($ch); + + if($info['http_code'] != 302) { + throw new Exception('Login error '.print_r($info, true)); + } + + // Das Objekt zurückgeben, damit man Aurufe verketten kann. + return $this; + } + + function post($text, $provider = "diasphp") { + // post-daten vorbereiten + $datatopost = json_encode(array( + 'aspect_ids' => 'public', + 'status_message' => array('text' => $text, + 'provider_display_name' => $provider) + )); + + // header vorbereiten + $headers = array( + 'Content-Type: application/json', + 'accept: application/json', + 'x-csrf-token: '.$this->_fetch_token() + ); + + // Adresse per cURL abrufen + $ch = curl_init(); + + curl_setopt ($ch, CURLOPT_URL, $this->pod . "/status_messages"); + curl_setopt ($ch, CURLOPT_COOKIEFILE, $this->cookiejar); + curl_setopt ($ch, CURLOPT_COOKIEJAR, $this->cookiejar); + curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, false); + curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt ($ch, CURLOPT_POST, true); + curl_setopt ($ch, CURLOPT_POSTFIELDS, $datatopost); + curl_setopt ($ch, CURLOPT_HTTPHEADER, $headers); + curl_setopt ($ch, CURLOPT_TIMEOUT, 60); + + curl_exec ($ch); + $info = curl_getinfo($ch); + curl_close($ch); + + if($info['http_code'] != 201) { + throw new Exception('Post error '.print_r($info, true)); + } + + // Ende der möglichen Kette, gib mal "true" zurück. + return true; + } +} +?> diff --git a/sources/addons/diaspost/diaspora.png b/sources/addons/diaspost/diaspora.png new file mode 100644 index 00000000..96665916 Binary files /dev/null and b/sources/addons/diaspost/diaspora.png differ diff --git a/sources/addons/diaspost/diaspost.css b/sources/addons/diaspost/diaspost.css new file mode 100755 index 00000000..e69de29b diff --git a/sources/addons/diaspost/diaspost.php b/sources/addons/diaspost/diaspost.php new file mode 100755 index 00000000..b4200fc8 --- /dev/null +++ b/sources/addons/diaspost/diaspost.php @@ -0,0 +1,337 @@ + + */ + +function diaspost_load() { + register_hook('post_local', 'addon/diaspost/diaspost.php', 'diaspost_post_local'); + register_hook('notifier_normal', 'addon/diaspost/diaspost.php', 'diaspost_send'); + register_hook('jot_networks', 'addon/diaspost/diaspost.php', 'diaspost_jot_nets'); + register_hook('feature_settings', 'addon/diaspost/diaspost.php', 'diaspost_settings'); + register_hook('feature_settings_post', 'addon/diaspost/diaspost.php', 'diaspost_settings_post'); + +} +function diaspost_unload() { + unregister_hook('post_local', 'addon/diaspost/diaspost.php', 'diaspost_post_local'); + unregister_hook('notifier_normal', 'addon/diaspost/diaspost.php', 'diaspost_send'); + unregister_hook('jot_networks', 'addon/diaspost/diaspost.php', 'diaspost_jot_nets'); + unregister_hook('feature_settings', 'addon/diaspost/diaspost.php', 'diaspost_settings'); + unregister_hook('feature_settings_post', 'addon/diaspost/diaspost.php', 'diaspost_settings_post'); + +} + + +function diaspost_jot_nets(&$a,&$b) { + if((! local_channel()) || (! perm_is_allowed(local_channel(),'','view_stream'))) + return; + + $diaspost_post = get_pconfig(local_channel(),'diaspost','post'); + if(intval($diaspost_post) == 1) { + $diaspost_defpost = get_pconfig(local_channel(),'diaspost','post_by_default'); + $selected = ((intval($diaspost_defpost) == 1) ? ' checked="checked" ' : ''); + $b .= '
' . t('Post to Diaspora') . '
'; + } +} + +function diaspost_queue_hook(&$a,&$b) { + $hostname = $a->get_hostname(); + + $qi = q("SELECT * FROM `queue` WHERE `network` = '%s'", + dbesc(NETWORK_DIASPORA2) + ); + if(! count($qi)) + return; + + require_once('include/queue_fn.php'); + + foreach($qi as $x) { + if($x['network'] !== NETWORK_DIASPORA2) + continue; + + logger('diaspost_queue: run'); + + $r = q("SELECT `user`.* FROM `user` LEFT JOIN `contact` on `contact`.`uid` = `user`.`uid` + WHERE `contact`.`self` = 1 AND `contact`.`id` = %d LIMIT 1", + intval($x['cid']) + ); + if(! count($r)) + continue; + + $userdata = $r[0]; + + $diaspost_username = get_pconfig($userdata['uid'],'diaspost','diaspost_username'); + $diaspost_password = z_unobscure(get_pconfig($userdata['uid'],'diaspost','diaspost_password')); + $diaspost_url = get_pconfig($userdata['uid'],'diaspost','diaspost_url'); + + $success = false; + + if($diaspost_url && $diaspost_username && $diaspost_password) { + require_once("addon/diaspost/diasphp.php"); + + logger('diaspost_queue: able to post for user '.$diaspost_username); + + $z = unserialize($x['content']); + + $post = $z['post']; + + logger('diaspost_queue: post: '.$post, LOGGER_DATA); + + try { + logger('diaspost_queue: prepare', LOGGER_DEBUG); + $conn = new Diasphp($diaspost_url); + logger('diaspost_queue: try to log in '.$diaspost_username, LOGGER_DEBUG); + $conn->login($diaspost_username, $diaspost_password); + logger('diaspost_queue: try to send '.$body, LOGGER_DEBUG); + $conn->post($post, $hostname); + + logger('diaspost_queue: send '.$userdata['uid'].' success', LOGGER_DEBUG); + + $success = true; + + remove_queue_item($x['id']); + } catch (Exception $e) { + logger("diaspost_queue: Send ".$userdata['uid']." failed: ".$e->getMessage(), LOGGER_DEBUG); + } + } else + logger('diaspost_queue: send '.$userdata['uid'].' missing username or password', LOGGER_DEBUG); + + if (!$success) { + logger('diaspost_queue: delayed'); + update_queue_time($x['id']); + } + } +} + +function diaspost_settings(&$a,&$s) { + + if(! local_channel()) + return; + + /* Add our stylesheet to the page so we can make our settings look nice */ + + //$a->page['htmlhead'] .= '' . "\r\n"; + + /* Get the current state of our config variables */ + + $enabled = get_pconfig(local_channel(),'diaspost','post'); + $checked = (($enabled) ? '1' : false); + $css = (($enabled) ? '' : '-disabled'); + + $def_enabled = get_pconfig(local_channel(),'diaspost','post_by_default'); + + $def_checked = (($def_enabled) ? 1 : false); + + $diaspost_username = get_pconfig(local_channel(), 'diaspost', 'diaspost_username'); + $diaspost_password = z_unobscure(get_pconfig(local_channel(), 'diaspost', 'diaspost_password')); + $diaspost_url = get_pconfig(local_channel(), 'diaspost', 'diaspost_url'); + + $status = ""; + + if ($diaspost_username AND $diaspost_password AND $diaspost_url) { + try { + require_once("addon/diaspost/diasphp.php"); + + $conn = new Diasphp($diaspost_url); + $conn->login($diaspost_username, $diaspost_password); + } catch (Exception $e) { + $status = t("Can't login to your Diaspora account. Please check username and password and ensure you used the complete address (including http...)"); + } + } + + /* Add some HTML to the existing form */ + if ($status) { + $sc .= '
'; + $sc .= '' . $status . ''; + $sc .= '
'; + } + + $sc .= replace_macros(get_markup_template('field_checkbox.tpl'), array( + '$field' => array('diaspost', t('Enable Diaspost Post Plugin'), $checked, '', array(t('No'),t('Yes'))), + )); + + $sc .= replace_macros(get_markup_template('field_input.tpl'), array( + '$field' => array('diaspost_username', t('Diaspora username'), $diaspost_username, '') + )); + + $sc .= replace_macros(get_markup_template('field_password.tpl'), array( + '$field' => array('diaspost_password', t('Diaspora password'), $diaspost_password, '') + )); + + $sc .= replace_macros(get_markup_template('field_input.tpl'), array( + '$field' => array('diaspost_url', t('Diaspora site URL'), $diaspost_url, 'Example: https://joindiaspora.com') + )); + + $sc .= replace_macros(get_markup_template('field_checkbox.tpl'), array( + '$field' => array('diaspost_bydefault', t('Post to Diaspora by default'), $def_checked, '', array(t('No'),t('Yes'))), + )); + + $s .= replace_macros(get_markup_template('generic_addon_settings.tpl'), array( + '$addon' => array('diaspost', '' . t('Diaspost Post Settings'), '', t('Submit')), + '$content' => $sc + )); + + return; +} + + +function diaspost_settings_post(&$a,&$b) { + + if(x($_POST,'diaspost-submit')) { + + set_pconfig(local_channel(),'diaspost','post',intval($_POST['diaspost'])); + set_pconfig(local_channel(),'diaspost','post_by_default',intval($_POST['diaspost_bydefault'])); + set_pconfig(local_channel(),'diaspost','diaspost_username',trim($_POST['diaspost_username'])); + set_pconfig(local_channel(),'diaspost','diaspost_password',z_obscure(trim($_POST['diaspost_password']))); + set_pconfig(local_channel(),'diaspost','diaspost_url',trim($_POST['diaspost_url'])); + + } + +} + +function diaspost_post_local(&$a,&$b) { + + if($b['created'] != $b['edited']) + return; + + if(! perm_is_allowed($b['uid'],'','view_stream')) + return; + + + if((! local_channel()) || (local_channel() != $b['uid'])) + return; + + if($b['item_private']) + return; + + $diaspost_post = intval(get_pconfig(local_channel(),'diaspost','post')); + + $diaspost_enable = (($diaspost_post && x($_REQUEST,'diaspost_enable')) ? intval($_REQUEST['diaspost_enable']) : 0); + + if($_REQUEST['api_source'] && intval(get_pconfig(local_channel(),'diaspost','post_by_default'))) + $diaspost_enable = 1; + + if(! $diaspost_enable) + return; + + if(strlen($b['postopts'])) + $b['postopts'] .= ','; + $b['postopts'] .= 'diaspost'; +} + + + + +function diaspost_send(&$a,&$b) { + $hostname = 'hubzilla ' . '(' . $a->get_hostname() . ')'; + + logger('diaspost_send: invoked',LOGGER_DEBUG); + + if($b['mid'] != $b['parent_mid']) + return; + + if((! is_item_normal($b)) || $b['item_private'] || ($b['created'] !== $b['edited'])) + return; + + + if(! perm_is_allowed($b['uid'],'','view_stream')) + return; + + + if(! strstr($b['postopts'],'diaspost')) + return; + + + logger('diaspost_send: prepare posting', LOGGER_DEBUG); + + $diaspost_username = get_pconfig($b['uid'],'diaspost','diaspost_username'); + $diaspost_password = z_unobscure(get_pconfig($b['uid'],'diaspost','diaspost_password')); + $diaspost_url = get_pconfig($b['uid'],'diaspost','diaspost_url'); + + if($diaspost_url && $diaspost_username && $diaspost_password) { + + logger('diaspost_send: all values seem to be okay', LOGGER_DEBUG); + + require_once('include/bb2diaspora.php'); + $tag_arr = array(); + $tags = ''; + $x = preg_match_all('/\#\[(.*?)\](.*?)\[/',$b['tag'],$matches,PREG_SET_ORDER); + + if($x) { + foreach($matches as $mtch) { + $tag_arr[] = $mtch[2]; + } + } + if(count($tag_arr)) + $tags = implode(',',$tag_arr); + + $title = $b['title']; + $body = $b['body']; + // Insert a newline before and after a quote + $body = str_ireplace("[quote", "\n\n[quote", $body); + $body = str_ireplace("[/quote]", "[/quote]\n\n", $body); + + // strip bookmark indicators + + $body = preg_replace('/\#\^\[([zu])rl/i', '[$1rl', $body); + + $body = preg_replace('/\#\^http/i', 'http', $body); + + + if(intval(get_pconfig($item['uid'],'system','prevent_tag_hijacking'))) { + $new_tag = html_entity_decode('⋕',ENT_COMPAT,'UTF-8'); + $new_mention = html_entity_decode('@',ENT_COMPAT,'UTF-8'); + + // #-tags + $body = preg_replace('/\#\[url/i', $new_tag . '[url', $body); + $body = preg_replace('/\#\[zrl/i', $new_tag . '[zrl', $body); + // @-mentions + $body = preg_replace('/\@\!?\[url/i', $new_mention . '[url', $body); + $body = preg_replace('/\@\!?\[zrl/i', $new_mention . '[zrl', $body); + } + + // remove multiple newlines + do { + $oldbody = $body; + $body = str_replace("\n\n\n", "\n\n", $body); + } while ($oldbody != $body); + + // convert to markdown + $body = bb2diaspora($body, false, true); + + // Adding the title + if(strlen($title)) + $body = "## ".html_entity_decode($title)."\n\n".$body; + + require_once("addon/diaspost/diasphp.php"); + + try { + logger('diaspost_send: prepare', LOGGER_DEBUG); + $conn = new Diasphp($diaspost_url); + logger('diaspost_send: try to log in '.$diaspost_username, LOGGER_DEBUG); + $conn->login($diaspost_username, $diaspost_password); + logger('diaspost_send: try to send '.$body, LOGGER_DEBUG); + + //throw new Exception('Test'); + $conn->post($body, $hostname); + + logger('diaspost_send: success'); + } catch (Exception $e) { + logger("diaspost_send: Error submitting the post: " . $e->getMessage()); + +// logger('diaspost_send: requeueing '.$b['uid'], LOGGER_DEBUG); + +// $r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", $b['uid']); +// if (count($r)) +// $a->contact = $r[0]["id"]; + +// $s = serialize(array('url' => $url, 'item' => $b['id'], 'post' => $body)); +// require_once('include/queue_fn.php'); +// add_to_queue($a->contact,NETWORK_DIASPORA2,$s); +// notice(t('Diaspost post failed. Queued for retry.').EOL); + } + } +} diff --git a/sources/addons/dirstats/dirstats.php b/sources/addons/dirstats/dirstats.php new file mode 100644 index 00000000..442f10c1 --- /dev/null +++ b/sources/addons/dirstats/dirstats.php @@ -0,0 +1,204 @@ + +*/ + +function dirstats_load() { + register_hook('cron_daily', 'addon/dirstats/dirstats.php', 'dirstats_cron'); +} +function dirstats_unload() { + unregister_hook('cron_daily', 'addon/dirstats/dirstats.php', 'dirstats_cron'); +} +function dirstats_module() {} + + +function dirstats_init() { + if(! get_config('dirstats','hubcount')) + dirstats_cron($a,$b); + +} + +function dirstats_content(&$a) { + + $hubcount = get_config('dirstats','hubcount'); + $zotcount = get_config('dirstats','zotcount'); + $friendicacount = get_config('dirstats','friendicacount'); + $diasporacount = get_config('dirstats','diasporacount'); + $channelcount = get_config('dirstats','channelcount'); + $friendicachannelcount = get_config('dirstats','friendicachannelcount'); + $diasporachannelcount = get_config('dirstats','diasporachannelcount'); + $over35s = get_config('dirstats','over35s'); + $under35s = get_config('dirstats','under35s'); + $average = get_config('dirstats','averageage'); + $chatrooms = get_config('dirstats','chatrooms'); + $tags = get_config('dirstats','tags'); + + $ob = $a->get_observer(); + $observer = $ob['xchan_hash']; + // Requested by Martin + $fountainofyouth = get_xconfig($observer, 'dirstats', 'averageage'); + if (intval($fountainofyouth)) + $average = $fountainofyouth; + +if (argv(1) == 'json') { + $dirstats = array ( + 'hubcount' => $hubcount, + 'zotcount' => $zotcount, + 'friendicacount' => $friendicacount, + 'diasporacount' => $diasporacount, + 'channelcount' => $channelcount, + 'friendicachannelcount' => $friendicachannelcount, + 'diasporachannelcount' => $diasporachannelcount, + 'over35s' => $over35s, + 'under35s' => $under35s, + 'average' => $average, + 'chatrooms' => $chatrooms, + 'tags' => $tags + ); + echo json_return_and_die($dirstats); + } + + // Used by Hubzilla News + elseif (argv(1) == 'genpost' && get_config('dirstats','allowfiledump')) { + $result = '[b]Hub count[/b] : ' . $hubcount . "\xA" . + '[b]Hubzilla Hubs[/b] : ' . $zotcount . "\xA" . + '[b]Friendica Hubs[/b] : ' . $friendicacount . "\xA" . + '[b]Diaspora Pods[/b] : ' . $diasporacount . "\xA" . + '[b]Hubzilla Channels[/b] : ' . $channelcount . "\xA" . + '[b]Friendica Profiles[/b] : ' . $friendicachannelcount . "\xA" . + '[b]Diaspora Profiles[/b] : ' . $diasporachannelcount . "\xA" . + '[b]People aged 35 and above[/b] : ' . $over35s . "\xA" . + '[b]People aged 34 and below[/b] : ' . $under35s . "\xA" . + '[b]Average Age[/b] : ' . $average . "\xA" . + '[b]Known Chatrooms[/b] : ' . $chatrooms . "\xA" . + '[b]Unique Profile Tags[/b] : ' . $tags . "\xA"; + + file_put_contents('genpost', $result); + } +else { + $tpl = get_markup_template( "dirstats.tpl", "addon/dirstats/" ); + return replace_macros($tpl, array( + '$title' => t('Hubzilla Directory Stats'), + '$hubtitle' => t('Total Hubs'), + '$hubcount' => $hubcount, + '$zotlabel' => t('Hubzilla Hubs'), + '$zotcount' => $zotcount, + '$friendicalabel' => t('Friendica Hubs'), + '$friendicacount' => $friendicacount, + '$diasporalabel' => t('Diaspora Pods'), + '$diasporacount' => $diasporacount, + '$zotchanlabel' => t('Hubzilla Channels'), + '$channelcount' => $channelcount, + '$friendicachanlabel' => t('Friendica Channels'), + '$friendicachannelcount' => $friendicachannelcount, + '$diasporachanlabel' => t('Diaspora Channels'), + '$diasporachannelcount' => $diasporachannelcount, + '$over35label' => t('Aged 35 and above'), + '$over35s' => $over35s, + '$under35label' => t('Aged 34 and under'), + '$under35s' => $under35s, + '$averageagelabel' => t('Average Age'), + '$average' => $average, + '$chatlabel' => t('Known Chatrooms'), + '$chatrooms' => $chatrooms, + '$tagslabel' => t('Known Tags'), + '$tags' => $tags, + '$disclaimer' => t('Please note Diaspora and Friendica statistics are merely those **this directory** is aware of, and not all those known in the network. This also applies to chatrooms,') + )); + } +} +function dirstats_cron(&$a, $b) { + // Some hublocs are immortal and won't ever die - they all have null date for hubloc_connected and hubloc_updated + $r = q("SELECT count(distinct hubloc_host) as total FROM `hubloc` where not (hubloc_flags & %d) > 0 and not (hubloc_connected = %d and hubloc_updated = %d)", + intval(HUBLOC_FLAGS_DELETED), + dbesc(NULL_DATE), + dbesc(NULL_DATE) + ); + if ($r) { + $hubcount = $r[0]['total']; + set_config('dirstats','hubcount',$hubcount); + } + + $r = q("SELECT count(distinct hubloc_host) as total FROM `hubloc` where hubloc_network = 'zot' and not (hubloc_flags & %d) > 0 and not (hubloc_connected = %d and hubloc_updated = %d)", + intval(HUBLOC_FLAGS_DELETED), + dbesc(NULL_DATE), + dbesc(NULL_DATE) + + ); + if ($r) { + $zotcount = $r[0]['total']; + set_config('dirstats','zotcount',$zotcount); + } + $r = q("SELECT count(distinct hubloc_host) as total FROM `hubloc` where hubloc_network = 'friendica-over-diaspora'"); + if ($r){ + $friendicacount = $r[0]['total']; + set_config('dirstats','friendicacount',$friendicacount); + } + $r = q("SELECT count(distinct hubloc_host) as total FROM `hubloc` where hubloc_network = 'diaspora'"); + if ($r) { + $diasporacount = $r[0]['total']; + set_config('dirstats','diasporacount',$diasporacount); + } + $r = q("SELECT count(distinct xchan_hash) as total FROM `xchan` where xchan_network = 'zot' and not (xchan_flags & %d) > 0", + intval(XCHAN_FLAGS_DELETED) + ); + if ($r) { + $channelcount = $r[0]['total']; + set_config('dirstats','channelcount',$channelcount); + } + $r = q("SELECT count(distinct xchan_hash) as total FROM `xchan` where xchan_network = 'friendica-over-diaspora'"); + if ($r) { + $friendicachannelcount = $r[0]['total']; + set_config('dirstats','friendicachannelcount',$friendicachannelcount); + } + $r = q("SELECT count(distinct xchan_hash) as total FROM `xchan` where xchan_network = 'diaspora'"); + if ($r) { + $diasporachannelcount = $r[0]['total']; + set_config('dirstats','diasporachannelcount',$diasporachannelcount); + } + $r = q("select count(xprof_hash) as total from `xprof` where xprof_age >=35"); + if ($r) { + $over35s = $r[0]['total']; + set_config('dirstats','over35s',$over35s); + } + $r = q("select count(xprof_hash) as total from `xprof` where xprof_age <=34 and xprof_age >=1"); + if ($r) { + $under35s = $r[0]['total']; + set_config('dirstats','under35s',$under35s); + } + + $r = q("select sum(xprof_age) as sum from xprof"); + if ($r) { + $rr = q("select count(xprof_hash) as total from `xprof` where xprof_age >=1"); + $total = $r[0]['sum']; + $number = $rr[0]['total']; + if($number) + $average = $total / $number; + else + $average = 0; + set_config('dirstats','averageage',$average); + } + + $r = q("select count(distinct xchat_url) as total from `xchat`"); + if ($r) { + $chatrooms = $r[0]['total']; + set_config('dirstats','chatrooms',$chatrooms); + } + $r = q("select count(distinct xtag_term) as total from xtag where xtag_flags = 0"); + if ($r) { + $tags = $r[0]['total']; + set_config('dirstats','tags',$tags); + } +} diff --git a/sources/addons/dirstats/view/tpl/dirstats.tpl b/sources/addons/dirstats/view/tpl/dirstats.tpl new file mode 100644 index 00000000..f1c3a132 --- /dev/null +++ b/sources/addons/dirstats/view/tpl/dirstats.tpl @@ -0,0 +1,20 @@ +
+

{{$title}}

+
    {{$hubtitle}} : {{$hubcount}}
+
    {{$zotlabel}} : {{$zotcount}}
+
    {{$friendicalabel}} : {{$friendicacount}}
+
    {{$diasporalabel}} : {{$diasporacount}}
+

+
    {{$zotchanlabel}} : {{$channelcount}}
+
    {{$friendicachanlabel}} : {{$friendicachannelcount}}
+
    {{$diasporachanlabel}} : {{$diasporachannelcount}}
+

+
    {{$over35label}} : {{$over35s}}
+
    {{$under35label}} : {{$under35s}}
+
    {{$averageagelabel}} : {{$average}}
+

+
    {{$chatlabel}} : {{$chatrooms}}
+
    {{$tagslabel}} : {{$tags}}
+ +

{{$disclaimer}}

+
diff --git a/sources/addons/donate/donate.apd b/sources/addons/donate/donate.apd new file mode 100644 index 00000000..eff602d3 --- /dev/null +++ b/sources/addons/donate/donate.apd @@ -0,0 +1,3 @@ +url: $baseurl/donate +name: Support Hubzilla +photo: $baseurl/addon/donate/donate.png diff --git a/sources/addons/donate/donate.php b/sources/addons/donate/donate.php new file mode 100644 index 00000000..1eb6d57d --- /dev/null +++ b/sources/addons/donate/donate.php @@ -0,0 +1,75 @@ +' . t('The Redmatrix/Hubzilla projects are provided primarily by volunteers giving their time and expertise - and often paying out of pocket for services they share with others.') . '

'; +$text .= '

' . t('There is no corporate funding and no ads, and we do not collect and sell your personal information. (We don\'t control your personal information - you do.)') . '

'; +$text .= '

' . t('Help support our ground-breaking work in decentralisation, web identity, and privacy.') . '

'; + +$text .= '

' . t('Your donations keep servers and services running and also helps us to provide innovative new features and continued development.') . '

'; + +$o = replace_macros(get_markup_template('donate.tpl','addon/donate'),array( + '$header' => t('Donate'), + '$text' => $text, + '$choice' => t('Choose a project, developer, or public hub to support with a one-time donation'), + '$onetime' => t('Donate Now'), + '$repeat' => t('Or become a project sponsor (Hubzilla Project only)'), + '$note' => t('Please indicate if you would like your first name or full name (or nothing) to appear in our sponsor listing'), + '$subscribe' => t('Sponsor'), + '$contributors' => $contributors, + '$sponsors' => $sponsors, + '$thanks' => t('Special thanks to: '), +)); + +call_hooks('donate_plugin',$o); + +return $o; + +} diff --git a/sources/addons/donate/donate.png b/sources/addons/donate/donate.png new file mode 100644 index 00000000..d932f001 Binary files /dev/null and b/sources/addons/donate/donate.png differ diff --git a/sources/addons/donate/tipping.jpg b/sources/addons/donate/tipping.jpg new file mode 100644 index 00000000..f370ece7 Binary files /dev/null and b/sources/addons/donate/tipping.jpg differ diff --git a/sources/addons/donate/view/tpl/donate.tpl b/sources/addons/donate/view/tpl/donate.tpl new file mode 100644 index 00000000..6382cc6f --- /dev/null +++ b/sources/addons/donate/view/tpl/donate.tpl @@ -0,0 +1,64 @@ +

{{$header}}

+ +
{{$text}}
+ +
+ +Donations + +
+
+ +
+ + +
{{$choice}}
+
+ + +


+ + + + + +
+ +


+ +

+{{$repeat}} +

+

+{{$note}} +

+ +
+ + +
+ + +
+
+
+ + +
+ +

+{{$thanks}} +
    +{{foreach $sponsors as $s}} +
  • {{$s}}
  • +{{/foreach}} +
diff --git a/sources/addons/dwpost/dwpost.css b/sources/addons/dwpost/dwpost.css new file mode 100644 index 00000000..e69de29b diff --git a/sources/addons/dwpost/dwpost.php b/sources/addons/dwpost/dwpost.php new file mode 100644 index 00000000..a4b999f0 --- /dev/null +++ b/sources/addons/dwpost/dwpost.php @@ -0,0 +1,229 @@ + + * Author: Michael Johnston + * Author: Cat Gray + */ + +require_once('include/permissions.php'); + +function dwpost_load() { + register_hook('post_local', 'addon/dwpost/dwpost.php', 'dwpost_post_local'); + register_hook('notifier_normal', 'addon/dwpost/dwpost.php', 'dwpost_send'); + register_hook('jot_networks', 'addon/dwpost/dwpost.php', 'dwpost_jot_nets'); + register_hook('feature_settings', 'addon/dwpost/dwpost.php', 'dwpost_settings'); + register_hook('feature_settings_post', 'addon/dwpost/dwpost.php', 'dwpost_settings_post'); + +} +function dwpost_unload() { + unregister_hook('post_local', 'addon/dwpost/dwpost.php', 'dwpost_post_local'); + unregister_hook('notifier_normal', 'addon/dwpost/dwpost.php', 'dwpost_send'); + unregister_hook('jot_networks', 'addon/dwpost/dwpost.php', 'dwpost_jot_nets'); + unregister_hook('feature_settings', 'addon/dwpost/dwpost.php', 'dwpost_settings'); + unregister_hook('feature_settings_post', 'addon/dwpost/dwpost.php', 'dwpost_settings_post'); + +} + + +function dwpost_jot_nets(&$a,&$b) { + if((! local_channel()) || (! perm_is_allowed(local_channel(),'','view_stream'))) + return; + + $dw_post = get_pconfig(local_channel(),'dwpost','post'); + if(intval($dw_post) == 1) { + $dw_defpost = get_pconfig(local_channel(),'dwpost','post_by_default'); + $selected = ((intval($dw_defpost) == 1) ? ' checked="checked" ' : ''); + $b .= '
' + . t('Post to Dreamwidth') . '
'; + } +} + + +function dwpost_settings(&$a,&$s) { + + if(! local_channel()) + return; + + /* Add our stylesheet to the page so we can make our settings look nice */ + + //$a->page['htmlhead'] .= '' . "\r\n"; + + /* Get the current state of our config variables */ + + $enabled = get_pconfig(local_channel(),'dwpost','post'); + + $checked = (($enabled) ? 1 : false); + + $def_enabled = get_pconfig(local_channel(),'dwpost','post_by_default'); + + $def_checked = (($def_enabled) ? 1 : false); + + $dw_username = get_pconfig(local_channel(), 'dwpost', 'dw_username'); + $dw_password = z_unobscure(get_pconfig(local_channel(), 'dwpost', 'dw_password')); + + + /* Add some HTML to the existing form */ + + $sc .= replace_macros(get_markup_template('field_checkbox.tpl'), array( + '$field' => array('dwpost', t('Enable Dreamwidth Post Plugin'), $checked, '', array(t('No'),t('Yes'))), + )); + + $sc .= replace_macros(get_markup_template('field_input.tpl'), array( + '$field' => array('dw_username', t('Dreamwidth username'), $dw_username, '') + )); + + $sc .= replace_macros(get_markup_template('field_password.tpl'), array( + '$field' => array('dw_password', t('Dreamwidth password'), $dw_password, '') + )); + + $sc .= replace_macros(get_markup_template('field_checkbox.tpl'), array( + '$field' => array('dw_bydefault', t('Post to Dreamwidth by default'), $def_checked, '', array(t('No'),t('Yes'))), + )); + + $s .= replace_macros(get_markup_template('generic_addon_settings.tpl'), array( + '$addon' => array('dwpost',t('Dreamwidth Post Settings'), '', t('Submit')), + '$content' => $sc + )); + +} + + +function dwpost_settings_post(&$a,&$b) { + + if(x($_POST,'dwpost-submit')) { + + set_pconfig(local_channel(),'dwpost','post',intval($_POST['dwpost'])); + set_pconfig(local_channel(),'dwpost','post_by_default',intval($_POST['dw_bydefault'])); + set_pconfig(local_channel(),'dwpost','dw_username',trim($_POST['dw_username'])); + set_pconfig(local_channel(),'dwpost','dw_password',z_obscure(trim($_POST['dw_password']))); + + } + +} + +function dwpost_post_local(&$a,&$b) { + + // This can probably be changed to allow editing by pointing to a different API endpoint + + if($b['edit']) + return; + + if((! local_channel()) || (local_channel() != $b['uid'])) + return; + + if($b['item_private'] || $b['parent']) + return; + + logger('Dreamwidth xpost invoked'); + + $dw_post = intval(get_pconfig(local_channel(),'dwpost','post')); + + $dw_enable = (($dw_post && x($_REQUEST,'dwpost_enable')) ? intval($_REQUEST['dwpost_enable']) : 0); + + if($_REQUEST['api_source'] && intval(get_pconfig(local_channel(),'dwpost','post_by_default'))) + $dw_enable = 1; + + if(! $dw_enable) + return; + + if(strlen($b['postopts'])) + $b['postopts'] .= ','; + $b['postopts'] .= 'dwpost'; +} + + + + +function dwpost_send(&$a,&$b) { + + if((! is_item_normal($b)) || $b['item_private'] || ($b['created'] !== $b['edited'])) + return; + + if(! perm_is_allowed($b['uid'],'','view_stream')) + return; + + if(! strstr($b['postopts'],'dwpost')) + return; + + if($b['parent'] != $b['id']) + return; + + // dreamwidth post in the LJ user's timezone. + // Hopefully the person's Friendica account + // will be set to the same thing. + + $tz = 'UTC'; + + $x = q("select channel_timezone from channel where channel_id = %d limit 1", + intval($b['uid']) + ); + if($x && strlen($x[0]['channel_timezone'])) + $tz = $x[0]['channel_timezone']; + + $dw_username = get_pconfig($b['uid'],'dwpost','dw_username'); + $dw_password = z_unobscure(get_pconfig($b['uid'],'dwpost','dw_password')); + $dw_blog = 'http://www.dreamwidth.org/interface/xmlrpc'; + + if($dw_username && $dw_password && $dw_blog) { + + require_once('include/bbcode.php'); + require_once('include/datetime.php'); + + $title = $b['title']; + $post = bbcode($b['body']); + $post = xmlify($post); + $tags = dwpost_get_tags($b['tag']); + + $date = datetime_convert('UTC',$tz,$b['created'],'Y-m-d H:i:s'); + $year = intval(substr($date,0,4)); + $mon = intval(substr($date,5,2)); + $day = intval(substr($date,8,2)); + $hour = intval(substr($date,11,2)); + $min = intval(substr($date,14,2)); + + $xml = <<< EOT + +LJ.XMLRPC.postevent + + +year$year +mon$mon +day$day +hour$hour +min$min +event$post +username$dw_username +password$dw_password +subject$title +lineendingsunix +ver1 +props + +useragentFriendica +taglist$tags + + + + + +EOT; + + logger('dwpost: data: ' . $xml, LOGGER_DATA); + + if($dw_blog !== 'test') + $x = z_post_url($dw_blog,$xml,array('headers' => array("Content-Type: text/xml"))); + logger('posted to dreamwidth: ' . print_r($x,true), LOGGER_DEBUG); + + } +} + +function dwpost_get_tags($post) +{ + preg_match_all("/\]([^\[#]+)\[/",$post,$matches); + $tags = implode(', ',$matches[1]); + return $tags; +} diff --git a/sources/addons/dwpost/lang/C/messages.po b/sources/addons/dwpost/lang/C/messages.po new file mode 100644 index 00000000..6bed922f --- /dev/null +++ b/sources/addons/dwpost/lang/C/messages.po @@ -0,0 +1,46 @@ +# ADDON dwpost +# Copyright (C) +# This file is distributed under the same license as the Friendica dwpost addon package. +# +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-02-27 05:01-0500\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: dwpost.php:39 +msgid "Post to Dreamwidth" +msgstr "" + +#: dwpost.php:70 +msgid "Dreamwidth Post Settings" +msgstr "" + +#: dwpost.php:72 +msgid "Enable dreamwidth Post Plugin" +msgstr "" + +#: dwpost.php:77 +msgid "dreamwidth username" +msgstr "" + +#: dwpost.php:82 +msgid "dreamwidth password" +msgstr "" + +#: dwpost.php:87 +msgid "Post to dreamwidth by default" +msgstr "" + +#: dwpost.php:93 +msgid "Submit" +msgstr "" diff --git a/sources/addons/dwpost/lang/ca/strings.php b/sources/addons/dwpost/lang/ca/strings.php new file mode 100644 index 00000000..6ad56a9b --- /dev/null +++ b/sources/addons/dwpost/lang/ca/strings.php @@ -0,0 +1,9 @@ +strings["Post to Dreamwidth"] = "Missatge a Dreamwidth"; +$a->strings["Dreamwidth Post Settings"] = "Configuració d'enviaments a Dreamwidth"; +$a->strings["Enable dreamwidth Post Plugin"] = "Habilitat el plugin d'enviaments a Dreamwidth"; +$a->strings["dreamwidth username"] = "Nom d'usuari a Dreamwidth"; +$a->strings["dreamwidth password"] = "Contrasenya a Dreamwidth"; +$a->strings["Post to dreamwidth by default"] = "Enviar per defecte a Dreamwidth"; +$a->strings["Submit"] = "Enviar"; diff --git a/sources/addons/dwpost/lang/cs/strings.php b/sources/addons/dwpost/lang/cs/strings.php new file mode 100644 index 00000000..e01db0d1 --- /dev/null +++ b/sources/addons/dwpost/lang/cs/strings.php @@ -0,0 +1,9 @@ +strings["Post to Dreamwidth"] = "Poslat na Dreamwidth"; +$a->strings["Dreamwidth Post Settings"] = "Nastavení Dreamwidth příspěvků"; +$a->strings["Enable dreamwidth Post Plugin"] = "Povolit dreamwidth Plugin"; +$a->strings["dreamwidth username"] = "dreamwidth uživatelské jméno"; +$a->strings["dreamwidth password"] = "dreamwidth heslo"; +$a->strings["Post to dreamwidth by default"] = "Defaultně umístit na dreamwidth"; +$a->strings["Submit"] = "Odeslat"; diff --git a/sources/addons/dwpost/lang/de/strings.php b/sources/addons/dwpost/lang/de/strings.php new file mode 100644 index 00000000..2e3ba985 --- /dev/null +++ b/sources/addons/dwpost/lang/de/strings.php @@ -0,0 +1,9 @@ +strings["Post to Dreamwidth"] = "In Dreamwidth veröffentlichen"; +$a->strings["Dreamwidth Post Settings"] = "Dreamwidth Veröffentlichungs-Einstellungen"; +$a->strings["Enable dreamwidth Post Plugin"] = "Dreamwidth Post Plugin aktivieren"; +$a->strings["dreamwidth username"] = "Dreamwidth Benutzername"; +$a->strings["dreamwidth password"] = "Dreamwidth Passwort"; +$a->strings["Post to dreamwidth by default"] = "Standardmäßig bei Dreamwidth veröffentlichen"; +$a->strings["Submit"] = "Senden"; diff --git a/sources/addons/dwpost/lang/eo/strings.php b/sources/addons/dwpost/lang/eo/strings.php new file mode 100644 index 00000000..967d4b9b --- /dev/null +++ b/sources/addons/dwpost/lang/eo/strings.php @@ -0,0 +1,9 @@ +strings["Post to Dreamwidth"] = "Afiŝi al Dreamwidth"; +$a->strings["Dreamwidth Post Settings"] = "Agordoj por Afiŝoj al Dreamwidth"; +$a->strings["Enable dreamwidth Post Plugin"] = "Ŝalti la Dreamwidth Kromprogramon"; +$a->strings["dreamwidth username"] = "Dreamwidth salutnomo"; +$a->strings["dreamwidth password"] = "Dreamwidth pasvorto"; +$a->strings["Post to dreamwidth by default"] = "Defaŭlte afiŝi al Dreamwidth"; +$a->strings["Submit"] = "Sendi"; diff --git a/sources/addons/dwpost/lang/es/strings.php b/sources/addons/dwpost/lang/es/strings.php new file mode 100644 index 00000000..11e6ff59 --- /dev/null +++ b/sources/addons/dwpost/lang/es/strings.php @@ -0,0 +1,9 @@ +strings["Post to Dreamwidth"] = "Publicar en Dreamwidth"; +$a->strings["Dreamwidth Post Settings"] = "Configuración de las publicaciones en Dreamwidth"; +$a->strings["Enable dreamwidth Post Plugin"] = "Activar el módulo de publicación en Dreamwidth"; +$a->strings["dreamwidth username"] = "Nombre de usuario de Dreamwidth"; +$a->strings["dreamwidth password"] = "Contraseña de Dreamwidth"; +$a->strings["Post to dreamwidth by default"] = "Publicar en Dreamwidth por defecto"; +$a->strings["Submit"] = "Envíar"; diff --git a/sources/addons/dwpost/lang/fr/strings.php b/sources/addons/dwpost/lang/fr/strings.php new file mode 100644 index 00000000..729bb028 --- /dev/null +++ b/sources/addons/dwpost/lang/fr/strings.php @@ -0,0 +1,9 @@ +strings["Post to Dreamwidth"] = "Poster vers Dreamwidth"; +$a->strings["Dreamwidth Post Settings"] = "Réglages Dreamwidth"; +$a->strings["Enable dreamwidth Post Plugin"] = "Activer \"Poster vers Dreamwidth\""; +$a->strings["dreamwidth username"] = "Nom d'utilisateur Dreamwidth"; +$a->strings["dreamwidth password"] = "Mot de passe"; +$a->strings["Post to dreamwidth by default"] = "Poster vers Dreamwidth par défaut"; +$a->strings["Submit"] = "Envoyer"; diff --git a/sources/addons/dwpost/lang/is/strings.php b/sources/addons/dwpost/lang/is/strings.php new file mode 100644 index 00000000..96f1f78b --- /dev/null +++ b/sources/addons/dwpost/lang/is/strings.php @@ -0,0 +1,9 @@ +strings["Post to Dreamwidth"] = ""; +$a->strings["Dreamwidth Post Settings"] = ""; +$a->strings["Enable dreamwidth Post Plugin"] = ""; +$a->strings["dreamwidth username"] = ""; +$a->strings["dreamwidth password"] = ""; +$a->strings["Post to dreamwidth by default"] = ""; +$a->strings["Submit"] = "Senda inn"; diff --git a/sources/addons/dwpost/lang/it/strings.php b/sources/addons/dwpost/lang/it/strings.php new file mode 100644 index 00000000..a47497aa --- /dev/null +++ b/sources/addons/dwpost/lang/it/strings.php @@ -0,0 +1,9 @@ +strings["Post to Dreamwidth"] = "Posta su Dreamwidth"; +$a->strings["Dreamwidth Post Settings"] = "Impostazioni post Dreamwidth"; +$a->strings["Enable dreamwidth Post Plugin"] = "Abilita il plugin dreamwidth"; +$a->strings["dreamwidth username"] = "dreamwidth username"; +$a->strings["dreamwidth password"] = "Password dreamwidth"; +$a->strings["Post to dreamwidth by default"] = "Invia a dreamwidth per impostazione predefinita"; +$a->strings["Submit"] = "Invia"; diff --git a/sources/addons/dwpost/lang/nb-no/strings.php b/sources/addons/dwpost/lang/nb-no/strings.php new file mode 100644 index 00000000..37677e6d --- /dev/null +++ b/sources/addons/dwpost/lang/nb-no/strings.php @@ -0,0 +1,9 @@ +strings["Post to Dreamwidth"] = ""; +$a->strings["Dreamwidth Post Settings"] = ""; +$a->strings["Enable dreamwidth Post Plugin"] = ""; +$a->strings["dreamwidth username"] = ""; +$a->strings["dreamwidth password"] = ""; +$a->strings["Post to dreamwidth by default"] = ""; +$a->strings["Submit"] = "Lagre"; diff --git a/sources/addons/dwpost/lang/pl/strings.php b/sources/addons/dwpost/lang/pl/strings.php new file mode 100644 index 00000000..237c95d9 --- /dev/null +++ b/sources/addons/dwpost/lang/pl/strings.php @@ -0,0 +1,9 @@ +strings["Post to Dreamwidth"] = "Opublikuj na Dreamwidth"; +$a->strings["Dreamwidth Post Settings"] = ""; +$a->strings["Enable dreamwidth Post Plugin"] = ""; +$a->strings["dreamwidth username"] = ""; +$a->strings["dreamwidth password"] = ""; +$a->strings["Post to dreamwidth by default"] = ""; +$a->strings["Submit"] = "Potwierdź"; diff --git a/sources/addons/dwpost/lang/pt-br/strings.php b/sources/addons/dwpost/lang/pt-br/strings.php new file mode 100644 index 00000000..329cf9e3 --- /dev/null +++ b/sources/addons/dwpost/lang/pt-br/strings.php @@ -0,0 +1,9 @@ +strings["Post to Dreamwidth"] = "Publicar no Dreamwidth"; +$a->strings["Dreamwidth Post Settings"] = "Configurações de publicação no Dreamwidth"; +$a->strings["Enable dreamwidth Post Plugin"] = "Habilitar o plugin de publicação no Dreamwidth"; +$a->strings["dreamwidth username"] = "Nome de usuário do Dreamwidth"; +$a->strings["dreamwidth password"] = "Senha do Dreamwidth"; +$a->strings["Post to dreamwidth by default"] = "Publicar no Dreamwidth por padrão"; +$a->strings["Submit"] = "Enviar"; diff --git a/sources/addons/dwpost/lang/ru/strings.php b/sources/addons/dwpost/lang/ru/strings.php new file mode 100644 index 00000000..98b08781 --- /dev/null +++ b/sources/addons/dwpost/lang/ru/strings.php @@ -0,0 +1,9 @@ +strings["Post to Dreamwidth"] = ""; +$a->strings["Dreamwidth Post Settings"] = "Dreamwidth настройки сообщений"; +$a->strings["Enable dreamwidth Post Plugin"] = "Включить dreamwidth плагин сообщений"; +$a->strings["dreamwidth username"] = "dreamwidth имя пользователя"; +$a->strings["dreamwidth password"] = "dreamwidth пароль"; +$a->strings["Post to dreamwidth by default"] = ""; +$a->strings["Submit"] = "Подтвердить"; diff --git a/sources/addons/dwpost/lang/sv/strings.php b/sources/addons/dwpost/lang/sv/strings.php new file mode 100644 index 00000000..3ec569a7 --- /dev/null +++ b/sources/addons/dwpost/lang/sv/strings.php @@ -0,0 +1,3 @@ +strings["Submit"] = "Spara"; diff --git a/sources/addons/dwpost/lang/zh-cn/strings.php b/sources/addons/dwpost/lang/zh-cn/strings.php new file mode 100644 index 00000000..93e075c6 --- /dev/null +++ b/sources/addons/dwpost/lang/zh-cn/strings.php @@ -0,0 +1,9 @@ +strings["Post to Dreamwidth"] = "转播到Dreamwidth"; +$a->strings["Dreamwidth Post Settings"] = "Dreamwidth转播设置"; +$a->strings["Enable dreamwidth Post Plugin"] = "使Dreamwidth转播插件可用"; +$a->strings["dreamwidth username"] = "Dreamwidth用户名"; +$a->strings["dreamwidth password"] = "Dreamwidth密码"; +$a->strings["Post to dreamwidth by default"] = "默认地转播到Dreamwidth"; +$a->strings["Submit"] = "提交"; diff --git a/sources/addons/embedly/embedly.php b/sources/addons/embedly/embedly.php new file mode 100644 index 00000000..924c21dd --- /dev/null +++ b/sources/addons/embedly/embedly.php @@ -0,0 +1,25 @@ + + * + */ + +function embedly_load() { + register_hook('oembed_probe','addon/embedly/embedly.php','embedly_oembed_probe'); +} + +function embedly_unload() { + unregister_hook('oembed_probe','addon/embedly/embedly.php','embedly_oembed_probe'); +} + +function embedly_oembed_probe($a,$b) { + // try oohembed service + $ourl = "http://oohembed.com/oohembed/?url=".$b['url'].'&maxwidth=' . $b['videowidth']; + $result = z_fetch_url($ourl); + if($result['success']) + $b['embed'] = $result['body']; +} \ No newline at end of file diff --git a/sources/addons/extcron/extcron.php b/sources/addons/extcron/extcron.php new file mode 100755 index 00000000..85169fe1 --- /dev/null +++ b/sources/addons/extcron/extcron.php @@ -0,0 +1,22 @@ + + * + * Notes: External service needs to make a web request to http(s)://yoursite/extcron + */ + +function extcron_load() {} + +function extcron_unload() {} + +function extcron_module() {} + +function extcron_init(&$a) { + proc_run('php','include/poller.php'); + killme(); +} diff --git a/sources/addons/extcron/lang/C/messages.po b/sources/addons/extcron/lang/C/messages.po new file mode 100644 index 00000000..e69de29b diff --git a/sources/addons/flattrwidget/CHANGELOG b/sources/addons/flattrwidget/CHANGELOG new file mode 100644 index 00000000..fd5f3538 --- /dev/null +++ b/sources/addons/flattrwidget/CHANGELOG @@ -0,0 +1,3 @@ +2013-09-22 Version 0.1 Tobias Diekershoff + initial version of the widget + * add a flattr button to left or right aside of the channel view diff --git a/sources/addons/flattrwidget/README.md b/sources/addons/flattrwidget/README.md new file mode 100644 index 00000000..9fc30baf --- /dev/null +++ b/sources/addons/flattrwidget/README.md @@ -0,0 +1,76 @@ +Flattr Widget for The Hubzilla +================================ +This widget is ment to add a [flattr][1] button for one thing to the +left/right aside area of a red# channel. For example this could be the flattr +thing for your blog (on a blog channel). + +What can be configured? + +* static button from your server or dynamic button generated using the flattr + API +* left or right aside area +* URL and Title of the thing you want to be flattred. + + If none are set, the channel URL and the title "_Channel Name_ on The Red + Matrix" will be used. + +There will also be a widget that adds the flattr button to each posting +separetely. + +Screenshots +----------- +_At the moment the screenshots will only show in your red# admin panel._ + +![Dynamic flattr button in channel view](/addon/flattrwidget/img/red-flattr-widget.png) + +Dynamic flattr button generated from the flattr API displaying the number of +flattrs received. + +![Static flattr button in channel view](/addon/flattrwidget/img/red-flattr-widget2.png) + +Static flattr buttton, the image is hosted on your server for privacy of the +visitors. + +Feedback +-------- + +You can send feedback, bug reports etc, for this widget to [my red# stuff +feedback channel][3], you can also leave a flattr there if you like. + +Author +------ + +Original Author: [Tobias Diekershoff][TD] + +License +------- + +This widget id licensed under the [MIT][2] license. + +Copyright (c) 2013, Tobias Diekershoff + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +The _flattr_ button located in the img directory was retrieved from the flattr +homepage. + +[1]: https://flattr.com +[2]: http://opensource.org/licenses/mit-license.php +[3]: https://diekershoff.de/channel/basredstuff +[TD]: https://diekershoff.de/channel/bavatar diff --git a/sources/addons/flattrwidget/flattrwidget.php b/sources/addons/flattrwidget/flattrwidget.php new file mode 100644 index 00000000..e0c0f87e --- /dev/null +++ b/sources/addons/flattrwidget/flattrwidget.php @@ -0,0 +1,129 @@ + + * Maintainer: Tobias Diekershoff + */ + +function flattrwidget_load() { + register_hook('construct_page', 'addon/flattrwidget/flattrwidget.php', 'flattrwidget_construct_page'); + register_hook('feature_settings', 'addon/flattrwidget/flattrwidget.php', 'flattrwidget_settings'); + register_hook('feature_settings_post', 'addon/flattrwidget/flattrwidget.php', 'flattrwidget_settings_post'); +} + +function flattrwidget_unload() { + unregister_hook('construct_page', 'addon/flattrwidget/flattrwidget.php', 'flattrwidget_construct_page'); + unregister_hook('feature_settings', 'addon/flattrwidget/flattrwidget.php', 'flattrwidget_settings'); + unregister_hook('feature_settings_post', 'addon/flattrwidget/flattrwidget.php', 'flattrwidget_settings_post'); +} + +function flattrwidget_construct_page(&$a,&$b) { + if (! $b['module']=='channel') + return; + $id = $a->profile['profile_uid']; + $enable = intval(get_pconfig($id,'flattrwidget','enable')); + if (! $enable) + return; + $a->page['htmlhead'] .= ''; + // get alignment and static/dynamic from the settings + // align is either "aside" or "right_aside" + // sd is either static or dynamic + $lr = get_pconfig( $id, 'flattrwidget', 'align'); + $sd = get_pconfig( $id, 'flattrwidget', 'sd'); + // title of the thing for the things page on flattr + $ftitle = get_pconfig( $id, 'flattrwidget', 'title'); + // URL of the thing + $thing = get_pconfig( $id, 'flattrwidget', 'thing'); + // flattr user the thing belongs to + $user = get_pconfig( $id, 'flattrwidget', 'user'); + // title for the flattr button itself + $title = t('Flattr this!'); + // construct the link for the button + $link = 'https://flattr.com/submit/auto?user_id='.$user.'&url=' . rawurlencode($thing).'&title='.rawurlencode($ftitle); + if ($sd == 'static') { + // static button graphic from the img folder + $img = $a->get_baseurl() .'/addon/flattrwidget/img/flattr-badge-large.png'; + $code = ''.$title.''; + } else { + $code = ''; + // dynamic button from flattr API + } + // put the widget content together + $flattrwidget = '
'.$code.'
'; + // place the widget into the selected aside area + if ($lr=='right_aside') { + $b['layout']['region_right_aside'] = $flattrwidget . $b['layout']['region_right_aside']; + } else { + $b['layout']['region_aside'] = $flattrwidget . $b['layout']['region_aside']; + } +} +function flattrwidget_settings_post($a,$s) { + if(! local_channel() || (! x($_POST,'flattrwidget-submit'))) + return; + $c = $a->get_channel(); + set_pconfig( local_channel(), 'flattrwidget', 'align', $_POST['flattrwidget-align'] ); + set_pconfig( local_channel(), 'flattrwidget', 'sd', $_POST['flattrwidget-static'] ); + $thing = $_POST['flattrwidget-thing']; + if ($thing == '') { + $thing = $a->get_baseurl().'/channel/'.$c['channel_address']; + } + set_pconfig( local_channel(), 'flattrwidget', 'thing', $thing); + set_pconfig( local_channel(), 'flattrwidget', 'user', $_POST['flattrwidget-user']); + $ftitle = $_POST['flattrwidget-thingtitle']; + if ($ftitle == '') { + $ftitle = $c['channel_name'].' on The Hubzilla'; + } + set_pconfig( local_channel(), 'flattrwidget', 'title', $ftitle); + set_pconfig( local_channel(), 'flattrwidget', 'enable', intval($_POST['flattrwidget-enable'])); + info(t('Flattr widget settings updated.').EOL); +} +function flattrwidget_settings(&$a,&$s) { + $id = local_channel(); + if (! $id) + return; + + //$a->page['htmlhead'] .= ''; + $lr = get_pconfig( $id, 'flattrwidget', 'align'); + $sd = get_pconfig( $id, 'flattrwidget', 'sd'); + $thing = get_pconfig( $id, 'flattrwidget', 'thing'); + $user = get_pconfig( $id, 'flattrwidget', 'user'); + $ftitle = get_pconfig( $id, 'flattrwidget', 'title'); + $enable = intval(get_pconfig(local_channel(),'flattrwidget','enable')); + $enable_checked = (($enable) ? 1 : false); + + $sc .= replace_macros(get_markup_template('field_input.tpl'), array( + '$field' => array('flattrwidget-user', t('Flattr user'), $user, '') + )); + + $sc .= replace_macros(get_markup_template('field_input.tpl'), array( + '$field' => array('flattrwidget-thing', t('URL of the Thing to flattr'), $thing, t('If empty channel URL is used')) + )); + + $sc .= replace_macros(get_markup_template('field_input.tpl'), array( + '$field' => array('flattrwidget-thingtitle', t('Title of the Thing to flattr'), $ftitle, t('If empty "channel name on The Hubzilla" will be used')) + )); + + $sc .= replace_macros(get_markup_template('field_select.tpl'), array( + '$field' => array('flattrwidget-static', t('Static or dynamic flattr button'), $sd, '', array('static'=>t('static'), 'dynamic'=>t('dynamic'))) + )); + + $sc .= replace_macros(get_markup_template('field_select.tpl'), array( + '$field' => array('flattrwidget-align', t('Alignment of the widget'), $lr, '', array('aside'=>t('left'), 'right_aside'=>t('right'))) + )); + + $sc .= replace_macros(get_markup_template('field_checkbox.tpl'), array( + '$field' => array('flattrwidget-enable', t('Enable Flattr widget'), $enable_checked, '', array(t('No'),t('Yes'))), + )); + + $s .= replace_macros(get_markup_template('generic_addon_settings.tpl'), array( + '$addon' => array('flattrwidget',t('Flattr Widget Settings'), '', t('Submit')), + '$content' => $sc + )); + + +} diff --git a/sources/addons/flattrwidget/img/flattr-badge-large.png b/sources/addons/flattrwidget/img/flattr-badge-large.png new file mode 100644 index 00000000..11053058 Binary files /dev/null and b/sources/addons/flattrwidget/img/flattr-badge-large.png differ diff --git a/sources/addons/flattrwidget/img/red-flattr-widget.png b/sources/addons/flattrwidget/img/red-flattr-widget.png new file mode 100644 index 00000000..c7226382 Binary files /dev/null and b/sources/addons/flattrwidget/img/red-flattr-widget.png differ diff --git a/sources/addons/flattrwidget/img/red-flattr-widget2.png b/sources/addons/flattrwidget/img/red-flattr-widget2.png new file mode 100644 index 00000000..84b886e7 Binary files /dev/null and b/sources/addons/flattrwidget/img/red-flattr-widget2.png differ diff --git a/sources/addons/flattrwidget/style.css b/sources/addons/flattrwidget/style.css new file mode 100644 index 00000000..e69de29b diff --git a/sources/addons/fortunate/README b/sources/addons/fortunate/README new file mode 100644 index 00000000..8297cf41 --- /dev/null +++ b/sources/addons/fortunate/README @@ -0,0 +1,7 @@ +This addon requires a fortune server. You may use the DB supplied here to create one. + +gunzip the fortunate.sql.gz and import into your database. +Copy cookie.php to the top level Friendica directory. +Edit fortunate.php and change FORTUNATE_SERVER definition to your hostname. Change the http in that file to https if your server doesn't support http. + +Many additional options are available if you examine cookie.php - a clever developer can provide a settings page to tailor this to one's liking. Also several languages are supported, and it would be convenient to set this to the current Friendica language if that is amongst those supported. \ No newline at end of file diff --git a/sources/addons/fortunate/cookie.php b/sources/addons/fortunate/cookie.php new file mode 100644 index 00000000..a4be4ef0 --- /dev/null +++ b/sources/addons/fortunate/cookie.php @@ -0,0 +1,351 @@ +real_escape_string($_GET['lang']); + +if(strlen($_GET['pattern'])) + $pattern = @$db->real_escape_string($_GET['pattern']); + +if(strlen($_GET['regex'])) + $regex = @$db->real_escape_string($_GET['regex']); + +if(strlen($_GET['db'])) + $table = @$db->real_escape_string($_GET['db']); +else + $table = ''; + +if($length < 0) + $length = 0; +if($numlines < 0) + $numlines = 0; + +function do_query($table,$length,$numlines,$adult,$cat,$limit,$lang,$pattern,$regex,$equal) { + global $db; + $rnd = mt_rand(); + $r = array(); + + $typesql = (($table) ? " WHERE `category` = '$table' " : " WHERE 1 "); + $lengthsql = (($length) ? " AND LENGTH(`text`) < $length " : "" ); + + if($adult == 2) + $adultsql = " AND offensive = 1 "; + elseif($adult == 1) + $adultsql = ""; + else + $adultsql = " AND offensive = 0 "; + + + if($numlines) + $lengthsql .= + " AND (LENGTH(`text`) - LENGTH(REPLACE(`text`,\"\n\",\"\"))) <= $numlines "; + + $langsql = (($lang === 'any') ? '' : " AND lang = '$lang' "); + + $patsql = ''; + if(strlen($pattern)) + $patsql = " AND MATCH text AGAINST ('$pattern') "; + + $regexsql = ''; + if(strlen($regex)) + $regexsql = " AND text REGEXP '$regex' "; + + $eqsql = ''; + + if($equal) { + $catsavail = array(); + $res = @$db->query("SELECT DISTINCT ( `category` ) FROM `fortune` + $typesql + $adultsql + $lengthsql + $langsql + $patsql + $regexsql "); + if($res->num_rows) { + while($x = $res->fetch_array(MYSQL_ASSOC)) + $catsavail[] = $x['category']; + + $eqsql = " AND `category` = '" + . $catsavail[mt_rand(0,$res->num_rows - 1)] . "' "; + } + } + + $order = (($patsql && $limit == 1) ? "" : "ORDER BY RAND($rnd)" ); + + $result = @$db->query("SELECT `text`, `category` FROM `fortune` + $typesql + $adultsql + $lengthsql + $langsql + $patsql + $regexsql + $eqsql + $order + LIMIT $limit"); + + if($result->num_rows) { + while($x = $result->fetch_array(MYSQL_ASSOC)) + $r[] = fortune_to_html($x['text']) + .(($cat) ? "
[{$x['category']}]
" : ""); + } + return $r; +} + + +function do_stats($table,$length,$numlines,$adult,$cat,$limit,$lang,$pattern,$regex,$equal) { + global $db; + $rnd = mt_rand(); + $r = array(); + + $typesql = (($table) ? " WHERE `category` = '$table' " : " WHERE 1 "); + $lengthsql = (($length) ? " AND LENGTH(`text`) < $length " : "" ); + + if($adult == 2) + $adultsql = " AND offensive = 1 "; + elseif($adult == 1) + $adultsql = ""; + else + $adultsql = " AND offensive = 0 "; + + + if($numlines) + $lengthsql .= + " AND (LENGTH(`text`) - LENGTH(REPLACE(`text`,\"\n\",\"\"))) <= $numlines "; + + $langsql = " AND lang = '$lang' "; + + $patsql = ''; + if(strlen($pattern)) + $patsql = " AND MATCH text AGAINST ('$pattern') "; + + $regexsql = ''; + if(strlen($regex)) + $regexsql = " AND text REGEXP '$regex' "; + + $eqsql = ''; + + $result = @$db->query("SELECT `text`, `category` FROM `fortune` + $typesql + $adultsql + $lengthsql + $langsql + $patsql + $regexsql + $eqsql"); + + + echo '
' . $result->num_rows . ' matching quotations.
'; + + + $res = @$db->query("SELECT DISTINCT ( `category` ) FROM `fortune` + $typesql + $adultsql + $lengthsql + $langsql + $patsql + $regexsql "); + if($res->num_rows) { + echo '
Matching Databases:
'; + while($x = $res->fetch_array(MYSQL_ASSOC)) + echo $x['category'].'
'; + + } + else + echo '
No matching databases using those search parameters - please refine your options.
'; + + +} + + +function fortune_to_html($s) { + + // First pass - escape all the HTML entities, and while we're at it + // get rid of any MS-DOS end-of-line characters and expand tabs to + // 8 non-breaking spaces, and translate linefeeds to
. + // We also get rid of ^G which used to sound the terminal beep or bell + // on ASCII terminals and were humourous in some fortunes. + // We could map these to autoplay a short sound file but browser support + // is still sketchy and then there's the issue of where to locate the + // URL, and a lot of people find autoplay sounds downright annoying. + // So for now, just remove them. + + $s = str_replace( + array("&", + "<", + ">", + '"', + "\007", + "\t", + "\r", + "\n"), + + array("&", + "<", + ">", + """, + "", + "        ", + "", + "
"), + $s); + // Replace pseudo diacritics + // These were used to produce accented characters. For instance an accented + // e would have been encoded by '^He - the backspace moving the cursor + // backward so both the single quote and the e would appear in the same + // character position. Umlauts were quite clever - they used a double quote + // as the accent mark over a normal character. + + $s = preg_replace("/'\010([a-zA-Z])/","&\\1acute;",$s); + $s = preg_replace("/\"\010([a-zA-Z])/","&\\1uml;",$s); + $s = preg_replace("/\`\010([a-zA-Z])/","&\\1grave;",$s); + $s = preg_replace("/\^\010([a-zA-Z])/","&\\1circ;",$s); + $s = preg_replace("/\~\010([a-zA-Z])/","&\\1tilde;",$s); + + // Ignore multiple underlines for the same character. These were + // most useful when sent to a line printer back in the day as it + // would type over the same character a number of times making it + // much darker (e.g. bold). I think there are only one or two + // instances of this in the current (2008) fortune cookie database. + + $s = preg_replace("/(_\010)+/","_\010",$s); + // Map the characters which sit underneath a backspace. + // If you can come up with a regex to do all of the following + // madness - be my guest. + // It's not as simple as you think. We need to take something + // that has been backspaced over an arbitrary number of times + // and wrap a forward looking matching number of characters in + // HTML, whilst deciding if it's intended as an underline or + // strikeout sequence. + + // Essentially we produce a string of '1' and '0' characters + // the same length as the source text. + // Any position which is marked '1' has been backspaced over. + + $cursor = 0; + $dst = $s; + $bs_found = false; + for($x = 0; $x < strlen($s); $x ++) { + if($s[$x] == "\010" && $cursor) { + $bs_found = true; + $cursor --; + $dst[$cursor] = '1'; + $dst[$x] = '0'; + $continue; + } + else { + if($bs_found) { + $bs_found = false; + $cursor = $x; + } + $dst[$cursor] = '0'; + $cursor ++; + } + + } + + $out = ''; + $strike = false; + $bold = false; + + // Underline sequence, convert to bold to avoid confusion with links. + // These were generally used for emphasis so it's a reasonable choice. + // Please note that this logic will fail if there is an underline sequence + // and also a strikeout sequence in the same fortune. + + if(strstr($s,"_\010")) { + $len = 0; + for($x = 0; $x < strlen($s); $x ++) { + if($dst[$x] == '1') { + $len ++; + $bold = true; + } + else { + if($bold) { + $out .= ''; + while($s[$x] == "\010") + $x ++; + $out .= substr($s,$x,$len); + $out .= ''; + $x = $x + $len - 1; + $len = 0; + $bold = false; + } + else + $out .= $s[$x]; + } + } + } + + // These aren't seen very often these days - simulation of + // backspace/replace. You could occasionally see the original text + // on slower terminals before it got replaced. Once modems reached + // 4800/9600 baud in the late 70's and early 80's the effect was + // mostly lost - but if you find a really old fortune file you might + // encounter a few of these. + + else { + for($x = 0; $x < strlen($s); $x ++) { + if($dst[$x] == '1') { + if($strike) + $out .= $s[$x]; + else + $out .= ''.$s[$x]; + $strike = true; + } + else { + if($strike) + $out .= ''; + $strike = false; + $out .= $s[$x]; + } + } + } + + // Many of the underline sequences are also wrapped in asterisks, + // which was yet another way of marking ASCII as 'bold'. + // So if it's an underline sequence, and there are asterisks + // on both ends, strip the asterisks as we've already emboldened the text. + + $out = preg_replace('/\*([^<]*<\/strong>)\*/',"\\1",$out); + + // Finally, remove the backspace characters which we don't need anymore. + + return str_replace("\010","",$out); +} + +$result1 = do_query($table,$length,$numlines,$adult,$cat,1,$lang,$pattern,$regex,$equal); + +if(count($result1)) + echo $result1[0]; + +if($stats) + do_stats($table,$length,$numlines,$adult,$cat,1,$lang,$pattern,$regex,$equal); + + diff --git a/sources/addons/fortunate/fortunate.apd b/sources/addons/fortunate/fortunate.apd new file mode 100644 index 00000000..d1c72473 --- /dev/null +++ b/sources/addons/fortunate/fortunate.apd @@ -0,0 +1,3 @@ +url: $baseurl/fortunate +name: Fortunate +photo: $baseurl/addon/fortunate/fortunate.png diff --git a/sources/addons/fortunate/fortunate.css b/sources/addons/fortunate/fortunate.css new file mode 100644 index 00000000..61813b7d --- /dev/null +++ b/sources/addons/fortunate/fortunate.css @@ -0,0 +1,7 @@ +.fortunate { + margin-top: 25px; + margin-left: 100px; + margin-bottom: 25px; + color: #000088; + font-size: 14px; +} \ No newline at end of file diff --git a/sources/addons/fortunate/fortunate.php b/sources/addons/fortunate/fortunate.php new file mode 100644 index 00000000..5b0f47ac --- /dev/null +++ b/sources/addons/fortunate/fortunate.php @@ -0,0 +1,43 @@ + + */ + + +function fortunate_load() { + register_hook('page_end', 'addon/fortunate/fortunate.php', 'fortunate_fetch'); + +} + +function fortunate_unload() { + unregister_hook('page_end', 'addon/fortunate/fortunate.php', 'fortunate_fetch'); +} + +function fortunate_module(){} + + +function fortunate_fetch(&$a,&$b) { + + $fort_server = get_config('fortunate','server'); + if(! $fort_server) + return; + + $a->page['htmlhead'] .= '' . "\r\n"; + + $s = z_fetch_url('http://' . $fort_server . '/cookie.php?numlines=4&equal=1&rand=' . mt_rand()); + if($s['success']) + $b .= '
' . $s['body'] . '
'; + +} + +function fortunate_content(&$a) { + +// $o = ''; +// fortunate_fetch($a,$o); +// return $o; + +} \ No newline at end of file diff --git a/sources/addons/fortunate/fortunate.png b/sources/addons/fortunate/fortunate.png new file mode 100644 index 00000000..894a94c7 Binary files /dev/null and b/sources/addons/fortunate/fortunate.png differ diff --git a/sources/addons/frphotos/frphotohelper.php b/sources/addons/frphotos/frphotohelper.php new file mode 100644 index 00000000..c2edc3e3 --- /dev/null +++ b/sources/addons/frphotos/frphotohelper.php @@ -0,0 +1,75 @@ +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, 'Hubzilla'); + + $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','addon/frphotos/frphotohelper.php',$jj, $channel['channel_address'], urlencode($fr_server)); + sleep(3); + } + } + if($total) { + set_pconfig(local_channel(),'frphotos','complete','1'); + } + @unlink($cookies); + goaway(z_root() . '/photos/' . $channel['channel_address']); + } +} + + +function frphotos_content(&$a) { + + if(! local_channel()) { + notice( t('Permission denied') . EOL); + return; + } + + if(intval(get_pconfig(local_channel(),'frphotos','complete'))) { + info('Friendica photos have already been imported into this channel.'); + return; + } + + $o = replace_macros(get_markup_template('frphotos.tpl','addon/frphotos'),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/sources/addons/frphotos/view/tpl/frphotos.tpl b/sources/addons/frphotos/view/tpl/frphotos.tpl new file mode 100644 index 00000000..b8e97882 --- /dev/null +++ b/sources/addons/frphotos/view/tpl/frphotos.tpl @@ -0,0 +1,13 @@ +

{{$header}}

+ +

{{$desc}}

+ +
+ +{{include file="field_input.tpl" field=$fr_server}} +{{include file="field_input.tpl" field=$fr_username}} +{{include file="field_password.tpl" field=$fr_password}} + + +
+ diff --git a/sources/addons/hexit/hexit.apd b/sources/addons/hexit/hexit.apd new file mode 100644 index 00000000..af0b05fb --- /dev/null +++ b/sources/addons/hexit/hexit.apd @@ -0,0 +1,3 @@ +url: $baseurl/hexit +name: Hexit +photo: $baseurl/addon/hexit/hexit.png diff --git a/sources/addons/hexit/hexit.php b/sources/addons/hexit/hexit.php new file mode 100644 index 00000000..bd9b7204 --- /dev/null +++ b/sources/addons/hexit/hexit.php @@ -0,0 +1,185 @@ + +/** + * A function for converting hex <-> dec w/o loss of precision. + * + * The problem is that parseInt("0x12345...") isn't precise enough to convert + * 64-bit integers correctly. + * + * Internally, this uses arrays to encode decimal digits starting with the least + * significant: + * 8 = [8] + * 16 = [6, 1] + * 1024 = [4, 2, 0, 1] + */ + +// Adds two arrays for the given base (10 or 16), returning the result. +// This turns out to be the only "primitive" operation we need. +function add(x, y, base) { + var z = []; + var n = Math.max(x.length, y.length); + var carry = 0; + var i = 0; + while (i < n || carry) { + var xi = i < x.length ? x[i] : 0; + var yi = i < y.length ? y[i] : 0; + var zi = carry + xi + yi; + z.push(zi % base); + carry = Math.floor(zi / base); + i++; + } + return z; +} + +// Returns a*x, where x is an array of decimal digits and a is an ordinary +// JavaScript number. base is the number base of the array x. +function multiplyByNumber(num, x, base) { + if (num < 0) return null; + if (num == 0) return []; + + var result = []; + var power = x; + while (true) { + if (num & 1) { + result = add(result, power, base); + } + num = num >> 1; + if (num === 0) break; + power = add(power, power, base); + } + + return result; +} + +function parseToDigitsArray(str, base) { + var digits = str.split(''); + var ary = []; + for (var i = digits.length - 1; i >= 0; i--) { + var n = parseInt(digits[i], base); + if (isNaN(n)) return null; + ary.push(n); + } + return ary; +} + +function convertBase(str, fromBase, toBase) { + var digits = parseToDigitsArray(str, fromBase); + if (digits === null) return null; + + var outArray = []; + var power = [1]; + for (var i = 0; i < digits.length; i++) { + // invariant: at this point, fromBase^i = power + if (digits[i]) { + outArray = add(outArray, multiplyByNumber(digits[i], power, toBase), toBase); + } + power = multiplyByNumber(fromBase, power, toBase); + } + + var out = ''; + for (var i = outArray.length - 1; i >= 0; i--) { + out += outArray[i].toString(toBase); + } + return out; +} + +function decToHex(decStr) { + var hex = convertBase(decStr, 10, 16); + return hex ? '0x' + hex : null; +} + +function hexToDec(hexStr) { + if (hexStr.substring(0, 2) === '0x') hexStr = hexStr.substring(2); + hexStr = hexStr.toLowerCase(); + return convertBase(hexStr, 16, 10); +} + + + + function str_or_null(x) { + return x === null ? 'null' : x; + } + + // "1.234e+5" -> "12340" + function expandExponential(x) { + var pos = x.indexOf("e"); + if (pos === -1) pos = x.indexOf("E"); + if (pos === -1) return x; + + var base = x.substring(0, pos); + var pow = parseInt(x.substring(pos + 1), 10); + if (pow < 0) return x; // not supported. + + var dotPos = base.indexOf('.'); + if (dotPos === -1) dotPos = base.length; + + var ret = base.replace('.', ''); + while (ret.length < dotPos + pow) ret += '0'; + return ret; + } + + function boldDifference(correct, actual) { + for (var i = 0, j = 0; i < correct.length && j < actual.length; i++, j++) { + if (correct[i] !== actual[j]) { + break; + } + } + if (j < actual.length) { + return actual.substring(0, j) + '' + actual.substring(j) + ''; + } else { + return actual; + } + } + + function convert() { + var input = document.getElementById("in").value; + if (input) { + var aHex = str_or_null(decToHex(input)); + var aDec = str_or_null(hexToDec(input)); + var bHex = '0x' + (parseInt(input, 10)).toString(16); + var bDec = "" + expandExponential("" +parseInt(input, 16)); + + var html = '

To Decimal(' + input + ') = ' + aDec + '

'; + html += '

To Hex(' + input + ') = ' + aHex + '

'; + document.getElementById('result').innerHTML = html; + } + } + convert(); + + + + +

Hexit

+ +

Type in a hex or decimal string:

+ +

+ + + +EOT; + +return $o; +} diff --git a/sources/addons/hexit/hexit.png b/sources/addons/hexit/hexit.png new file mode 100644 index 00000000..990f7ead Binary files /dev/null and b/sources/addons/hexit/hexit.png differ diff --git a/sources/addons/ijpost/ijpost.css b/sources/addons/ijpost/ijpost.css new file mode 100644 index 00000000..e69de29b diff --git a/sources/addons/ijpost/ijpost.php b/sources/addons/ijpost/ijpost.php new file mode 100644 index 00000000..863a2b05 --- /dev/null +++ b/sources/addons/ijpost/ijpost.php @@ -0,0 +1,229 @@ + + * Author: Michael Johnston + * Author: Cat Gray + */ + +require_once('include/permissions.php'); + +function ijpost_load() { + register_hook('post_local', 'addon/ijpost/ijpost.php', 'ijpost_post_local'); + register_hook('notifier_normal', 'addon/ijpost/ijpost.php', 'ijpost_send'); + register_hook('jot_networks', 'addon/ijpost/ijpost.php', 'ijpost_jot_nets'); + register_hook('feature_settings', 'addon/ijpost/ijpost.php', 'ijpost_settings'); + register_hook('feature_settings_post', 'addon/ijpost/ijpost.php', 'ijpost_settings_post'); + +} +function ijpost_unload() { + unregister_hook('post_local', 'addon/ijpost/ijpost.php', 'ijpost_post_local'); + unregister_hook('notifier_normal', 'addon/ijpost/ijpost.php', 'ijpost_send'); + unregister_hook('jot_networks', 'addon/ijpost/ijpost.php', 'ijpost_jot_nets'); + unregister_hook('feature_settings', 'addon/ijpost/ijpost.php', 'ijpost_settings'); + unregister_hook('feature_settings_post', 'addon/ijpost/ijpost.php', 'ijpost_settings_post'); + +} + + +function ijpost_jot_nets(&$a,&$b) { + if((! local_channel()) || (! perm_is_allowed(local_channel(),'','view_stream'))) + return; + + $ij_post = get_pconfig(local_channel(),'ijpost','post'); + if(intval($ij_post) == 1) { + $ij_defpost = get_pconfig(local_channel(),'ijpost','post_by_default'); + $selected = ((intval($ij_defpost) == 1) ? ' checked="checked" ' : ''); + $b .= '
' + . t('Post to Insanejournal') . '
'; + } +} + + +function ijpost_settings(&$a,&$s) { + + if(! local_channel()) + return; + + /* Add our stylesheet to the page so we can make our settings look nice */ + + //$a->page['htmlhead'] .= '' . "\r\n"; + + /* Get the current state of our config variables */ + + $enabled = get_pconfig(local_channel(),'ijpost','post'); + + $checked = (($enabled) ? 1 : false); + + $def_enabled = get_pconfig(local_channel(),'ijpost','post_by_default'); + + $def_checked = (($def_enabled) ? 1 : false); + + $ij_username = get_pconfig(local_channel(), 'ijpost', 'ij_username'); + $ij_password = z_unobscure(get_pconfig(local_channel(), 'ijpost', 'ij_password')); + + + /* Add some HTML to the existing form */ + + $sc .= replace_macros(get_markup_template('field_checkbox.tpl'), array( + '$field' => array('ijpost', t('Enable InsaneJournal Post Plugin'), $checked, '', array(t('No'),t('Yes'))), + )); + + $sc .= replace_macros(get_markup_template('field_input.tpl'), array( + '$field' => array('ij_username', t('InsaneJournal username'), $ij_username, '') + )); + + $sc .= replace_macros(get_markup_template('field_password.tpl'), array( + '$field' => array('ij_password', t('InsaneJournal password'), $ij_password, '') + )); + + $sc .= replace_macros(get_markup_template('field_checkbox.tpl'), array( + '$field' => array('ij_bydefault', t('Post to InsaneJournal by default'), $def_checked, '', array(t('No'),t('Yes'))), + )); + + $s .= replace_macros(get_markup_template('generic_addon_settings.tpl'), array( + '$addon' => array('ijpost',t('InsaneJournal Post Settings'), '', t('Submit')), + '$content' => $sc + )); + +} + + +function ijpost_settings_post(&$a,&$b) { + + if(x($_POST,'ijpost-submit')) { + + set_pconfig(local_channel(),'ijpost','post',intval($_POST['ijpost'])); + set_pconfig(local_channel(),'ijpost','post_by_default',intval($_POST['ij_bydefault'])); + set_pconfig(local_channel(),'ijpost','ij_username',trim($_POST['ij_username'])); + set_pconfig(local_channel(),'ijpost','ij_password',z_obscure(trim($_POST['ij_password']))); + info( t('Insane Journal Settings saved.') . EOL); + } + +} + +function ijpost_post_local(&$a,&$b) { + + // This can probably be changed to allow editing by pointing to a different API endpoint + + if($b['edit']) + return; + + if((! local_channel()) || (local_channel() != $b['uid'])) + return; + + if($b['item_private'] || $b['parent']) + return; + + $ij_post = intval(get_pconfig(local_channel(),'ijpost','post')); + + $ij_enable = (($ij_post && x($_REQUEST,'ijpost_enable')) ? intval($_REQUEST['ijpost_enable']) : 0); + + if($_REQUEST['api_source'] && intval(get_pconfig(local_channel(),'ijpost','post_by_default'))) + $ij_enable = 1; + + if(! $ij_enable) + return; + + if(strlen($b['postopts'])) + $b['postopts'] .= ','; + $b['postopts'] .= 'ijpost'; +} + + + + +function ijpost_send(&$a,&$b) { + + if((! is_item_normal($b)) || $b['item_private'] || ($b['created'] !== $b['edited'])) + return; + + if(! perm_is_allowed($b['uid'],'','view_stream')) + return; + + if(! strstr($b['postopts'],'ijpost')) + return; + + if($b['parent'] != $b['id']) + return; + + logger('Insanejournal xpost invoked'); + + // insanejournal post in the LJ user's timezone. + // Hopefully the person's Friendica account + // will be set to the same thing. + + $tz = 'UTC'; + + $x = q("select channel_timezone from channel where channel_id = %d limit 1", + intval($b['uid']) + ); + if($x && strlen($x[0]['channel_timezone'])) + $tz = $x[0]['channel_timezone']; + + $ij_username = get_pconfig($b['uid'],'ijpost','ij_username'); + $ij_password = z_unobscure(get_pconfig($b['uid'],'ijpost','ij_password')); + $ij_blog = 'http://www.insanejournal.com/interface/xmlrpc'; + + if($ij_username && $ij_password && $ij_blog) { + + require_once('include/bbcode.php'); + require_once('include/datetime.php'); + + $title = $b['title']; + $post = bbcode($b['body']); + $post = xmlify($post); + $tags = ijpost_get_tags($b['tag']); + + $date = datetime_convert('UTC',$tz,$b['created'],'Y-m-d H:i:s'); + $year = intval(substr($date,0,4)); + $mon = intval(substr($date,5,2)); + $day = intval(substr($date,8,2)); + $hour = intval(substr($date,11,2)); + $min = intval(substr($date,14,2)); + + $xml = <<< EOT + +LJ.XMLRPC.postevent + + +year$year +mon$mon +day$day +hour$hour +min$min +event$post +username$ij_username +password$ij_password +subject$title +lineendingsunix +ver1 +props + +useragentHubzilla +taglist$tags + + + + + +EOT; + + logger('ijpost: data: ' . $xml, LOGGER_DATA); + + if($ij_blog !== 'test') + $x = z_post_url($ij_blog,$xml,array('headers' => array("Content-Type: text/xml"))); + logger('posted to insanejournal: ' . print_r($x,true), LOGGER_DEBUG); + + } +} + +function ijpost_get_tags($post) +{ + preg_match_all("/\]([^\[#]+)\[/",$post,$matches); + $tags = implode(', ',$matches[1]); + return $tags; +} diff --git a/sources/addons/ijpost/lang/C/messages.po b/sources/addons/ijpost/lang/C/messages.po new file mode 100644 index 00000000..4f62c23a --- /dev/null +++ b/sources/addons/ijpost/lang/C/messages.po @@ -0,0 +1,46 @@ +# ADDON ijpost +# Copyright (C) +# This file is distributed under the same license as the Friendica ijpost addon package. +# +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-02-27 05:01-0500\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ijpost.php:39 +msgid "Post to Insanejournal" +msgstr "" + +#: ijpost.php:70 +msgid "InsaneJournal Post Settings" +msgstr "" + +#: ijpost.php:72 +msgid "Enable InsaneJournal Post Plugin" +msgstr "" + +#: ijpost.php:77 +msgid "InsaneJournal username" +msgstr "" + +#: ijpost.php:82 +msgid "InsaneJournal password" +msgstr "" + +#: ijpost.php:87 +msgid "Post to InsaneJournal by default" +msgstr "" + +#: ijpost.php:93 +msgid "Submit" +msgstr "" diff --git a/sources/addons/ijpost/lang/ca/strings.php b/sources/addons/ijpost/lang/ca/strings.php new file mode 100644 index 00000000..b5382615 --- /dev/null +++ b/sources/addons/ijpost/lang/ca/strings.php @@ -0,0 +1,9 @@ +strings["Post to Insanejournal"] = "Enviament a Insanejournal"; +$a->strings["InsaneJournal Post Settings"] = "Ajustos d'Enviament a Insanejournal"; +$a->strings["Enable InsaneJournal Post Plugin"] = "Habilita el Plugin d'Enviaments a Insanejournal"; +$a->strings["InsaneJournal username"] = "Nom d'usuari de Insanejournal"; +$a->strings["InsaneJournal password"] = "Contrasenya de Insanejournal"; +$a->strings["Post to InsaneJournal by default"] = "Enviar per defecte a Insanejournal"; +$a->strings["Submit"] = "Enviar"; diff --git a/sources/addons/ijpost/lang/cs/strings.php b/sources/addons/ijpost/lang/cs/strings.php new file mode 100644 index 00000000..8e40419a --- /dev/null +++ b/sources/addons/ijpost/lang/cs/strings.php @@ -0,0 +1,9 @@ +strings["Post to Insanejournal"] = "Odeslat na Insanejournal"; +$a->strings["InsaneJournal Post Settings"] = "Nastavení příspěvků pro InsaneJournal"; +$a->strings["Enable InsaneJournal Post Plugin"] = "Povolit Insanejournal plugin"; +$a->strings["InsaneJournal username"] = "Insanejournal uživatelské jméno"; +$a->strings["InsaneJournal password"] = "Insanejournal heslo"; +$a->strings["Post to InsaneJournal by default"] = "Defaultně zasílat příspěvky na InsaneJournal"; +$a->strings["Submit"] = "Odeslat"; diff --git a/sources/addons/ijpost/lang/de/strings.php b/sources/addons/ijpost/lang/de/strings.php new file mode 100644 index 00000000..319a9743 --- /dev/null +++ b/sources/addons/ijpost/lang/de/strings.php @@ -0,0 +1,9 @@ +strings["Post to Insanejournal"] = "Auf InsaneJournal posten."; +$a->strings["InsaneJournal Post Settings"] = "InsaneJournal Beitrags-Einstellungen"; +$a->strings["Enable InsaneJournal Post Plugin"] = "InsaneJournal Plugin aktivieren"; +$a->strings["InsaneJournal username"] = "InsaneJournal Benutzername"; +$a->strings["InsaneJournal password"] = "InsaneJournal Passwort"; +$a->strings["Post to InsaneJournal by default"] = "Standardmäßig auf InsaneJournal posten."; +$a->strings["Submit"] = "Senden"; diff --git a/sources/addons/ijpost/lang/eo/strings.php b/sources/addons/ijpost/lang/eo/strings.php new file mode 100644 index 00000000..11698887 --- /dev/null +++ b/sources/addons/ijpost/lang/eo/strings.php @@ -0,0 +1,9 @@ +strings["Post to Insanejournal"] = "Afiŝi al Insanejournal"; +$a->strings["InsaneJournal Post Settings"] = "Agordoj pri Insaenejournal Afiŝoj"; +$a->strings["Enable InsaneJournal Post Plugin"] = "Ŝalti la InsaneJournal afiŝo kromprogramon."; +$a->strings["InsaneJournal username"] = "Salutnomo ĉe InsaneJournal"; +$a->strings["InsaneJournal password"] = "Pasvorto ĉe InsaneJournal"; +$a->strings["Post to InsaneJournal by default"] = "Defaŭlte afiŝi ĉe InsaneJournal"; +$a->strings["Submit"] = "Sendi"; diff --git a/sources/addons/ijpost/lang/es/strings.php b/sources/addons/ijpost/lang/es/strings.php new file mode 100644 index 00000000..4468be83 --- /dev/null +++ b/sources/addons/ijpost/lang/es/strings.php @@ -0,0 +1,9 @@ +strings["Post to Insanejournal"] = "Publicar en Insanejournal"; +$a->strings["InsaneJournal Post Settings"] = "Configuración de publicación en Insanejournal"; +$a->strings["Enable InsaneJournal Post Plugin"] = "Activar el módulo de publicación en Insanejournal"; +$a->strings["InsaneJournal username"] = "Nombre de usuario de Insanejournal"; +$a->strings["InsaneJournal password"] = "Contraseña de Insanejournal"; +$a->strings["Post to InsaneJournal by default"] = "Publicar en Insanejournal por defecto"; +$a->strings["Submit"] = "Envíar"; diff --git a/sources/addons/ijpost/lang/fr/strings.php b/sources/addons/ijpost/lang/fr/strings.php new file mode 100644 index 00000000..7db58ccf --- /dev/null +++ b/sources/addons/ijpost/lang/fr/strings.php @@ -0,0 +1,9 @@ +strings["Post to Insanejournal"] = "Publier vers InsaneJournal"; +$a->strings["InsaneJournal Post Settings"] = "Réglages InsaneJournal"; +$a->strings["Enable InsaneJournal Post Plugin"] = "Activer le connecteur InsaneJournal"; +$a->strings["InsaneJournal username"] = "Utilisateur InsaneJournal"; +$a->strings["InsaneJournal password"] = "Mot de passe InsaneJournal"; +$a->strings["Post to InsaneJournal by default"] = "Publier sur InsaneJournal par défaut"; +$a->strings["Submit"] = "Envoyer"; diff --git a/sources/addons/ijpost/lang/is/strings.php b/sources/addons/ijpost/lang/is/strings.php new file mode 100644 index 00000000..b79f347e --- /dev/null +++ b/sources/addons/ijpost/lang/is/strings.php @@ -0,0 +1,9 @@ +strings["Post to Insanejournal"] = ""; +$a->strings["InsaneJournal Post Settings"] = ""; +$a->strings["Enable InsaneJournal Post Plugin"] = ""; +$a->strings["InsaneJournal username"] = ""; +$a->strings["InsaneJournal password"] = ""; +$a->strings["Post to InsaneJournal by default"] = ""; +$a->strings["Submit"] = "Senda inn"; diff --git a/sources/addons/ijpost/lang/it/strings.php b/sources/addons/ijpost/lang/it/strings.php new file mode 100644 index 00000000..f82132ce --- /dev/null +++ b/sources/addons/ijpost/lang/it/strings.php @@ -0,0 +1,9 @@ +strings["Post to Insanejournal"] = "Invia a Insanejournal"; +$a->strings["InsaneJournal Post Settings"] = "Impostazioni Invio a InsaneJournal "; +$a->strings["Enable InsaneJournal Post Plugin"] = "Abilita il plugin Invio a InsaneJournal"; +$a->strings["InsaneJournal username"] = "Nome utente InsaneJournal"; +$a->strings["InsaneJournal password"] = "Password InsaneJournal"; +$a->strings["Post to InsaneJournal by default"] = "Invia sempre a InsaneJournal"; +$a->strings["Submit"] = "Invia"; diff --git a/sources/addons/ijpost/lang/nb-no/strings.php b/sources/addons/ijpost/lang/nb-no/strings.php new file mode 100644 index 00000000..2eaa62e3 --- /dev/null +++ b/sources/addons/ijpost/lang/nb-no/strings.php @@ -0,0 +1,9 @@ +strings["Post to Insanejournal"] = ""; +$a->strings["InsaneJournal Post Settings"] = ""; +$a->strings["Enable InsaneJournal Post Plugin"] = ""; +$a->strings["InsaneJournal username"] = ""; +$a->strings["InsaneJournal password"] = ""; +$a->strings["Post to InsaneJournal by default"] = ""; +$a->strings["Submit"] = "Lagre"; diff --git a/sources/addons/ijpost/lang/pl/strings.php b/sources/addons/ijpost/lang/pl/strings.php new file mode 100644 index 00000000..5b6ec674 --- /dev/null +++ b/sources/addons/ijpost/lang/pl/strings.php @@ -0,0 +1,9 @@ +strings["Post to Insanejournal"] = "Opublikuj na Insanejournal"; +$a->strings["InsaneJournal Post Settings"] = ""; +$a->strings["Enable InsaneJournal Post Plugin"] = ""; +$a->strings["InsaneJournal username"] = ""; +$a->strings["InsaneJournal password"] = ""; +$a->strings["Post to InsaneJournal by default"] = ""; +$a->strings["Submit"] = "Potwierdź"; diff --git a/sources/addons/ijpost/lang/pt-br/strings.php b/sources/addons/ijpost/lang/pt-br/strings.php new file mode 100644 index 00000000..4dce00fc --- /dev/null +++ b/sources/addons/ijpost/lang/pt-br/strings.php @@ -0,0 +1,9 @@ +strings["Post to Insanejournal"] = "Publicar no InsaneJournal"; +$a->strings["InsaneJournal Post Settings"] = "Configurações da publicação no InsaneJournal"; +$a->strings["Enable InsaneJournal Post Plugin"] = "Habilitar o plugin de publicação no InsaneJournal"; +$a->strings["InsaneJournal username"] = "Nome de usuário do InsaneJournal"; +$a->strings["InsaneJournal password"] = "Senha do InsaneJournal"; +$a->strings["Post to InsaneJournal by default"] = "Publicar no InsaneJournal por padrão"; +$a->strings["Submit"] = "Enviar"; diff --git a/sources/addons/ijpost/lang/ru/strings.php b/sources/addons/ijpost/lang/ru/strings.php new file mode 100644 index 00000000..0109f8a6 --- /dev/null +++ b/sources/addons/ijpost/lang/ru/strings.php @@ -0,0 +1,9 @@ +strings["Post to Insanejournal"] = ""; +$a->strings["InsaneJournal Post Settings"] = ""; +$a->strings["Enable InsaneJournal Post Plugin"] = "Включить InsaneJournal плагин сообщений"; +$a->strings["InsaneJournal username"] = ""; +$a->strings["InsaneJournal password"] = ""; +$a->strings["Post to InsaneJournal by default"] = ""; +$a->strings["Submit"] = "Подтвердить"; diff --git a/sources/addons/ijpost/lang/sv/strings.php b/sources/addons/ijpost/lang/sv/strings.php new file mode 100644 index 00000000..3ec569a7 --- /dev/null +++ b/sources/addons/ijpost/lang/sv/strings.php @@ -0,0 +1,3 @@ +strings["Submit"] = "Spara"; diff --git a/sources/addons/ijpost/lang/zh-cn/strings.php b/sources/addons/ijpost/lang/zh-cn/strings.php new file mode 100644 index 00000000..f2a04712 --- /dev/null +++ b/sources/addons/ijpost/lang/zh-cn/strings.php @@ -0,0 +1,9 @@ +strings["Post to Insanejournal"] = "转播到Insanejournal"; +$a->strings["InsaneJournal Post Settings"] = "Insanejournal转播设置"; +$a->strings["Enable InsaneJournal Post Plugin"] = "使InsaneJournal转播插件可用"; +$a->strings["InsaneJournal username"] = "InsaneJournal用户名"; +$a->strings["InsaneJournal password"] = "InsaneJournal密码"; +$a->strings["Post to InsaneJournal by default"] = "默认地转播到InsaneJournal"; +$a->strings["Submit"] = "提交"; diff --git a/sources/addons/irc/irc.apd b/sources/addons/irc/irc.apd new file mode 100644 index 00000000..12189e78 --- /dev/null +++ b/sources/addons/irc/irc.apd @@ -0,0 +1,3 @@ +url: $baseurl/irc +name: IRC Chat +photo: $baseurl/addon/irc/irc.png diff --git a/sources/addons/irc/irc.css b/sources/addons/irc/irc.css new file mode 100644 index 00000000..e69de29b diff --git a/sources/addons/irc/irc.php b/sources/addons/irc/irc.php new file mode 100644 index 00000000..b9d3a4a0 --- /dev/null +++ b/sources/addons/irc/irc.php @@ -0,0 +1,119 @@ + +*/ + +/* enable in admin->plugins + * you will then have "irc chatroom" listed at yoursite/apps + * and the app will run at yoursite/irc + * documentation at http://tonybaldwin.me/hax/doku.php?id=friendica:irc + * admin can set popular chans, auto connect chans in settings->plugin settings + */ + +function irc_load() { + register_hook('app_menu', 'addon/irc/irc.php', 'irc_app_menu'); + register_hook('feature_settings', 'addon/irc/irc.php', 'irc_addon_settings'); + register_hook('feature_settings_post', 'addon/irc/irc.php', 'irc_addon_settings_post'); +} + +function irc_unload() { + unregister_hook('app_menu', 'addon/irc/irc.php', 'irc_app_menu'); + unregister_hook('feature_settings', 'addon/irc/irc.php', 'irc_addon_settings'); + unregister_hook('feature_settings_post', 'addon/irc/irc.php', 'irc_addon_settings_post'); + +} + + +function irc_addon_settings(&$a,&$s) { + + if(! is_site_admin()) + return; + + /* Add our stylesheet to the page so we can make our settings look nice */ + + //$a->page['htmlhead'] .= '' . "\r\n"; + + /* setting popular channels, auto connect channels */ + $sitechats = get_config('irc','sitechats'); /* popular channels */ + $autochans = get_config('irc','autochans'); /* auto connect chans */ + + $sc .= replace_macros(get_markup_template('field_input.tpl'), array( + '$field' => array('autochans', t('Channels to auto connect'), $sitechats, t('Comma separated list')) + )); + + $sc .= replace_macros(get_markup_template('field_input.tpl'), array( + '$field' => array('sitechats', t('Popular Channels'), $autochans, t('Comma separated list')) + )); + + $s .= replace_macros(get_markup_template('generic_addon_settings.tpl'), array( + '$addon' => array('irc', t('IRC Settings'), '', t('Submit')), + '$content' => $sc + )); + + return; + +} + +function irc_addon_settings_post(&$a,&$b) { + if(! is_site_admin()) + return; + + if($_POST['irc-submit']) { + set_config('irc','autochans',trim($_POST['autochans'])); + set_config('irc','sitechats',trim($_POST['sitechats'])); + /* stupid pop-up thing */ + info( t('IRC settings saved.') . EOL); + } +} + +function irc_app_menu($a,&$b) { +$b['app_menu'][] = ''; +} + + +function irc_module() { +return; +} + + +function irc_content(&$a) { + + $baseurl = $a->get_baseurl() . '/addon/irc'; + $o = ''; + + /* set the list of popular channels */ + $sitechats = get_config('irc','sitechats'); + if($sitechats) + $chats = explode(',',$sitechats); + else + $chats = array('hubzilla','friendica','chat','chatback','hottub','ircbar','dateroom','debian'); + + + $a->page['aside'] .= '

' . t('Popular Channels') . '

    '; + foreach($chats as $chat) { + $a->page['aside'] .= '
  • ' . '#' . $chat . '
  • '; + } + $a->page['aside'] .= '
'; + + /* setting the channel(s) to auto connect */ + $autochans = get_config('irc','autochans'); + if($autochans) + $channels = $autochans; + else + $channels = ((x($_GET,'channels')) ? $_GET['channels'] : 'hubzilla'); + +/* add the chatroom frame and some html */ + $o .= <<< EOT +

IRC chat

+

A beginner's guide to using IRC. [en]

+ +EOT; + +return $o; + +} + + diff --git a/sources/addons/irc/irc.png b/sources/addons/irc/irc.png new file mode 100644 index 00000000..0e4b185d Binary files /dev/null and b/sources/addons/irc/irc.png differ diff --git a/sources/addons/jappixmini/MIT.txt b/sources/addons/jappixmini/MIT.txt new file mode 100644 index 00000000..2517727f --- /dev/null +++ b/sources/addons/jappixmini/MIT.txt @@ -0,0 +1,7 @@ +You may distribute all files which are not within the jappix/ folder under the following conditions: + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/sources/addons/jappixmini/README b/sources/addons/jappixmini/README new file mode 100644 index 00000000..0bda660f --- /dev/null +++ b/sources/addons/jappixmini/README @@ -0,0 +1,27 @@ +Jappix Mini Plugin +================== + +This quick-and-dirty addon allows you to add a Jabber-based, Facebook-like chat +to Hubzilla. It uses Jappix Mini. + +It is necessary to use a BOSH host - so to use this plugin, each users need to +know the address of a BOSH host that works with his account. +It is recommended that you install your own BOSH server and recommend it using +the configuration help field. If it is on the same server, you can also deactivate the +BOSH proxy. This should improve the performance. + +The addon has an experimental autosubscribe and autosuggest functionality which +tries to add your Hubzilla contacts to your roster automatically. + +Limitations: + - Jabber passwords can only be encrypted if they are at most 39 characters + long. + +Notes on the license +-------------------- + +The license of this addon is AGPL, as required by Jappix Mini. If you make +modifications to the addon, you are responsible for providing a proper facility +for downloading the changed source code. +Moreover, it may be necessary that you publish the source code of the Friendica +application and all other used addons if you do not use standard versions. diff --git a/sources/addons/jappixmini/jappix/AUTHORS b/sources/addons/jappixmini/jappix/AUTHORS new file mode 100644 index 00000000..0086eb6a --- /dev/null +++ b/sources/addons/jappixmini/jappix/AUTHORS @@ -0,0 +1,54 @@ +Jappix - An open social platform +These are the authors of Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 15/01/12 + +------------------------------------------------- + +Here are the Jappix contributors, who coded or translated the application (Codingteam.net nicknames): + +# DEVELOPERS + - am0ur3ux + - LinkMauve + - Maranda + - Mathieui + - Olivier + - sim6 + - Vanaryon + +# TRANSLATORS + - allan + - Arsimael + - Belzeneph + - Catdarko + - Cerritus + - chunzu + - ebraminio + - Finkregh + - hamano + - JanCBorchardt + - jarda + - joeka + - kr2ysiek + - krohn + - Lenwe + - LinkMauve + - Liverbool + - lwj + - m1st + - Maime + - Maranda + - mbajur + - mentalo + - mkwm + - Otourly + - pocamon + - quimi + - sahwar + - Vanaryon + - vitalyster + - Zash diff --git a/sources/addons/jappixmini/jappix/COPYING b/sources/addons/jappixmini/jappix/COPYING new file mode 100644 index 00000000..84ae389f --- /dev/null +++ b/sources/addons/jappixmini/jappix/COPYING @@ -0,0 +1,662 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license +for software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are +designed to take away your freedom to share and change the works. By +contrast, our General Public Licenses are intended to guarantee your +freedom to share and change all versions of a program--to make sure it +remains free software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public +License. + + "Copyright" also means copyright-like laws that apply to other kinds +of works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further restriction, +you may remove that term. If a license document contains a further +restriction but permits relicensing or conveying under this License, you +may add to a covered work material governed by the terms of that license +document, provided that the further restriction does not survive such +relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have permission +to link or combine any covered work with a work licensed under version 3 +of the GNU General Public License into a single combined work, and to +convey the resulting work. The terms of this License will continue to +apply to the part which is the covered work, but the work with which it is +combined will remain governed by version 3 of the GNU General Public +License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may differ +in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero +General Public License "or any later version" applies to it, you have +the option of following the terms and conditions either of that +numbered version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number +of the GNU Affero General Public License, you may choose any version +ever published by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that +proxy's public statement of acceptance of a version permanently +authorizes you to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. \ No newline at end of file diff --git a/sources/addons/jappixmini/jappix/INSTALL b/sources/addons/jappixmini/jappix/INSTALL new file mode 100644 index 00000000..652c1be7 --- /dev/null +++ b/sources/addons/jappixmini/jappix/INSTALL @@ -0,0 +1,23 @@ +Jappix - An open social platform +These are the installation instructions for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 15/09/10 + +------------------------------------------------- + +It's very simple to install Jappix on your webserver, you just have to follow these things: + +# INSTALLATION + - The HTTP server : http://codingteam.net/project/jappix/doc/HttpServer + - The XMPP server : http://codingteam.net/project/jappix/doc/XmppServer + - The BOSH server : http://codingteam.net/project/jappix/doc/BoshServer + - The Jappix app. : http://codingteam.net/project/jappix/doc/JappixApp + +# MORE + - The whole documentation is available at : http://codingteam.net/project/jappix/doc + +Now, you can use Jappix. Happy socializing! diff --git a/sources/addons/jappixmini/jappix/README b/sources/addons/jappixmini/jappix/README new file mode 100644 index 00000000..49cbf974 --- /dev/null +++ b/sources/addons/jappixmini/jappix/README @@ -0,0 +1,20 @@ +Jappix - An open social platform +This is the readme file for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 18/02/11 + +------------------------------------------------- + +Please refer to the installation instructions that are located in the INSTALL file to process the Jappix installation. + +The Jappix Project official service: https://www.jappix.com/ +The Jappix Project website: https://project.jappix.com/ +The Jappix Project panel: http://codingteam.net/project/jappix + +Jappix is released under the terms of the AGPL license. See COPYING for details. + +Have fun with Jappix! diff --git a/sources/addons/jappixmini/jappix/THANKS b/sources/addons/jappixmini/jappix/THANKS new file mode 100644 index 00000000..a5b12227 --- /dev/null +++ b/sources/addons/jappixmini/jappix/THANKS @@ -0,0 +1,27 @@ +Jappix - An open social platform +These are the special thanks for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 16/02/11 + +------------------------------------------------- + +We would like to thanks the authors of these tools, coming from other projects: + +# PROJECTS + - Base64 http://rumkin.com + - DrawSVGChart http://codingteam.net/project/codingteam + - idzXHR http://www.iadvize.com/plugin_strophe_xmpp.html + - JSJaC http://blog.jwchat.org/jsjac/ + - jQuery http://jquery.com/ + - jQuery Form http://jquery.malsup.com/form/ + - jQuery Timers http://plugins.jquery.com/project/timers + - jXHR http://mulletxhr.com/ + - Mobile Detect http://code.google.com/p/php-mobile-detect/ + - JSMin http://github.com/rgrove/jsmin-php/ + - PHP-gettext https://launchpad.net/php-gettext + - Silk icons http://www.famfamfam.com/lab/icons/silk/ + - Smileys http://www.gajim.org/ diff --git a/sources/addons/jappixmini/jappix/VERSION b/sources/addons/jappixmini/jappix/VERSION new file mode 100644 index 00000000..76892598 --- /dev/null +++ b/sources/addons/jappixmini/jappix/VERSION @@ -0,0 +1 @@ +Spaco [0.9] diff --git a/sources/addons/jappixmini/jappix/css/adhoc.css b/sources/addons/jappixmini/jappix/css/adhoc.css new file mode 100644 index 00000000..68d0383f --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/adhoc.css @@ -0,0 +1,26 @@ +/* + +Jappix - An open social platform +This is the Ad-Hoc CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 20/12/10 + +*/ + +#adhoc .content { + padding: 10px 0 10px 0; +} + +#adhoc .adhoc-head { + background-color: #f1f6fd; + border: 1px #9dc4fc solid; + width: 598px; + height: 18px; + font-size: 0.9em; + margin: 0 10px 12px 10px; + padding: 6px 10px; +} diff --git a/sources/addons/jappixmini/jappix/css/anonymous.css b/sources/addons/jappixmini/jappix/css/anonymous.css new file mode 100644 index 00000000..f61a79c6 --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/anonymous.css @@ -0,0 +1,29 @@ +/* + +Jappix - An open social platform +This is the anonymous mode CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 06/11/10 + +*/ + +#top-content { + min-width: 500px !important; +} + +#main-content { + min-width: 490px !important; + min-height: 450px !important; +} + +#left-content { + display: none; +} + +#right-content { + left: 0; +} diff --git a/sources/addons/jappixmini/jappix/css/archives.css b/sources/addons/jappixmini/jappix/css/archives.css new file mode 100644 index 00000000..5e60a8be --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/archives.css @@ -0,0 +1,93 @@ +/* + +Jappix - An open social platform +This is the archives CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 19/12/10 + +*/ + +#archives .content { + padding: 10px 0 10px 0; +} + +#archives .filter { + background-color: #e9f1fd; + border-right: 1px solid #9dc4fc; + width: 180px; + padding: 12px; + position: absolute; + top: 0; + left: 0; + bottom: 0; + float: left; + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; + -moz-border-radius-topleft: 4px; + -moz-border-radius-bottomleft: 4px; + -webkit-border-top-left-radius: 4px; + -webkit-border-bottom-left-radius: 4px; +} + +#archives .filter .friend { + margin-bottom: 12px; +} + +#archives .filter .friend { + height: 210px; + width: 180px; + float: none; +} + +#archives .current, +#archives .logs { + position: absolute; + bottom: 0; + right: 0; + left: 204px; +} + +#archives .current { + background-color: #e4eef9; + border-bottom: 1px solid #9dc4fc; + font-size: 0.9em; + height: 16px; + padding: 6px; + top: 0; +} + +#archives .current span { + height: 16px; + overflow: hidden; +} + +#archives .current .name { + max-width: 160px; + font-weight: bold; + float: left; +} + +#archives .current .time { + color: #47646a; + font-size: 0.95em; + float: right; +} + +#archives .logs { + color: black; + font-size: 0.9em; + overflow: auto; + padding: 8px 10px 0; + float: left; + position: absolute; + top: 29px; +} + +#archives .logs a { + color: black; + text-decoration: underline; +} diff --git a/sources/addons/jappixmini/jappix/css/board.css b/sources/addons/jappixmini/jappix/css/board.css new file mode 100644 index 00000000..91e6dcf9 --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/board.css @@ -0,0 +1,47 @@ +/* + +Jappix - An open social platform +This is the board CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 26/08/11 + +*/ + +#board .one-board { + display: none; + position: fixed; + top: 0; + left: 0; + right: 0; + height: 18px; + z-index: 10000; + font-size: 0.92em; + padding: 6px 8px; + box-shadow: 0 0 8px #5c5c5c; + -moz-box-shadow: 0 0 8px #5c5c5c; + -webkit-box-shadow: 0 0 8px #5c5c5c; +} + +#board .one-board:hover { + cursor: pointer; +} + +#board .one-board.visible { + display: block; +} + +#board .one-board.error { + background-color: rgb(241,160,160); + background-color: rgba(241,160,160,0.9); + color: #420c0c; +} + +#board .one-board.info { + background-color: rgb(248,246,186); + background-color: rgba(248,246,186,0.9); + color: #2f2a02; +} diff --git a/sources/addons/jappixmini/jappix/css/buddylist.css b/sources/addons/jappixmini/jappix/css/buddylist.css new file mode 100644 index 00000000..3bfa70cb --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/buddylist.css @@ -0,0 +1,530 @@ +/* + +Jappix - An open social platform +This is the buddy-list CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 31/08/11 + +*/ + +#buddy-list { + background-color: rgb(20,20,20); + background-color: rgba(20,20,20,0.85); + color: #919191; + padding: 15px 6px 4px 6px; + border-radius: 4px; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + box-shadow: 0 0 6px #5c5c5c; + -moz-box-shadow: 0 0 6px #5c5c5c; + -webkit-box-shadow: 0 0 6px #5c5c5c; +} + +#buddy-list .content { + background: #e8f1f3; + background: -moz-linear-gradient(top, #e8f1f3, #e4edef); + background: -webkit-gradient(linear, left top, left bottom, from(#e8f1f3), to(#e4edef)); + color: #666666; + height: 207px; + padding: 4px 4px 0 4px; + overflow-x: hidden; + overflow-y: auto; + border-top-left-radius: 3px; + border-top-right-radius: 3px; + -moz-border-radius-topleft: 3px; + -moz-border-radius-topright: 3px; + -webkit-border-top-left-radius: 3px; + -webkit-border-top-right-radius: 3px; +} + +#buddy-list .one-group { + margin-bottom: 10px; +} + +#buddy-list .one-group a.group { + color: #202c2f; + font-size: 0.8em; + margin: 3px 6px; + padding-left: 12px; + max-height: 15px; + text-decoration: none; + overflow: hidden; + display: block; +} + +#buddy-list .one-group a.group.plus { + background-position: -4px -1143px; +} + +#buddy-list .one-group a.group.minus { + background-position: -4px -1162px; +} + +#buddy-list .one-group a.group:hover { + cursor: pointer; +} + +#buddy-list .hidden-buddy, +#buddy-list .foot-edit-finish, +.buddy-conf-more-display-available { + display: none; +} + +#buddy-list .buddy { + width: 100%; + height: 50px; + margin-bottom: 4px; +} + +#buddy-list .buddy-click { + background: #d9e7ea; + width: 100%; + height: 100%; + overflow: hidden; + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; +} + +#buddy-list .buddy-click:hover, +#buddy-list .buddy-click:focus { + background: #cedee1; + cursor: pointer; +} + +#buddy-list .buddy-click:active { + background: #c3d3d7; +} + +#buddy-list .gateway { + height: 27px; +} + +#buddy-list .gateway .name { + margin-left: 0; +} + +#buddy-list .gateway .buddy-presence { + float: left; + overflow: hidden; + width: 0; + margin: 0 4px; +} + +#buddy-list .avatar-container { + float: left; + text-align: center; + margin: 3px; + width: 46px; + height: 46px; +} + +#buddy-list .avatar { + max-width: 44px; + max-height: 44px; +} + +#buddy-list .name { + margin: 4px 3px 5px 56px; +} + +#buddy-list .buddy-name { + height: 17px; + font-weight: bold; + font-size: 0.8em; + color: #264249; + margin: 5px 0 5px 2px; + overflow: hidden; +} + +#buddy-list .buddy.blocked p.buddy-name { + text-decoration: line-through; +} + +#buddy-list .buddy-presence { + height: 14px; + font-size: 0.7em; + color: #3a585e; + padding: 2px 0 0 16px; + margin-top: -3px; +} + +#buddy-list .unavailable, +#page-switch .unavailable, +#page-engine p.bc-infos span.show.unavailable { + background-position: 0 -153px; +} + +#buddy-list .available, +#page-engine p.bc-infos span.show.available, +#page-engine .list .available, +#page-engine .list .chat, +#page-switch .available, +#my-infos .f-presence a[data-value=available] span { + background-position: 0 -169px; +} + +#buddy-list .away, +#page-engine p.bc-infos span.show.away, +#page-engine .list .away, +#page-switch .away, +#my-infos .f-presence a[data-value=away] span { + background-position: 0 -185px; +} + +#buddy-list .busy, +#page-engine p.bc-infos span.show.busy, +#page-engine .list .xa, +#page-engine .list .dnd, +#page-switch .busy, +#my-infos .f-presence a[data-value=xa] span { + background-position: 0 -201px; +} + +#buddy-list .error, +#page-switch .error, +#page-engine p.bc-infos span.show.error { + background-position: 0 -217px; +} + +#buddy-list .buddy-infos { + position: absolute; + z-index: 100; + width: 337px; + color: white; + font-size: 0.8em; +} + +.buddy-infos-subarrow { + background-position: 0 -241px; + opacity: 0.8; + width: 9px; + height: 20px; + margin-top: 12px; + float: left; +} + +.buddy-infos-subitem { + background-color: rgb(0,0,0); + background-color: rgba(0,0,0,0.8); + padding: 8px 10px; + width: 308px; + text-shadow: 0 1px 1px black; + float: left; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; +} + +.manage-infos p.bm-authorize, +#rosterx .oneresult span.action.add { + background-position: 0 -1181px; +} + +.manage-infos p.bm-remove, +#rosterx .oneresult span.action.delete, +#attach div.one-file a.remove { + background-position: 0 -1200px; +} + +.manage-infos p.bm-remove { + margin-bottom: 18px; +} + +.manage-infos p.bm-rename { + background-position: 0 -1216px; +} + +.manage-infos p.bm-group { + background-position: 0 -1241px; +} + +.manage-infos div.bm-choose { + max-height: 95px; + margin: 0 0 8px 102px; + overflow: auto; +} + +.manage-infos div.bm-choose label { + float: left; + clear: both; + margin-bottom: 1px; +} + +.manage-infos div.bm-choose input { + float: left; +} + +.manage-infos div.bm-choose input[type=checkbox] { + margin: 0 6px 0 0; +} + +.manage-infos div.bm-choose div { + clear: both; +} + +.manage-infos p.bm-rename, +.manage-infos p.bm-group { + height: 26px; +} + +.manage-infos p.bm-rename label, +.manage-infos p.bm-group label { + width: 80px; + padding-top: 3px; + float: left; +} + +.manage-infos p.bm-rename input, +.manage-infos p.bm-group input { + float: left; + width: 155px; +} + +.manage-infos a.save { + float: right; + margin: 4px; +} + +.buddy-infos-subitem p { + margin: 6px 0; + padding-left: 22px; + height: 16px; + overflow: hidden; +} + +.buddy-infos-subitem a { + color: white; + text-decoration: underline; +} + +.tune-note { + background-position: 0 -676px; +} + +.location-world { + background-position: 0 -658px; +} + +.view-individual { + background-position: 0 -34px; +} + +.edit-buddy { + background-position: 0 -1008px; +} + +#buddy-list .filter { + background-color: white; + border-top: 1px solid #b8c2c4; + height: 15px; + padding: 2px 4px; + font-size: 0.8em; + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; + -moz-border-radius-bottomleft: 3px; + -moz-border-radius-bottomright: 3px; + -webkit-border-bottom-left-radius: 3px; + -webkit-border-bottom-right-radius: 3px; +} + +#buddy-list .filter input { + border: none; + color: #273a3f; + width: 211px; + padding: 0; + box-shadow: none; + -moz-box-shadow: none; + -webkit-box-shadow: none; +} + +#buddy-list .filter a { + display: none; + background-color: #9a2d2d; + color: white; + height: 13px; + width: 13px; + margin-top: 1px; + font-size: 0.8em; + text-align: center; + text-decoration: none; + float: right; + border-radius: 2px; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; +} + +#buddy-list .filter a:hover, +#buddy-list .filter a:focus { + background-color: #8c2121; +} + +#buddy-list .filter a:active { + background-color: #7e1919; +} + +#buddy-list .foot { + padding: 9px 1px 3px; +} + +#buddy-list .buddy-list-icon { + height: 16px; + width: 16px; + margin: -3px 5px 0 0; + float: left; +} + +#buddy-list .buddy-list-icon a.talk-images { + height: 16px; + width: 16px; + display: block; +} + +#buddy-list .add, +#page-engine .text .tools-add { + background-position: 0 -1047px; +} + +#buddy-list .join { + background-position: 0 -1065px; +} + +#buddy-list .groupchat, +#page-switch .groupchat-default { + background-position: 0 -1082px; +} + +#buddy-list .more { + background-position: 0 -1100px; +} + +#buddy-list .foot-edit-finish a { + color: white; + font-size: 0.8em; + margin: -3px 4px 0 0; + float: right; + display: block; +} + +#buddy-list .foot-edit-finish a:hover, +#buddy-list .foot-edit-finish a:focus { + text-decoration: underline; + cursor: pointer; +} + +.buddy-conf-item { + position: absolute; + width: 263px; + color: white; + z-index: 9998; + text-align: left; + font-size: 0.8em; + margin-left: -10px; +} + +.buddy-conf-item:hover { + cursor: default; +} + +.buddy-conf-subarrow { + background-position: 0 -241px; + opacity: 0.8; + height: 10px; + width: 18px; + margin-left: 9px; +} + +.buddy-conf-subitem { + background-color: rgb(0,0,0); + background-color: rgba(0,0,0,0.8); + padding: 10px; + text-shadow: 0 1px 1px black; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; +} + +.buddy-conf-p { + margin-bottom: 4px; + width: 220px; + font-weight: bold; + float: left; +} + +.buddy-conf-input { + padding-top: 2px; +} + +.buddy-conf-text { + font-size: 11px; + clear: both; + margin-bottom: 3px; +} + +.buddy-conf-text a { + color: white; +} + +.buddy-conf-text a:hover, +.buddy-conf-text a:focus { + cursor: pointer; + text-decoration: underline; +} + +.buddy-conf-text a.buddy-conf-add-search { + text-decoration: underline; + margin-top: 6px; + display: block; +} + +.buddy-conf-select { + font-size: 1.1em; + clear: both; + margin-bottom: 8px; + width: 180px; + height: 23px; +} + +.join-jid { + width: 220px; + margin-top: 5px; +} + +.add-contact-jid, +.add-contact-name, +.add-contact-gateway { + width: 156px; + margin-bottom: 4px; +} + +.add-contact-name-get { + font-size: 0.8em; + display: none; +} + +.buddy-conf-subitem label { + clear: both; +} + +.buddy-conf-subitem label span { + width: 76px; + height: 14px; + margin-top: 3px; + overflow: hidden; + float: left; +} + +#buddy-conf-join ul { + width: 224px; + max-height: 160px; + left: 10px; + top: 51px; +} + +.buddy-conf-join-select { + margin: 8px 0 0 0; +} diff --git a/sources/addons/jappixmini/jappix/css/channel.css b/sources/addons/jappixmini/jappix/css/channel.css new file mode 100644 index 00000000..671d25ea --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/channel.css @@ -0,0 +1,545 @@ +/* + +Jappix - An open social platform +This is the channel CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 26/08/11 + +*/ + +#channel .top div.update { + position: absolute; + top: 12px; + left: 115px; + right: 15px; + bottom: 15px; + border-radius: 20px; + -moz-border-radius: 20px; + -webkit-border-radius: 20px; +} + +#channel .top p { + font-size: 0.9em; + margin-bottom: 10px; +} + +#channel .top h2 { + font-size: 1.6em; + margin-bottom: 10px; + color: #232323; +} + +#channel .top a { + font-size: 0.9em; + color: #232323; +} + +#channel .top.individual div.update { + right: 36px; +} + +#channel .top.individual div.shortcuts, +#userinfos .main-infos div.shortcuts { + width: 16px; + float: right; +} + +#channel .top.individual div.shortcuts { + margin: 2px 5px 0 0; +} + +#channel .top.individual div.shortcuts a, +#userinfos .main-infos div.shortcuts a { + height: 16px; + width: 16px; + margin-bottom: 4px; + display: block; +} + +#channel .top.individual div.shortcuts a.message, +#userinfos .main-infos a.message { + background-position: 0 -1717px; +} + +#channel .top.individual div.shortcuts a.chat, +#userinfos .main-infos a.chat { + background-position: 0 -1737px; +} + +#channel .top.individual div.shortcuts a.command, +#userinfos .main-infos a.command { + background-position: 0 -1758px; +} + +#channel .microblog-body { + height: 20px; + margin-right: 50px; +} + +#channel .microblog-body input { + width: 100%; + height: 100%; + padding: 8px; +} + +#channel .one-microblog-icon { + position: absolute; + top: 38px; + right: 0; +} + +#channel div.update .one-microblog-icon, +#channel div.update .postit { + width: 16px; + height: 16px; + display: block; +} + +#channel div.update .attach { + background-position: 0 -79px; + display: none; +} + +#attach { + position: absolute; + width: 263px; + margin-left: -227px; + color: white; + font-size: 0.85em; + z-index: 9998; + text-align: left; + display: none; +} + +#attach p { + margin-bottom: 6px !important; +} + +#attach input[type=submit] { + margin: 8px 0 6px 0; +} + +#attach .wait { + float: right; + margin: 7px 5px; +} + +#attach div.one-file { + height: 16px; + margin-top: 2px; +} + +#attach div.one-file a.link { + color: white; + width: 215px; + height: 14px; + margin-left: 2px; + overflow: hidden; + float: left; +} + +#attach div.one-file a.remove { + width: 16px; + height: 16px; + float: left; +} + +.attach-subarrow { + background-position: 0 -241px; + opacity: 0.8; + height: 10px; + width: 18px; + margin-left: 226px; +} + +.attach-subitem { + background-color: rgb(0,0,0); + background-color: rgba(0,0,0,0.8); + padding: 10px; + text-shadow: 0 1px 1px black; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; +} + +.attach-p { + font-weight: bold; + float: left; +} + +#channel .one-update { + margin-bottom: 12px; + padding: 6px 6px 8px 6px; + border-bottom: 1px dotted #d0d0d0; + min-height: 50px; + color: black; + position: relative; + display: none; +} + +#channel .one-update .avatar-container { + text-align: center; + margin-right: 16px; + float: left; + height: 50px; + width: 50px; +} + +#channel .one-update .avatar-container:hover { + cursor: pointer; +} + +#channel .one-update img.avatar { + max-height: 50px; + max-width: 50px; +} + +#channel .one-update div.body { + margin-left: 65px; + opacity: 0.8; +} + +#channel .one-update:hover div.body { + opacity: 1; +} + +#channel .one-update a.repeat { + background-position: 0 -1681px; + height: 16px; + width: 16px; + margin-right: 4px; + float: left; +} + +#channel .one-update span a { + text-decoration: underline; +} + +#channel .one-update p { + display: block; + margin: 0 12px 5px 0; +} + +#channel .one-update p b.name:hover { + cursor: pointer; + text-decoration: underline; +} + +#channel .one-update p.infos { + font-size: 0.9em; +} + +#channel .one-update p.infos a.geoloc { + background-position: 0 -1778px; + color: #363636; + margin-left: 18px; + padding-left: 14px; +} + +#channel .one-update p.infos a.geoloc:hover, +#channel .one-update p.infos a.geoloc:focus, +#channel .one-update p.infos a.geoloc:active { + color: #141414; +} + +#channel .one-update p.file { + font-size: 0.9em; + margin: 6px 0 5px 10px; +} + +#channel .one-update p.file a.link, +#inbox .inbox-new-file a.file { + min-height: 16px; + padding-left: 22px; + text-decoration: underline; + display: block; +} + +#channel .one-update p.file a.link { + margin-top: 4px; +} + +#channel p.file a, +#inbox .inbox-new-file a.file { + background-position: 0 -988px; +} + +#channel p.file a.audio, +#inbox .inbox-new-file a.file.audio { + background-position: 0 -899px; +} + +#channel p.file a.image, +#inbox .inbox-new-file a.file.image { + background-position: 0 -917px; +} + +#channel p.file a.video, +#inbox .inbox-new-file a.file.video { + background-position: 0 -935px; +} + +#channel p.file a.document, +#inbox .inbox-new-file a.file.document { + background-position: 0 -953px; +} + +#channel p.file a.package, +#inbox .inbox-new-file a.file.package { + background-position: 0 -971px; +} + +#channel .one-update p.file a.thumb img { + border: 1px solid #a2a2a2; + max-width: 140px; + max-height: 105px; + margin: 4px 10px 2px 0; + padding: 1px; +} + +#channel .one-update p.file a.thumb img:hover { + border-color: #464646; +} + +#channel .one-update div.comments, +.popup.large div.comments { + width: 410px; + margin: 2px 0 2px 76px; +} + +#channel .one-update div.comments div.arrow, +.popup.large div.comments div.arrow { + background-position: 0 -1702px; + width: 20px; + height: 8px; + margin-left: 20px; + display: block; +} + +#channel .one-update div.comments div.comments-content, +.popup.large div.comments div.comments-content { + background-color: #e5ebec; + color: black; + font-size: 0.9em; + text-shadow: 0 1px 0 white; +} + +#channel .one-update div.comments input, +.popup.large div.comments input { + width: 356px; + margin: 6px 0; + padding: 4px 5px; +} + +#channel .one-update div.comments span.icon, +.popup.large div.comments span.icon { + background-position: 0 -1082px; + height: 16px; + width: 16px; + margin: 10px; + float: left; +} + +#channel .one-update div.comments .one-comment.loading span.icon, +.popup.large div.comments .one-comment.loading span.icon { + margin: 0 10px 0 0; +} + +#channel .one-update div.comments .one-comment, +.popup.large div.comments .one-comment { + border-bottom: 1px solid #f4f4f4; + padding: 4px 8px 0px 8px; + position: relative; + display: block; +} + +#channel .one-update div.comments .one-comment.compose, +.popup.large div.comments .one-comment.compose { + border-bottom: 2px solid #f4f4f4; + height: 36px; + padding: 0; +} + +#channel .one-update div.comments .one-comment.new, +.popup.large div.comments .one-comment.new { + display: none; +} + +#channel .one-update div.comments a.one-comment, +.popup.large div.comments a.one-comment { + text-decoration: none; +} + +#channel .one-update div.comments a.one-comment:hover, +#channel .one-update div.comments a.one-comment:focus, +.popup.large div.comments a.one-comment:hover, +.popup.large div.comments a.one-comment:focus { + text-decoration: underline; +} + +#channel .one-update div.comments .one-comment.loading, +.popup.large div.comments .one-comment.loading { + padding-bottom: 5px; +} + +#channel .one-update div.comments .one-comment div.marker, +.popup.large div.comments .one-comment div.marker { + background-color: #6d8387; + width: 2px; + position: absolute; + top: 0; + left: 0; + bottom: 0; +} + +#channel .one-update div.comments .one-comment .avatar-container, +.popup.large div.comments .one-comment .avatar-container { + text-align: center; + width: 30px; + height: 30px; + margin: 2px 8px 0 0; + float: left; +} + +#channel .one-update div.comments .one-comment .avatar-container:hover, +.popup.large div.comments .one-comment .avatar-container:hover { + cursor: pointer; +} + +#channel .one-update div.comments .one-comment img.avatar, +.popup.large div.comments .one-comment img.avatar { + max-height: 30px; + max-width: 30px; +} + +#channel .one-update div.comments .one-comment .comment-container, +.popup.large div.comments .one-comment .comment-container { + float: left; +} + +#channel .one-update div.comments .one-comment a.name, +.popup.large div.comments .one-comment a.name { + font-weight: bold; + text-decoration: none; + font-size: 0.95em; + padding-bottom: 2px; + float: left; +} + +#channel .one-update div.comments .one-comment a.name:hover, +#channel .one-update div.comments .one-comment a.name:focus, +.popup.large div.comments .one-comment a.name:hover, +.popup.large div.comments .one-comment a.name:focus { + text-decoration: underline; +} + +#channel .one-update div.comments .one-comment span.date, +#channel .one-update div.comments .one-comment a.remove, +.popup.large div.comments .one-comment span.date, +.popup.large div.comments .one-comment a.remove { + font-size: 0.85em; + float: right; +} + +#channel .one-update div.comments .one-comment.me:hover span.date, +.popup.large div.comments .one-comment.me:hover span.date { + display: none; +} + +#channel .one-update div.comments .one-comment.me a.remove, +.popup.large div.comments .one-comment.me a.remove { + display: none; +} + +#channel .one-update div.comments .one-comment.me:hover a.remove, +.popup.large div.comments .one-comment.me:hover a.remove { + display: block; +} + +#channel .one-update div.comments .one-comment p.body, +.popup.large div.comments .one-comment p.body { + clear: both; +} + +#channel a.more { + background-position: 0 -334px; + color: black; + height: 16px; + text-decoration: none; + margin: -2px 0 0 4px; + padding: 0 0 14px 20px; + display: block; + visibility: hidden; +} + +#channel a.more:hover, +#channel a.more:focus { + text-decoration: underline; +} + +#channel a.mbtool { + width: 11px; + height: 11px; + display: none; + position: absolute; + right: 0; +} + +#channel .one-update:hover a.mbtool { + display: block; +} + +#channel a.mbtool:hover, +#channel a.mbtool:focus { + text-decoration: none; +} + +#channel a.mbtool.profile { + background-position: -1px -1333px; + top: 24px; +} + +#channel a.mbtool.repost { + background-position: -1px -1354px; +} + +#channel a.mbtool.remove { + background-position: -1px -1312px; +} + +#channel a.mbtool.repost, +#channel a.mbtool.remove { + top: 6px; +} + +#channel .footer { + bottom: 0; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + -moz-border-radius-bottomleft: 4px; + -moz-border-radius-bottomright: 4px; + -webkit-border-bottom-left-radius: 4px; + -webkit-border-bottom-right-radius: 4px; +} + +#channel .footer div { + margin-left: 5px; + padding-left: 24px; + min-height: 16px; + font-size: 0.85em; + width: auto !important; +} + +#channel .footer .sync { + background-position: 0 -804px; + display: none; +} + +#channel .footer .unsync { + background-position: 0 -830px; + display: none; +} diff --git a/sources/addons/jappixmini/jappix/css/directory.css b/sources/addons/jappixmini/jappix/css/directory.css new file mode 100644 index 00000000..34b32312 --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/directory.css @@ -0,0 +1,16 @@ +/* + +Jappix - An open social platform +This is the directory tool CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 13/02/11 + +*/ + +#directory .content { + padding: 10px 0 10px 0; +} diff --git a/sources/addons/jappixmini/jappix/css/discovery.css b/sources/addons/jappixmini/jappix/css/discovery.css new file mode 100644 index 00000000..f66456b6 --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/discovery.css @@ -0,0 +1,61 @@ +/* + +Jappix - An open social platform +This is the discovery CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 13/02/11 + +*/ + +#discovery .content { + padding: 10px 0 10px 0; +} + +#discovery .content p { + margin: 5px 10px 5px 10px; + text-align: justify; + font-size: 0.85em; +} + +#discovery .discovery-head, +#directory .directory-head, +#rosterx .rosterx-head, +#privacy .privacy-head { + width: 606px; + height: 24px; + margin: 0 10px 10px 10px; + padding: 6px; + background: #f1f6fd; + border: 1px #9dc4fc solid; +} + +#discovery .disco-server-text, +#directory .directory-server-text { + float: left; + font-size: 0.9em; + margin: 3px; +} + +#discovery .disco-server-input, +#directory .directory-server-input { + float: right; + width: 200px; + padding: 2px; + height: 18px; + float: right; + margin-right: 10px; + padding: 2px; +} + +#discovery .disco-category { + display: none; + margin-bottom: 22px; +} + +#discovery .disco-category-title { + font-weight: bold; +} diff --git a/sources/addons/jappixmini/jappix/css/favorites.css b/sources/addons/jappixmini/jappix/css/favorites.css new file mode 100644 index 00000000..5d3fd51d --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/favorites.css @@ -0,0 +1,179 @@ +/* + +Jappix - An open social platform +This is the favorites CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 28/12/10 + +*/ + +#favorites .content { + padding: 10px 0 10px 0; +} + +#favorites .fedit-head-select { + min-width: 190px; + max-width: 210px; +} + +#favorites .switch-fav { + margin: 0 10px 0 10px; + width: 200px; + height: 355px; + border-right: 1px #c0c0c0 dotted; + float: left; +} + +#favorites .room-switcher { + width: 188px; + height: 18px; + border-bottom: 1px #9dc4fc solid; + float: left; + padding: 10px 6px; + font-size: 0.9em; +} + +#favorites .room-switcher:hover { + background-color: #e9f1fd; + cursor: pointer; +} + +#favorites .room-switcher:active { + background-color: #f1f6fd; +} + +#favorites .switch-fav .icon { + float: left; + height: 16px; + width: 16px; + margin: 0 8px 0 0; +} + +#favorites .switch-fav .room-list .list-icon { + background-position: 0 -855px; +} + +#favorites .switch-fav .room-search .search-icon { + background-position: 0 -876px; +} + +#favorites .static-fav { + width: 385px; + height: 335px; + margin: 0 10px 0 0; + padding: 10px; + float: right; +} + +#favorites .favorites-search { + display: none; +} + +#favorites .static-fav-head { + width: 393px; + margin: -10px; +} + +#favorites .static-fav-results { + width: 406px; + height: 314px; + margin: 10px -10px -10px -10px; + padding: 6px 0 0 0; +} + +#favorites .fedit-line { + height: 30px; + font-size: 0.9em; + padding: 10px 0 4px 4px; + border-bottom: 1px #9dc4fc solid; +} + +#favorites .fedit-line:hover { + background: #e9f1fd; +} + +#favorites label { + width: 140px; + margin-top: 3px; +} + +#favorites input { + height: 18px; + width: 186px; + margin-top: 0; + padding: 2px; +} + +#favorites .fedit-select { + min-width: 160px; +} + +#favorites .fedit-actions { + margin: 10px 0 0; + font-size: 0.9em; + float: right; +} + +#favorites input[type=checkbox] { + margin-top: 5px; +} + +#favorites .fedit-terminate { + float: right; +} + +#favorites .fedit-add { + display: block; +} + +#favorites .fedit-edit { + background-position: 2px -1240px; +} + +#favorites .fedit-remove { + margin: 0 8px 0 0; +} + +#favorites .add, +.popup .results .one-button.one-add { + background-position: 3px -1177px; +} + +#favorites .remove, +#inbox .remove { + background-position: 3px -1196px; +} + +#favorites .join, +#inbox .reply, +#inbox .send, +.popup .results .one-button.one-chat { + background-position: 3px -124px; +} + +#favorites .one-button, +#inbox .one-button, +.popup .results .one-button { + padding-left: 20px !important; + font-size: 0.98em; +} + +#favorites .fsearch-results { + overflow: auto; +} + +#favorites .room-name { + margin: 4px 2px 5px; + max-width: 210px; + float: left; +} + +#favorites .fsearch-noresults { + display: none; + font-size: 0.9em; + font-weight: bold; +} diff --git a/sources/addons/jappixmini/jappix/css/home.css b/sources/addons/jappixmini/jappix/css/home.css new file mode 100644 index 00000000..789ea4d9 --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/home.css @@ -0,0 +1,579 @@ +/* + +Jappix - An open social platform +This is the home CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 15/01/12 + +*/ + +#home { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + min-height: 550px; + min-width: 875px; +} + +#home .corporation, +#home .corporation .corp_network, +#home .locale, +#home .obsolete { + background-color: rgb(20,20,20); + background-color: rgba(20,20,20,0.70); + color: white; + position: absolute; + top: 0; + text-shadow: 0 0 1px black; + z-index: 100; + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; + -moz-border-radius-bottomleft: 3px; + -moz-border-radius-bottomright: 3px; + -webkit-border-bottom-left-radius: 3px; + -webkit-border-bottom-right-radius: 3px; +} + +#home .corporation { + background-position: 9px -357px; + left: 12px; + height: 26px; + width: 34px; +} + +#home .corporation.hovered { + height: 28px; + border-radius: 0; + -moz-border-radius: 0; + -webkit-border-radius: 0; +} + +#home .corporation .corp_network { + width: 180px; + padding: 10px 12px; + top: 28px; + display: none; + border-top-right-radius: 3px; + -moz-border-radius-topright: 3px; + -webkit-border-top-right-radius: 3px; +} + +#home .corporation.hovered .corp_network { + display: block; +} + +#home .corporation .corp_network h2 { + font-size: 1.1em; + margin: 14px 0 4px 0; +} + +#home .corporation .corp_network h2.nomargin { + margin-top: 0; +} + +#home .corporation .corp_network a { + font-size: 0.8em; + margin: 2px 0; + padding: 2px 6px; + border-radius: 2px; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; +} + +#home .corporation .corp_network a span { + margin: 2px 0; + display: block; +} + +#home .corporation .corp_network a span.name { + font-weight: bold; +} + +#home .corporation .corp_network a span.desc { + font-size: 0.9em; + margin-left: 2px; +} + +#home .locale { + left: 52px; + font-size: 0.8em; +} + +#home .locale .current { + height: 19px; + padding: 3px 12px 4px 12px; + font-weight: bold; +} + +#home .locale .current:hover { + cursor: default; +} + +#home .locale .current .current_align { + height: 19px; + vertical-align: middle; + display: table-cell; +} + +#home .locale .list { + margin: 2px 0 2px; +} + +#home .locale .list a, +#home .corporation .corp_network a { + color: white; + text-decoration: none; + display: block; +} + +#home .locale .list a { + padding: 3px 10px; +} + +#home .locale .list a:hover, +#home .locale .list a:focus, +#home .corporation .corp_network a:hover, +#home .corporation .corp_network a:focus { + background-color: rgb(255,255,255); + background-color: rgba(255,255,255,0.1); + cursor: pointer; +} + +#home .locale .list a:active, +#home .corporation .corp_network a:active { + background-color: rgb(255,255,255); + background-color: rgba(255,255,255,0.14); +} + +#home .obsolete { + height: 60px; + padding: 4px 10px; + right: 12px; + font-size: 0.9em; + font-weight: bold; + display: none; +} + +#home .obsolete a { + height: 33px; + width: 33px; + margin: 5px 2px 0 0; + float: left; +} + +#home .obsolete a:hover, +#home .obsolete a:focus { + opacity: 0.8; +} + +#home .obsolete a:active { + opacity: 0.6; +} + +#home .obsolete a.firefox { + background-position: 1px 0; +} + +#home .obsolete a.chrome { + background-position: -34px 0; +} + +#home .obsolete a.safari { + background-position: -68px 0; +} + +#home .obsolete a.opera { + background-position: -101px 0; +} + +#home .obsolete a.ie { + background-position: -135px 0; +} + +#home .plane { + background-position: 0 -384px; + width: 507px; + height: 328px; + position: absolute; + left: 0; + top: 60px; +} + +#home .main { + background-color: rgb(20,20,20); + background-color: rgba(20,20,20,0.85); + position: absolute; + top: 50%; + margin-top: -200px; + width: 800px; + height: 400px; + left: 50%; + margin-left: -400px; + z-index: 50; + border-radius: 10px; + -moz-border-radius: 10px; + -webkit-border-radius: 10px; + box-shadow: 0 0 35px #5c5c5c; + -moz-box-shadow: 0 0 35px #5c5c5c; + -webkit-box-shadow: 0 0 35px #5c5c5c; +} + +#home .left { + float: left; + width: 350px; + height: 370px; + margin: 15px 0 15px 15px; + color: white; + text-align: center; + text-shadow: 0 1px 1px black; +} + +#home .left .logo { + background-position: 0 0; + float: left; + margin: 30px 20px; + width: 311px; + height: 113px; +} + +#home .left p.upper { + margin: 12px 0 20px 0; +} + +#home .left p.secondary { + margin: 8px 0 0 16px; + font-size: 0.9em; + width: 320px; +} + +#home .right { + background: #e4eef9; + background: -moz-linear-gradient(top, #e4eef9, #C5E1FF); + background: -webkit-gradient(linear, left top, left bottom, from(#e4eef9), to(#C5E1FF)); + float: right; + width: 385px; + height: 350px; + margin: 15px 15px 15px 0; + padding: 10px; + font-size: 13px; + text-align: justify; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + box-shadow: 0 0 20px black; + -moz-box-shadow: 0 0 20px black; + -webkit-box-shadow: 0 0 20px black; +} + +#home .right h1 { + font-size: 16px; + padding-bottom: 4px; + border-bottom: 1px black dotted; +} + +#home .right p { + margin-bottom: 4px; +} + +#home .right p a { + border-width: 0 0 1px 0; + border-style: dotted; + border-color: black; +} + +#home .right p a:hover, +#home .right p a:focus { + border-style: solid; + text-decoration: none; +} + +#home .right button { + display: block; + margin-left: 22px; + width: 342px; + height: 64px; + text-decoration: none; + font-weight: bold; + border-radius: 4px; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; +} + +#home .right button:hover { + cursor: pointer; +} + +#home .right button span { + float: left; +} + +#home .right button span.home-images { + height: 16px; + width: 16px; + margin: 5px 7px 7px 24px; +} + +#home .right button span.text { + padding-left: 20px; + font-size: 1.5em; +} + +#home .right .login { + background-color: #72d071; + background-position: 0 0; + border: 1px solid #5cb55c; + margin-top: 22px; + box-shadow: 0 0 10px #89e389; + -moz-box-shadow: 0 0 10px #89e389; + -webkit-box-shadow: 0 0 10px #89e389; +} + +#home .right .login:hover, +#home .right .login:focus { + border: 1px solid #419141; + box-shadow: 0 0 15px #72d071; + -moz-box-shadow: 0 0 15px #72d071; + -webkit-box-shadow: 0 0 15px #72d071; +} + +#home .right .login:active { + background-color: #97e896; + background-position: 0 -80px; +} + +#home .right .login span.text { + color: #2d612d; + text-shadow: 1px 1px 1px #5cb55c; +} + +#home .right .login span.home-images { + background-position: 0 -230px; +} + +#home .right .register { + background-color: #f6ef82; + background-position: 0 -160px; + border: 1px solid #e3db56; + margin-top: 15px; + box-shadow: 0 0 15px #f1e968; + -moz-box-shadow: 0 0 15px #f1e968; + -webkit-box-shadow: 0 0 15px #f1e968; +} + +#home .right .register:hover, +#home .right .register:focus { + border: 1px solid #d2c93f; + box-shadow: 0 0 15px #e0d743; + -moz-box-shadow: 0 0 15px #e0d743; + -webkit-box-shadow: 0 0 15px #e0d743; +} + +#home .right .register:active { + background-color: #fdf7af; + background-position: 0 -240px; +} + +#home .right .register span.text { + color: #6d6813; + text-shadow: 1px 1px 1px #dbd56e; +} + +#home .right .register span.home-images { + background-position: 0 -204px; +} + +#home .right p.notice { + margin-top: 24px; + font-size: 0.9em; +} + +#home .right .navigation { + clear: both; + width: 385px; + border-top: 1px black dotted; + position: absolute; + text-align: right; + bottom: 25px; + right: 25px; + padding-top: 6px; +} + +#home .right .navigation a { + margin-left: 9px; + color: black; + text-decoration: none; + font-size: 0.9em; + height: 12px; + padding: 0 0 4px 20px; + float: right; +} + +#home .right .navigation a:hover, +#home .right .navigation a:focus { + text-decoration: underline; +} + +#home .right .navigation a.unencrypted { + background-position: 0 -256px; +} + +#home .right .navigation a.encrypted { + background-position: 0 -282px; +} + +#home .right .navigation a.project { + background-position: 0 -126px; +} + +#home .right .navigation a.manager { + background-position: 0 -152px; +} + +#home .right .navigation a.mobile { + background-position: 0 -178px; +} + +#home a.advanced { + background-position: 0 -334px; + font-size: 0.9em; + height: 16px; + margin-bottom: 10px; + padding-left: 16px; + display: block; +} + +#home fieldset.advanced { + display: none; +} + +#home .anonymouser input[type=text] { + width: 160px; +} + +#home .homediv.registerer .success a { + font-weight: bold; + text-decoration: underline; +} + +#home fieldset { + border: 1px solid black; + margin: 12px 0 12px 0; + padding: 5px 0 4px 0; + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; +} + +#home legend { + font-size: 0.9em; + margin: 0 0 0 15px; + padding: 0 2px; + text-transform: uppercase; +} + +#home label { + width: 110px; + display: block; + float: left; + clear: both; + margin: 0 0 5px 12px; +} + +#home input, +#home select { + float: left; + margin-bottom: 5px; +} + +#home input[type=text], +#home input[type=password], +#home select { + width: 140px; + margin-top: -2px; +} + +#home input[type=submit] { + min-width: 120px; + float: right; +} + +#home span.jid { + display: block; + float: left; + margin: 0 4px; +} + +#home input.nick, #home input.server { + width: 110px; +} + +#home .info { + padding: 6px; + position: absolute; + bottom: 62px; + right: 35px; + border-width: 1px; + border-style: dotted; + clear: both; + width: 350px; +} + +#home .info.success { + background-color: #aee578; + border-color: #85b05c; + display: none; +} + +#home .info.fail { + background-color: #f19d9d; + border-color: #b34f4f; +} + +#home .info.report { + background-color: #f3f48b; + border-color: #c9c66b; + display: none; +} + +#home .info.report span { + text-decoration: underline; +} + +#home .notice.simple { + background-color: rgb(20,20,20); + background-color: rgba(20,20,20,0.7); + color: white; + font-size: 0.9em; + text-decoration: none; + text-shadow: 0 1px 0 black; + position: fixed; + bottom: 0; + left: 0; + right: 0; + padding: 8px 20px; + z-index: 100; + box-shadow: 0 0 25px #ababab; + -moz-box-shadow: 0 0 25px #ababab; + -webkit-box-shadow: 0 0 25px #ababab; +} + +#home .notice.simple .title { + background-color: rgb(20,20,20); + background-color: rgba(20,20,20,0.4); + background-position: 8px -299px; + border-width: 0 1px 1px 1px; + border-style: solid; + border-color: #141414; + font-weight: bold; + padding: 8px 8px 8px 30px; +} + +#home .notice.simple .text { + margin-left: 20px; +} diff --git a/sources/addons/jappixmini/jappix/css/ie.css b/sources/addons/jappixmini/jappix/css/ie.css new file mode 100644 index 00000000..8808b50b --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/ie.css @@ -0,0 +1,146 @@ +/* + +Jappix - An open social platform +These are all the IE compliant CSS classes + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 22/04/11 + +*/ + +/* rgba(255,255,255,0.9) */ +.search ul { + background: transparent; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#edffffff,endColorstr=#edffffff); +} + +/* rgba(255,255,255,0.3) */ +a.finish:active, +#manager-buttons input:active, +#install-buttons input:active { + background: transparent; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#49ffffff,endColorstr=#49ffffff); +} + +/* rgba(255,255,255,0.2) */ +a.finish:hover, +a.finish:focus, +#manager-buttons input:hover, +#manager-buttons input:focus, +#install-buttons input:hover, +#install-buttons input:focus, +.notifications-content .one-notification:active { + background: transparent; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#33ffffff,endColorstr=#33ffffff); +} + +/* rgba(255,255,255,0.14) */ +#home .locale .list a:active { + background: transparent; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#2fffffff,endColorstr=#2fffffff); +} + +/* rgba(255,255,255,0.1) */ +#home .locale .list a:hover, +#home .locale .list a:focus, +a.finish, +a.finish.disabled:hover, +a.finish.disabled:focus, +a.finish.disabled:active, +#manager-buttons input, +#install-buttons input, +.notifications-content .one-notification:hover, +.notifications-content .one-notification:focus { + background: transparent; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#20ffffff,endColorstr=#20ffffff); +} + +/* rgba(255,239,104,0.8) */ +.popup .infos { + background: transparent; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#deffef68,endColorstr=#deffef68); +} + +/* rgba(225,160,20,0.3) */ +.search ul li.hovered { + background: transparent; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#46e1a014,endColorstr=#46e1a014); +} + +/* rgba(248,246,186,0.9) */ +#board .one-board.info { + background: transparent; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#edf8f6ba,endColorstr=#edf8f6ba); +} + +/* rgba(241,160,160,0.9) */ +#board .one-board.error { + background: transparent; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#edf1a0a0,endColorstr=#edf1a0a0); +} + +/* rgba(234,234,234,0.8) */ +#page-engine .chatstate { + background: transparent; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#deeaeaea,endColorstr=#deeaeaea); +} + +/* rgba(20,20,20,0.6) */ +#home .locale, +#home .obsolete, +#home .notice.simple { + background: transparent; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#a0141414,endColorstr=#a0141414); +} + +/* rgba(20,20,20,0.8) */ +#home .main, +#reconnect .pane, +#my-infos, +#right-content, +#buddy-list, +#manager, +#install { + background: transparent; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#de141414,endColorstr=#de141414); +} + +/* rgba(20,20,20,0.9) */ +.popup { + background: transparent; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ed141414,endColorstr=#ed141414); +} + +/* rgba(0,0,0,0.2) */ +#install-top .step { + background: transparent; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#33000000,endColorstr=#33000000); +} + +/* rgba(0,0,0,0.6) */ +.lock { + background: url(../img/others/lock.png) repeat !important; +} + +/* rgba(0,0,0,0.8) */ +#page-engine .tooltip-subitem, +.attach-subitem, +.buddy-infos-subitem, +.buddy-conf-subitem, +.tools-content-subitem { + background: transparent; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#de000000,endColorstr=#de000000); +} + +/* Fix a fieldset padding bug */ +legend { + margin-bottom: 5px !important; +} + +/* Fix an opacity bug */ +a.finish.disabled { + filter: alpha(opacity = 20) !important; +} diff --git a/sources/addons/jappixmini/jappix/css/images.css b/sources/addons/jappixmini/jappix/css/images.css new file mode 100644 index 00000000..2dfb756f --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/images.css @@ -0,0 +1,89 @@ +/* + +Jappix - An open social platform +This is the images CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 16/01/12 + +*/ + +.body-images { + background-image: url(../img/sprites/background.png); + background-repeat: repeat; + background-color: #93c5fa; +} + +.install-images { + background-image: url(../img/sprites/install.png); + background-repeat: no-repeat; +} + +.home-images { + background-image: url(../img/sprites/home.png); + background-repeat: no-repeat; +} + +.browsers-images { + background-image: url(../img/sprites/browsers.png); + background-repeat: no-repeat; +} + +.buttons-images { + background-image: url(../img/sprites/buttons.png); + background-repeat: repeat-x; +} + +.talk-images { + background-image: url(../img/sprites/talk.png); + background-repeat: no-repeat; +} + +.smileys-images { + background-image: url(../img/sprites/smileys.png); + background-repeat: no-repeat; +} + +.welcome-images { + background-image: url(../img/sprites/welcome.png); + background-repeat: no-repeat; +} + +.me-images { + background-image: url(../img/sprites/me.png); + background-repeat: no-repeat; +} + +.manager-images { + background-image: url(../img/sprites/manager.png); + background-repeat: no-repeat; +} + +.mobile-images { + background-image: url(../img/sprites/mobile.png); + background-repeat: no-repeat; +} + +.wait-small { + background-image: url(../img/wait/wait-small.gif); + background-repeat: no-repeat; + height: 16px; + width: 16px; +} + +.wait-medium { + background-image: url(../img/wait/wait-medium.png); + background-repeat: no-repeat; + height: 24px; + width: 24px; +} + +.wait-big { + background-image: url(../img/wait/wait-big.gif); + background-repeat: no-repeat; + height: 30px; + width: 30px; +} diff --git a/sources/addons/jappixmini/jappix/css/inbox.css b/sources/addons/jappixmini/jappix/css/inbox.css new file mode 100644 index 00000000..1ef05886 --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/inbox.css @@ -0,0 +1,202 @@ +/* + +Jappix - An open social platform +This is the inbox CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 28/12/10 + +*/ + +#inbox .content { + padding: 10px 0 10px 0; +} + +#inbox .content p { + margin: 3px 10px; + text-align: justify; + font-size: 0.9em; +} + +#inbox .inbox-results { + height: 310px; + width: 620px; + margin: -5px 0 0 10px; + padding: 6px 0 0 0; + overflow: auto; +} + +#inbox .message-unread { + background-color: #E9F1FD; +} + +#inbox .one-message { + font-size: 0.9em; + border-bottom: 1px #b2c7cb solid; +} + +#inbox .message-head { + padding: 6px 0 7px 4px; + overflow: hidden; +} + +#inbox .message-head:hover { + background-color: #e9f1fd; + cursor: pointer; +} + +#inbox .message-head:active { + background-color: #f1f6fd; +} + +#inbox .one-message.message-reading, +#inbox .one-message.message-reading .message-head { + background-color: #f1f6fd; +} + +#inbox .avatar-container { + float: left; + width: 40px; + height: 40px; + margin-right: 7px; + text-align: center; + background-repeat: no-repeat; +} + +#inbox .avatar { + max-width: 40px; + max-height: 40px; +} + +#inbox .message-jid, +#inbox .message-subject { + float: left; + margin: 0 2px; + overflow: hidden; +} + +#inbox .message-jid { + width: 165px; + font-weight: bold; +} + +#inbox .message-subject { + width: 355px; +} + +#inbox .message-truncated { + color: #42646b; + font-size: 0.8em; + margin: 23px 0 0 49px; +} + +#inbox .message-body { + padding: 8px 5px 5px 5px; +} + +#inbox .message-body a { + text-decoration: underline; +} + +#inbox .message-meta { + margin-top: 6px; + padding: 3px 4px; + border-top: 1px #b2c7cb dotted; +} + +#inbox .message-meta span.date { + color: #28474e; + font-size: 0.8em; + margin: 10px 0 0 4px; + float: left; +} + +#inbox .message-meta a { + font-size: 0.98em; + margin: 5px; + float: right; + display: block; +} + +#inbox .inbox-noresults { + font-weight: bold; + display: none; +} + +#inbox .a-show-messages { + display: none; +} + +#inbox .inbox-new { + display: none; + height: 300px; + width: 620px; + margin: -5px 0 0 10px; + padding: 16px 0 0 0; +} + +#inbox .inbox-new-block { + border-top: 1px #686868 dotted; + padding-top: 9px; + min-height: 32px; + clear: both; +} + +#inbox .inbox-new-text { + float: left; + width: 100px; +} + +#inbox .inbox-new-textarea { + width: 460px; + height: 109px; + margin-bottom: 10px; + float: left; +} + +#inbox .inbox-new input { + float: left; +} + +#inbox .inbox-new-to ul { + width: 264px; + max-height: 168px; + font-size: 0.9em; + left: 120px; + top: 31px; +} + +#inbox .inbox-new-to-input { + width: 260px; +} + +#inbox .inbox-new-subject-input { + width: 380px; +} + +#inbox .inbox-new-file a { + display: block; + float: left; +} + +#inbox .inbox-new-file a.file { + font-size: 0.85em; + height: 16px; + max-width: 320px; + margin: 3px 0 15px 013px; + overflow: hidden; +} + +#inbox .inbox-new-file a.one-button { + font-size: 0.85em; + margin: -2px 0 0 25px; +} + +#inbox .inbox-new-send a { + font-size: 0.85em; + float: right; + display: block; +} diff --git a/sources/addons/jappixmini/jappix/css/install.css b/sources/addons/jappixmini/jappix/css/install.css new file mode 100644 index 00000000..9dbde3fc --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/install.css @@ -0,0 +1,285 @@ +/* + +Jappix - An open social platform +This is the install CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 08/06/11 + +*/ + +body { + color: white; +} + +#install { + background-color: rgb(20,20,20); + background-color: rgba(20,20,20,0.85); + width: 800px; + margin: 35px auto; + padding-bottom: 17px; + border-radius: 6px; + -moz-border-radius: 6px; + -webkit-border-radius: 6px; + box-shadow: 0 0 35px #5c5c5c; + -moz-box-shadow: 0 0 35px #5c5c5c; + -webkit-box-shadow: 0 0 35px #5c5c5c; +} + +#install a { + color: black; + text-decoration: underline; +} + +#install .clear { + clear: both; +} + +#install fieldset { + border: 1px solid black; + margin: 22px 0 15px 0; + padding: 7px 2px 5px 2px; + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; +} + +#install legend { + font-size: 0.9em; + margin: 0 0 0 15px; + padding: 0 2px; + text-transform: uppercase; +} + +#install label { + width: 200px; + display: block; + float: left; + clear: both; + margin: 0 0 9px 12px; +} + +#install input { + float: left; + margin-bottom: 5px; +} + +#install input[type=text], +#install input[type=url], +#install input[type=password] { + margin-top: -2px; + padding: 3px; + font-size: 0.95em; + min-width: 220px; +} + +#install input.icon { + padding-left: 24px; + min-width: 199px; + max-height: 18px; +} + +#install input.icon#user_name { + background-position: 4px -204px; +} + +#install input.icon#user_password { + background-position: 4px -226px; +} + +#install input.icon#user_repassword { + background-position: 4px -248px; +} + +#install-top { + padding: 30px 45px; +} + +#install-top .logo { + background-position: 0 0; + min-width: 88px; + height: 36px; + padding: 32px 0 0 66px; + font-size: 32px; + color: white; + text-transform: lowercase; + float: left; + text-shadow: 0 1px 1px black; +} + +#install-top .step { + background-color: rgb(0,0,0); + background-color: rgba(0,0,0,0.2); + border: 2px solid white; + padding: 6px 21px; + font-size: 2.7em; + text-shadow: 0 1px 1px black; + float: right; + border-radius: 40px; + -moz-border-radius: 40px; + -webkit-border-radius: 40px; + box-shadow: 0 0 10px #202020; + -moz-box-shadow: 0 0 10px #202020; + -webkit-box-shadow: 0 0 10px #202020; +} + +#install-top .step span { + font-size: 0.6em; +} + +#install-content { + background: #e4eef9; + background: -moz-linear-gradient(top, #e4eef9, #d0e5fa); + background: -webkit-gradient(linear, left top, left bottom, from(#e4eef9), to(#d0e5fa)); + color: black; + font-size: 0.9em; + margin: 0 10px; + padding: 20px 24px; + min-height: 260px; + clear: both; + right: 10px; + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + box-shadow: 0 0 20px #202020; + -moz-box-shadow: 0 0 20px #202020; + -webkit-box-shadow: 0 0 20px #202020; +} + +#install-content h3 { + padding-left: 24px; + margin-bottom: 15px; +} + +#install-content h3.start { + background-position: 0 -73px; +} + +#install-content h3.storage { + background-position: 0 -95px; +} + +#install-content h3.account { + background-position: 0 -117px; +} + +#install-content h3.main { + background-position: 0 -139px; +} + +#install-content h3.hosts { + background-position: 0 -161px; +} + +#install-content h3.services { + background-position: 0 -183px; +} + +#install-content p { + margin-bottom: 10px; +} + +#install-content .info { + color: black; + border-width: 1px; + border-style: dashed; + padding: 6px 8px; + display: block; + text-decoration: none; +} + +#install-content .info.smallspace { + margin: 14px 0 10px 0; +} + +#install-content .info.bigspace { + margin: 35px 0 20px 0; +} + +#install-content .info.first { + margin-top: 28px; +} + +#install-content .info.last { + margin-bottom: 28px; +} + +#install-content .info.neutral { + background-color: #f0f19d; + border-color: #b3ad4f; +} + +#install-content a.info.neutral:hover, +#install-content a.info.neutral:focus { + background-color: #eced96; +} + +#install-content a.info.neutral:active { + background-color: #e9ea93; +} + +#install-content .info.success { + background-color: #a8dca9; + border-color: #5e9f5f; +} + +#install-content a.info.success:hover, +#install-content a.info.success:focus { + background-color: #a0d5a1; +} + +#install-content a.info.success:active { + background-color: #9ad09b; +} + +#install-content .info.fail { + background-color: #f19d9d; + border-color: #b34f4f; +} + +#install-content ol { + margin: 20px 30px; +} + +#install-content ol li { + margin-bottom: 1px; +} + +#install-buttons { + margin-top: 22px; +} + +#install-buttons input { + border: 1px solid white; + background-color: rgb(255,255,255); + background-color: rgba(255,255,255,0.1); + color: white; + padding: 4px 8px; + margin-right: 20px; + text-shadow: 0 1px 1px black; + float: right; + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + box-shadow: 0 0 5px #202020; + -moz-box-shadow: 0 0 5px #202020; + -webkit-box-shadow: 0 0 5px #202020; +} + +#install-buttons input:hover, +#install-buttons input:focus { + cursor: pointer; + background-color: rgb(255,255,255); + background-color: rgba(255,255,255,0.2); + box-shadow: 0 0 15px #202020; + -moz-box-shadow: 0 0 15px #202020; + -webkit-box-shadow: 0 0 15px #202020; +} + +#install-buttons input:active { + background-color: rgb(255,255,255); + background-color: rgba(255,255,255,0.3); +} diff --git a/sources/addons/jappixmini/jappix/css/integratebox.css b/sources/addons/jappixmini/jappix/css/integratebox.css new file mode 100644 index 00000000..b5cb9c9f --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/integratebox.css @@ -0,0 +1,34 @@ +/* + +Jappix - An open social platform +This is the integratebox CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 06/11/10 + +*/ + +#integratebox .top { + height: 40px; +} + +#integratebox .content { + text-align: center; + height: 385px; +} + +#integratebox .one-media img { + max-height: 385px; + max-width: 640px; +} + +#integratebox .one-media a img { + border: none; +} + +#integratebox .one-media audio { + margin-top: 170px; +} diff --git a/sources/addons/jappixmini/jappix/css/jquery.datepicker.css b/sources/addons/jappixmini/jappix/css/jquery.datepicker.css new file mode 100644 index 00000000..264cd544 --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/jquery.datepicker.css @@ -0,0 +1,148 @@ +/* + +Jappix - An open social platform +This is the datepicker CSS stylesheet + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 28/12/10 + +*/ + +div.datepicker { + position: relative; + font-family: Arial, Helvetica, sans-serif; + font-size: 12px; + width: 196px; + height: 147px; + position: absolute; + cursor: default; + top: 0; + left: 0; + display: none; +} + +.datepickerHidden { + display: none; +} + +div.datepicker table { + border-collapse:collapse; +} + +div.datepicker a { + text-decoration: none; + cursor: default; + outline: none; +} + +div.datepicker table td { + text-align: right; + padding: 0; + margin: 0; +} + +div.datepicker th { + text-align: center; + color: #47646a; + font-weight: normal; +} + +div.datepicker tbody th { + text-align: left; +} + +div.datepicker tbody a { + display: block; +} + +.datepickerDays a { + width: 20px; + line-height: 16px; + height: 16px; + padding-right: 2px; +} + +.datepickerYears a, +.datepickerMonths a { + width: 44px; + line-height: 36px; + height: 36px; + text-align: center; +} + +td.datepickerNotInMonth { + background: #c7d1d4; +} + +tbody.datepickerDays td.datepickerSelected { + background: #b0bdc1; +} + +tbody.datepickerYears td.datepickerSelected, +tbody.datepickerMonths td.datepickerSelected { + background: #9daaae; +} + +div.datepicker a:hover, +div.datepicker a:focus { + color: #3d7682; +} + +div.datepicker tbody th { + text-align: left; +} + +.datepickerSpace div { + width: 20px; +} + +.datepickerGoNext a, +.datepickerGoPrev a, +.datepickerMonth a { + text-align: center; + height: 20px; + line-height: 20px; +} + +.datepickerGoNext a { + float: right; + width: 20px; +} + +.datepickerGoPrev a { + float: left; + width: 20px; +} + +table.datepickerViewDays tbody.datepickerMonths, +table.datepickerViewDays tbody.datepickerYears { + display: none; +} + +table.datepickerViewMonths tbody.datepickerDays, +table.datepickerViewMonths tbody.datepickerYears, +table.datepickerViewMonths tr.datepickerDoW { + display: none; +} + +table.datepickerViewYears tbody.datepickerDays, +table.datepickerViewYears tbody.datepickerMonths, +table.datepickerViewYears tr.datepickerDoW { + display: none; +} + +td.datepickerDisabled a, +td.datepickerDisabled.datepickerNotInMonth a { + color: #333; +} + +td.datepickerSpecial a { + background: #700; +} + +td.datepickerSpecial.datepickerSelected a { + background: #a00; +} diff --git a/sources/addons/jappixmini/jappix/css/main.css b/sources/addons/jappixmini/jappix/css/main.css new file mode 100644 index 00000000..68254814 --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/main.css @@ -0,0 +1,131 @@ +/* + +Jappix - An open social platform +This is the main CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 05/10/11 + +*/ + +* { + margin: 0; + padding: 0; +} + +body { + font: normal 14.4px Helvetica, Verdana, sans-serif; + text-shadow: 0 0 5px white; +} + +h1 { + margin-bottom: 15px; +} + +a { + text-decoration: none; + color: black; + outline-style: none; +} + +a:hover, +a:focus { + cursor: pointer; + text-decoration: underline; +} + +legend { + color: black; +} + +input, +textarea { + background-color: white; + border: 1px solid #636363; + font-size: 0.95em; + padding: 2px; + border-radius: 2px; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; + box-shadow: inset 0 3px 10px #dcdcdc; + -moz-box-shadow: inset 0 3px 10px #dcdcdc; + -webkit-box-shadow: inset 0 3px 10px #dcdcdc; +} + +textarea { + font-size: 1.1em; +} + +input:focus, +input[type=submit]:hover, +input[type=reset]:hover, +textarea:focus { + border: 1px solid #e1a014; + box-shadow: inset 0 3px 10px #edd9bc; + -moz-box-shadow: inset 0 3px 10px #edd9bc; + -webkit-box-shadow: inset 0 3px 10px #edd9bc; +} + +input[type=submit], +input[type=reset] { + cursor: pointer; +} + +input[type=submit]:active, +input[type=reset]:active { + box-shadow: inset 0 3px 15px #e1a753; + -moz-box-shadow: inset 0 3px 15px #e1a753; + -webkit-box-shadow: inset 0 3px 15px #e1a753; +} + +input[disabled], +textarea[disabled] { + background-color: #f3f3f3; + border: 1px solid #989898; +} + +input:placeholder { + color: #67787c !important; +} + +input:-moz-placeholder { + color: #67787c !important; +} + +input::-webkit-input-placeholder { + color: #67787c !important; +} + +input.placeholder { + color: #67787c !important; +} + +input[type=checkbox] { + margin-top: 2px; +} + +input[type=checkbox], +input[type=radio] { + background: transparent none !important; + border: 0 none !important; +} + +.please-complete, +.please-complete:hover, +.please-complete:focus { + border: 1px #ac2525 solid !important; + box-shadow: inset 0 3px 10px #f39c9c !important; + -moz-box-shadow: inset 0 3px 10px #f39c9c !important; + -webkit-box-shadow: inset 0 3px 10px #f39c9c !important; +} + +.hidden { + display: none !important; +} + +.clear { + clear: both !important; +} diff --git a/sources/addons/jappixmini/jappix/css/manager.css b/sources/addons/jappixmini/jappix/css/manager.css new file mode 100644 index 00000000..c1dd358c --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/manager.css @@ -0,0 +1,543 @@ +/* + +Jappix - An open social platform +This is the manager CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 31/08/11 + +*/ + +#manager { + background-color: rgb(20,20,20); + background-color: rgba(20,20,20,0.85); + width: 945px; + margin: 0 auto 25px; + padding-bottom: 17px; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + -moz-border-radius-bottomleft: 4px; + -moz-border-radius-bottomright: 4px; + -webkit-border-bottom-left-radius: 4px; + -webkit-border-bottom-right-radius: 4px; + box-shadow: 0 0 35px #5c5c5c; + -moz-box-shadow: 0 0 35px #5c5c5c; + -webkit-box-shadow: 0 0 35px #5c5c5c; +} + +#manager a { + color: black; + text-decoration: underline; +} + +#manager .clear { + clear: both; +} + +#manager fieldset { + border: 1px solid black; + margin: 22px 0 15px 0; + padding: 7px 2px 5px 2px; + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; +} + +#manager legend { + font-size: 0.9em; + margin: 0 0 0 15px; + padding: 0 2px; + text-transform: uppercase; +} + +#manager label { + width: 200px; + display: block; + float: left; + clear: both; + margin: 0 0 9px 12px; +} + +#manager label.master { + text-decoration: underline; +} + +#manager input, +#manager select { + float: left; + margin-bottom: 5px; +} + +#manager input[type=radio] { + margin: 2px 8px 5px 0; +} + +#manager input[type=text], +#manager input[type=url], +#manager input[type=password], +#manager select { + margin-top: -2px; + font-size: 0.95em; +} + +#manager input[type=text], +#manager input[type=url], +#manager input[type=password] { + padding: 3px; + min-width: 220px; +} + +#manager input.icon { + padding-left: 24px; + min-width: 199px; + max-height: 18px; +} + +#manager input.icon#admin_name { + background-position: 4px -510px; +} + +#manager input.icon#admin_password, +#manager input.icon#user_repassword { + background-position: 4px -532px; +} + +#manager input.icon#user_name, +#manager input.icon#music_artist { + background-position: 4px -554px; +} + +#manager input.icon#user_password { + background-position: 4px -576px; +} + +#manager input.icon#music_title { + background-position: 4px -598px; +} + +#manager input.icon#music_album { + background-position: 4px -620px; +} + +#manager input.icon#background_image_color, +#manager input.icon#background_color_color { + background-position: 4px -641px; +} + +#manager select { + min-width: 160px; + max-width: 230px; +} + +#manager-top { + padding: 25px 45px 30px; +} + +#manager-top .logo { + background-position: 0 0; + min-width: 89px; + height: 40px; + padding: 28px 0 0 65px; + font-size: 32px; + color: white; + text-transform: lowercase; + float: left; + text-shadow: 0 1px 1px black; +} + +#manager-top .meta { + background-color: #e0eaec; + font-size: 0.9em; + padding: 12px 7px 12px 14px; + float: right; + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + box-shadow: 0 0 10px #202020; + -moz-box-shadow: 0 0 10px #202020; + -webkit-box-shadow: 0 0 10px #202020; +} + +#manager-top .meta span { + margin-right: 10px; + color: black; +} + +#manager-top .meta a { + background-color: #f1f6fd; + border: 1px solid #b9cbcf; + color: #224249; + padding: 4px 8px 4px 21px; + margin-left: 2px; + text-decoration: none; + border-radius: 2px; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; +} + +#manager-top .meta a:hover, +#manager-top .meta a:focus { + border: 1px solid #95b1b7; +} + +#manager-top .meta a:active { + border: 1px solid #77989f; +} + +#manager-top .meta a.logout { + background-position: 3px -69px; +} + +#manager-top .meta a.close { + background-position: 3px -90px; +} + +#manager-tabs { + margin-left: 12px; +} + +#manager-tabs a { + background-color: #d9e7ea; + color: #204249; + width: 107px; + height: 17px; + padding: 4px 4px 4px 16px; + margin-left: 4px; + font-size: 0.94em; + text-decoration: none; + overflow: hidden; + float: left; + border-top-right-radius: 3px; + border-top-left-radius: 3px; + -moz-border-radius-topright: 3px; + -moz-border-radius-topleft: 3px; + -webkit-border-top-right-radius: 3px; + -webkit-border-top-left-radius: 3px; +} + +#manager-tabs a:hover, +#manager-tabs a:focus { + background-color: #cedee1; + text-decoration: none; +} + +#manager-tabs a:active { + background-color: #c3d3d7; + text-decoration: none; +} + +#manager-tabs a.tab-active { + background-color: #e4eef9 !important; +} + +#manager-content { + background: #e4eef9; + background: -moz-linear-gradient(top, #e4eef9, #d0e5fa); + background: -webkit-gradient(linear, left top, left bottom, from(#e4eef9), to(#d0e5fa)); + color: black; + font-size: 0.9em; + margin: 0 10px; + padding: 20px 24px; + min-height: 260px; + clear: both; + right: 10px; + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + box-shadow: 0 0 20px #202020; + -moz-box-shadow: 0 0 20px #202020; + -webkit-box-shadow: 0 0 20px #202020; +} + +#manager-content h3 { + padding-left: 24px; + margin-bottom: 15px; +} + +#manager-content h3.login { + background-position: 0 -466px; +} + +#manager-content h3.statistics { + background-position: 0 -203px; +} + +#manager-content h3.configuration { + background-position: 0 -224px; +} + +#manager-content h3.hosts { + background-position: 0 -246px; +} + +#manager-content h3.storage { + background-position: 0 -268px; +} + +#manager-content h3.design { + background-position: 0 -290px; +} + +#manager-content h3.users { + background-position: 0 -312px; +} + +#manager-content h3.updates { + background-position: 0 -334px; +} + +#manager-content h4 { + border-top: 1px dotted black; + padding-top: 5px; + margin: 20px 0 14px; + clear: both; +} + +#manager-content ul, +#manager-content ol { + width: 380px; + margin: 8px 0 20px 18px; +} + +#manager-content li { + margin-bottom: 3px; +} + +#manager-content li.total { + margin-bottom: 14px; +} + +#manager-content li b { + width: 190px; + float: left; +} + +#manager-content li span { + margin-left: 10px; + float: left; +} + +#manager-content ul.stats, +#manager-content ol.stats { + float: left; +} + +#manager-content object.stats { + border: 1px dotted #bed4d9; + width: 450px; + height: 270px; + margin-bottom: 20px; + float: right; +} + +#manager-content p, +#manager-content div { + margin-bottom: 10px; +} + +#manager-content .info { + color: black; + border-width: 1px; + border-style: dashed; + padding: 6px 8px; + display: block; + text-decoration: none; +} + +#manager-content .info.bottomspace { + margin-bottom: 16px; +} + +#manager-content .info.smallspace { + margin: 14px 0 10px 0; +} + +#manager-content .info.bigspace { + margin: 35px 0 20px 0; +} + +#manager-content .info.neutral { + background-color: #f0f19d; + border-color: #b3ad4f; +} + +#manager-content a.info.neutral:hover, +#manager-content a.info.neutral:focus { + background-color: #eced96; +} + +#manager-content a.info.neutral:active { + background-color: #e9ea93; +} + +#manager-content .info.success { + background-color: #a8dca9; + border-color: #5e9f5f; +} + +#manager-content a.info.success:hover, +#manager-content a.info.success:focus { + background-color: #a0d5a1; +} + +#manager-content a.info.success:active { + background-color: #9ad09b; +} + +#manager-content .info.fail { + background-color: #f19d9d; + border-color: #b34f4f; +} + +#manager-content a.info.fail:hover, +#manager-content a.info.fail:focus { + background-color: #ea9595; +} + +#manager-content a.info.fail:active { + background-color: #e59090; +} + +#manager-content .browse { + margin: 2px 0 6px; + max-height: 243px; + overflow: auto; +} + +#manager-content .browse .one-browse { + padding: 5px 10px 5px 34px; + height: 17px; +} + +#manager-content .browse .user { + background-position: 9px -111px; +} + +#manager-content .browse .other { + background-position: 9px -133px; +} + +#manager-content .browse .folder { + background-position: 9px -178px; +} + +#manager-content .browse .audio { + background-position: 9px -154px; +} + +#manager-content .browse .alert { + background-position: 9px -353px; +} + +#manager-content .browse .image { + background-position: 9px -374px; +} + +#manager-content .browse .video { + background-position: 9px -397px; +} + +#manager-content .browse .document { + background-position: 9px -418px; +} + +#manager-content .browse .package { + background-position: 9px -441px; +} + +#manager-content .browse .previous { + background-position: 9px -485px; + margin-bottom: 4px; +} + +#manager-content .browse div { + margin: 0; +} + +#manager-content .browse input { + float: right; + margin: 1px 0; +} + +#manager-content .browse .odd { + background-color: #e9f1fd; +} + +#manager-content .browse .even { + background-color: #f1f6fd; +} + +#manager-content .sub { + border-left: 1px solid black; + margin: 5px 0 20px 22px; + padding-left: 12px; + clear: both; +} + +#manager span.logo_links a { + width: 16px; + height: 16px; + margin-right: 6px; + float: left; +} + +#manager span.logo_links a.remove { + background-position: 0 -688px; +} + +#manager span.logo_links a.view { + background-position: 0 -666px; +} + +#manager-content .clear { + margin: 0; +} + +#manager-content textarea.notice-text { + height: 70px; + width: 600px; + margin-left: 4px; + padding: 5px; + font-size: 1.2em; +} + +#manager-buttons { + margin-top: 22px; +} + +#manager-buttons input { + border: 1px solid white; + background-color: rgb(255,255,255); + background-color: rgba(255,255,255,0.1); + color: white; + padding: 4px 8px; + margin-left: -12px; + margin-right: 20px; + font-size: 1em; + text-shadow: 0 1px 1px black; + float: right; + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + box-shadow: 0 0 5px #202020; + -moz-box-shadow: 0 0 5px #202020; + -webkit-box-shadow: 0 0 5px #202020; +} + +#manager-buttons input:hover, +#manager-buttons input:focus { + cursor: pointer; + background-color: rgb(255,255,255); + background-color: rgba(255,255,255,0.2); + box-shadow: 0 0 15px #202020; + -moz-box-shadow: 0 0 15px #202020; + -webkit-box-shadow: 0 0 15px #202020; +} + +#manager-buttons input:active { + background-color: rgb(255,255,255); + background-color: rgba(255,255,255,0.3); +} diff --git a/sources/addons/jappixmini/jappix/css/me.css b/sources/addons/jappixmini/jappix/css/me.css new file mode 100644 index 00000000..2ff74fbd --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/me.css @@ -0,0 +1,49 @@ +/* + +Jappix - An open social platform +This is the Jappix Me tool CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 16/01/12 + +*/ + +#me .content { + padding: 10px 0; +} + +#me .logo { + background-position: 0 0; + width: 300px; + height: 61px; + margin: 20px auto 0 auto; + display: block; +} + +#me .infos { + margin-top: 30px; +} + +#me .infos p { + margin-top: 8px; +} + +#me .infos p.infos-title { + margin-top: 0; +} + +#me .infos a { + text-decoration: underline; +} + +#me a.go { + text-align: center; + font-weight: bold; + width: 300px; + margin: 30px auto 0 auto; + padding: 8px 12px; + display: block; +} \ No newline at end of file diff --git a/sources/addons/jappixmini/jappix/css/mini-ie.css b/sources/addons/jappixmini/jappix/css/mini-ie.css new file mode 100644 index 00000000..d8f4b908 --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/mini-ie.css @@ -0,0 +1,73 @@ +/* + +Jappix - An open social platform +This is the Jappix Mini legacy IE CSS stylesheet + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 20/03/11 + +*/ + +#jappix_mini { + width: expression(document.documentElement.clientWidth - 150 + 'px') !important; + position: absolute !important; + bottom: auto !important; + right: auto !important; + top: expression(((document.documentElement.clientHeight - this.offsetHeight) + (ignoreMiniTop = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop)) + 'px') !important; + left: expression((150 + this.offsetWidth - (document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth) + (ignoreMiniLeft = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft)) + 'px') !important; +} + +#jappix_mini .jm_images { + background-image: url(../img/sprites/mini.gif) !important; +} + +#jappix_mini .jm_images_animate { + background-image: url(../img/sprites/animate.gif) !important; +} + +#jappix_mini a.jm_button { + width: 1px !important; +} + +#jappix_mini div.jm_roster { + right: -1px !important; + bottom: 23px !important; +} + +#jappix_mini div.jm_roster div.jm_buddies { + height: expression(this.scrollHeight > (document.documentElement.clientHeight - 70) ? (document.documentElement.clientHeight - 70) + 'px' : 'auto') !important; +} + +#jappix_mini a.jm_pane { + height: 12px !important; + overflow-y: hidden !important; +} + +#jappix_mini a.jm_button.jm_clicked { + background-image: none !important; +} + +#jappix_mini div.jm_conversations a.jm_clicked { + border-right: none !important; + padding: 7px 6px 6px 6px !important; +} + +#jappix_mini div.jm_chat-content { + bottom: 23px !important; + right: -2px !important; +} + +#jappix_popup { + height: expression(document.documentElement.clientHeight + 'px') !important; + width: expression(document.documentElement.clientWidth + 'px') !important; + position: absolute !important; + top: expression(((ignorePopupTop = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop)) + 'px') !important; + left: expression(((ignorePopupLeft = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft)) + 'px') !important; +} + +#jappix_popup div.jm_prompt { + position: absolute !important; +} diff --git a/sources/addons/jappixmini/jappix/css/mini.css b/sources/addons/jappixmini/jappix/css/mini.css new file mode 100644 index 00000000..7ad6058b --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/mini.css @@ -0,0 +1,540 @@ +/* + +Jappix - An open social platform +This is the Jappix Mini CSS stylesheet + +------------------------------------------------- + +License: AGPL +Authors: Vanaryon, Julien +Last revision: 16/01/12 + +*/ + +#jappix_mini, +#jappix_popup { + font: normal 11px helvetica, "Lucida Grande", "Lucida Sans", "Lucida Sans Unicode", Arial, sans-serif; +} + +#jappix_mini { + margin-left: 130px; + position: fixed; + bottom: 0; + right: 20px; + z-index: 999; +} + +#jappix_mini *, +#jappix_popup * { + border: none; + color: black; + width: auto; + height: auto; + margin: 0; + padding: 0; + overflow: visible; + font-size: 11px; + text-align: left; + text-transform: none; + text-shadow: none; + opacity: 1.0; + border-radius: 0; + -moz-border-radius: 0; + -webkit-border-radius: 0; + box-shadow: none; + -moz-box-shadow: none; + -webkit-box-shadow: none; +} + +#jappix_mini .jm_images { + background-image: url(../img/sprites/mini.png); + background-repeat: no-repeat; +} + +#jappix_mini .jm_images_animate { + background-image: url(../img/sprites/animate.png); + background-repeat: no-repeat; +} + +#jappix_mini a { + text-decoration: none; + cursor: pointer; +} + +#jappix_mini a:hover { + cursor: pointer; +} + +#jappix_mini div.jm_position { + float: right; +} + +#jappix_mini a.jm_pane { + background-color: #f4f4f4; + background-position: 0 -100px; + background-repeat: repeat-x; + border-color: #999999; + border-style: solid; + border-width: 1px 1px 0 1px; + font-weight: bold; + outline-style: none; + display: block; + padding: 6px; + height: 24px; +} + +#jappix_mini a.jm_pane:hover { + background: white; +} + +#jappix_mini a.jm_pane:hover, +#jappix_mini a.jm_pane:focus { + border-color: #666666; +} + +#jappix_mini div.jm_starter, +#jappix_mini div.jm_conversations, +#jappix_mini div.jm_conversation { + float: left; + position: relative; +} + +#jappix_mini div.jm_conversation { + width: 153px; +} + +#jappix_mini a.jm_chat-tab { + border-width: 1px 0 0 1px; + width: 140px; + float: right; + overflow: hidden; +} + +#jappix_mini a.jm_chat-tab.jm_clicked { + background: white; + position: relative; + border-top: none; + border-left: 1px solid #999999; + padding-top: 7px; +} + +#jappix_mini a.jm_chat-tab span.jm_notify { + position: absolute; + top: 6px; + right: 9px; +} + +#jappix_mini a.jm_chat-tab span.jm_notify span { + float: left; +} + +#jappix_mini a.jm_chat-tab span.jm_notify span.jm_notify_left { + background-position: 0 -360px; +} + +#jappix_mini a.jm_chat-tab span.jm_notify span.jm_notify_right { + background-position: -7px -360px; +} + +#jappix_mini a.jm_chat-tab span.jm_notify span.jm_notify_left, +#jappix_mini a.jm_chat-tab span.jm_notify span.jm_notify_right { + height: 16px; + width: 7px; +} + +#jappix_mini a.jm_chat-tab span.jm_notify span.jm_notify_middle { + background-color: #c60505; + color: white; + font-size: 0.85em; + height: 14px; + padding-top: 2px; +} + +#jappix_mini div.jm_conversation.jm_type_groupchat span.jm_name { + margin-left: 4px; +} + +#jappix_mini div.jm_chat-content { + background-color: white; + border: 1px solid #999999; + height: 300px; + width: 260px; + position: absolute; + right: -1px; + bottom: 25px; + display: none; +} + +#jappix_mini div.jm_actions { + background-color: #565d5e; + border-bottom: 1px solid #3a3a3a; + height: 24px; + padding: 4px 6px; + font-weight: bold; + overflow: hidden; +} + +#jappix_mini div.jm_actions span.jm_nick { + color: white; + height: 16px; + width: 225px; + overflow: hidden; + float: left; +} + +#jappix_mini div.jm_actions a.jm_one-action { + background-color: #727879; + margin: 0 -2px 0 5px; + height: 15px; + width: 15px; + outline-style: none; + float: right; +} + +#jappix_mini div.jm_actions a.jm_one-action:hover, +#jappix_mini div.jm_actions a.jm_one-action:focus { + background-color: #7f8788; +} + +#jappix_mini div.jm_actions a.jm_one-action:active { + background-color: #8c9293; +} + +#jappix_mini div.jm_actions a.jm_logo { + background-position: 7px 2px; + width: 81px; + height: 22px; + margin: -4px 0 0 -2px; + outline-style: none; + float: left; +} + +#jappix_mini div.jm_actions a.jm_logo:hover, +#jappix_mini div.jm_actions a.jm_logo:focus { + background-color: #636a6b; +} + +#jappix_mini div.jm_actions a.jm_logo:active { + background-color: #707677; +} + +#jappix_mini div.jm_actions a.jm_close { + background-position: 1px -341px; +} + +#jappix_mini div.jm_actions a.jm_join { + background-position: 0 -327px; +} + +#jappix_mini div.jm_received-messages { + background-color: white; + padding: 5px 0 4px; + height: 242px; + overflow: auto; +} + +#jappix_mini div.jm_received-messages p { + margin: 3px 0; + word-wrap: break-word; +} + +#jappix_mini div.jm_received-messages p, +#jappix_mini div.jm_received-messages a { + color: black !important; +} + +#jappix_mini div.jm_received-messages div.jm_group { + margin: 2px 6px 9px 6px; + padding-bottom: 8px; + border-bottom: 1px solid #eaeaea; +} + +#jappix_mini div.jm_received-messages div.jm_system-message p, +#jappix_mini div.jm_received-messages div.jm_system-message a { + color: #053805 !important; + font-style: italic !important; +} + +#jappix_mini div.jm_received-messages p a { + text-decoration: underline; +} + +#jappix_mini div.jm_received-messages b { + margin-bottom: 3px; + display: block; +} + +#jappix_mini div.jm_received-messages b.jm_me { + color: #123a5c; +} + +#jappix_mini div.jm_received-messages b.jm_him { + color: #801e1e; +} + +#jappix_mini div.jm_received-messages span.jm_date { + font-size: 0.8em; + float: right; + display: none; +} + +#jappix_mini div.jm_received-messages div.jm_group:hover span.jm_date { + display: block; +} + +#jappix_mini input.jm_send-messages { + background-color: white; + border-color: #999999; + border-style: solid; + border-width: 1px 0 0 0; + padding: 5px; + width: 250px; + min-height: 14px; +} + +#jappix_mini div.jm_disabled div.jm_chat-content, +#jappix_mini div.jm_disabled input.jm_send-messages, +#jappix_mini div.jm_disabled a.jm_pane { + background: #f3f3f3 !important; +} + +#jappix_mini div.jm_disabled input.jm_send-messages { + color: #9d9d9d; +} + +#jappix_mini div.jm_roster { + background-color: white; + border: 1px solid #999999; + width: 160px; + position: absolute; + right: 0; + bottom: 25px; + display: none; +} + +#jappix_mini div.jm_roster div.jm_buddies { + width: 100%; + max-height: 300px; + padding: 5px 0; + overflow: auto; +} + +#jappix_mini div.jm_roster div.jm_grouped { + margin: 2px 0; +} + +#jappix_mini div.jm_roster div.jm_grouped div.jm_name { + margin-bottom: 2px; + padding: 4px 8px 0; + font-weight: bold; +} + +#jappix_mini a.jm_friend { + border-color: white; + border-style: solid; + border-width: 1px 0; + outline-style: none; + padding: 6px; + display: block; +} + +#jappix_mini a.jm_friend.jm_offline { + display: none; +} + +#jappix_mini a.jm_friend:hover, +#jappix_mini a.jm_friend:focus { + background-color: #888888; + border-color: #494949; + color: white; +} + +#jappix_mini a.jm_friend:hover span.jm_presence, +#jappix_mini a.jm_friend:focus span.jm_presence { + background-position: 0 -84px; +} + +#jappix_mini a.jm_button { + padding: 6px 10px; + position: relative; + z-index: 1; +} + +#jappix_mini a.jm_button.jm_clicked { + background: white; + border-top: none; + border-left: 1px solid #999999; + border-right: 1px solid #999999; + padding: 7px 10px 6px 10px; +} + +#jappix_mini span.jm_animate { + background-position: 0 0; + width: 111px; + height: 102px; + position: absolute; + top: -100px; + left: -74px; + z-index: 1; + display: block; +} + +#jappix_mini span.jm_counter { + background-position: 0 -288px; + color: #333333; + height: 16px; + padding-left: 25px; + display: block; +} + +#jappix_mini span.jm_counter.jm_error { + background-position: 0 -305px; +} + +#jappix_mini span.jm_presence { + display: block; + height: 16px; + width: 16px; + margin-right: 4px; + float: left; +} + +#jappix_mini span.jm_name { + color: #272727; + height: 14px; + width: 105px; + overflow: hidden; + float: left; +} + +#jappix_mini .jm_available, +#jappix_mini .jm_chat { + background-position: 0 -20px; +} + +#jappix_mini .jm_away { + background-position: 0 -36px; +} + +#jappix_mini .jm_xa, +#jappix_mini .jm_dnd { + background-position: 0 -52px; +} + +#jappix_mini .jm_unavailable { + background-position: 0 -68px; +} + +#jappix_mini .jm_smiley { + border: 0 none; + height: 16px; + width: 16px; + vertical-align: bottom; +} + +#jappix_mini .jm_smiley-wink { + background-position: 0 -148px; +} + +#jappix_mini .jm_smiley-waii { + background-position: 0 -164px; +} + +#jappix_mini .jm_smiley-unhappy { + background-position: 0 -180px; +} + +#jappix_mini .jm_smiley-tongue { + background-position: 0 -196px; +} + +#jappix_mini .jm_smiley-surprised { + background-position: 0 -212px; +} + +#jappix_mini .jm_smiley-smile { + background-position: 0 -228px; +} + +#jappix_mini .jm_smiley-happy { + background-position: 0 -244px; +} + +#jappix_mini .jm_smiley-grin { + background-position: 0 -260px; +} + +#jappix_popup { + background: url(../img/others/blank.gif) repeat; + position: fixed; + top: 0; + bottom: 0; + left: 0; + right: 0; + z-index: 999; +} + +#jappix_popup div.jm_prompt { + background-color: #565d5e; + border: 1px solid #3a3a3a; + width: 346px; + position: fixed; + top: 50%; + left: 50%; + margin-left: -175px; + padding: 16px 2px 2px 2px; + border-top-right-radius: 4px; + border-top-left-radius: 4px; + -moz-border-radius-topright: 4px; + -moz-border-radius-topleft: 4px; + -webkit-border-top-right-radius: 4px; + -webkit-border-top-left-radius: 4px; + box-shadow: 0 0 35px #232323; + -moz-box-shadow: 0 0 35px #232323; + -webkit-box-shadow: 0 0 35px #232323; +} + +#jappix_popup div.jm_prompt form { + background-color: white; + border: 1px solid #3a3a3a; + width: 332px; + padding: 6px; +} + +#jappix_popup div.jm_prompt form input { + background-color: #f9f9f9; + border: 1px solid #666666; + font-size: 1.1em; + padding: 1px 2px; +} + +#jappix_popup div.jm_prompt form input:hover, +#jappix_popup div.jm_prompt form input:focus { + border: 1px solid #202020; +} + +#jappix_popup div.jm_prompt form input.jm_text { + width: 326px; + margin: 6px 0; + display: block; +} + +#jappix_popup div.jm_prompt form input.jm_submit { + text-align: center; + margin-left: 3px; + float: right; +} + +#jappix_popup div.jm_prompt form input.jm_submit:hover, +#jappix_popup div.jm_prompt form input.jm_submit:focus { + background-color: #f3f3f3; + cursor: pointer; +} + +#jappix_popup div.jm_prompt form input.jm_submit:active { + background-color: #e8e8e8; +} + +#jappix_popup div.jm_prompt div.jm_clear { + clear: both; +} diff --git a/sources/addons/jappixmini/jappix/css/mobile.css b/sources/addons/jappixmini/jappix/css/mobile.css new file mode 100644 index 00000000..ed44cc03 --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/mobile.css @@ -0,0 +1,288 @@ +/* + +Jappix - An open social platform +This is the Jappix Mobile CSS stylesheet + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 05/10/11 + +*/ + +/* BEGIN GENERAL STYLE */ + +* { + margin: 0; + padding: 0; +} + +body { + font: normal 14.4px Helvetica, Verdana, sans-serif; + background-color: #dcdcdc; + margin: 0 auto; + text-align: center; + min-width: 200px; + min-height: 260px; +} + +a { + color: black; +} + +/* END GENERAL STYLE */ + +/* BEGIN HEADER STYLE */ + +.header { + background-color: #2d2d2d; + border-bottom: 1px solid #6d6d6d; + color: #405964; + padding: 6px 0; + height: 30px; +} + +.header div { + background-position: 0 0; + width: 83px; + height: 30px; +} + +/* END HEADER STYLE */ + +/* BEGIN HOME STYLE */ + +#home .header div { + margin: 0 auto; +} + +#home .notification { + padding: 2px; + margin-top: -1px; +} + +#noscript { + background: #86a2ff; + border-bottom: 1px solid #5890d6; + color: #1e4b82; +} + +#error { + background: #ff8686; + border-bottom: 1px solid #d65858; + color: #821e1e; + display: none; +} + +#info { + background: #f3eba7; + border-bottom: 1px solid #d9d085; + color: #5e5616; + display: none; +} + +#home .login { + padding: 8px 0; + margin: 30px 0 30px 0; +} + +#home .login input { + margin-top: 5px; + padding: 2px; +} + +#home .login input.xid, +#home .login input.password { + display: block; + margin: 4px auto; + font-size: 0.85em; + padding: 4px; + background-color: white; + border: 1px solid #636363; + width: 150px; + padding-left: 24px; +} + +#home .login input.xid { + background-position: 4px -30px; +} + +#home .login input.password { + background-position: 4px -53px; +} + +#home .login label { + margin-bottom: 12px; + display: block; +} + +#home .login label input { + margin-right: 4px; +} + +#home a { + font-size: 0.8em; +} + +/* END HOME STYLE */ + +/* BEGIN TALK STYLE */ + +#talk .header div, +#chat .header div { + float: left; + margin-left: 7px; +} + +#talk .header button, +#chat .header button { + float: right; + margin-right: 7px; + padding: 2px; +} + +#talk a.one-buddy { + display: none; + background-color: #87a5ab; + border-bottom: 1px solid #5b8088; + text-shadow: 1px 1px 1px #5b8088; + text-decoration: none; + color: white; + outline-style: none; + padding: 10px 0; +} + +#talk a.one-buddy:hover { + cursor: pointer; +} + +#talk a.available, +#talk a.chat { + background-color: #83b187; + border-bottom: 1px solid #4d8252; + text-shadow: 1px 1px 1px #4d8252; +} + +#talk a.available:hover, +#talk a.chat:hover, +#talk a.available:focus, +#talk a.chat:focus { + background-color: #89c68e; +} + +#talk a.available:active, +#talk a.chat:active { + background-color: #90d496; +} + +#talk a.away { + background-color: #e0be7b; + border-bottom: 1px solid #ae8941; + text-shadow: 1px 1px 1px #ae8941; +} + +#talk a.away:hover, +#talk a.away:focus { + background-color: #eac784; +} + +#talk a.away:active { + background-color: #f3d294; +} + +#talk a.xa, +#talk a.dnd { + background-color: #db8989; + border-bottom: 1px solid #a24343; + text-shadow: 1px 1px 1px #a24343; +} + +#talk a.xa:hover, +#talk a.dnd:hover, +#talk a.xa:focus, +#talk a.dnd:focus { + background-color: #e89797; +} + +#talk a.xa:active, +#talk a.dnd:active { + background-color: #ef9f9f; +} + +/* END TALK STYLE */ + +/* BEGIN CHAT STYLE */ + +#chat { + display: none; +} + +#chat .one-chat, +#chat .one-chat p, +#chat .one-chat div, +#chat .one-chat input { + position: absolute; + bottom: 0; + right: 0; +} + +#chat .one-chat { + top: 43px; + left: 0; +} + +#chat .one-chat p { + background-color: #87a5ab; + border-bottom: 1px solid #5b8088; + text-shadow: 1px 1px 1px #5b8088; + color: white; + top: 0; + left: 0; + height: 18px; + padding: 2px 0; + font-size: 0.9em; +} + +#chat .one-chat div { + border-bottom: 1px solid #cbcbcb; + top: 23px; + left: 0; + bottom: 25px; + overflow: auto; + text-align: left; +} + +#chat .one-chat span { + display: block; + font-size: 0.85em; + margin: 4px 6px; + word-wrap: break-word; +} + +#chat .one-chat b { + margin-right: 3px; +} + +#chat .one-chat b.me { + color: #123a5c; +} + +#chat .one-chat b.him { + color: #801e1e; +} + +#chat .one-chat input { + background-color: white; + bottom: 0; + height: 25px; + width: 100%; + border: none; +} + +#chat .one-chat input.submit { + right: 0; + width: 35px; +} + +/* END CHAT STYLE */ diff --git a/sources/addons/jappixmini/jappix/css/mucadmin.css b/sources/addons/jappixmini/jappix/css/mucadmin.css new file mode 100644 index 00000000..3fe1c754 --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/mucadmin.css @@ -0,0 +1,91 @@ +/* + +Jappix - An open social platform +This is the mucadmin CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 11/05/11 + +*/ + +#mucadmin .content { + padding: 10px 0 10px 0; +} + +#mucadmin .content p { + margin: 5px 10px 5px 10px; + text-align: justify; +} + +#mucadmin .mucadmin-head-jid { + text-decoration: underline; + font-size: 0.9em; + float: right; + margin: 1px 4px 1px 1px; +} + +#mucadmin .mucadmin-forms { + height: 310px; + width: 620px; + margin: -5px 0 0 10px; + padding: 6px 0 0 0; + overflow: auto; +} + +#mucadmin .mucadmin-forms label { + width: 260px; +} + +#mucadmin .mucadmin-topic label, +#mucadmin .mucadmin-aut label, +#mucadmin .mucadmin-others label { + font-size: 0.9em; +} + +#mucadmin .mucadmin-forms textarea { + height: 60px; + width: 300px; + margin: 5px 12px 10px 0; +} + +#mucadmin .results { + height: auto; + width: auto; + overflow: visible; + margin: 5px; +} + +#mucadmin .aut-group { + float: left; + padding-bottom: 4px; +} + +#mucadmin .one-aut { + clear: both; + margin: 0 10px 5px 0; +} + +#mucadmin .aut-add { + clear: both; + float: left; + margin-bottom: 5px; + font-size: 0.9em; +} + +#mucadmin .aut-remove { + float: left; +} + +#mucadmin .aut-remove:hover, +#mucadmin .aut-remove:focus { + font-weight: bold; + text-decoration: none; +} + +#mucadmin .mucadmin-others a { + float: left; + font-size: 0.9em; +} diff --git a/sources/addons/jappixmini/jappix/css/myinfos.css b/sources/addons/jappixmini/jappix/css/myinfos.css new file mode 100644 index 00000000..83262268 --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/myinfos.css @@ -0,0 +1,330 @@ +/* + +Jappix - An open social platform +This is the my-infos CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 31/08/11 + +*/ + +#my-infos { + background-color: rgb(20,20,20); + background-color: rgba(20,20,20,0.85); + color: #919191; + margin-top: 8px; + padding: 15px 6px 6px 6px; + border-radius: 4px; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + box-shadow: 0 0 6px #5c5c5c; + -moz-box-shadow: 0 0 6px #5c5c5c; + -webkit-box-shadow: 0 0 6px #5c5c5c; +} + +#my-infos .content { + background: #e8f1f3; + background: -moz-linear-gradient(top, #e4edef, #e8f1f3); + background: -webkit-gradient(linear, left top, left bottom, from(#e4edef), to(#e8f1f3)); + color: #919191; + max-height: 140px; + padding: 1px 0; + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; +} + +#my-infos .element { + height: 24px; + margin: 6px 0; + position: relative; +} + +#my-infos .element .icon { + background-color: white; + border-color: #636363; + border-width: 1px; + border-style: solid; + margin-left: 6px; + height: 22px; + width: 25px; + border-radius: 2px; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; +} + +#my-infos .element div.bubble a { + width: 100%; + height: 20px; +} + +#my-infos .element .icon:hover, +#my-infos .element div.bubble a:hover { + background-color: #f4f4f4; +} + +#my-infos .element .icon:active, +#my-infos .element div.bubble a:active { + background-color: #ededed; +} + +#my-infos .f-presence div.bubble a[data-value=available] { + background-position: 4px -167px; +} + +#my-infos .f-presence div.bubble a[data-value=away] { + background-position: 4px -183px; +} + +#my-infos .f-presence div.bubble a[data-value=xa] { + background-position: 4px -199px; +} + +#my-infos .f-mood div.bubble a[data-value=crazy] { + background-position: 4px -296px; +} + +#my-infos .f-mood div.bubble a[data-value=excited] { + background-position: 4px -314px; +} + +#my-infos .f-mood div.bubble a[data-value=playful] { + background-position: 4px -332px; +} + +#my-infos .f-mood div.bubble a[data-value=happy] { + background-position: 4px -350px; +} + +#my-infos .f-mood div.bubble a[data-value=shocked] { + background-position: 4px -368px; +} + +#my-infos .f-mood div.bubble a[data-value=hot] { + background-position: 4px -386px; +} + +#my-infos .f-mood div.bubble a[data-value=sad] { + background-position: 4px -404px; +} + +#my-infos .f-mood div.bubble a[data-value=amorous] { + background-position: 4px -422px; +} + +#my-infos .f-mood div.bubble a[data-value=confident] { + background-position: 4px -440px; +} + +#my-infos .f-mood a[data-value] span { + background-position: 0 -352px; +} + +#my-infos .f-mood a[data-value=crazy] span, +.mood-one { + background-position: 0 -298px; +} + +#my-infos .f-mood a[data-value=excited] span, +.mood-two { + background-position: 0 -316px; +} + +#my-infos .f-mood a[data-value=playful] span, +.mood-three { + background-position: 0 -334px; +} + +#my-infos .f-mood a[data-value=happy] span, +.mood-four { + background-position: 0 -352px; +} + +#my-infos .f-mood a[data-value=shocked] span, +.mood-five { + background-position: 0 -370px; +} + +#my-infos .f-mood a[data-value=hot] span, +.mood-six { + background-position: 0 -388px; +} + +#my-infos .f-mood a[data-value=sad] span, +.mood-seven { + background-position: 0 -406px; +} + +#my-infos .f-mood a[data-value=amorous] span, +.mood-eight { + background-position: 0 -424px; +} + +#my-infos .f-mood a[data-value=confident] span, +.mood-nine { + background-position: 0 -442px; +} + +#my-infos .f-activity div.bubble a[data-value=doing_chores] { + background-position: 4px -458px; +} + +#my-infos .f-activity div.bubble a[data-value=drinking] { + background-position: 4px -476px; +} + +#my-infos .f-activity div.bubble a[data-value=eating] { + background-position: 4px -494px; +} + +#my-infos .f-activity div.bubble a[data-value=exercising] { + background-position: 4px -512px; +} + +#my-infos .f-activity div.bubble a[data-value=grooming] { + background-position: 4px -548px; +} + +#my-infos .f-activity div.bubble a[data-value=having_appointment] { + background-position: 4px -566px; +} + +#my-infos .f-activity div.bubble a[data-value=inactive] { + background-position: 4px -530px; +} + +#my-infos .f-activity div.bubble a[data-value=relaxing] { + background-position: 4px -620px; +} + +#my-infos .f-activity div.bubble a[data-value=talking] { + background-position: 4px -602px; +} + +#my-infos .f-activity div.bubble a[data-value=traveling] { + background-position: 4px -584px; +} + +#my-infos .f-activity div.bubble a[data-value=working] { + background-position: 4px -638px; +} + +#my-infos .f-activity a[data-value] span { + background-position: 0 -514px; +} + +#my-infos .f-activity a[data-value=doing_chores] span, +.activity-doing_chores { + background-position: 0 -460px; +} + +#my-infos .f-activity a[data-value=drinking] span, +.activity-drinking { + background-position: 0 -478px; +} + +#my-infos .f-activity a[data-value=eating] span, +.activity-eating { + background-position: 0 -496px; +} + +#my-infos .f-activity a[data-value=exercising] span, +.activity-exercising { + background-position: 0 -514px; +} + +#my-infos .f-activity a[data-value=grooming] span, +.activity-grooming { + background-position: 0 -550px; +} + +#my-infos .f-activity a[data-value=having_appointment] span, +.activity-having_appointment { + background-position: 0 -568px; +} + +#my-infos .f-activity a[data-value=inactive] span, +.activity-inactive { + background-position: 0 -532px; +} + +#my-infos .f-activity a[data-value=relaxing] span, +.activity-relaxing { + background-position: 0 -622px; +} + +#my-infos .f-activity a[data-value=talking] span, +.activity-talking { + background-position: 0 -604px; +} + +#my-infos .f-activity a[data-value=traveling] span, +.activity-traveling { + background-position: 0 -586px; +} + +#my-infos .f-activity a[data-value=working] span, +.activity-working { + background-position: 0 -640px; +} + +#my-infos .element .icon.picker { + border-width: 1px 0 1px 1px; + border-top-right-radius: 0; + border-bottom-right-radius: 0; + -moz-border-radius-topright: 0; + -moz-border-radius-bottomright: 0; + -webkit-border-top-right-radius: 0; + -webkit-border-bottom-right-radius: 0; +} + +#my-infos .element .icon.disabled { + background-color: #f3f3f3; + border-color: #989898; + cursor: default; +} + +#my-infos .element div.bubble { + background-color: white; + border-color: #636363; + border-width: 1px 1px 0 1px; + border-style: solid; + width: 25px; + padding: 1px 0; + position: absolute; + bottom: 21px; + left: 6px; + border-top-left-radius: 2px; + border-top-right-radius: 2px; + -moz-border-radius-topleft: 2px; + -moz-border-radius-topright: 2px; + -webkit-border-top-left-radius: 2px; + -webkit-border-top-right-radius: 2px; +} + +#my-infos .element a { + float: left; +} + +#my-infos .element .icon span { + height: 16px; + width: 16px; + margin: 3px 4px; + display: block; +} + +#my-infos .element input { + height: 18px; + width: 190px; + font-size: 0.85em; + padding-left: 4px; + border-top-left-radius: 0; + border-bottom-left-radius: 0; + -moz-border-radius-topleft: 0; + -moz-border-radius-bottomleft: 0; + -webkit-border-top-left-radius: 0; + -webkit-border-top-bottom-radius: 0; +} diff --git a/sources/addons/jappixmini/jappix/css/options.css b/sources/addons/jappixmini/jappix/css/options.css new file mode 100644 index 00000000..6dc4ecdb --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/options.css @@ -0,0 +1,97 @@ +/* + +Jappix - An open social platform +This is the options CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 26/04/11 + +*/ + +#options label { + width: 190px; + font-size: 0.94em; +} + +#options .forms { + width: 610px; + height: 328px; + margin: 15px 15px 15px 15px; + float: left; +} + +#options .forms select { + margin-top: -3px; + min-width: 120px; + float: left; +} + +#options .forms a.linked { + font-size: 0.9em; + float: left; +} + +#options fieldset.privacy { + display: none; +} + +#options .sub-ask-delete, #options .sub-ask-pass, #options .sub-ask-pass-success { + display: none; +} + +#options .sub-ask { + display: none; + width: 592px; + padding: 8px; + float: left; + border: 1px #879da2 dotted; + background: #cbdde1; +} + +#options .sub-ask-top { + font-size: 0.9em; + margin-top: -3px; +} + +#options .sub-ask-title { + margin-bottom: 4px; + float: left; +} + +#options .sub-ask-close { + float: right; +} + +#options .sub-ask-close:hover { + cursor: pointer; +} + +#options .sub-ask-content { + clear: both; + height: 25px; + font-size: 0.9em; + border-top: 1px #416972 solid; + padding: 12px 0; +} + +#options .sub-ask-content label { + width: 125px; +} + +#options .sub-ask-content input { + width: 125px; +} + +#options .sub-ask-bottom { + clear: both; + font-size: 0.9em; + float: right; + text-decoration: underline; +} + +#options .sub-ask-bottom:hover { + cursor: pointer; +} diff --git a/sources/addons/jappixmini/jappix/css/others.css b/sources/addons/jappixmini/jappix/css/others.css new file mode 100644 index 00000000..f3e2461f --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/others.css @@ -0,0 +1,118 @@ +/* + +Jappix - An open social platform +This is the others CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 31/08/11 + +*/ + +#audio { + display: none; +} + +#top-content { + position: absolute; + right: 5px; + left: 5px; + top: 0; + min-width: 860px; + z-index: 50; +} + +#main-content { + position: absolute; + top: 34px; + left: 5px; + right: 5px; + bottom: 5px; + min-width: 850px; + min-height: 450px; +} + +#left-content { + position: absolute; + top: 0; + left: 0; + bottom: 0; + width: 248px; +} + +#right-content { + background-color: rgb(20,20,20); + background-color: rgba(20,20,20,0.85); + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 260px; + z-index: 10; + border-radius: 4px; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + box-shadow: 0 0 6px #5c5c5c; + -moz-box-shadow: 0 0 6px #5c5c5c; + -webkit-box-shadow: 0 0 6px #5c5c5c; +} + +#general-wait { + background: url(../img/others/blank.gif) repeat; + z-index: 10000; + position: fixed; + top: 0; + bottom: 0; + left: 0; + right: 0; +} + +.general-wait-content { + background-color: rgb(255,255,255); + background-color: rgba(255,255,255,0.9); + background-position: 8px 8px; + padding: 8px; + position: absolute; + right: 5px; + bottom: 5px; + border-radius: 4px; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + box-shadow: 0 0 2px #000; + -moz-box-shadow: 0 0 2px #000; + -webkit-box-shadow: 0 0 2px #000; +} + +.inbox-hidable, +.options-hidable, +.pep-hidable, +.pubsub-hidable, +.archives-hidable, +.commands-hidable, +.privacy-hidable, +.xmpplinks-hidable { + display: none; +} + +#reconnect .pane { + background-color: rgb(20,20,20); + background-color: rgba(20,20,20,0.85); + color: white; + padding: 25px; + z-index: 10000; + text-shadow: 0 1px 1px black; + position: absolute; + left: 0; + right: 0; + top: 0; + box-shadow: 0 0 35px #232323; + -moz-box-shadow: 0 0 35px #232323; + -webkit-box-shadow: 0 0 35px #232323; +} + +#reconnect .pane a { + margin-top: -4px; + float: right; +} diff --git a/sources/addons/jappixmini/jappix/css/pageengine.css b/sources/addons/jappixmini/jappix/css/pageengine.css new file mode 100644 index 00000000..75038b6c --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/pageengine.css @@ -0,0 +1,601 @@ +/* + +Jappix - An open social platform +This is the page-engine CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 31/08/11 + +*/ + +#page-engine { + background-color: #f4f4f4; + position: absolute; + top: 40px; + bottom: 6px; + right: 6px; + left: 6px; + z-index: 8; + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; +} + +#page-engine .top { + background: #e8f1f3; + background: -moz-linear-gradient(top, #e8f1f3, #dee8ea); + background: -webkit-gradient(linear, left top, left bottom, from(#e8f1f3), to(#dee8ea)); + border-bottom: 1px solid #d0d0d0; + color: black; + position: absolute; + top: 0; + left: 0; + right: 0; + padding: 6px; + height: 80px; + border-top-right-radius: 3px; + border-top-left-radius: 3px; + -moz-border-radius-topright: 3px; + -moz-border-radius-topleft: 3px; + -webkit-border-top-right-radius: 3px; + -webkit-border-top-left-radius: 3px; +} + +#page-engine .top .avatar-container { + text-align: center; + margin: 2px 0 0 10px; + height: 76px; + width: 76px; + float: left; +} + +#page-engine .top .avatar { + max-height: 76px; + max-width: 76px; +} + +#page-engine .top .name { + text-align: right; + padding: 7px; +} + +#page-engine p.bc-name { + font-size: 2.3em; + margin-bottom: 5px; +} + +#page-engine p.bc-infos { + font-size: 0.85em; + height: 16px; + overflow: hidden; + position: absolute; + left: 115px; + right: 12px; +} + +#page-engine .page-engine-chan[data-type=groupchat] p.bc-infos { + left: 12px; +} + +#page-engine p.bc-infos span.show { + padding-left: 18px; +} + +#page-engine p.bc-infos a { + text-decoration: underline; +} + +#page-engine div.bc-pep { + float: right; +} + +#page-engine div.bc-pep a { + height: 16px; + width: 16px; + margin-left: 4px; + float: left; +} + +#page-engine div.bc-pep a:hover { + cursor: default; +} + +#page-engine div.bc-pep a[href]:hover { + cursor: pointer; +} + +#page-engine .content, +#page-engine .list { + font-size: 0.9em; + position: absolute; + top: 93px; + right: 0; + bottom: 29px; + overflow: auto; + box-shadow: inset 0 3px 10px #e8e8e8; + -moz-box-shadow: inset 0 3px 10px #e8e8e8; + -webkit-box-shadow: inset 0 3px 10px #e8e8e8; +} + +#page-engine .content { + left: 0; + padding: 12px 14px 0; +} + +#page-engine .content a { + text-decoration: underline; +} + +#page-engine .page-engine-chan { + display: none; +} + +#page-engine .chat .content, +#page-engine .chat .list { + bottom: 93px; +} + +#page-engine .chat .content { + padding-bottom: 24px; +} + +#page-engine .groupchat-content { + padding-bottom: 16px !important; + right: 191px !important; +} + +#page-engine .list { + border-left: 1px solid #c8c8c8; + padding: 8px 0 0; + width: 190px; + right: 0; +} + +#page-engine .list .role { + display: none; + margin-bottom: 10px; +} + +#page-engine .list .title { + font-weight: bold; + color: #383838; + margin-left: 8px; +} + +#page-engine .list .user { + background: #eff2f2; + background: -moz-linear-gradient(top, #eff2f2, #ecefef); + background: -webkit-gradient(linear, left top, left bottom, from(#eff2f2), to(#ecefef)); + border-color: #c8c8c8; + border-width: 1px 0; + border-style: solid; + color: #383838; + margin-bottom: 3px; + height: 32px; + overflow: hidden; +} + +#page-engine .list .user:hover { + background: #e9ecec; + cursor: pointer; +} + +#page-engine .list .user:active { + background: #e3e7e7; +} + +#page-engine .list .user.myself { + background-color: #eff2f2; + cursor: default; +} + +#page-engine .list .user .name { + float: left; + height: 18px; + overflow: hidden; + margin: 7px 0 7px 3px; + padding-left: 18px; +} + +#page-engine .list .user .avatar-container { + text-align: center; + float: right; + height: 32px; + width: 32px; +} + +#page-engine .list .user .avatar { + max-height: 32px; + max-width: 32px; +} + +#page-engine .one-group, +#archives .one-group { + border-bottom: 1px dotted #d0d0d0; + padding-bottom: 8px; + margin-bottom: 10px; +} + +#page-engine .one-line, +#archives .one-line, +#page-engine .one-group b.name, +#archives .one-group b.name { + padding-left: 50px; + word-wrap: break-word; +} + +#page-engine .one-group b.name, +#archives .one-group b.name { + display: block; + margin-bottom: 4px; +} + +#page-engine .one-group b.name.me, +#archives .one-group b.name.me { + color: #123a5c; +} + +#page-engine .one-group b.name.him, +#archives .one-group b.name.him { + color: #801e1e; +} + +#page-engine .one-group span.date, +#archives .one-group span.date { + float: right; + font-size: 0.9em; +} + +#page-engine .one-group .avatar-container, +#archives .one-group .avatar-container { + text-align: center; + margin: 4px 0 0 6px; + height: 30px; + width: 30px; + float: left; +} + +#page-engine .one-group .avatar, +#archives .one-group .avatar { + max-height: 30px; + max-width: 30px; +} + +#page-engine b.name.talk-images { + background-position: 50px -99px; + padding-left: 68px; +} + +#page-engine .user-message, +#archives .user-message { + margin-bottom: 3px; +} + +#page-engine .system-message { + color: #053805 !important; + margin-bottom: 3px !important; + padding-left: 0 !important; +} + +#page-engine .system-message a { + color: #053805 !important; +} + +#page-engine .system-message p.help b { + margin-bottom: 5px; + text-decoration: underline; + display: block; +} + +#page-engine .system-message p.help em { + width: 240px; + text-decoration: underline; + margin-left: 5px; + float: left; +} + +#page-engine .my-nick { + font-weight: bold; +} + +#page-engine .old-message { + font-size: 11px !important; + margin-bottom: 1px !important; +} + +#page-engine .chatstate { + background-color: rgb(234,234,234); + background-color: rgba(234,234,234,0.8); + color: #2c2c2c; + padding: 3px 10px 2px 8px; + position: absolute; + bottom: 93px; + left: 0; + font-size: 0.75em; + border-top-right-radius: 3px; + -moz-border-radius-topright: 3px; + -webkit-border-top-right-radius: 3px; +} + +#page-engine .text { + height: 93px; + position: absolute; + bottom: 0; + left: 0; + right: 0; +} + +#page-engine .footer { + background: #e8f1f3; + background: -moz-linear-gradient(top, #dee8ea, #e8f1f3); + background: -webkit-gradient(linear, left top, left bottom, from(#dee8ea), to(#e8f1f3)); + border-color: #d0d0d0; + border-width: 1px 0 0; + border-style: solid; + color: black; + position: absolute; + left: 0; + right: 0; + padding: 6px; + height: 16px; +} + +#page-engine .chat .footer { + border-width: 1px 0; + position: static; +} + +#page-engine .chat-tools-content { + height: 16px; + width: 16px; + margin-right: 8px; + float: left; +} + +#page-engine .tools-tooltip { + display: block; + height: 16px; + width: 16px; + overflow: hidden; + float: left; +} + +#page-engine .text .chat-tools-smileys { + margin-left: 4px; +} + +#page-engine .text .chat-tools-file { + display: none; +} + +#page-engine .text .chat-tools-file.mini .bubble-file { + z-index: 39; +} + +#page-engine .text .chat-tools-file.mini .tooltip-subitem { + width: 22px; + height: 20px; +} + +#page-engine .text .chat-tools-file.mini .wait { + margin: -2px 0 0 -1px; +} + +#page-engine .text .tools-smileys { + background-position: 0 -388px; +} + +#page-engine .text .tools-style { + background-position: 0 -700px; +} + +#page-engine .text .tools-file { + background-position: 0 -1956px; +} + +#page-engine .text .tools-save { + background-position: 0 -719px; +} + +#page-engine .text .tools-clear { + background-position: 0 -739px; +} + +#page-engine .text .tools-infos, +#channel .top div.shortcuts a.profile { + background-position: 0 -758px; +} + +#page-engine .text .tools-add, +#page-engine .text .tools-archives, +#page-engine .text .tools-mucadmin { + display: none; +} + +#page-engine .text .tools-mucadmin { + background-position: 0 -777px; +} + +#page-engine .bubble-style label.bold { + font-weight: bold; +} + +#page-engine .bubble-style label.italic { + font-style: italic; +} + +#page-engine .bubble-style label.underline { + text-decoration: underline; +} + +#page-engine .bubble-style a.color { + height: 18px; + width: 18px; + border-color: white; + border-width: 1px; + border-style: solid; + margin: 6px 5px 0 0; + float: left; + opacity: 0.6; + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + box-shadow: 0 0 5px black; + -moz-box-shadow: 0 0 5px black; + -webkit-box-shadow: 0 0 5px black; +} + +#page-engine .bubble-style a.color:hover, +#page-engine .bubble-style a.color:focus { + opacity: 0.7; +} + +#page-engine .bubble-style a.color.selected { + opacity: 1; + border-color: #ffb20d; +} + +#page-engine .bubble-file .tooltip-subitem { + width: 240px; +} + +#page-engine .bubble-file input[type=file] { + width: 220px; +} + +#page-engine .bubble-file input[type=submit], +#page-engine .bubble-file input[type=reset] { + margin: 4px 4px 0 0; +} + +#page-engine .text .compose, +#page-engine .muc-ask { + position: absolute; + left: 0; +} + +#page-engine .text .compose { + top: 29px; + right: 12px; + bottom: 12px; +} + +#page-engine .muc-ask { + right: 0; + bottom: 0; +} + +#page-engine .text textarea { + border: 1px solid #c8c8c8; + padding: 5px; + height: 100%; + width: 100%; + font-size: 1.1em; + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-top-right-radius: 0; + border-top-left-radius: 0; + -moz-border-radius-topright: 0; + -moz-border-radius-topleft: 0; + -webkit-border-top-right-radius: 0; + -webkit-border-top-left-radius: 0; +} + +#page-engine .muc-ask { + background-color: #e8f1f3; + height: 64px; + font-size: 0.9em; + right: 0; + z-index: 2; + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; + -moz-border-radius-bottomleft: 3px; + -moz-border-radius-bottomright: 3px; + -webkit-border-bottom-left-radius: 3px; + -webkit-border-bottom-right-radius: 3px; +} + +#page-engine .muc-ask label { + color: #224249; + margin: 23px 10px 0 16px; + font-weight: bold; +} + +#page-engine .muc-ask input { + width: 200px; + margin: 19px 10px 0 10px; + padding: 3px; +} + +#page-engine .tooltip { + position: absolute; + bottom: 84px; + margin-left: -13px; + z-index: 40; + font-size: 0.8em; + color: white; +} + +#page-engine .tooltip a { + color: white; + text-decoration: underline; +} + +#page-engine .tooltip-subitem { + background-color: rgb(0,0,0); + background-color: rgba(0,0,0,0.8); + padding: 10px; + width: 200px; + height: 110px; + text-shadow: 0 1px 1px black; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; +} + +#page-engine .tooltip-subarrow { + background-position: 0 -251px; + opacity: 0.8; + height: 10px; + width: 18px; + margin-left: 12px; +} + +#page-engine .tooltip .tooltip-top { + margin-bottom: 8px; + font-weight: bold; +} + +#page-engine .tooltip label { + margin-bottom: 4px; + float: left; + clear: both; +} + +#page-engine .tooltip label input[type=checkbox] { + margin: 0 6px 0 0; + float: left; +} + +#page-engine .tooltip label.select { + margin-top: 5px; +} + +#page-engine .tooltip input, +#page-engine .tooltip select { + float: left; +} + +#page-engine .tooltip select { + width: 100px; +} + +#page-engine .tooltip .tooltip-actionlog:hover, +#page-engine .tooltip .tooltip-actionlog:focus { + cursor: pointer; + text-decoration: underline; +} diff --git a/sources/addons/jappixmini/jappix/css/pageswitch.css b/sources/addons/jappixmini/jappix/css/pageswitch.css new file mode 100644 index 00000000..59830049 --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/pageswitch.css @@ -0,0 +1,209 @@ +/* + +Jappix - An open social platform +This is the page-switch CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 22/05/11 + +*/ + +#page-switch { + position: absolute; + top: 15px; + left: 10px; + right: 10px; + z-index: 9; +} + +#page-switch .chans { + position: absolute; + left: 0; + right: 40px; + top: 0; + height: 25px; + overflow: hidden; +} + +#page-switch .more { + position: absolute; + right: 0; + top: 0; +} + +#page-switch .more-button { + background-position: 6px -1372px; + background-color: #d9e7ea; + width: 7px; + height: 17px; + padding: 1px 6px; + font-size: 0.9em; + text-decoration: none; + border-radius: 2px; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; +} + +#page-switch .more-content { + background-color: #d9e7ea; + width: 200px; + max-height: 400px; + overflow: auto; + position: absolute; + margin: -2px 0 0 -181px; + padding: 4px 0; + font-size: 0.95em; + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; + -moz-border-radius-topleft: 3px; + -moz-border-radius-bottomleft: 3px; + -moz-border-radius-bottomright: 3px; + -webkit-border-top-left-radius: 3px; + -webkit-border-bottom-left-radius: 3px; + -webkit-border-bottom-right-radius: 3px; +} + +#page-switch .switcher { + background-color: #d9e7ea; + color: #17353b; + height: 15px; + padding: 5px 10px 5px 5px; + margin: 0 2px; + font-size: 0.85em; + float: left; + border-top-right-radius: 3px; + border-top-left-radius: 3px; + -moz-border-radius-topright: 3px; + -moz-border-radius-topleft: 3px; + -webkit-border-top-right-radius: 3px; + -webkit-border-top-left-radius: 3px; +} + +#page-switch .more-content .switcher { + background-color: #d9e7ea; + float: none; + margin: 0; + font-size: 0.9em; + border-radius: 0; + -moz-border-radius: 0; + -webkit-border-radius: 0; +} + +#page-switch .more-content .switcher .exit { + display: block; +} + +#page-switch .more-button:hover, +#page-switch .more-button:focus, +#page-switch .switcher:hover, +#page-switch .switcher:focus, +#page-switch .more-content .switcher:hover, +#page-switch .more-content .switcher:focus { + background-color: #cedee1; + cursor: pointer; +} + +#page-switch .more-button:active, +#page-switch .switcher:active, +#page-switch .more-content .switcher:active { + background-color: #c3d3d7; +} + +#page-switch .switcher.activechan { + background-color: #e8f1f3; +} + +#page-switch .more-content .switcher.activechan { + background-color: #d1e0e3; +} + +#page-switch .icon { + height: 16px; + width: 16px; + float: left; +} + +#page-switch .name { + float: left; + margin-left: 4px; + max-height: 16px; + max-width: 140px; + overflow: hidden; +} + +#page-switch .exit { + display: none; + background-color: #bdd9dc; + border: 1px solid #80aab0; + color: #355e64; + height: 14px; + width: 13px; + margin-left: 10px; + font-size: 0.85em; + text-align: center; + text-decoration: none; + float: right; + border-radius: 2px; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; +} + +#page-switch .exit:hover, +#page-switch .exit:focus { + background-color: #aac7cb; +} + +#page-switch .exit:active { + background-color: #9bbdc1; +} + +#page-switch .activechan .exit { + display: block; + float: right; +} + +#page-switch .chan-newmessage { + background-color: #f6edc3 !important; +} + +#page-switch .chan-newmessage:hover, +#page-switch .chan-newmessage:focus { + background-color: #f1eac0 !important; +} + +#page-switch .chan-newmessage:active { + background-color: #ede4b8 !important; +} + +#page-switch .composing, +#page-engine .list .user.composing { + color: #217021 !important; +} + +#page-switch .paused, +#page-switch .chan-unread .name, +#page-engine .list .user.paused { + color: #2431ac !important; +} + +#page-switch .active, +#page-engine .list .user.active { + color: #353535 !important; +} + +#page-switch .inactive, +#page-engine .list .user.inactive { + color: #585858 !important; +} + +#page-switch .gone { + color: #851313 !important; +} + +#page-switch .channel .icon { + background-position: 0 -55px; +} diff --git a/sources/addons/jappixmini/jappix/css/popup.css b/sources/addons/jappixmini/jappix/css/popup.css new file mode 100644 index 00000000..e5b3eb92 --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/popup.css @@ -0,0 +1,612 @@ +/* + +Jappix - An open social platform +This is the popup CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 02/05/11 + +*/ + +.lock { + background-color: rgb(0,0,0); + background-color: rgba(0,0,0,0.6); + left: 0; + right: 0; + top: 0; + bottom: 0; + position: fixed; + z-index: 9999; +} + +.popup { + background-color: rgb(20,20,20); + background-color: rgba(20,20,20,0.95); + margin-top: -250px; + margin-left: -330px; + width: 640px; + height: 500px; + padding: 0 10px; + position: absolute; + z-index: 10000; + left: 50%; + top: 50%; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + box-shadow: 0 0 35px #232323; + -moz-box-shadow: 0 0 35px #232323; + -webkit-box-shadow: 0 0 35px #232323; +} + +.popup.large { + margin-left: -460px; + width: 920px; +} + +.popup .top { + width: 600px; + height: 45px; + font-size: 1.2em; + padding-top: 9px; + color: white; + margin: 14px 0 0 40px; + text-transform: uppercase; + text-decoration: none; + font-weight: bold; + text-shadow: 0 2px 2px black; +} + +.popup .tab { + width: 620px; + height: 25px; + margin: -5px 10px 0 10px; + position: relative; + z-index: 1; +} + +.popup .tab a { + background-color: #d9e7ea; + color: #204249; + width: 180px; + height: 17px; + padding: 4px 4px 4px 16px; + margin-left: 5px; + font-size: 0.94em; + overflow: hidden; + float: left; + border-top-right-radius: 3px; + border-top-left-radius: 3px; + -moz-border-radius-topright: 3px; + -moz-border-radius-topleft: 3px; + -webkit-border-top-right-radius: 3px; + -webkit-border-top-left-radius: 3px; +} + +.popup .tab a:hover, +.popup .tab a:focus { + background-color: #cedee1; + text-decoration: none; +} + +.popup .tab a:active { + background-color: #c3d3d7; + text-decoration: none; +} + +.popup .tab a.tab-active { + background-color: #e4eef9 !important; +} + +.popup .one-lap { + display: none; +} + +.popup .one-lap.lap-active { + display: block; +} + +.popup .content { + background: #e4eef9; + background: -moz-linear-gradient(top, #e4eef9, #D0E5FA); + background: -webkit-gradient(linear, left top, left bottom, from(#e4eef9), to(#D0E5FA)); + height: 358px; + width: 640px; + position: absolute; + left: 10px; + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + box-shadow: 0 0 20px black; + -moz-box-shadow: 0 0 20px black; + -webkit-box-shadow: 0 0 20px black; +} + +.popup .content, +.popup .content a { + color: #112a2f; +} + +.popup.large div.comments { + background-color: #f4f4f4; + width: 272px; + margin: 0; + position: absolute; + right: 10px; + top: 63px; + bottom: 10px; + overflow-x: hidden; + overflow-y: auto; + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; +} + +.popup.large div.comments div.comments-content { + font-size: 0.8em; +} + +.popup.large div.comments input { + width: 185px; + min-width: 0; +} + +.popup.large div.comments .one-comment { + padding-bottom: 4px; +} + +.popup.large div.comments .one-comment a { + text-decoration: underline; +} + +.popup.large div.comments div.comments-content { + border-top-right-radius: 3px; + border-top-left-radius: 3px; + -moz-border-radius-topright: 3px; + -moz-border-radius-topleft: 3px; + -webkit-border-top-right-radius: 3px; + -webkit-border-top-left-radius: 3px; +} + +.popup .head { + background: #f1f6fd; + border: 1px #9dc4fc solid; + width: 606px; + height: 24px; + margin: 0 10px 10px 10px; + padding: 6px; +} + +.popup .head-text { + float: left; + font-size: 0.9em; + margin: 3px; +} + +.popup .head-actions { + float: right; + margin-top: 2px; +} + +.popup .head-actions a { + font-size: 0.9em; + margin: 0 4px; +} + +.popup .actions a { + color: #30575f; + font-size: 0.9em; + margin-left: 5px; +} + +.popup .head .head-input { + float: right; + width: 200px; + padding: 2px; +} + +.popup .head .head-select { + float: right; + height: 24px; +} + +.popup .forms { + width: 390px; + height: 328px; + margin: 15px; + float: left; +} + +.popup fieldset { + border: 1px #547177 solid; + margin: 0 0 15px 0; + padding: 8px 2px 3px 2px; + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; +} + +.popup legend { + font-size: 0.9em; + margin: 0 0 0 15px; + padding: 0 2px; + text-transform: uppercase; +} + +.popup label { + color: #1b1b1b; + width: 150px; + margin: 0 0 10px 12px; + clear: both; + float: left; +} + +.popup input, +.popup select { + margin: 0 10px 10px 0; + float: left; +} + +.popup input[type=text] { + min-width: 174px; +} + +.popup select { + min-height: 20px; +} + +.popup .results { + height: 310px; + width: 620px; + margin: -5px 0 0 10px; + padding: 6px 0 0 0; + overflow: auto; +} + +.popup .results .no-results { + margin: 6px 0; + font-size: 0.85em; + font-weight: bold; +} + +.popup .results label { + width: 180px; + margin: 6px 4px 4px 4px; +} + +.popup .results input, +.popup .results textarea, +.popup .results select { + margin: 4px; +} + +.popup .results input, +.popup .results select { + min-width: 180px; +} + +.popup .results input[type=checkbox], +.popup .results input[type=radio] { + margin-top: 7px; +} + +.popup .results textarea { + width: 380px; +} + +.popup .results .avatar-container { + float: left; + width: 60px; + height: 60px; + margin: 5px 12px 5px 9px; + text-align: center; + background-repeat: no-repeat; +} + +.popup .results img.avatar { + max-width: 60px; + max-height: 60px; +} + +.popup .results .one-icon { + height: 16px; + width: 16px; + margin: 10px 3px 0 8px; + float: left; +} + +.popup .results .one-icon.account, +.popup .results .one-icon.auth { + background-position: 0 -777px; +} + +.popup .results .one-icon.automation, +.popup .results .one-icon.client { + background-position: 0 -1500px; +} + +.popup .results .one-icon.collaboration { + background-position: 0 -1520px; +} + +.popup .results .one-icon.proxy, +.popup .results .one-icon.server, +.popup .results .one-icon.others { + background-position: 0 -1540px; +} + +.popup .results .one-icon.component, +.popup .results .one-icon.gateway { + background-position: 0 -1560px; +} + +.popup .results .one-icon.conference { + background-position: 0 -1082px; +} + +.popup .results .one-icon.directory { + background-position: 0 -876px; +} + +.popup .results .one-icon.headline, +.popup .results .one-icon.hierarchy { + background-position: 0 -1580px; +} + +.popup .results .one-icon.pubsub, +.popup .results .one-icon.store { + background-position: 0 -1600px; +} + +.popup .results .one-icon.loading { + background-position: 0 -1620px; +} + +.popup .results .one-icon.down { + background-position: 0 -1640px; +} + +.popup .results .one-host { + font-weight: bold; + width: 170px; +} + +.popup .results .one-type { + width: 210px; +} + +.popup .results .one-type, +.popup .results .one-host { + float: left; + overflow: hidden; + margin: 9px 8px; +} + +.popup .results .one-jid, +.popup .results .one-ctry, +.popup .results .one-fn { + margin: 4px; + width: 400px; +} + +.popup .results .one-fn { + font-weight: bold; +} + +.popup .results .one-jid { + margin-top: 8px; + font-size: 0.9em; +} + +.popup .results .one-name { + float: left; + margin: 4px; +} + +.popup a.one-button { + display: none; + background-color: #f1f6fd; + border: 1px solid #b9cbcf; + margin-top: 1px; + padding: 4px 8px; + text-decoration: none; + border-radius: 2px; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; +} + +.popup a.one-button:hover, +.popup a.one-button:focus { + border: 1px solid #95b1b7; +} + +.popup a.one-button:active { + border: 1px solid #77989f; +} + +.popup .results .oneresult:hover a.one-button { + display: block; +} + +.popup .results a.one-button, +#inbox .one-message a.one-button { + float: right; + padding: 3px 6px; + margin-right: 4px; +} + +.popup .results a.one-vjud { + position: absolute; + right: 4px; +} + +.popup .results a.one-add { + top: 8px; +} + +.popup .results a.one-chat { + top: 42px; +} + +.popup .results .one-next { + float: right; + margin: 4px 8px 4px 4px; + font-weight: bold; +} + +.popup .results .one-actions { + width: 148px; + margin: 4px; + float: left; +} + +.popup .results .one-actions a { + width: 16px; + height: 16px; + padding: 2px 2px 4px 5px !important; + margin-top: 2px; +} + +.popup .results .one-actions a.browse { + background-position: 3px -1396px; +} + +.popup .results .one-actions a.command { + background-position: 3px -1415px; +} + +.popup .results .one-actions a.subscribe { + background-position: 4px -1435px; +} + +.popup .results .one-actions a.join { + background-position: 3px -1455px; +} + +.popup .results .one-actions a.search { + background-position: 4px -1475px; +} + +.popup .results a.submit, +.popup .results a.cancel, +.popup .results a.back { + margin-right: 8px; + float: right; +} + +.popup .onetitle { + font-size: 0.9em; + padding: 4px; + font-weight: bold; +} + +.popup .oneinstructions { + font-size: 0.9em; + padding: 4px; + margin: 8px 0; +} + +.popup .oneresult { + font-size: 0.9em; + padding: 3px 0 4px 4px; + border-bottom: 1px #9dc4fc solid; + overflow: hidden; + position: relative; +} + +.popup .oneresult:hover { + background: #e9f1fd; +} + +.popup .oneresult[onclick]:hover { + cursor: pointer; +} + +.popup .oneresult[onclick]:active { + background: #f1f6fd; +} + +.popup .infos { + background-color: rgb(255,239,104); + background-color: rgba(255,239,104,0.8); + border: 1px #decb2f solid; + color: #3f3f3f; + padding: 8px; + margin: 10px; + font-size: 0.8em; +} + +.popup .infos p { + margin-top: 10px; +} + +.popup .infos p.infos-title { + font-weight: bold; +} + +.popup .bottom { + width: 640px; + height: 40px; + position: absolute; + bottom: 8px; +} + +.popup .wait { + display: none; + margin: 8px 0 0 3px; + float: left; +} + +a.finish { + border: 1px solid white; + background-color: rgb(255,255,255); + background-color: rgba(255,255,255,0.1); + color: white; + padding: 4px 8px; + margin-right: 7px; + font-size: 0.95em; + text-align: center; + text-decoration: none; + text-shadow: 0 1px 1px black; + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + box-shadow: 0 0 5px black; + -moz-box-shadow: 0 0 5px black; + -webkit-box-shadow: 0 0 5px black; +} + +a.finish:hover, +a.finish:focus { + cursor: pointer; + background-color: rgb(255,255,255); + background-color: rgba(255,255,255,0.2); + box-shadow: 0 0 15px black; + -moz-box-shadow: 0 0 15px black; + -webkit-box-shadow: 0 0 15px black; +} + +a.finish:active { + background-color: rgb(255,255,255); + background-color: rgba(255,255,255,0.3); +} + +a.finish.disabled { + opacity: 0.2; +} + +a.finish.disabled:hover, +a.finish.disabled:focus, +a.finish.disabled:active { + cursor: default; + background-color: rgb(255,255,255); + background-color: rgba(255,255,255,0.1); +} + +.popup a.finish { + margin-top: 6px; + float: right; +} diff --git a/sources/addons/jappixmini/jappix/css/privacy.css b/sources/addons/jappixmini/jappix/css/privacy.css new file mode 100644 index 00000000..521be322 --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/privacy.css @@ -0,0 +1,197 @@ +/* + +Jappix - An open social platform +This is the privacy CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 16/02/11 + +*/ + +#privacy .content { + padding: 10px 0 10px 0; +} + +#privacy .privacy-head div.list-left, +#privacy .privacy-head div.list-center, +#privacy .privacy-head div.list-right, +#privacy .privacy-first { + float: left; +} + +#privacy .privacy-head div.list-left { + margin-left: 5px; +} + +#privacy .privacy-head div.list-center { + border-right: 1px dotted #1b393f; + height: 24px; + width: 1px; + margin-right: 15px; + padding-left: 18px; +} + +#privacy .privacy-head span, +#privacy .privacy-head a, +#privacy .privacy-item span, +#privacy .privacy-item a { + float: left; +} + +#privacy .privacy-head span { + font-size: 0.9em; + font-weight: bold; + margin: 3px 10px 0 0; +} + +#privacy .privacy-head input, +#privacy .privacy-head select { + width: 180px; +} + +#privacy .privacy-head input { + margin-top: 1px; +} + +#privacy .privacy-head select, +#privacy .privacy-item select { + margin-top: -2px; +} + +#privacy .privacy-head span.left-space { + margin-left: 16px; +} + +#privacy .privacy-head a, +#privacy .privacy-item a { + width: 20px; + height: 20px; + padding: 0; + display: block; +} + +#privacy .privacy-item a.item-add { + background-position: 2px -1178px; +} + +#privacy .privacy-head a.list-remove, +#privacy .privacy-item a.item-remove { + background-position: 2px -1197px; +} + +#privacy .privacy-item a.item-save { + background-position: 3px -126px; + width: auto; + height: 19px; + padding: 1px 7px 0 21px; +} + +#privacy .privacy-item, +#privacy form, +#privacy .privacy-active { + clear: both; +} + +#privacy .privacy-item { + margin: 17px 12px; + font-size: 0.9em; +} + +#privacy .privacy-item span { + font-weight: bold; +} + +#privacy .privacy-item select { + width: 300px; + margin: -4px 30px 0 10px; +} + +#privacy .privacy-item a { + margin: -2px 6px 0 0; +} + +#privacy .privacy-first, +#privacy .privacy-second, +#privacy .privacy-third { + height: 195px; + font-size: 0.9em; + margin: 10px 0 0 10px; + float: left; +} + +#privacy .privacy-first, +#privacy .privacy-second { + border-right: 1px dotted #1b393f; + padding-right: 14px; +} + +#privacy .privacy-first { + width: 125px; +} + +#privacy .privacy-first label { + margin: 50px 0 0 15px; +} + +#privacy .privacy-first label input { + margin-top: 2px; +} + +#privacy .privacy-second { + width: 205px; +} + +#privacy .privacy-second label { + margin: 2px 0 0 12px; +} + +#privacy .privacy-second input[type=radio], +#privacy .privacy-third input[type=checkbox] { + margin-top: 2px; + margin-bottom: 2px; +} + +#privacy .privacy-second input[type=text], +#privacy .privacy-second select { + width: 170px; + margin: 2px 0 11px 12px; + float: none; +} + +#privacy .privacy-third label { + width: auto; + margin-top: 11px; +} + +#privacy .privacy-third { + width: 240px; +} + +#privacy .privacy-active { + margin: 34px 16px 0 16px; + font-size: 0.9em; +} + +#privacy .privacy-active-elements { + float: right; +} + +#privacy .privacy-active input[type=text] { + width: 30px; + margin: 0 0 0 8px; + float: none; +} + +#privacy .privacy-active input[type=checkbox] { + margin: 2px 8px 0 0; + float: left; +} + +#privacy .privacy-active label { + width: auto; + margin: 0 15px 0 0; + clear: none; +} diff --git a/sources/addons/jappixmini/jappix/css/rosterx.css b/sources/addons/jappixmini/jappix/css/rosterx.css new file mode 100644 index 00000000..4f159ac8 --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/rosterx.css @@ -0,0 +1,53 @@ +/* + +Jappix - An open social platform +This is the Roster Item Exchange tool CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 05/02/11 + +*/ + +#rosterx .content { + padding: 10px 0 10px 0; +} + +#rosterx .rosterx-head a { + font-size: 0.9em; + margin: 3px 4px; + float: left; +} + +#rosterx .oneresult:hover { + cursor: pointer; +} + +#rosterx .oneresult span { + margin: 2px 5px 0 5px; + overflow: hidden; + float: left; +} + +#rosterx .oneresult span.name { + width: 230px; + font-weight: bold; +} + +#rosterx .oneresult span.xid { + width: 270px; + font-size: 0.9em; +} + +#rosterx .oneresult span.action { + width: 16px; + height: 16px; + margin-top: 4px; + float: right; +} + +#rosterx .oneresult span.action.modify { + background-position: 0 -1244px; +} diff --git a/sources/addons/jappixmini/jappix/css/search.css b/sources/addons/jappixmini/jappix/css/search.css new file mode 100644 index 00000000..505b17d9 --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/search.css @@ -0,0 +1,60 @@ +/* + +Jappix - An open social platform +This is the search tool CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 23/01/11 + +*/ + +.search { + position: relative; +} + +.search input.suggested { + border-bottom: 1px solid white; + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; + -moz-border-radius-bottomright: 0; + -moz-border-radius-bottomleft: 0; + -webkit-border-bottom-right-radius: 0; + -webkit-border-bottom-left-radius: 0; +} + +.search ul { + background-color: rgb(255,255,255); + background-color: rgba(255,255,255,0.9); + border-color: #e1a014; + border-style: solid; + border-width: 0 1px 1px 1px; + position: absolute; + z-index: 1; + padding: 3px 0; + list-style: none; + overflow: auto; + border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; + -moz-border-radius-bottomright: 3px; + -moz-border-radius-bottomleft: 3px; + -webkit-border-bottom-right-radius: 3px; + -webkit-border-bottom-left-radius: 3px; +} + +.search ul li { + padding: 2px 6px; + color: #3d3d3d; + text-shadow: none; +} + +.search ul li:hover { + cursor: pointer; +} + +.search ul li.hovered { + background-color: rgb(225,160,20); + background-color: rgba(225,160,20,0.3); +} diff --git a/sources/addons/jappixmini/jappix/css/smileys.css b/sources/addons/jappixmini/jappix/css/smileys.css new file mode 100644 index 00000000..faad478b --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/smileys.css @@ -0,0 +1,196 @@ +/* + +Jappix - An open social platform +This is the smileys CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 16/02/11 + +*/ + +.emoticon { + width: 16px; + height: 16px; +} + +a.emoticon { + margin: 2px; + float: left; +} + +a.emoticon:hover, +a.emoticon:focus { + opacity: 0.8; +} + +a.emoticon:active { + opacity: 0.7; +} + +img.emoticon { + border: 0 none; + vertical-align: bottom; +} + +.emoticon-biggrin { + background-position: 0 0; +} + +.emoticon-devil { + background-position: -16px 0; +} + +.emoticon-coolglasses { + background-position: -32px 0; +} + +.emoticon-tongue { + background-position: -48px 0; +} + +.emoticon-smile { + background-position: -64px 0; +} + +.emoticon-wink { + background-position: -80px 0; +} + +.emoticon-blush { + background-position: -96px 0; +} + +.emoticon-stare { + background-position: -112px 0; +} + +.emoticon-frowning { + background-position: -128px 0; +} + +.emoticon-oh { + background-position: -144px 0; +} + +.emoticon-unhappy { + background-position: -160px 0; +} + +.emoticon-cry { + background-position: -176px 0; +} + +.emoticon-angry { + background-position: -192px 0; +} + +.emoticon-puke { + background-position: -208px 0; +} + +.emoticon-hugright { + background-position: -224px 0; +} + +.emoticon-hugleft { + background-position: -240px 0; +} + +.emoticon-lion { + background-position: -256px 0; +} + +.emoticon-pussy { + background-position: -272px 0; +} + +.emoticon-bat { + background-position: -288px 0; +} + +.emoticon-kiss { + background-position: -304px 0; +} + +.emoticon-heart { + background-position: -320px 0; +} + +.emoticon-brheart { + background-position: -336px 0; +} + +.emoticon-flower { + background-position: -352px 0; +} + +.emoticon-brflower { + background-position: -368px 0; +} + +.emoticon-thumbup { + background-position: -384px 0; +} + +.emoticon-thumbdown { + background-position: -400px 0; +} + +.emoticon-lamp { + background-position: -416px 0; +} + +.emoticon-coffee { + background-position: -432px 0; +} + +.emoticon-drink { + background-position: -448px 0; +} + +.emoticon-beer { + background-position: -464px 0; +} + +.emoticon-boy { + background-position: -480px 0; +} + +.emoticon-girl { + background-position: -496px 0; +} + +.emoticon-phone { + background-position: -512px 0; +} + +.emoticon-photo { + background-position: -528px 0; +} + +.emoticon-music { + background-position: -544px 0; +} + +.emoticon-cuffs { + background-position: -560px 0; +} + +.emoticon-mail { + background-position: -576px 0; +} + +.emoticon-rainbow { + background-position: -592px 0; +} + +.emoticon-star { + background-position: -608px 0; +} + +.emoticon-moon { + background-position: -624px 0; +} diff --git a/sources/addons/jappixmini/jappix/css/stats-svg.css b/sources/addons/jappixmini/jappix/css/stats-svg.css new file mode 100644 index 00000000..f512a939 --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/stats-svg.css @@ -0,0 +1,71 @@ +/* + +Jappix - An open social platform +This is the SVG stats CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Erwan Briand, Vanaryon +Last revision: 20/11/10 + +*/ + +svg { + background-color: #e8f1f3; +} + +.refline { + stroke: #596171; + stroke-width: 2px; +} + +.refleft { + fill: #000000; + font-family: "Inconsolata", "DejaVu Serif sans", Verdana, sans-serif; + font-size: 8px; +} + +.reftext { + fill: #586070; + font-family: "Inconsolata", "DejaVu Serif sans", Verdana, sans-serif; + font-size: 10px; +} + +.bubbletextblue, +.bubbletextred { + fill: none; + font-family: "Inconsolata", "DejaVu Serif sans", Verdana, sans-serif; + font-size: 8px; + text-anchor: end; +} + +.bluebar { + fill: "#6C84C0"; + fill-opacity: "0.6"; +} + +.gbar:hover .bluebar { + fill: #2A3F73; +} + +.gbar:hover .redbar { + fill: #C70705; +} + +.gbar:hover #bubble { + fill: white; + stroke: grey; +} + +.gbar:hover .bubbletextblue { + fill: #2A3F73; +} + +.gbar:hover .bubbletextred { + fill: #C70705; +} + +.gbar:hover .reftext { + fill: #000000; +} diff --git a/sources/addons/jappixmini/jappix/css/tools.css b/sources/addons/jappixmini/jappix/css/tools.css new file mode 100644 index 00000000..8b689f54 --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/tools.css @@ -0,0 +1,346 @@ +/* + +Jappix - An open social platform +This is the tools CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 27/08/11 + +*/ + +#top-content .tools { + background-color: rgb(232,241,243); + background-color: rgba(232,241,243,0.6); + padding: 3px 8px 5px 8px; + min-width: 10px; + height: 17px; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + -moz-border-radius-bottomleft: 4px; + -moz-border-radius-bottomright: 4px; + -webkit-border-bottom-left-radius: 4px; + -webkit-border-bottom-right-radius: 4px; +} + +#top-content .tools a { + color: black; + padding: 0 3px; + margin: 0 1.5px; +} + +#top-content .tools a:hover, +#top-content .tools a:focus { + cursor: pointer; + text-decoration: underline; +} + +#top-content .tools-logo { + background-position: 9px 2px; + width: 74px; + float: left; +} + +#top-content .tools-all { + float: right; + text-align: right; + margin-left: 8px; + font-size: 0.9em; + color: black; +} + +#top-content .notifications { + background-position: 7px -1264px; +} + +#top-content .music { + background-position: 6px -1286px; +} + +#top-content .notifications:hover, +#top-content .music:hover { + cursor: pointer; +} + +#top-content .music:hover, +#top-content .notifications:hover, +#top-content .music:focus, +#top-content .notifications:focus { + background-color: rgb(232,241,243); + background-color: rgba(232,241,243,0.7); +} + +#top-content .music:active, +#top-content .notifications:active { + background-color: rgb(232,241,243); + background-color: rgba(232,241,243,0.8); +} + +#top-content .actived, +#top-content .actived:hover, +#top-content .actived:focus, +#top-content .actived:active { + background-color: rgb(232,241,243) !important; + background-color: rgba(232,241,243,0.9) !important; +} + +#top-content .notify { + background-color: #c60505; + color: white; + font-size: 0.7em; + font-weight: bold; + margin-left: -10px; + padding: 1px 4px; + position: absolute; + bottom: -2px; + border-radius: 10px; + -moz-border-radius: 10px; + -webkit-border-radius: 10px; +} + +#top-content .tools-content { + display: none; + position: absolute; + top: 25px; + margin-left: -8px; +} + +.tools-content-subarrow { + background-position: 0 -241px; + opacity: 0.8; + height: 10px; + width: 18px; + margin-left: 12px; +} + +.tools-content-subitem { + background-color: rgb(0,0,0); + background-color: rgba(0,0,0,0.8); + padding: 14px 6px 6px 6px; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; +} + +.notifications-content { + width: 240px; +} + +.notifications-content .tools-content-subitem { + max-height: 250px; + color: white; + text-shadow: 0 1px 1px black; + text-align: left; + overflow-x: none; + overflow-y: auto; +} + +.notifications-content .empty { + color: white; + font-size: 0.9em; + text-decoration: underline; + margin: -8px 4px 2px 0; + display: none; + float: right; +} + +.notifications-content .nothing { + font-size: 0.9em; + margin: 5px; +} + +.notifications-content .one-notification { + padding: 6px 4px; + font-size: 0.85em; + clear: both; + border-radius: 2px; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; +} + +.notifications-content .one-notification:hover, +.notifications-content .one-notification:focus { + background-color: rgb(255,255,255); + background-color: rgba(255,255,255,0.1); +} + +.notifications-content .one-notification:active { + background-color: rgb(255,255,255); + background-color: rgba(255,255,255,0.2); +} + +.notifications-content .avatar-container { + float: left; + width: 40px; + height: 40px; + margin: 0 8px 8px 0; + text-align: center; + background-repeat: no-repeat; +} + +.notifications-content .avatar { + max-width: 40px; + max-height: 40px; +} + +.notifications-content .notification-text, +.notifications-content .notification-actions { + margin-left: 48px; + overflow: hidden; +} + +.notifications-content .notification-actions { + margin-top: 3px; +} + +.notifications-content .notification-actions a { + color: white; + font-weight: bold; + font-size: 0.9em; + text-decoration: underline; + margin-right: 8px; +} + +.notifications-content .one-notification .notification-actions span.talk-images { + background-position: 0 -1828px; + width: 16px; + height: 16px; + margin: -1px 6px 0 0; + float: left; +} + +.notifications-content .one-notification[data-type=subscribe] .notification-actions span.talk-images { + background-position: 0 -1796px; +} + +.notifications-content .one-notification[data-type=invite_room] .notification-actions span.talk-images { + background-position: 0 -1812px; +} + +.notifications-content .one-notification[data-type=send] .notification-actions span.talk-images, +.notifications-content .one-notification[data-type=send_accept] .notification-actions span.talk-images, +.notifications-content .one-notification[data-type=send_reject] .notification-actions span.talk-images, +.notifications-content .one-notification[data-type=send_fail] .notification-actions span.talk-images { + background-position: 0 -1956px; +} + +.notifications-content .one-notification[data-type=rosterx] .notification-actions span.talk-images { + background-position: 0 -1844px; +} + +.notifications-content .one-notification[data-type=comment] .notification-actions span.talk-images { + background-position: 0 -1860px; +} + +.notifications-content .one-notification[data-type=like] .notification-actions span.talk-images { + background-position: 0 -1876px; +} + +.notifications-content .one-notification[data-type=quote] .notification-actions span.talk-images { + background-position: 0 -1892px; +} + +.notifications-content .one-notification[data-type=wall] .notification-actions span.talk-images { + background-position: 0 -1908px; +} + +.notifications-content .one-notification[data-type=photo] .notification-actions span.talk-images { + background-position: 0 -1924px; +} + +.notifications-content .one-notification[data-type=video] .notification-actions span.talk-images { + background-position: 0 -1940px; +} + +.music-content { + width: 220px; +} + +.music-content .tools-content-subitem { + height: 247px; +} + +.music-content .player { + background: #b5d5db; + background: -moz-linear-gradient(top, #b5d5db, #adced4); + background: -webkit-gradient(linear, left top, left bottom, from(#b5d5db), to(#adced4)); + height: 20px; + padding: 2px 5px; + border-top-right-radius: 4px; + border-top-left-radius: 4px; + -moz-border-radius-topright: 4px; + -moz-border-radius-topleft: 4px; + -webkit-border-top-right-radius: 4px; + -webkit-border-top-left-radius: 4px; +} + +.music-content .player a { + margin: 2px; + height: 16px; + width: 16px; + float: left; +} + +.music-content .player a:hover, +.music-content .player a:focus { + opacity: 0.8; +} + +.music-content .player a:active { + opacity: 0.6; +} + +.music-content .stop { + display: none; + background-position: 0 -270px; +} + +.music-content .list { + background-color: #e8f1f3; + height: 188px; + padding: 5px; + text-align: left; + overflow-y: auto; + overflow-x: hidden; +} + +.music-content p.no-results { + display: none; + color: black; + font-size: 0.9em; +} + +.music-content div.special { + padding-bottom: 2px; + margin-bottom: 6px; + border-bottom: 1px solid #c3d4d7; +} + +.music-content .song { + display: block; + margin: 3px 0; + font-size: 0.8em; +} + +.music-content .playing { + font-weight: bold; +} + +.music-content .search { + background-color: #e8f1f3; + height: 25px; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + -moz-border-radius-bottomleft: 4px; + -moz-border-radius-bottomright: 4px; + -webkit-border-bottom-right-radius: 4px; + -webkit-border-bottom-right-radius: 4px; +} + +.music-content .search input { + margin: 2px; + width: 198px; + height: 15px; +} diff --git a/sources/addons/jappixmini/jappix/css/userinfos.css b/sources/addons/jappixmini/jappix/css/userinfos.css new file mode 100644 index 00000000..59bab655 --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/userinfos.css @@ -0,0 +1,100 @@ +/* + +Jappix - An open social platform +This is the user-infos CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 27/03/11 + +*/ + +#userinfos .content { + overflow: auto; +} + +#userinfos .one-lap a { + text-decoration: underline; +} + +#userinfos .main-infos { + margin: 20px 20px 8px 20px; + height: 120px; + background: white; + position: relative; + border-radius: 4px; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; +} + +#userinfos .avatar-container { + float: left; + text-align: center; + margin: 20px 35px; + width: 80px; + height: 80px; +} + +#userinfos .avatar { + max-width: 80px; + max-height: 80px; +} + +#userinfos h1, +#userinfos h2, +#userinfos h3 { + width: 410px; + overflow: hidden; +} + +#userinfos h1 { + font-size: 2em; + padding-top: 12px; + margin-bottom: 4px; +} + +#userinfos h2 { + color: #447079; + font-size: 1.1em; + margin-bottom: 10px; +} + +#userinfos h3 { + color: #6e8388; + font-size: 0.8em; +} + +#userinfos .main-infos div.shortcuts { + position: absolute; + top: 10px; + right: 12px; +} + +#userinfos .block-infos { + margin: 7px 20px; + float: left; +} + +#userinfos .one-line { + margin: 4px 0; + font-size: 0.9em; + float: left; +} + +#userinfos .one-line b { + width: 120px; + float: left; +} + +#userinfos .one-line span.reset-info { + float: left; + width: 460px; +} + +#userinfos textarea { + margin: 30px 0 0 30px; + width: 572px; + height: 292px; +} diff --git a/sources/addons/jappixmini/jappix/css/vcard.css b/sources/addons/jappixmini/jappix/css/vcard.css new file mode 100644 index 00000000..59dfc486 --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/vcard.css @@ -0,0 +1,106 @@ +/* + +Jappix - An open social platform +This is the vCard CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 16/01/12 + +*/ + +#vcard label { + font-size: 0.94em; + margin-top: 2px; +} + +#vcard #vcard-avatar input[type=file] { + margin-left: 15px; +} + +#vcard .avatar-container { + float: left; + text-align: center; + margin: 20px 0 35px 35px; + max-width: 96px; + max-height: 96px; +} + +#vcard .avatar { + max-width: 96px; + max-height: 96px; +} + +#vcard .avatar-delete { + background-position: 3px -1195px; + margin: 12px 25px 0 025px; + padding-left: 20px; + font-size: 0.9em; + float: right; +} + +#vcard .no-avatar { + width: 300px; + color: #7c2222; + padding: 10px; + margin: 15px 0 20px 40px; + background: #f8cece; + border: 1px #ba6d6d solid; + font-size: 0.8em; +} + +#vcard .forms textarea { + height: 111px; + width: 358px; + margin: 5px 12px 10px 12px; +} + +#vcard .forms .avatar-info { + border-width: 1px; + border-style: solid; + display: none; + width: 370px; + height: 15px; + font-size: 0.85em; + padding: 10px; +} + +#vcard .forms .avatar-wait { + background-color: #9bcbed; + color: #0a3858; + border-color: #306780; +} + +#vcard .forms .avatar-ok { + background-color: #c4ed9b; + color: #325213; + border-color: #578030; +} + +#vcard .forms .avatar-error { + background-color: #e79595; + color: #6a0b0b; + border-color: #7c1010; +} + +#vcard .infos { + width: 179px; + height: 328px; + margin: 15px 15px 15px 0; + padding: 0 8px; + float: right; +} + +#vcard .infos a { + text-decoration: underline; +} + +#vcard .send { + float: right; +} + +#vcard .send:hover { + cursor: pointer; +} diff --git a/sources/addons/jappixmini/jappix/css/welcome.css b/sources/addons/jappixmini/jappix/css/welcome.css new file mode 100644 index 00000000..71b31ef2 --- /dev/null +++ b/sources/addons/jappixmini/jappix/css/welcome.css @@ -0,0 +1,170 @@ +/* + +Jappix - An open social platform +This is the welcome tool CSS stylesheet for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 26/04/11 + +*/ + +#welcome .infos { + margin: 15px; +} + +#welcome .infos p { + margin-top: 6px; +} + +#welcome .infos p.infos-title { + margin-top: 0; +} + +#welcome a.box { + background-color: #e4eef9; + border: 1px solid #ccdbde; + margin: 12px 11px 4px 15px; + padding: 10px; + width: 270px; + text-decoration: none; + float: left; + border-radius: 4px; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; +} + +#welcome a.box.share { + width: 350px; + margin: 4px 130px; + padding: 4px 10px; + clear: both; +} + +#welcome a.box.share.first { + margin-top: 0; +} + +#welcome a.box.share:hover span.go { + display: block; +} + +#welcome a.box:hover, +#welcome a.box:focus { + border: 1px solid #93c5fa; +} + +#welcome a.box:active { + border: 1px solid #419afa; +} + +#welcome a.box.enabled { + background-color: #f1f6fd; + border: 1px solid #9dc4fc; +} + +#welcome a.box span { + margin: 3px 0; + display: block; +} + +#welcome a.box span.logo { + height: 35px; + width: 35px; + margin-right: 15px; + float: left; +} + +#welcome a.box span.logo.facebook { + background-position: 0 0; +} + +#welcome a.box span.logo.twitter { + background-position: -35px 0; +} + +#welcome a.box span.logo.buzz { + background-position: -70px 0; +} + +#welcome a.box span.logo.identica { + background-position: -105px 0; +} + +#welcome a.box span.option, +#welcome a.box span.name { + font-size: 0.9em; + font-weight: bold; +} + +#welcome a.box span.description { + font-size: 0.7em; + margin-top: 7px; +} + +#welcome a.box.share span.description { + margin-top: 4px; +} + +#welcome a.box span.image { + height: 16px; + width: 16px; + margin: -30px 12px 0 0; + float: right; +} + +#welcome a.box span.image.sound { + background-position: 0 -900px; +} + +#welcome a.box span.image.geolocation { + background-position: 0 -658px; +} + +#welcome a.box span.image.xmpp { + background-position: 0 -990px; +} + +#welcome a.box span.image.archives, +#page-engine .text .tools-archives { + background-position: 0 -1025px; +} + +#welcome a.box span.image.offline { + background-position: 0 -80px; +} + +#welcome a.box span.tick, +#welcome a.box span.go { + height: 16px; + width: 16px; + display: none; + float: right; +} + +#welcome a.box span.tick { + background-position: 0 -1661px; + margin: -52px -15px 0 0; +} + +#welcome a.box span.go { + background-position: 0 -1120px; + margin: -28px 5px 0 0; +} + +#welcome a.box.enabled span.tick { + display: block; +} + +#welcome div.results { + margin: -7px 15px; + padding: 0; + height: 272px; + overflow: auto; +} + +#welcome .bottom .finish.save { + display: none; +} diff --git a/sources/addons/jappixmini/jappix/img/others/blank.gif b/sources/addons/jappixmini/jappix/img/others/blank.gif new file mode 100644 index 00000000..35d42e80 Binary files /dev/null and b/sources/addons/jappixmini/jappix/img/others/blank.gif differ diff --git a/sources/addons/jappixmini/jappix/img/others/default-avatar.png b/sources/addons/jappixmini/jappix/img/others/default-avatar.png new file mode 100644 index 00000000..7cda4c64 Binary files /dev/null and b/sources/addons/jappixmini/jappix/img/others/default-avatar.png differ diff --git a/sources/addons/jappixmini/jappix/img/others/lock.png b/sources/addons/jappixmini/jappix/img/others/lock.png new file mode 100644 index 00000000..cba6c0d3 Binary files /dev/null and b/sources/addons/jappixmini/jappix/img/others/lock.png differ diff --git a/sources/addons/jappixmini/jappix/img/sprites/animate.gif b/sources/addons/jappixmini/jappix/img/sprites/animate.gif new file mode 100644 index 00000000..cbf55da5 Binary files /dev/null and b/sources/addons/jappixmini/jappix/img/sprites/animate.gif differ diff --git a/sources/addons/jappixmini/jappix/img/sprites/animate.png b/sources/addons/jappixmini/jappix/img/sprites/animate.png new file mode 100644 index 00000000..3d89e5db Binary files /dev/null and b/sources/addons/jappixmini/jappix/img/sprites/animate.png differ diff --git a/sources/addons/jappixmini/jappix/img/sprites/background.png b/sources/addons/jappixmini/jappix/img/sprites/background.png new file mode 100644 index 00000000..4ae286d8 Binary files /dev/null and b/sources/addons/jappixmini/jappix/img/sprites/background.png differ diff --git a/sources/addons/jappixmini/jappix/img/sprites/browsers.png b/sources/addons/jappixmini/jappix/img/sprites/browsers.png new file mode 100644 index 00000000..8fadb7b3 Binary files /dev/null and b/sources/addons/jappixmini/jappix/img/sprites/browsers.png differ diff --git a/sources/addons/jappixmini/jappix/img/sprites/buttons.png b/sources/addons/jappixmini/jappix/img/sprites/buttons.png new file mode 100644 index 00000000..4c32b14d Binary files /dev/null and b/sources/addons/jappixmini/jappix/img/sprites/buttons.png differ diff --git a/sources/addons/jappixmini/jappix/img/sprites/home.png b/sources/addons/jappixmini/jappix/img/sprites/home.png new file mode 100644 index 00000000..cd3ca4a1 Binary files /dev/null and b/sources/addons/jappixmini/jappix/img/sprites/home.png differ diff --git a/sources/addons/jappixmini/jappix/img/sprites/install.png b/sources/addons/jappixmini/jappix/img/sprites/install.png new file mode 100644 index 00000000..e2f4cd26 Binary files /dev/null and b/sources/addons/jappixmini/jappix/img/sprites/install.png differ diff --git a/sources/addons/jappixmini/jappix/img/sprites/logs.png b/sources/addons/jappixmini/jappix/img/sprites/logs.png new file mode 100644 index 00000000..bae4fb18 Binary files /dev/null and b/sources/addons/jappixmini/jappix/img/sprites/logs.png differ diff --git a/sources/addons/jappixmini/jappix/img/sprites/manager.png b/sources/addons/jappixmini/jappix/img/sprites/manager.png new file mode 100644 index 00000000..d63a3fec Binary files /dev/null and b/sources/addons/jappixmini/jappix/img/sprites/manager.png differ diff --git a/sources/addons/jappixmini/jappix/img/sprites/me.png b/sources/addons/jappixmini/jappix/img/sprites/me.png new file mode 100644 index 00000000..8a8bc0fb Binary files /dev/null and b/sources/addons/jappixmini/jappix/img/sprites/me.png differ diff --git a/sources/addons/jappixmini/jappix/img/sprites/mini.gif b/sources/addons/jappixmini/jappix/img/sprites/mini.gif new file mode 100644 index 00000000..3f3f9523 Binary files /dev/null and b/sources/addons/jappixmini/jappix/img/sprites/mini.gif differ diff --git a/sources/addons/jappixmini/jappix/img/sprites/mini.png b/sources/addons/jappixmini/jappix/img/sprites/mini.png new file mode 100644 index 00000000..6852274d Binary files /dev/null and b/sources/addons/jappixmini/jappix/img/sprites/mini.png differ diff --git a/sources/addons/jappixmini/jappix/img/sprites/mobile.png b/sources/addons/jappixmini/jappix/img/sprites/mobile.png new file mode 100644 index 00000000..ba36a24c Binary files /dev/null and b/sources/addons/jappixmini/jappix/img/sprites/mobile.png differ diff --git a/sources/addons/jappixmini/jappix/img/sprites/smileys.png b/sources/addons/jappixmini/jappix/img/sprites/smileys.png new file mode 100644 index 00000000..1c33243d Binary files /dev/null and b/sources/addons/jappixmini/jappix/img/sprites/smileys.png differ diff --git a/sources/addons/jappixmini/jappix/img/sprites/talk.png b/sources/addons/jappixmini/jappix/img/sprites/talk.png new file mode 100644 index 00000000..a307e19e Binary files /dev/null and b/sources/addons/jappixmini/jappix/img/sprites/talk.png differ diff --git a/sources/addons/jappixmini/jappix/img/sprites/welcome.png b/sources/addons/jappixmini/jappix/img/sprites/welcome.png new file mode 100644 index 00000000..9044bd9c Binary files /dev/null and b/sources/addons/jappixmini/jappix/img/sprites/welcome.png differ diff --git a/sources/addons/jappixmini/jappix/img/wait/wait-big.gif b/sources/addons/jappixmini/jappix/img/wait/wait-big.gif new file mode 100644 index 00000000..c6573207 Binary files /dev/null and b/sources/addons/jappixmini/jappix/img/wait/wait-big.gif differ diff --git a/sources/addons/jappixmini/jappix/img/wait/wait-medium.png b/sources/addons/jappixmini/jappix/img/wait/wait-medium.png new file mode 100644 index 00000000..4b9a780b Binary files /dev/null and b/sources/addons/jappixmini/jappix/img/wait/wait-medium.png differ diff --git a/sources/addons/jappixmini/jappix/img/wait/wait-small.gif b/sources/addons/jappixmini/jappix/img/wait/wait-small.gif new file mode 100644 index 00000000..c4b5787e Binary files /dev/null and b/sources/addons/jappixmini/jappix/img/wait/wait-small.gif differ diff --git a/sources/addons/jappixmini/jappix/js/adhoc.js b/sources/addons/jappixmini/jappix/js/adhoc.js new file mode 100644 index 00000000..d4e3bf4c --- /dev/null +++ b/sources/addons/jappixmini/jappix/js/adhoc.js @@ -0,0 +1,85 @@ +/* + +Jappix - An open social platform +These are the Ad-Hoc JS scripts for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 11/07/11 + +*/ + +// Opens the adhoc popup +function openAdHoc() { + // Popup HTML content + var html = + '
' + _e("Commands") + '
' + + + '
' + + '
' + + + '
' + + '
' + + + '
' + + '
' + + + '' + _e("Close") + '' + + '
'; + + // Create the popup + createPopup('adhoc', html); + + // Associate the events + launchAdHoc(); + + return false; +} + +// Quits the adhoc popup +function closeAdHoc() { + // Destroy the popup + destroyPopup('adhoc'); + + return false; +} + +// Retrieves an entity adhoc command +function retrieveAdHoc(xid) { + // Open the popup + openAdHoc(); + + // Add a XID marker + $('#adhoc .adhoc-head').html('' + getBuddyName(xid).htmlEnc() + ' (' + xid.htmlEnc() + ')'); + + // Get the highest entity resource + var highest = getHighestResource(xid); + + if(highest) + xid = highest; + + // Start a new adhoc command + dataForm(xid, 'command', '', '', 'adhoc'); + + return false; +} + +// Starts an adhoc command on the user server +function serverAdHoc(server) { + // Open the popup + openAdHoc(); + + // Add a XID marker + $('#adhoc .adhoc-head').html('' + server.htmlEnc() + ''); + + // Start a new adhoc command + dataForm(server, 'command', '', '', 'adhoc'); +} + +// Plugin launcher +function launchAdHoc() { + // Click event + $('#adhoc .bottom .finish').click(closeAdHoc); +} diff --git a/sources/addons/jappixmini/jappix/js/anonymous.js b/sources/addons/jappixmini/jappix/js/anonymous.js new file mode 100644 index 00000000..88eaa7dc --- /dev/null +++ b/sources/addons/jappixmini/jappix/js/anonymous.js @@ -0,0 +1,131 @@ +/* + +Jappix - An open social platform +These are the anonymous mode JS script for Jappix + +------------------------------------------------- + +License: AGPL +Authors: Vanaryon, LinkMauve +Last revision: 02/10/11 + +*/ + +// Connected to an anonymous session +function anonymousConnected(con) { + logThis('Jappix (anonymous) is now connected.', 3); + + // Connected marker + CONNECTED = true; + CURRENT_SESSION = true; + RECONNECT_TRY = 0; + RECONNECT_TIMER = 0; + + // Not resumed? + if(!RESUME) { + // Create the app + createTalkPage(); + + // Send our first presence + firstPresence(''); + + // Set last activity stamp + LAST_ACTIVITY = getTimeStamp(); + + // Create the new groupchat + checkChatCreate(generateXID(ANONYMOUS_ROOM, 'groupchat'), 'groupchat'); + + // Remove some nasty elements for the anonymous mode + $('.tools-mucadmin, .tools-add').remove(); + } + + // Resumed + else { + // Send again our presence + presenceSend(); + + // Change the title + updateTitle(); + } + + // Remove the waiting icon + removeGeneralWait(); +} + +// Disconnected from an anonymous session +function anonymousDisconnected() { + logThis('Jappix (anonymous) is now disconnected.', 3); +} + +// Logins to a anonymous account +function anonymousLogin(server) { + try { + // We define the http binding parameters + oArgs = new Object(); + + if(HOST_BOSH_MAIN) + oArgs.httpbase = HOST_BOSH_MAIN; + else + oArgs.httpbase = HOST_BOSH; + + // We create the new http-binding connection + con = new JSJaCHttpBindingConnection(oArgs); + + // And we handle everything that happen + con.registerHandler('message', handleMessage); + con.registerHandler('presence', handlePresence); + con.registerHandler('iq', handleIQ); + con.registerHandler('onconnect', anonymousConnected); + con.registerHandler('onerror', handleError); + con.registerHandler('ondisconnect', anonymousDisconnected); + + // We set the anonymous connection parameters + oArgs = new Object(); + oArgs.domain = server; + oArgs.authtype = 'saslanon'; + oArgs.resource = JAPPIX_RESOURCE + ' Anonymous (' + (new Date()).getTime() + ')'; + oArgs.secure = true; + oArgs.xmllang = XML_LANG; + + // We connect ! + con.connect(oArgs); + + // Change the page title + pageTitle('wait'); + } + + catch(e) { + // Logs errors + logThis('Error while anonymous loggin in: ' + e, 1); + + // Reset Jappix + anonymousDisconnected(); + + // Open an unknown error + openThisError(2); + } + + finally { + return false; + } +} + +// Plugin launcher +function launchAnonymous() { + logThis('Anonymous mode detected, connecting...', 3); + + // We add the login wait div + showGeneralWait(); + + // Get the vars + if(LINK_VARS['r']) + ANONYMOUS_ROOM = LINK_VARS['r']; + if(LINK_VARS['n']) + ANONYMOUS_NICK = LINK_VARS['n']; + + // Fire the login action + anonymousLogin(HOST_ANONYMOUS); +} + +// Launch this plugin! +$(document).ready(launchAnonymous); diff --git a/sources/addons/jappixmini/jappix/js/archives.js b/sources/addons/jappixmini/jappix/js/archives.js new file mode 100644 index 00000000..387a379f --- /dev/null +++ b/sources/addons/jappixmini/jappix/js/archives.js @@ -0,0 +1,418 @@ +/* + +Jappix - An open social platform +These are the archives functions for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 03/03/11 + +*/ + +// Opens the archive tools +function openArchives() { + // Popup HTML content + var html = + '
' + _e("Message archives") + '
' + + + '
' + + '
' + + '' + + + '
' + + '
' + + + '
' + + '' + + '' + _e("Please select a friend to view the chat history.") + '' + + '
' + + + '
' + + '
' + + + '
' + + '
' + + + '' + _e("Close") + '' + + '
'; + + // Create the popup + createPopup('archives', html); + + // Associate the events + launchArchives(); + + // Get all the buddies in our roster + var buddies = getAllBuddies(); + var options = ''; + + for(i in buddies) { + var current = buddies[i]; + + // Add the current buddy + options += ''; + } + + // Can append the buddy HTML code? + if(options) + $('#archives .filter .friend').append(options); + + return false; +} + +// Closes the archive tools +function closeArchives() { + // Destroy the popup + destroyPopup('archives'); + + return false; +} + +// Gets the archives list for a buddy +function getListArchives(xid) { + // Reset the archives viewer + $('#archives .logs').empty(); + + // Show the waiting icon + $('#archives .wait').show(); + + // Apply the ID + var id = genID(); + $('#archives').attr('data-session', id); + + // New IQ + var iq = new JSJaCIQ(); + iq.setType('get'); + iq.setID(id); + + var list = iq.appendNode('list', {'xmlns': NS_URN_ARCHIVE, 'with': xid}); + var set = list.appendChild(iq.buildNode('set', {'xmlns': NS_RSM})); + set.appendChild(iq.buildNode('max', {'xmlns': NS_RSM}, '0')); + + con.send(iq, handleListArchives); + + logThis('Getting archives list for: ' + xid + '...'); +} + +// Handles the archives list for a buddy +function handleListArchives(iq) { + // Hide the waiting icon + $('#archives .wait').hide(); + + // Any error? + if(handleErrorReply(iq) || !exists('#archives[data-session=' + iq.getID() + ']')) + return; + + // Get the last archive date + var last = $(iq.getNode()).find('list set changed').text(); + + // Any last archive? + if(last) { + // Read the date + var date = Date.jab2date(last); + + // Change the datepicker value + $('#archives .filter .date').DatePickerSetDate(date, true); + + // Retrieve the archives + checkChangeArchives(); + } + + logThis('Got archives list.', 2); +} + +// Gets the archives for a day +function getDayArchives(xid, date) { + // Reset the archives viewer + $('#archives .logs').empty(); + + // Show the waiting icon + $('#archives .wait').show(); + + // Apply the ID + var id = genID(); + $('#archives').attr('data-session', id); + + // New IQ + var iq = new JSJaCIQ(); + iq.setType('get'); + iq.setID(id); + + iq.appendNode('list', {'xmlns': NS_URN_ARCHIVE, 'with': xid, 'start': date + 'T00:00:00Z', 'end': date + 'T23:59:59Z'}); + + con.send(iq, handleDayArchives); + + logThis('Getting day archives (' + date + ') for: ' + xid + '...'); +} + +// Handles the archives for a day +function handleDayArchives(iq) { + // Hide the waiting icon + $('#archives .wait').hide(); + + // Any error? + if(handleErrorReply(iq) || !exists('#archives[data-session=' + iq.getID() + ']')) + return; + + // Get each archive thread + $(iq.getNode()).find('chat').each(function() { + // Current values + var xid = $(this).attr('with'); + var start = $(this).attr('start'); + + if(xid && start) + $('#archives .logs').append(''); + }); + + // Display the day + var date = parseDay($('#archives .filter .date').DatePickerGetDate(true) + 'T00:00:00Z' + getDateTZO()); + + // Try to get the first thread + var pending = '#archives input.archives-pending:first'; + + if(!exists(pending)) + date = printf(_e("Nothing found for: %s"), date); + + else { + retrieveArchives($(pending).attr('data-with'), $(pending).attr('data-start')); + $(pending).remove(); + } + + $('#archives .current .time').text(date); + + logThis('Got day archives.', 2); +} + +// Retrieves a specified archive collection +function retrieveArchives(xid, start) { + // Show the waiting icon + $('#archives .wait').show(); + + // Apply the ID + var id = genID(); + $('#archives').attr('data-session', id); + + // New IQ + var iq = new JSJaCIQ(); + iq.setType('get'); + iq.setID(id); + + var list = iq.appendNode('retrieve', {'xmlns': NS_URN_ARCHIVE, 'with': xid, 'start': start}); + + con.send(iq, handleRetrieveArchives); + + logThis('Retrieving archives (start: ' + start + ') for: ' + xid + '...'); +} + +// Handles a specified archive collection +function handleRetrieveArchives(iq) { + // Hide the waiting icon + $('#archives .wait').hide(); + + // Any error? + if(handleErrorReply(iq) || !exists('#archives[data-session=' + iq.getID() + ']')) + return; + + // Get the node + var chat = $(iq.getNode()).find('chat:first'); + + // Get the buddy XID + var xid = bareXID(chat.attr('with')); + + // Get the start date & stamp + var start_date = Date.jab2date(chat.attr('start')); + var start_stamp = extractStamp(start_date); + + // Parse the result chat + chat.find('to, from').each(function() { + var node = (this).nodeName; + var stamp = start_stamp + parseInt($(this).attr('secs')); + var date = extractTime(new Date(stamp * 1000)); + var body = $(this).find('body').text(); + + // Is it my message? + if((node == 'to') && body) + displayMessage('chat', getXID(), 'archives', getBuddyName(getXID()).htmlEnc(), body, date, start_stamp, 'user-message', true, '', 'me'); + + // Is it a buddy message? + else if((node == 'from') && body) + displayMessage('chat', xid, 'archives', getBuddyName(xid).htmlEnc(), body, date, start_stamp, 'user-message', true, '', 'him'); + }); + + // Not the latest thread? + var pending = '#archives input.archives-pending:first'; + + if(exists(pending)) { + retrieveArchives($(pending).attr('data-with'), $(pending).attr('data-start')); + $(pending).remove(); + } + + // Everything has been retrieved, get the avatars + else { + getAvatar(getXID(), 'cache', 'true', 'forget'); + getAvatar(xid, 'cache', 'true', 'forget'); + } + + logThis('Got archives.', 2); +} + +// Gets the archiving configuration +function getConfigArchives() { + // Lock the archiving options + $('#archiving').attr('checked', false).attr('disabled', true); + + // Get the archiving configuration + var iq = new JSJaCIQ(); + iq.setType('get'); + + iq.appendNode('pref', {'xmlns': NS_URN_ARCHIVE}); + + con.send(iq, handleGetConfigArchives); +} + +// Handles the archiving configuration +function handleGetConfigArchives(iq) { + // Reset the options stuffs + waitOptions('archives'); + + // Unlock the archiving options + $('#archiving').removeAttr('disabled'); + + // End if not a result + if(!iq || (iq.getType() != 'result')) + return; + + // Extract the preferences from the IQ + var enabled = $(iq.getNode()).find('pref auto').attr('save'); + + // Define the input enabling/disabling vars + var checked = true; + + if(enabled != 'true') + checked = false; + + // Apply the values + $('#archiving').attr('checked', checked); +} + +// Configures the archiving on the server +function configArchives(enabled) { + // Configure the auto element + var iq = new JSJaCIQ(); + iq.setType('set'); + + iq.appendNode('auto', {'xmlns': NS_URN_ARCHIVE, 'save': enabled}); + + con.send(iq, handleConfigArchives); + + // Configure the default element + var iq = new JSJaCIQ(); + iq.setType('set'); + + var pref = iq.appendNode('pref', {'xmlns': NS_URN_ARCHIVE}); + pref.appendChild(iq.appendNode('default', {'xmlns': NS_URN_ARCHIVE, 'otr': 'concede', 'save': 'body'})); + + con.send(iq); + + // Configure the method element + var iq = new JSJaCIQ(); + iq.setType('set'); + + var mType = new Array('auto', 'local', 'manual'); + var mUse = new Array('prefer', 'concede', 'concede'); + + var pref = iq.appendNode('pref', {'xmlns': NS_URN_ARCHIVE}); + + for(i in mType) + pref.appendChild(iq.appendNode('method', {'xmlns': NS_URN_ARCHIVE, 'type': mType[i], 'use': mUse[i]})); + + con.send(iq); + + // Logger + logThis('Configuring archives...', 3); +} + +// Handles the archives configuration +function handleConfigArchives(iq) { + if(!iq || (iq.getType() != 'result')) + logThis('Archives not configured.', 2); + else + logThis('Archives configured.', 3); +} + +// Checks if the datepicker has changed +function checkChangeArchives() { + var xid = $('#archives .filter .friend').val(); + var date = $('#archives .filter .date').DatePickerGetDate(true); + + // No XID? + if(!xid || !xid.length) + return; + + // Too many value? + if(xid.length > 1) { + $('#archives .filter .friend').val(xid[0]); + + return; + } + + // Get the first XID + xid = xid[0]; + + // Get the archives + getDayArchives(xid, date); +} + +// Update the archives with the selected XID +function updateArchives() { + // Read the values + var xid = $('#archives .filter .friend').val(); + var date = $('#archives .filter .date').DatePickerGetDate(true); + + // No XID? + if(!xid || !xid.length) + return; + + // Too many value? + if(xid.length > 1) { + $('#archives .filter .friend').val(xid[0]); + + return; + } + + // Get the first XID + xid = xid[0]; + + // Apply the current marker + $('#archives .current .name').text(getBuddyName(xid)); + $('#archives .current .time').text(parseDay(date + 'T00:00:00Z' + getDateTZO())); + + // Get the archives + getListArchives(xid, date); +} + +// Plugin launcher +function launchArchives() { + // Current date + var current_date = explodeThis('T', getXMPPTime(), 0); + + // Datepicker + $('#archives .filter .date').DatePicker({ + flat: true, + date: current_date, + current: current_date, + calendars: 1, + starts: 1, + onChange: checkChangeArchives + }); + + // Click events + $('#archives .bottom .finish').click(function() { + return closeArchives(); + }); + + // Change event + $('#archives .filter .friend').change(updateArchives); +} diff --git a/sources/addons/jappixmini/jappix/js/audio.js b/sources/addons/jappixmini/jappix/js/audio.js new file mode 100644 index 00000000..f83583a9 --- /dev/null +++ b/sources/addons/jappixmini/jappix/js/audio.js @@ -0,0 +1,46 @@ +/* + +Jappix - An open social platform +These are the audio JS scripts for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 10/08/11 + +*/ + +// Plays the given sound ID +function soundPlay(num) { + try { + // Not supported! + if((BrowserDetect.browser == 'Explorer') && (BrowserDetect.version < 9)) + return false; + + // If the sounds are enabled + if(getDB('options', 'sounds') == '1') { + // If the audio elements aren't yet in the DOM + if(!exists('#audio')) { + $('body').append( + '
' + + '
' + ); + } + + // We play the target sound + var playThis = document.getElementById('audio').getElementsByTagName('audio')[num]; + playThis.load(); + playThis.play(); + } + } + + catch(e) {} + + finally { + return false; + } +} diff --git a/sources/addons/jappixmini/jappix/js/autocompletion.js b/sources/addons/jappixmini/jappix/js/autocompletion.js new file mode 100644 index 00000000..52d3c47e --- /dev/null +++ b/sources/addons/jappixmini/jappix/js/autocompletion.js @@ -0,0 +1,99 @@ +/* + +Jappix - An open social platform +These are the autocompletion tools JS script for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 12/11/10 + +*/ + +// Sort an array with insensitivity to the case +function caseInsensitiveSort(a, b) { + // Put the two strings into lower case + a = a.toLowerCase(); + b = b.toLowerCase(); + + // Process the sort + if(a > b) + return 1; + if(a < b) + return -1; +} + +// Creates an array with the autocompletion results +function processAutocompletion(query, id) { + // Replace forbidden characters in regex + query = escapeRegex(query); + + // Create an empty array + var results = new Array(); + + // Search in the roster + $('#' + id + ' .user').each(function() { + var nick = $(this).find('.name').text(); + var regex = new RegExp('(^)' + query, 'gi'); + + if(nick.match(regex)) + results.push(nick); + }); + + // Sort the array + results = results.sort(caseInsensitiveSort); + + // Return the results array + return results; +} + +// Resets the autocompletion tools +function resetAutocompletion(hash) { + $('#' + hash + ' .message-area').removeAttr('data-autocompletion-pointer').removeAttr('data-autocompletion-query'); +} + +// Autocompletes the chat input nick +function createAutocompletion(hash) { + // Initialize + var vSelector = $('#' + hash + ' .message-area'); + var value = vSelector.val(); + if(!value) + resetAutocompletion(hash); + var query = vSelector.attr('data-autocompletion-query'); + + // The autocompletion has not been yet launched + if(query == undefined) { + query = value; + vSelector.attr('data-autocompletion-query', query); + } + + // Get the pointer + var pointer = vSelector.attr('data-autocompletion-pointer'); + var i = 0; + + if(pointer) + i = parseInt(pointer); + + // We get the nickname + var nick = processAutocompletion(query, hash)[i]; + + // Shit, this is my nick! + if((nick != undefined) && (nick.toLowerCase() == getMUCNick(hash).toLowerCase())) { + // Increment + i++; + + // Get the next nick + nick = processAutocompletion(query, hash)[i]; + } + + // We quote the nick + if(nick != undefined) { + // Increment + i++; + quoteMyNick(hash, nick); + + // Put a pointer + vSelector.attr('data-autocompletion-pointer', i); + } +} diff --git a/sources/addons/jappixmini/jappix/js/avatar.js b/sources/addons/jappixmini/jappix/js/avatar.js new file mode 100644 index 00000000..4234ffc7 --- /dev/null +++ b/sources/addons/jappixmini/jappix/js/avatar.js @@ -0,0 +1,205 @@ +/* + +Jappix - An open social platform +These are the avatar JS scripts for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 01/03/11 + +*/ + +// Requests the avatar of a given user +var AVATAR_PENDING = []; + +function getAvatar(xid, mode, enabled, photo) { + /* REF: http://xmpp.org/extensions/xep-0153.html */ + + // No need to get the avatar, another process is yet running + if(existArrayValue(AVATAR_PENDING, xid)) + return false; + + // Initialize: XML data is in one SQL entry, because some browser are sloooow with SQL requests + var xml = XMLFromString(getPersistent('avatar', xid)); + var forced = false; + + // Retrieving forced? + if($(xml).find('forced').text() == 'true') + forced = true; + + // No avatar in presence + if(!photo && !forced && (enabled == 'true')) { + // Pending marker + AVATAR_PENDING.push(xid); + + // Reset the avatar + resetAvatar(xid, hex_md5(xid)); + + logThis('No avatar for: ' + xid, 2); + } + + // Try to catch the avatar + else { + // Define some stuffs + var type = $(xml).find('type').text(); + var binval = $(xml).find('binval').text(); + var checksum = $(xml).find('checksum').text(); + var updated = false; + + // Process the checksum of the avatar + if((checksum == photo) || (photo == 'forget') || forced) + updated = true; + + // If the avatar is yet stored and a new retrieving is not needed + if((mode == 'cache') && type && binval && checksum && updated) { + // Pending marker + AVATAR_PENDING.push(xid); + + // Display the cache avatar + displayAvatar(xid, hex_md5(xid), type, binval); + + logThis('Read avatar from cache: ' + xid, 3); + } + + // Else if the request has not yet been fired, we get it + else if((!updated || (mode == 'cache' && !updated) || (mode == 'force') || (photo = 'forget')) && (enabled != 'false')) { + // Pending marker + AVATAR_PENDING.push(xid); + + // Get the latest avatar + var iq = new JSJaCIQ(); + iq.setType('get'); + iq.setTo(xid); + + iq.appendNode('vCard', {'xmlns': NS_VCARD}); + + con.send(iq, handleAvatar); + + logThis('Get avatar from server: ' + xid, 3); + } + } + + return true; +} + +// Handles the avatar +function handleAvatar(iq) { + // Extract the XML values + var handleXML = iq.getNode(); + var handleFrom = fullXID(getStanzaFrom(iq)); + + // Is this me? Remove the resource! + if(bareXID(handleFrom) == getXID()) + handleFrom = bareXID(handleFrom); + + // Get some other values + var hash = hex_md5(handleFrom); + var find = $(handleXML).find('vCard'); + var aChecksum = 'none'; + var oChecksum = null; + + // Read our own checksum + if(handleFrom == getXID()) { + oChecksum = getDB('checksum', 1); + + // Avoid the "null" value + if(!oChecksum) + oChecksum = ''; + } + + // vCard not empty? + if(find.size()) { + // We get our profile details + if(handleFrom == getXID()) { + // Get the names + var names = generateBuddyName(iq); + + // Write the values to the database + setDB('profile', 'name', names[0]); + setDB('profile', 'nick', names[1]); + } + + // We get the avatar + var aType = find.find('TYPE:first').text(); + var aBinval = find.find('BINVAL:first').text(); + + // No binval? + if(!aBinval) { + aType = 'none'; + aBinval = 'none'; + } + + // Enough data + else { + // No type? + if(!aType) + aType = 'image/png'; + + // Process the checksum + else + aChecksum = hex_sha1(Base64.decode(aBinval)); + } + + // We display the user avatar + displayAvatar(handleFrom, hash, aType, aBinval); + + // Store the avatar + setPersistent('avatar', handleFrom, '' + aType + '' + aBinval + '' + aChecksum + 'false'); + + logThis('Avatar retrieved from server: ' + handleFrom, 3); + } + + // vCard is empty + else + resetAvatar(handleFrom); + + // We got a new checksum for us? + if(((oChecksum != null) && (oChecksum != aChecksum)) || !FIRST_PRESENCE_SENT) { + // Define a proper checksum + var pChecksum = aChecksum; + + if(pChecksum == 'none') + pChecksum = ''; + + // Update our temp. checksum + setDB('checksum', 1, pChecksum); + + // Send the stanza + if(FIRST_PRESENCE_SENT) + presenceSend(pChecksum); + else + getStorage(NS_OPTIONS); + } +} + +// Reset the avatar of an user +function resetAvatar(xid, hash) { + // Store the empty avatar + setPersistent('avatar', xid, 'nonenonenonefalse'); + + // Display the empty avatar + displayAvatar(xid, hash, 'none', 'none'); +} + +// Displays the avatar of an user +function displayAvatar(xid, hash, type, binval) { + // Initialize the vars + var container = hash + ' .avatar-container'; + var code = ''; + + // Replace with the new avatar (in the roster and in the chat) + $('.' + container).html(code); + + // We can remove the pending marker + removeArrayValue(AVATAR_PENDING, xid); +} diff --git a/sources/addons/jappixmini/jappix/js/base64.js b/sources/addons/jappixmini/jappix/js/base64.js new file mode 100644 index 00000000..1cf2dc74 --- /dev/null +++ b/sources/addons/jappixmini/jappix/js/base64.js @@ -0,0 +1,80 @@ +// This code was written by Tyler Akins and has been placed in the +// public domain. It would be nice if you left this header intact. +// Base64 code from Tyler Akins -- http://rumkin.com + +var Base64 = (function () { + var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + + var obj = { + /** + * Encodes a string in base64 + * @param {String} input The string to encode in base64. + */ + encode: function (input) { + var output = ""; + var chr1, chr2, chr3; + var enc1, enc2, enc3, enc4; + var i = 0; + + do { + chr1 = input.charCodeAt(i++); + chr2 = input.charCodeAt(i++); + chr3 = input.charCodeAt(i++); + + enc1 = chr1 >> 2; + enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); + enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); + enc4 = chr3 & 63; + + if (isNaN(chr2)) { + enc3 = enc4 = 64; + } else if (isNaN(chr3)) { + enc4 = 64; + } + + output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + + keyStr.charAt(enc3) + keyStr.charAt(enc4); + } while (i < input.length); + + return output; + }, + + /** + * Decodes a base64 string. + * @param {String} input The string to decode. + */ + decode: function (input) { + var output = ""; + var chr1, chr2, chr3; + var enc1, enc2, enc3, enc4; + var i = 0; + + // remove all characters that are not A-Z, a-z, 0-9, +, /, or = + input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); + + do { + enc1 = keyStr.indexOf(input.charAt(i++)); + enc2 = keyStr.indexOf(input.charAt(i++)); + enc3 = keyStr.indexOf(input.charAt(i++)); + enc4 = keyStr.indexOf(input.charAt(i++)); + + chr1 = (enc1 << 2) | (enc2 >> 4); + chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); + chr3 = ((enc3 & 3) << 6) | enc4; + + output = output + String.fromCharCode(chr1); + + if (enc3 != 64) { + output = output + String.fromCharCode(chr2); + } + if (enc4 != 64) { + output = output + String.fromCharCode(chr3); + } + } while (i < input.length); + + return output; + } + }; + + return obj; +})(); diff --git a/sources/addons/jappixmini/jappix/js/board.js b/sources/addons/jappixmini/jappix/js/board.js new file mode 100644 index 00000000..1d26acee --- /dev/null +++ b/sources/addons/jappixmini/jappix/js/board.js @@ -0,0 +1,141 @@ +/* + +Jappix - An open social platform +These are the notification board JS script for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 12/03/11 + +*/ + +// Creates a board panel +function createBoard(type, id) { + // Text var + var text = ''; + + // Info + if(type == 'info') { + switch(id) { + // Password change + case 1: + text = _e("Your password has been changed, now you can connect to your account with your new login data."); + + break; + + // Account deletion + case 2: + text = _e("Your XMPP account has been removed, bye!"); + + break; + + // Account logout + case 3: + text = _e("You have been logged out of your XMPP account, have a nice day!"); + + break; + + // Groupchat join + case 4: + text = _e("The room you joined seems not to exist. You should create it!"); + + break; + + // Groupchat removal + case 5: + text = _e("The groupchat has been removed, now someone else will be able to recreate it."); + + break; + + // Non-existant groupchat user + case 6: + text = _e("The user that you want to reach is not present in the room."); + + break; + } + } + + // Error + else { + switch(id) { + // Custom error + case 1: + text = '' + _e("Error") + ' » '; + + break; + + // Network error + case 2: + text = _e("Jappix has been interrupted by a network issue, a bug or bad login (check that you entered the right credentials), sorry for the inconvenience."); + + break; + + // List retrieving error + case 3: + text = _e("The element list on this server could not be obtained!"); + + break; + + // Attaching error + case 4: + text = printf(_e("An error occured while uploading your file: maybe it is too big (%s maximum) or forbidden!"), JAPPIX_MAX_UPLOAD); + + break; + } + } + + // No text? + if(!text) + return false; + + // Append the content + $('#board').append('
' + text + '
'); + + // Events (click and auto-hide) + $('#board .one-board.' + type + '[data-id=' + id + ']') + + .click(function() { + closeThisBoard(this); + }) + + .oneTime('5s', function() { + closeThisBoard(this); + }) + + .slideDown(); + + return true; +} + +// Destroys the existing board notifications +function destroyBoard() { + $('#board').empty(); +} + +// Executes a given action on the notification board +function actionBoard(id, type) { + // In a first, we destroy other boards + destroyBoard(); + + // Then we display the board + createBoard(type, id); +} + +// Opens a given error ID +function openThisError(id) { + actionBoard(id, 'error'); +} + +// Opens a given info ID +function openThisInfo(id) { + actionBoard(id, 'info'); +} + +// Closes a given board +function closeThisBoard(board) { + $(board).slideUp('normal', function() { + $(this).remove(); + }); +} diff --git a/sources/addons/jappixmini/jappix/js/browser-detect.js b/sources/addons/jappixmini/jappix/js/browser-detect.js new file mode 100644 index 00000000..39edaf2b --- /dev/null +++ b/sources/addons/jappixmini/jappix/js/browser-detect.js @@ -0,0 +1,124 @@ +/* BROWSER DETECT + * http://www.quirksmode.org/js/detect.html + */ + +var BrowserDetect = { + init: function () { + this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; + this.version = this.searchVersion(navigator.userAgent) + || this.searchVersion(navigator.appVersion) + || "an unknown version"; + this.OS = this.searchString(this.dataOS) || "an unknown OS"; + }, + + searchString: function (data) { + for (var i=0;i ' + _e("no subject defined for this room.") + '

'; + specialCode = '

' + _e("Moderators") + '

' + _e("Participants") + '

' + _e("Visitors") + '

' + _e("Others") + '

'; + specialLink = ''; + specialStyle = ''; + + // Is this a gateway? + if(xid.match(/%/)) + specialDisabled = ''; + else + specialDisabled = ' disabled=""'; + } + + // Chat (or other things?!) special code + else { + specialAttributes = ' data-type="chat"'; + specialAvatar = '
'; + specialName = '

'; + specialCode = '
'; + specialLink = ''; + specialStyle = ' style="display: none;"'; + specialDisabled = ''; + } + + // Not a groupchat private chat, we can use the buddy add icon + if((type == 'chat') || (type == 'groupchat')) { + var addTitle; + + if(type == 'chat') + addTitle = _e("Add this contact to your friends"); + else + addTitle = _e("Add this groupchat to your favorites"); + + specialLink += ''; + } + + // IE DOM parsing bug fix + var specialStylePicker = '
' + + '' + + '
'; + + if((BrowserDetect.browser == 'Explorer') && (BrowserDetect.version < 9)) + specialStylePicker = ''; + + // Append the chat HTML code + $('#page-engine').append( + '
' + + '
' + + specialAvatar + + + '
' + + '

' + nick.htmlEnc() + '

' + + specialName + + '
' + + '
' + + + specialCode + + + '
' + + '' + + + '
' + + '' + + '
' + + '
' + + '
' + ); + + // Click event: chat cleaner + $(path + 'tools-clear').click(function() { + cleanChat(id); + }); + + // Click event: user-infos + $(path + 'tools-infos').click(function() { + openUserInfos(xid); + }); +} + +// Generates the chat switch elements +function generateSwitch(type, id, xid, nick) { + // Path to the element + var chat_switch = '#page-switch .'; + + // Special code + var specialClass = ' unavailable'; + var show_close = true; + + // Groupchat + if(type == 'groupchat') { + specialClass = ' groupchat-default'; + + if(isAnonymous() && (xid == generateXID(ANONYMOUS_ROOM, 'groupchat'))) + show_close = false; + } + + // Generate the HTML code + var html = '
' + + '
' + + + '
' + nick.htmlEnc() + '
'; + + // Show the close button if not MUC and not anonymous + if(show_close) + html += '
x
'; + + // Close the HTML + html += '
'; + + // Append the HTML code + $(chat_switch + 'chans, ' + chat_switch + 'more-content').append(html); +} + +// Cleans given the chat lines +function cleanChat(chat) { + $('#page-engine #' + chat + ' .content .one-group').remove(); + + $(document).oneTime(10, function() { + $('#page-engine #' + chat + ' .text .message-area').focus(); + }); +} + +// Creates a new chat +function chatCreate(hash, xid, nick, type) { + logThis('New chat: ' + xid, 3); + + // Create the chat content + generateChat(type, hash, xid, nick); + + // Create the chat switcher + generateSwitch(type, hash, xid, nick); + + // If the user is not in our buddy-list + if(type == 'chat') { + // Add button + if(!exists('#buddy-list .buddy[data-xid=' + escape(xid) + ']')) + $('#' + hash + ' .tools-add').click(function() { + // Hide the icon (to tell the user all is okay) + $(this).hide(); + + // Send the subscribe request + addThisContact(xid, nick); + }).show(); + + // Archives button + else if(enabledArchives() || enabledArchives('auto') || enabledArchives('manual') || enabledArchives('manage')) + $('#' + hash + ' .tools-archives').click(function() { + // Open the archives popup + openArchives(); + + // Get the archives for this user + $('#archives .filter .friend').val(xid); + updateArchives(); + }).show(); + } + + // We catch the user's informations (like this avatar, vcard, and so on...) + getUserInfos(hash, xid, nick, type); + + // The icons-hover functions + tooltipIcons(xid, hash); + + // The event handlers + var inputDetect = $('#page-engine #' + hash + ' .message-area'); + + inputDetect.focus(function() { + chanCleanNotify(hash); + }) + + inputDetect.keypress(function(e) { + // Enter key + if(e.keyCode == 13) { + // Add a new line + if(e.shiftKey) + inputDetect.val(inputDetect.val() + '\n'); + + // Send the message + else { + // Send the message + sendMessage(hash, 'chat'); + + // Reset the composing database entry + setDB('chatstate', xid, 'off'); + } + + return false; + } + }); + + // Chatstate events + eventsChatState(inputDetect, xid, hash); +} diff --git a/sources/addons/jappixmini/jappix/js/chatstate.js b/sources/addons/jappixmini/jappix/js/chatstate.js new file mode 100644 index 00000000..de7e7966 --- /dev/null +++ b/sources/addons/jappixmini/jappix/js/chatstate.js @@ -0,0 +1,174 @@ +/* + +Jappix - An open social platform +These are the chatstate JS script for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 25/08/11 + +*/ + +// Sends a given chatstate to a given entity +function chatStateSend(state, xid, hash) { + var user_type = $('#' + hash).attr('data-type'); + + // If the friend client supports chatstates and is online + if((user_type == 'groupchat') || ((user_type == 'chat') && $('#' + hash + ' .message-area').attr('data-chatstates') && !exists('#page-switch .' + hash + ' .unavailable'))) { + // Already sent? + if(getDB('currentchatstate', xid) == state) + return; + + // Write the state + setDB('currentchatstate', xid, state); + + // New message stanza + var aMsg = new JSJaCMessage(); + aMsg.setTo(xid); + aMsg.setType(user_type); + + // Append the chatstate node + aMsg.appendNode(state, {'xmlns': NS_CHATSTATES}); + + // Send this! + con.send(aMsg); + } +} + +// Displays a given chatstate in a given chat +function displayChatState(state, hash, type) { + // Groupchat? + if(type == 'groupchat') { + resetChatState(hash, type); + + // "gone" state not allowed + if(state != 'gone') + $('#page-engine .page-engine-chan .user.' + hash).addClass(state); + } + + // Chat + else { + // We change the buddy name color in the page-switch + resetChatState(hash, type); + $('#page-switch .' + hash + ' .name').addClass(state); + + // We generate the chatstate text + var text = ''; + + switch(state) { + // Active + case 'active': + text = _e("Your friend is paying attention to the conversation."); + + break; + + // Composing + case 'composing': + text = _e("Your friend is writing a message..."); + + break; + + // Paused + case 'paused': + text = _e("Your friend stopped writing a message."); + + break; + + // Inactive + case 'inactive': + text = _e("Your friend is doing something else."); + + break; + + // Gone + case 'gone': + text = _e("Your friend closed the chat."); + + break; + } + + // We reset the previous state + $('#' + hash + ' .chatstate').remove(); + + // We create the chatstate + $('#' + hash + ' .content').after('
' + text + '
'); + } +} + +// Resets the chatstate switcher marker +function resetChatState(hash, type) { + // Define the selector + var selector; + + if(type == 'groupchat') + selector = $('#page-engine .page-engine-chan .user.' + hash); + else + selector = $('#page-switch .' + hash + ' .name'); + + // Reset! + selector.removeClass('active') + selector.removeClass('composing') + selector.removeClass('paused') + selector.removeClass('inactive') + selector.removeClass('gone'); +} + +// Adds the chatstate events +function eventsChatState(target, xid, hash) { + target.keyup(function(e) { + if(e.keyCode != 13) { + // Composing a message + if($(this).val() && (getDB('chatstate', xid) != 'on')) { + // We change the state detect input + setDB('chatstate', xid, 'on'); + + // We send the friend a "composing" chatstate + chatStateSend('composing', xid, hash); + } + + // Stopped composing a message + else if(!$(this).val() && (getDB('chatstate', xid) == 'on')) { + // We change the state detect input + setDB('chatstate', xid, 'off'); + + // We send the friend an "active" chatstate + chatStateSend('active', xid, hash); + } + } + }); + + target.change(function() { + // Reset the composing database entry + setDB('chatstate', xid, 'off'); + }); + + target.focus(function() { + // Not needed + if(target.is(':disabled')) + return; + + // Nothing in the input, user is active + if(!$(this).val()) + chatStateSend('active', xid, hash); + + // Something was written, user started writing again + else + chatStateSend('composing', xid, hash); + }); + + target.blur(function() { + // Not needed + if(target.is(':disabled')) + return; + + // Nothing in the input, user is inactive + if(!$(this).val()) + chatStateSend('inactive', xid, hash); + + // Something was written, user paused + else + chatStateSend('paused', xid, hash); + }); +} diff --git a/sources/addons/jappixmini/jappix/js/common.js b/sources/addons/jappixmini/jappix/js/common.js new file mode 100644 index 00000000..ab10d6e7 --- /dev/null +++ b/sources/addons/jappixmini/jappix/js/common.js @@ -0,0 +1,311 @@ +/* + +Jappix - An open social platform +These are the common JS script for Jappix + +------------------------------------------------- + +License: AGPL +Authors: Vanaryon, olivierm +Last revision: 24/06/11 + +*/ + +// Checks if an element exists in the DOM +function exists(selector) { + if(jQuery(selector).size() > 0) + return true; + else + return false; +} + +// Checks if Jappix is connected +function isConnected() { + if((typeof con != 'undefined') && con && con.connected()) + return true; + + return false; +} + +// Checks if Jappix has focus +function isFocused() { + try { + if(document.hasFocus()) + return true; + + return false; + } + + catch(e) { + return true; + } +} + +// Generates the good XID +function generateXID(xid, type) { + // XID needs to be transformed + if(xid && (xid.indexOf('@') == -1)) { + // Groupchat + if(type == 'groupchat') + return xid + '@' + HOST_MUC; + + // One-to-one chat + if(xid.indexOf('.') == -1) + return xid + '@' + HOST_MAIN; + + // It might be a gateway? + return xid; + } + + // Nothing special (yet bare XID) + return xid; +} + +// Gets the asked translated string +function _e(string) { + return string; +} + +// Replaces '%s' to a given value for a translated string +function printf(string, value) { + return string.replace('%s', value); +} + +// Properly explodes a string with a given character +function explodeThis(toEx, toStr, i) { + // Get the index of our char to explode + var index = toStr.indexOf(toEx); + + // We split if necessary the string + if(index != -1) { + if(i == 0) + toStr = toStr.substr(0, index); + else + toStr = toStr.substr(index + 1); + } + + // We return the value + return toStr; +} + +// Cuts the resource of a XID +function cutResource(aXID) { + return explodeThis('/', aXID, 0); +} + +// Gets the resource of a XID +function thisResource(aXID) { + // Any resource? + if(aXID.indexOf('/') != -1) + return explodeThis('/', aXID, 1); + + // No resource + return ''; +} + +// Does stringprep on a string +function stringPrep(string) { + // Replacement arrays + var invalid = new Array('Š', 'š', 'Đ', 'đ', 'Ž', 'ž', 'Č', 'č', 'Ć', 'ć', 'À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'Þ', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ý', 'þ', 'ÿ', 'Ŕ', 'ŕ'); + + var valid = new Array('S', 's', 'Dj', 'dj', 'Z', 'z', 'C', 'c', 'C', 'c', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'N', 'O', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'Y', 'B', 'Ss', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'o', 'n', 'o', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'y', 'b', 'y', 'R', 'r'); + + // Compute a new string + for(i in invalid) + string = string.replace(invalid[i], valid[i]); + + return string; +} + +// Encodes quotes in a string +function encodeQuotes(str) { + return (str + '').replace(/"/g, '"'); +} + +// Gets the bare XID from a XID +function bareXID(xid) { + // Cut the resource + xid = cutResource(xid); + + // Launch the stringprep + xid = stringPrep(xid); + + // Set the XID to lower case + xid = xid.toLowerCase(); + + return xid; +} + +// Gets the full XID from a XID +function fullXID(xid) { + // Normalizes the XID + var full = bareXID(xid); + var resource = thisResource(xid); + + // Any resource? + if(resource) + full += '/' + resource; + + return full; +} + +// Gets the nick from a XID +function getXIDNick(aXID) { + return explodeThis('@', aXID, 0); +} + +// Gets the host from a XID +function getXIDHost(aXID) { + return explodeThis('@', aXID, 1); +} + +// Checks if we are in developer mode +function isDeveloper() { + if(DEVELOPER == 'on') + return true; + + return false; +} + +// Checks if anonymous mode is allowed +function allowedAnonymous() { + if(ANONYMOUS == 'on') + return true; + + return false; +} + +// Checks if host is locked +function lockHost() { + if(LOCK_HOST == 'on') + return true; + + return false; +} + +// Gets the full XID of the user +function getXID() { + // Return the XID of the user + if(con.username && con.domain) + return con.username + '@' + con.domain; + + return ''; +} + +// Generates the colors for a given user XID +function generateColor(xid) { + var colors = new Array( + 'ac0000', + 'a66200', + '007703', + '00705f', + '00236b', + '4e005c' + ); + + var number = 0; + + for(var i = 0; i < xid.length; i++) + number += xid.charCodeAt(i); + + var color = '#' + colors[number % (colors.length)]; + + return color; +} + +// Checks if the XID is a gateway +function isGateway(xid) { + if(xid.indexOf('@') != -1) + return false; + + return true; +} + +// Gets the from attribute of a stanza (overrides some servers like Prosody missing from attributes) +function getStanzaFrom(stanza) { + var from = stanza.getFrom(); + + // No from, we assume this is our XID + if(!from) + from = getXID(); + + return from; +} + +// Logs a given data in the console +function logThis(data, level) { + // Console not available + if(!isDeveloper() || (typeof(console) == 'undefined')) + return false; + + // Switch the log level + switch(level) { + // Debug + case 0: + console.debug(data); + + break; + + // Error + case 1: + console.error(data); + + break; + + // Warning + case 2: + console.warn(data); + + break; + + // Information + case 3: + console.info(data); + + break; + + // Default log level + default: + console.log(data); + + break; + } + + return true; +} + +// Gets the current Jappix app. location +function getJappixLocation() { + var url = window.location.href; + + // If the URL has variables, remove them + if(url.indexOf('?') != -1) + url = url.split('?')[0]; + if(url.indexOf('#') != -1) + url = url.split('#')[0]; + + // No "/" at the end + if(!url.match(/(.+)\/$/)) + url += '/'; + + return url; +} + +// Removes spaces at the beginning & the end of a string +function trim(str) { + return str.replace(/^\s+/g,'').replace(/\s+$/g,''); +} + +// Adds a zero to a date when needed +function padZero(i) { + // Negative number (without first 0) + if(i > -10 && i < 0) + return '-0' + (i * -1); + + // Positive number (without first 0) + if(i < 10 && i >= 0) + return '0' + i; + + // All is okay + return i; +} diff --git a/sources/addons/jappixmini/jappix/js/connection.js b/sources/addons/jappixmini/jappix/js/connection.js new file mode 100644 index 00000000..85a718c5 --- /dev/null +++ b/sources/addons/jappixmini/jappix/js/connection.js @@ -0,0 +1,526 @@ +/* + +Jappix - An open social platform +These are the connection JS script for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 29/08/11 + +*/ + +// Does the user login +var CURRENT_SESSION = false; + +function doLogin(lNick, lServer, lPass, lResource, lPriority, lRemember) { + try { + // We remove the not completed class to avoid problems + $('#home .loginer input').removeClass('please-complete'); + + // We add the login wait div + showGeneralWait(); + + // We define the http binding parameters + oArgs = new Object(); + + if(HOST_BOSH_MAIN) + oArgs.httpbase = HOST_BOSH_MAIN; + else + oArgs.httpbase = HOST_BOSH; + + // We create the new http-binding connection + con = new JSJaCHttpBindingConnection(oArgs); + + // And we handle everything that happen + setupCon(con); + + // Generate a resource + var random_resource = getDB('session', 'resource'); + + if(!random_resource) + random_resource = lResource + ' (' + (new Date()).getTime() + ')'; + + // We retrieve what the user typed in the login inputs + oArgs = new Object(); + oArgs.domain = trim(lServer); + oArgs.username = trim(lNick); + oArgs.resource = random_resource; + oArgs.pass = lPass; + oArgs.secure = true; + oArgs.xmllang = XML_LANG; + + // Store the resource (for reconnection) + setDB('session', 'resource', random_resource); + + // Generate a session XML to be stored + session_xml = 'true' + lServer.htmlEnc() + '' + lNick.htmlEnc() + '' + lResource.htmlEnc() + '' + lPass.htmlEnc() + '' + lPriority.htmlEnc() + ''; + + // Save the session parameters (for reconnect if network issue) + CURRENT_SESSION = session_xml; + + // Remember me? + if(lRemember) + setDB('remember', 'session', 1); + + // We store the infos of the user into the data-base + setDB('priority', 1, lPriority); + + // We connect ! + con.connect(oArgs); + + // Change the page title + pageTitle('wait'); + + logThis('Jappix is connecting...', 3); + } + + catch(e) { + // Logs errors + logThis('Error while logging in: ' + e, 1); + + // Reset Jappix + destroyTalkPage(); + + // Open an unknown error + openThisError(2); + } + + finally { + return false; + } +} + +// Handles the user registration +function handleRegistered() { + logThis('A new account has been registered.', 3); + + // We remove the waiting image + removeGeneralWait(); + + // Reset the title + pageTitle('home'); + + // We show the success information + $('#home .registerer .success').fadeIn('fast'); + + // We quit the session + logout(); +} + +// Does the user registration +function doRegister(username, domain, pass) { + logThis('Trying to register an account...', 3); + + try { + // We define the http binding parameters + oArgs = new Object(); + + if(HOST_BOSH_MAIN) + oArgs.httpbase = HOST_BOSH_MAIN; + else + oArgs.httpbase = HOST_BOSH; + + // We create the new http-binding connection + con = new JSJaCHttpBindingConnection(oArgs); + + // We setup the connection ! + con.registerHandler('onconnect', handleRegistered); + con.registerHandler('onerror', handleError); + + // We retrieve what the user typed in the register inputs + oArgs = new Object(); + oArgs.domain = trim(domain); + oArgs.username = trim(username); + oArgs.resource = JAPPIX_RESOURCE + ' Register (' + (new Date()).getTime() + ')'; + oArgs.pass = pass; + oArgs.register = true; + oArgs.secure = true; + oArgs.xmllang = XML_LANG; + + con.connect(oArgs); + + // We change the registered information text + $('#home .homediv.registerer').append( + '
' + + _e("You have been registered, here is your XMPP address:") + ' ' + con.username.htmlEnc() + '@' + con.domain.htmlEnc() + ' - ' + _e("Login") + '' + + '
' + ); + + // Login link + $('#home .homediv.registerer .success a').click(function() { + return doLogin(con.username, con.domain, con.pass, con.resource, '10', false); + }); + + // Show the waiting image + showGeneralWait(); + + // Change the page title + pageTitle('wait'); + } + + catch(e) { + // Logs errors + logThis(e, 1); + } + + finally { + return false; + } +} + +// Does the user anonymous login +function doAnonymous() { + logThis('Trying to login anonymously...', 3); + + var aPath = '#home .anonymouser '; + var room = $(aPath + '.room').val(); + var nick = $(aPath + '.nick').val(); + + // If the form is correctly completed + if(room && nick) { + // We remove the not completed class to avoid problems + $('#home .anonymouser input').removeClass('please-complete'); + + // Redirect the user to the anonymous room + window.location.href = JAPPIX_LOCATION + '?r=' + room + '&n=' + nick; + } + + // We check if the form is entirely completed + else { + $(aPath + 'input[type=text]').each(function() { + var select = $(this); + + if(!select.val()) + $(document).oneTime(10, function() { + select.addClass('please-complete').focus(); + }); + else + select.removeClass('please-complete'); + }); + } + + return false; +} + +// Handles the user connected event +var CONNECTED = false; + +function handleConnected() { + logThis('Jappix is now connected.', 3); + + // Connection markers + CONNECTED = true; + RECONNECT_TRY = 0; + RECONNECT_TIMER = 0; + + // We hide the home page + $('#home').hide(); + + // Not resumed? + if(!RESUME) { + // Remember the session? + if(getDB('remember', 'session')) + setPersistent('session', 1, CURRENT_SESSION); + + // We show the chatting app. + createTalkPage(); + + // We reset the homepage + switchHome('default'); + + // We get all the other things + getEverything(); + + // Set last activity stamp + LAST_ACTIVITY = getTimeStamp(); + } + + // Resumed + else { + // Send our presence + presenceSend(); + + // Change the title + updateTitle(); + } + + // Remove the waiting item + removeGeneralWait(); +} + +// Handles the user disconnected event +function handleDisconnected() { + logThis('Jappix is now disconnected.', 3); + + // Normal disconnection + if(!CURRENT_SESSION && !CONNECTED) + destroyTalkPage(); +} + +// Setups the normal connection +function setupCon(con) { + // We setup all the necessary handlers for the connection + con.registerHandler('message', handleMessage); + con.registerHandler('presence', handlePresence); + con.registerHandler('iq', handleIQ); + con.registerHandler('onconnect', handleConnected); + con.registerHandler('onerror', handleError); + con.registerHandler('ondisconnect', handleDisconnected); +} + +// Logouts from the server +function logout() { + // We are not connected + if(!isConnected()) + return false; + + // Disconnect from the XMPP server + con.disconnect(); + + logThis('Jappix is disconnecting...', 3); +} + +// Terminates a session +function terminate() { + if(!isConnected()) + return; + + // Clear temporary session storage + resetConMarkers(); + + // Show the waiting item (useful if BOSH is sloooow) + showGeneralWait(); + + // Change the page title + pageTitle('wait'); + + // Disconnect from the XMPP server + logout(); +} + +// Quitss a session +function quit() { + if(!isConnected()) + return; + + // We show the waiting image + showGeneralWait(); + + // Change the page title + pageTitle('wait'); + + // We disconnect from the XMPP server + logout(); +} + +// Creates the reconnect pane +var RECONNECT_TRY = 0; +var RECONNECT_TIMER = 0; + +function createReconnect(mode) { + logThis('This is not a normal disconnection, show the reconnect pane...', 1); + + // Reconnect pane not yet displayed? + if(!exists('#reconnect')) { + // Blur the focused input/textarea/select + $('input, select, textarea').blur(); + + // Create the HTML code + var html = '
' + + '
' + + _e("Due to a network issue, you were disconnected. What do you want to do now?"); + + // Can we cancel reconnection? + if(mode == 'normal') + html += '' + _e("Cancel") + ''; + + html += '' + _e("Reconnect") + '' + + '
'; + + // Append the code + $('body').append(html); + + // Click events + if(mode == 'normal') + $('#reconnect a.finish.cancel').click(function() { + return cancelReconnect(); + }); + + $('#reconnect a.finish.reconnect').click(function() { + return acceptReconnect(mode); + }); + + // Try to reconnect automatically after a while + if(RECONNECT_TRY < 5) + RECONNECT_TIMER = 5 + (5 * RECONNECT_TRY); + else + RECONNECT_TIMER = 120; + + // Change the try number + RECONNECT_TRY++; + + // Fire the event! + $('#reconnect a.finish.reconnect').everyTime('1s', function() { + // We can reconnect! + if(RECONNECT_TIMER == 0) + return acceptReconnect(mode); + + // Button text + if(RECONNECT_TIMER <= 10) + $(this).text(_e("Reconnect") + ' (' + RECONNECT_TIMER + ')'); + + // Remove 1 second + RECONNECT_TIMER--; + }); + + // Page title + updateTitle(); + } +} + +// Reconnects the user if he was disconnected (network issue) +var RESUME = false; + +function acceptReconnect(mode) { + logThis('Trying to reconnect the user...', 3); + + // Resume marker + RESUME = true; + + // Show waiting item + showGeneralWait(); + + // Reset some various stuffs + var groupchats = '#page-engine .page-engine-chan[data-type=groupchat]'; + $(groupchats + ' .list .role').hide(); + $(groupchats + ' .one-group, ' + groupchats + ' .list .user').remove(); + $(groupchats).attr('data-initial', 'false'); + + // Stop the timer + $('#reconnect a.finish.reconnect').stopTime(); + + // Remove the reconnect pane + $('#reconnect').remove(); + + // Try to login again + if(mode == 'normal') + loginFromSession(XMLFromString(CURRENT_SESSION)); + else if(mode == 'anonymous') + anonymousLogin(HOST_ANONYMOUS); + + return false; +} + +// Cancel the reconnection of user account (network issue) +function cancelReconnect() { + logThis('User has canceled automatic reconnection...', 3); + + // Stop the timer + $('#reconnect a.finish.reconnect').stopTime(); + + // Remove the reconnect pane + $('#reconnect').remove(); + + // Destroy the talk page + destroyTalkPage(); + + // Renitialize the previous session parameters + resetConMarkers(); + + return false; +} + +// Clears session reminder database +function clearLastSession() { + // Clear temporary storage + resetConMarkers(); + + // Clear persistent storage + if($(XMLFromString(getPersistent('session', 1))).find('stored').text() == 'true') + removePersistent('session', 1); +} + +// Resets the connection markers +function resetConMarkers() { + CURRENT_SESSION = false; + CONNECTED = false; + RESUME = false; + RECONNECT_TRY = 0; + RECONNECT_TIMER = 0; +} + +// Logins from a saved session +function loginFromSession(data) { + // Select the data + var session = $(data); + + // Fire the login event + doLogin( + session.find('username').text(), + session.find('domain').text(), + session.find('password').text(), + session.find('resource').text(), + session.find('priority').text(), + false + ); +} + +// Quits a session normally +function normalQuit() { + // Reset our database + clearLastSession(); + + // We quit the current session + quit(); + + // We show an info + openThisInfo(3); + + return false; +} + +// Gets all the users stuffs +function getEverything() { + getFeatures(); + getRoster(); + listPrivacy(); + getStorage(NS_ROSTERNOTES); +} + +// Plugin launcher +function launchConnection() { + // Logouts when Jappix is closed + $(window).bind('beforeunload', terminate); + + // Nothing to do when anonymous! + if(isAnonymous()) + return; + + // Try to resume a stored session, if not anonymous + var session = XMLFromString(getPersistent('session', 1)); + + if($(session).find('stored').text() == 'true') { + // Hide the homepage + $('#home').hide(); + + // Show the waiting icon + showGeneralWait(); + + // Login! + loginFromSession(session); + + logThis('Saved session found, resuming it...', 3); + } + + // Not connected, maybe a XMPP link is submitted? + else if((parent.location.hash != '#OK') && LINK_VARS['x']) { + switchHome('loginer'); + + logThis('A XMPP link is set, switch to login page.', 3); + } +} + +// Launch this plugin! +$(document).ready(launchConnection); diff --git a/sources/addons/jappixmini/jappix/js/constants.js b/sources/addons/jappixmini/jappix/js/constants.js new file mode 100644 index 00000000..bc59bd75 --- /dev/null +++ b/sources/addons/jappixmini/jappix/js/constants.js @@ -0,0 +1,211 @@ +/* + +Jappix - An open social platform +These are the constants JS scripts for Jappix + +------------------------------------------------- + +License: AGPL +Authors: Stefan Strigler, Vanaryon +Last revision: 26/08/11 + +*/ + +// XMPP XMLNS attributes +var NS_PROTOCOL = 'http://jabber.org/protocol/'; +var NS_FEATURES = 'http://jabber.org/features/'; +var NS_CLIENT = 'jabber:client'; +var NS_IQ = 'jabber:iq:'; +var NS_X = 'jabber:x:'; +var NS_IETF = 'urn:ietf:params:xml:ns:xmpp-'; +var NS_XMPP = 'urn:xmpp:'; + +var NS_STORAGE = 'storage:'; +var NS_BOOKMARKS = NS_STORAGE + 'bookmarks'; +var NS_ROSTERNOTES = NS_STORAGE + 'rosternotes'; + +var NS_JAPPIX = 'jappix:'; +var NS_INBOX = NS_JAPPIX + 'inbox'; +var NS_OPTIONS = NS_JAPPIX + 'options'; + +var NS_DISCO_ITEMS = NS_PROTOCOL + 'disco#items'; +var NS_DISCO_INFO = NS_PROTOCOL + 'disco#info'; +var NS_VCARD = 'vcard-temp'; +var NS_VCARD_P = NS_VCARD + ':x:update'; +var NS_AUTH = NS_IQ + 'auth'; +var NS_AUTH_ERROR = NS_IQ + 'auth:error'; +var NS_REGISTER = NS_IQ + 'register'; +var NS_SEARCH = NS_IQ + 'search'; +var NS_ROSTER = NS_IQ + 'roster'; +var NS_PRIVACY = NS_IQ + 'privacy'; +var NS_PRIVATE = NS_IQ + 'private'; +var NS_VERSION = NS_IQ + 'version'; +var NS_TIME = NS_IQ + 'time'; +var NS_LAST = NS_IQ + 'last'; +var NS_IQDATA = NS_IQ + 'data'; +var NS_XDATA = NS_X + 'data'; +var NS_IQOOB = NS_IQ + 'oob'; +var NS_XOOB = NS_X + 'oob'; +var NS_DELAY = NS_X + 'delay'; +var NS_EXPIRE = NS_X + 'expire'; +var NS_EVENT = NS_X + 'event'; +var NS_XCONFERENCE = NS_X + 'conference'; +var NS_STATS = NS_PROTOCOL + 'stats'; +var NS_MUC = NS_PROTOCOL + 'muc'; +var NS_MUC_USER = NS_MUC + '#user'; +var NS_MUC_ADMIN = NS_MUC + '#admin'; +var NS_MUC_OWNER = NS_MUC + '#owner'; +var NS_MUC_CONFIG = NS_MUC + '#roomconfig'; +var NS_PUBSUB = NS_PROTOCOL + 'pubsub'; +var NS_PUBSUB_EVENT = NS_PUBSUB + '#event'; +var NS_PUBSUB_OWNER = NS_PUBSUB + '#owner'; +var NS_PUBSUB_NMI = NS_PUBSUB + '#node-meta-info'; +var NS_PUBSUB_NC = NS_PUBSUB + '#node_config'; +var NS_PUBSUB_RI = NS_PUBSUB + '#retrieve-items'; +var NS_COMMANDS = NS_PROTOCOL + 'commands'; +var NS_BOSH = NS_PROTOCOL + 'httpbind'; +var NS_STREAM = 'http://etherx.jabber.org/streams'; +var NS_URN_TIME = NS_XMPP + 'time'; +var NS_URN_PING = NS_XMPP + 'ping'; +var NS_URN_ADATA = NS_XMPP + 'avatar:data'; +var NS_URN_AMETA = NS_XMPP + 'avatar:metadata'; +var NS_URN_MBLOG = NS_XMPP + 'microblog:0'; +var NS_URN_INBOX = NS_XMPP + 'inbox'; +var NS_URN_ARCHIVE = NS_XMPP + 'archive'; +var NS_URN_AR_PREF = NS_URN_ARCHIVE + ':pref'; +var NS_URN_AR_AUTO = NS_URN_ARCHIVE + ':auto'; +var NS_URN_AR_MANUAL = NS_URN_ARCHIVE + ':manual'; +var NS_URN_AR_MANAGE = NS_URN_ARCHIVE + ':manage'; +var NS_URN_DELAY = NS_XMPP + 'delay'; +var NS_URN_RECEIPTS = NS_XMPP + 'receipts'; +var NS_RSM = NS_PROTOCOL + 'rsm'; +var NS_IPV6 = 'ipv6'; +var NS_XHTML = 'http://www.w3.org/1999/xhtml'; +var NS_XHTML_IM = NS_PROTOCOL + 'xhtml-im'; +var NS_CHATSTATES = NS_PROTOCOL + 'chatstates'; +var NS_HTTP_AUTH = NS_PROTOCOL + 'http-auth'; +var NS_ROSTERX = NS_PROTOCOL + 'rosterx'; +var NS_MOOD = NS_PROTOCOL + 'mood'; +var NS_ACTIVITY = NS_PROTOCOL + 'activity'; +var NS_TUNE = NS_PROTOCOL + 'tune'; +var NS_GEOLOC = NS_PROTOCOL + 'geoloc'; +var NS_NICK = NS_PROTOCOL + 'nick'; +var NS_NOTIFY = '+notify'; +var NS_CAPS = NS_PROTOCOL + 'caps'; +var NS_ATOM = 'http://www.w3.org/2005/Atom'; + +var NS_STANZAS = NS_IETF + 'stanzas'; +var NS_STREAMS = NS_IETF + 'streams'; + +var NS_TLS = NS_IETF + 'tls'; +var NS_SASL = NS_IETF + 'sasl'; +var NS_SESSION = NS_IETF + 'session'; +var NS_BIND = NS_IETF + 'bind'; + +var NS_FEATURE_IQAUTH = NS_FEATURES + 'iq-auth'; +var NS_FEATURE_IQREGISTER = NS_FEATURES + 'iq-register'; +var NS_FEATURE_COMPRESS = NS_FEATURES + 'compress'; + +var NS_COMPRESS = NS_PROTOCOL + 'compress'; + +// Available locales +var LOCALES_AVAILABLE_ID = new Array(); +var LOCALES_AVAILABLE_NAMES = new Array(); + +// XML lang +var XML_LANG = null; + +// Jappix parameters +var JAPPIX_STATIC = null; +var JAPPIX_VERSION = null; +var JAPPIX_MAX_FILE_SIZE = null; +var JAPPIX_MAX_UPLOAD = null; + +// Jappix main configuration +var SERVICE_NAME = null; +var SERVICE_DESC = null; +var JAPPIX_RESOURCE = null; +var LOCK_HOST = null; +var ANONYMOUS = null; +var REGISTRATION = null; +var BOSH_PROXY = null; +var MANAGER_LINK = null; +var GROUPCHATS_JOIN = null; +var ENCRYPTION = null; +var HTTPS_STORAGE = null; +var HTTPS_FORCE = null; +var COMPRESSION = null; +var MULTI_FILES = null; +var DEVELOPER = null; + +// Jappix hosts configuration +var HOST_MAIN = null; +var HOST_MUC = null; +var HOST_PUBSUB = null; +var HOST_VJUD = null; +var HOST_ANONYMOUS = null; +var HOST_BOSH = null; +var HOST_BOSH_MAIN = null; +var HOST_BOSH_MINI = null; +var HOST_STATIC = null; +var HOST_UPLOAD = null; + +// Anonymous mode +var ANONYMOUS_ROOM = null; +var ANONYMOUS_NICK = null; + +// Node parameters +var JAPPIX_LOCATION = getJappixLocation(); + +// XMPP error stanzas +function STANZA_ERROR(code, type, cond) { + if (window == this) + return new STANZA_ERROR(code, type, cond); + + this.code = code; + this.type = type; + this.cond = cond; +} + +var ERR_BAD_REQUEST = + STANZA_ERROR('400', 'modify', 'bad-request'); +var ERR_CONFLICT = + STANZA_ERROR('409', 'cancel', 'conflict'); +var ERR_FEATURE_NOT_IMPLEMENTED = + STANZA_ERROR('501', 'cancel', 'feature-not-implemented'); +var ERR_FORBIDDEN = + STANZA_ERROR('403', 'auth', 'forbidden'); +var ERR_GONE = + STANZA_ERROR('302', 'modify', 'gone'); +var ERR_INTERNAL_SERVER_ERROR = + STANZA_ERROR('500', 'wait', 'internal-server-error'); +var ERR_ITEM_NOT_FOUND = + STANZA_ERROR('404', 'cancel', 'item-not-found'); +var ERR_JID_MALFORMED = + STANZA_ERROR('400', 'modify', 'jid-malformed'); +var ERR_NOT_ACCEPTABLE = + STANZA_ERROR('406', 'modify', 'not-acceptable'); +var ERR_NOT_ALLOWED = + STANZA_ERROR('405', 'cancel', 'not-allowed'); +var ERR_NOT_AUTHORIZED = + STANZA_ERROR('401', 'auth', 'not-authorized'); +var ERR_PAYMENT_REQUIRED = + STANZA_ERROR('402', 'auth', 'payment-required'); +var ERR_RECIPIENT_UNAVAILABLE = + STANZA_ERROR('404', 'wait', 'recipient-unavailable'); +var ERR_REDIRECT = + STANZA_ERROR('302', 'modify', 'redirect'); +var ERR_REGISTRATION_REQUIRED = + STANZA_ERROR('407', 'auth', 'registration-required'); +var ERR_REMOTE_SERVER_NOT_FOUND = + STANZA_ERROR('404', 'cancel', 'remote-server-not-found'); +var ERR_REMOTE_SERVER_TIMEOUT = + STANZA_ERROR('504', 'wait', 'remote-server-timeout'); +var ERR_RESOURCE_CONSTRAINT = + STANZA_ERROR('500', 'wait', 'resource-constraint'); +var ERR_SERVICE_UNAVAILABLE = + STANZA_ERROR('503', 'cancel', 'service-unavailable'); +var ERR_SUBSCRIPTION_REQUIRED = + STANZA_ERROR('407', 'auth', 'subscription-required'); +var ERR_UNEXPECTED_REQUEST = + STANZA_ERROR('400', 'wait', 'unexpected-request'); diff --git a/sources/addons/jappixmini/jappix/js/dataform.js b/sources/addons/jappixmini/jappix/js/dataform.js new file mode 100644 index 00000000..7fbea89d --- /dev/null +++ b/sources/addons/jappixmini/jappix/js/dataform.js @@ -0,0 +1,921 @@ +/* + +Jappix - An open social platform +These are the dataform JS scripts for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 28/08/11 + +*/ + +// Gets the defined dataform elements +function dataForm(host, type, node, action, target) { + // Clean the current session + cleanDataForm(target); + + // We tell the user that a search has been launched + $('#' + target + ' .wait').show(); + + // If we have enough data + if(host && type) { + // Generate a session ID + var sessionID = Math.round(100000.5 + (((900000.49999) - (100000.5)) * Math.random())); + var id = target + '-' + sessionID + '-' + genID(); + $('.' + target + '-results').attr('data-session', target + '-' + sessionID); + + // We request the service item + var iq = new JSJaCIQ(); + iq.setID(id); + iq.setTo(host); + iq.setType('get'); + + // MUC admin query + if(type == 'muc') { + iq.setQuery(NS_MUC_OWNER); + con.send(iq, handleDataFormMuc); + } + + // Browse query + else if(type == 'browse') { + var iqQuery = iq.setQuery(NS_DISCO_ITEMS); + + if(node) + iqQuery.setAttribute('node', node); + + con.send(iq, handleDataFormBrowse); + } + + // Command + else if(type == 'command') { + var items; + + if(node) + items = iq.appendNode('command', {'node': node, 'xmlns': NS_COMMANDS}); + + else { + items = iq.setQuery(NS_DISCO_ITEMS); + items.setAttribute('node', NS_COMMANDS); + } + + if(action && node) { + iq.setType('set'); + items.setAttribute('action', action); + } + + con.send(iq, handleDataFormCommand); + } + + // Search query + else if(type == 'search') { + iq.setQuery(NS_SEARCH); + con.send(iq, handleDataFormSearch); + } + + // Subscribe query + else if(type == 'subscribe') { + iq.setQuery(NS_REGISTER); + con.send(iq, handleDataFormSubscribe); + } + + // Join + else if(type == 'join') { + if(target == 'discovery') + closeDiscovery(); + + checkChatCreate(host, 'groupchat'); + } + } + + return false; +} + +// Sends a given dataform +function sendDataForm(type, action, x_type, id, xid, node, sessionid, target) { + // Path + var pathID = '#' + target + ' .results[data-session=' + id + ']'; + + // New IQ + var iq = new JSJaCIQ(); + iq.setTo(xid); + iq.setType('set'); + + // Set the correct query + var query; + + if(type == 'subscribe') + iqQuery = iq.setQuery(NS_REGISTER); + else if(type == 'search') + iqQuery = iq.setQuery(NS_SEARCH); + else if(type == 'command') + iqQuery = iq.appendNode('command', {'xmlns': NS_COMMANDS, 'node': node, 'sessionid': sessionid, 'action': action}); + else if(type == 'x') + iqQuery = iq.setQuery(NS_MUC_OWNER); + + // Build the XML document + if(action != 'cancel') { + // No X node + if(exists('input.register-special') && (type == 'subscribe')) { + $('input.register-special').each(function() { + var iName = $(this).attr('name'); + var iValue = $(this).val(); + + iqQuery.appendChild(iq.buildNode(iName, {'xmlns': NS_REGISTER}, iValue)); + }); + } + + // Can create the X node + else { + var iqX = iqQuery.appendChild(iq.buildNode('x', {'xmlns': NS_XDATA, 'type': x_type})); + + // Each input + $(pathID + ' .oneresult input, ' + pathID + ' .oneresult textarea, ' + pathID + ' .oneresult select').each(function() { + // Get the current input value + var iVar = $(this).attr('name'); + var iType = $(this).attr('data-type'); + var iValue = $(this).val(); + + // Build a new field node + var field = iqX.appendChild(iq.buildNode('field', {'var': iVar, 'type': iType, 'xmlns': NS_XDATA})); + + // Boolean input? + if(iType == 'boolean') { + if($(this).filter(':checked').size()) + iValue = '1'; + else + iValue = '0'; + } + + // JID-multi input? + if(iType == 'jid-multi') { + // Values array + var xid_arr = [iValue]; + var xid_check = []; + + // Try to split it + if(iValue.indexOf(',') != -1) + xid_arr = iValue.split(','); + + // Append each value to the XML document + for(i in xid_arr) { + // Get the current value + xid_current = trim(xid_arr[i]); + + // No current value? + if(!xid_current) + continue; + + // Add the current value + if(!existArrayValue(xid_check, xid_current)) { + xid_check.push(xid_current); + field.appendChild(iq.buildNode('value', {'xmlns': NS_XDATA}, xid_current)); + } + } + } + + // List-multi selector? + else if(iType == 'list-multi') { + // Any value? + if(iValue && iValue.length) { + for(i in iValue) + field.appendChild(iq.buildNode('value', {'xmlns': NS_XDATA}, iValue[i])); + } + } + + // Other inputs? + else + field.appendChild(iq.buildNode('value', {'xmlns': NS_XDATA}, iValue)); + }); + } + } + + // Clean the current session + cleanDataForm(target); + + // Show the waiting item + $('#' + target + ' .wait').show(); + + // Change the ID of the current discovered item + var iqID = target + '-' + genID(); + $('#' + target + ' .' + target + '-results').attr('data-session', iqID); + iq.setID(iqID); + + // Send the IQ + if(type == 'subscribe') + con.send(iq, handleDataFormSubscribe); + else if(type == 'search') + con.send(iq, handleDataFormSearch); + else if(type == 'command') + con.send(iq, handleDataFormCommand); + else + con.send(iq); + + return false; +} + +// Displays the good dataform buttons +function buttonsDataForm(type, action, id, xid, node, sessionid, target, pathID) { + // No need to use buttons? + if(type == 'muc') + return; + + // Override the "undefined" output + if(!id) + id = ''; + if(!xid) + xid = ''; + if(!node) + node = ''; + if(!sessionid) + sessionid = ''; + + // We generate the buttons code + var buttonsCode = '
'; + + if(action == 'submit') { + if((target == 'adhoc') && (type == 'command')) { + buttonsCode += '' + _e("Submit") + ''; + + // When keyup on one text input + $(pathID + ' input').keyup(function(e) { + if(e.keyCode == 13) { + sendDataForm(type, 'execute', 'submit', id, xid, node, sessionid, target); + + return false; + } + }); + } + + else { + buttonsCode += '' + _e("Submit") + ''; + + // When keyup on one text input + $(pathID + ' input').keyup(function(e) { + if(e.keyCode == 13) { + sendDataForm(type, 'submit', 'submit', id, xid, node, sessionid, target); + + return false; + } + }); + } + } + + if((action == 'submit') && (type != 'subscribe') && (type != 'search')) + buttonsCode += '' + _e("Cancel") + ''; + + if(((action == 'back') || (type == 'subscribe') || (type == 'search')) && (target == 'discovery')) + buttonsCode += '' + _e("Close") + ''; + + if((action == 'back') && ((target == 'welcome') || (target == 'directory'))) + buttonsCode += '' + _e("Previous") + ''; + + if((action == 'back') && (target == 'adhoc')) + buttonsCode += '' + _e("Previous") + ''; + + buttonsCode += '
'; + + // We display the buttons code + $(pathID).append(buttonsCode); + + // If no submit link, lock the form + if(!exists(pathID + ' a.submit')) + $(pathID + ' input, ' + pathID + ' textarea').attr('readonly', true); +} + +// Handles the MUC dataform +function handleDataFormMuc(iq) { + handleErrorReply(iq); + handleDataFormContent(iq, 'muc'); +} + +// Handles the browse dataform +function handleDataFormBrowse(iq) { + handleErrorReply(iq); + handleDataFormContent(iq, 'browse'); +} + +// Handles the command dataform +function handleDataFormCommand(iq) { + handleErrorReply(iq); + handleDataFormContent(iq, 'command'); +} + +// Handles the subscribe dataform +function handleDataFormSubscribe(iq) { + handleErrorReply(iq); + handleDataFormContent(iq, 'subscribe'); +} + +// Handles the search dataform +function handleDataFormSearch(iq) { + handleErrorReply(iq); + handleDataFormContent(iq, 'search'); +} + +// Handles the dataform content +function handleDataFormContent(iq, type) { + // Get the ID + var sID = iq.getID(); + + // Get the target + var splitted = sID.split('-'); + var target = splitted[0]; + var sessionID = target + '-' + splitted[1]; + var from = fullXID(getStanzaFrom(iq)); + var pathID = '#' + target + ' .results[data-session=' + sessionID + ']'; + + // If an error occured + if(!iq || (iq.getType() != 'result')) + noResultDataForm(pathID); + + // If we got something okay + else { + var handleXML = iq.getNode(); + + if(type == 'browse') { + if($(handleXML).find('item').attr('jid')) { + // Get the query node + var queryNode = $(handleXML).find('query').attr('node'); + + $(handleXML).find('item').each(function() { + // We parse the received xml + var itemHost = $(this).attr('jid'); + var itemNode = $(this).attr('node'); + var itemName = $(this).attr('name'); + var itemHash = hex_md5(itemHost); + + // Node + if(itemNode) + $(pathID).append( + '
' + + '
' + itemNode.htmlEnc() + '
' + + '
' + ); + + // Item + else if(queryNode && itemName) + $(pathID).append( + '
' + + '
' + itemName.htmlEnc() + '
' + + '
' + ); + + // Item with children + else { + // We display the waiting element + $(pathID + ' .disco-wait .disco-category-title').after( + '
' + + '
' + + '
' + itemHost + '
' + + '
' + _e("Requesting this service...") + '
' + + '
' + ); + + // We display the category + $('#' + target + ' .disco-wait').show(); + + // We ask the server what's the service type + getDataFormType(itemHost, itemNode, sessionID); + } + }); + } + + // Else, there are no items for this query + else + noResultDataForm(pathID); + } + + else if((type == 'muc') || (type == 'search') || (type == 'subscribe') || ((type == 'command') && $(handleXML).find('command').attr('xmlns'))) { + // Get some values + var xCommand = $(handleXML).find('command'); + var bNode = xCommand.attr('node'); + var bSession = xCommand.attr('sessionid'); + var bStatus = xCommand.attr('status'); + var xRegister = $(handleXML).find('query[xmlns=' + NS_REGISTER + ']').text(); + var xElement = $(handleXML).find('x'); + + // Search done + if((xElement.attr('type') == 'result') && (type == 'search')) { + var bPath = pathID; + + // Display the result + $(handleXML).find('item').each(function() { + var bXID = $(this).find('field[var=jid] value:first').text(); + var bName = $(this).find('field[var=fn] value:first').text(); + var bCountry = $(this).find('field[var=ctry] value:first').text(); + var dName = bName; + + // Override "undefined" value + if(!bXID) + bXID = ''; + if(!bName) + bName = _e("Unknown name"); + if(!bCountry) + bCountry = _e("Unknown country"); + + // User hash + var bHash = hex_md5(bXID); + + // HTML code + var bHTML = '
' + + '
' + + '' + + '
' + + '
' + bName + '
' + + '
' + bCountry + '
' + + '
' + bXID + '
' + + '
'; + + // The buddy is not in our buddy list? + if(!exists('#buddy-list .buddy[data-xid=' + escape(bXID) + ']')) + bHTML += '' + _e("Add") + ''; + + // Chat button, if not in welcome/directory mode + if(target == 'discovery') + bHTML += '' + _e("Chat") + ''; + + // Close the HTML element + bHTML += '
'; + + $(bPath).append(bHTML); + + // Click events + $(bPath + ' .' + bHash + ' a').click(function() { + // Buddy add + if($(this).is('.one-add')) { + $(this).hide(); + + addThisContact(bXID, dName); + } + + // Buddy chat + if($(this).is('.one-chat')) { + if(target == 'discovery') + closeDiscovery(); + + checkChatCreate(bXID , 'chat', '', '', dName); + } + + return false; + }); + + // Get the user's avatar + if(bXID) + getAvatar(bXID, 'cache', 'true', 'forget'); + }); + + // No result? + if(!$(handleXML).find('item').size()) + noResultDataForm(pathID); + + // Previous button + buttonsDataForm(type, 'back', sessionID, from, bNode, bSession, target, pathID); + } + + // Command to complete + else if(xElement.attr('xmlns') || ((type == 'subscribe') && xRegister)) { + // We display the elements + fillDataForm(handleXML, sessionID); + + // We display the buttons + if(bStatus != 'completed') + buttonsDataForm(type, 'submit', sessionID, from, bNode, bSession, target, pathID); + else + buttonsDataForm(type, 'back', sessionID, from, bNode, bSession, target, pathID); + } + + // Command completed or subscription done + else if(((bStatus == 'completed') && (type == 'command')) || (!xRegister && (type == 'subscribe'))) { + // Display the good text + var cNote = $(xCommand).find('note'); + + // Any note? + if(cNote.size()) { + cNote.each(function() { + $(pathID).append( + '
' + $(this).text().htmlEnc() + '
' + ); + }); + } + + // Default text + else + $(pathID).append('
' + _e("Your form has been sent.") + '
'); + + // Display the back button + buttonsDataForm(type, 'back', sessionID, from, '', '', target, pathID); + + // Add the gateway to our roster if subscribed + if(type == 'subscribe') + addThisContact(from); + } + + // Command canceled + else if((bStatus == 'canceled') && (type == 'command')) { + if(target == 'discovery') + startDiscovery(); + else if(target == 'adhoc') + dataForm(from, 'command', '', '', 'adhoc'); + } + + // No items for this query + else + noResultDataForm(pathID); + } + + else if(type == 'command') { + if($(handleXML).find('item').attr('jid')) { + // We display the elements + $(handleXML).find('item').each(function() { + // We parse the received xml + var itemHost = $(this).attr('jid'); + var itemNode = $(this).attr('node'); + var itemName = $(this).attr('name'); + var itemHash = hex_md5(itemHost); + + // We display the waiting element + $(pathID).prepend( + '
' + + '
' + itemName + '
' + + '
»
' + + '
' + ); + }); + } + + // Else, there are no items for this query + else + noResultDataForm(pathID); + } + } + + // Focus on the first input + $(document).oneTime(10, function() { + $(pathID + ' input:visible:first').focus(); + }); + + // Hide the wait icon + $('#' + target + ' .wait').hide(); +} + +// Fills the dataform elements +function fillDataForm(xml, id) { + /* REF: http://xmpp.org/extensions/xep-0004.html */ + + // Initialize new vars + var target = id.split('-')[0]; + var pathID = '#' + target + ' .results[data-session=' + id + ']'; + var selector, is_dataform; + + // Is it a dataform? + if($(xml).find('x[xmlns=' + NS_XDATA + ']').size()) + is_dataform = true; + else + is_dataform = false; + + // Determines the good selector to use + if(is_dataform) + selector = $(xml).find('x[xmlns=' + NS_XDATA + ']'); + else + selector = $(xml); + + // Form title + selector.find('title').each(function() { + $(pathID).append( + '
' + $(this).text().htmlEnc() + '
' + ); + }); + + // Form instructions + selector.find('instructions').each(function() { + $(pathID).append( + '
' + $(this).text().htmlEnc() + '
' + ); + }); + + // Register? + if(!is_dataform) { + // Items to detect + var reg_names = [_e("Nickname"), _e("Name"), _e("Password"), _e("E-mail")]; + var reg_ids = ['username', 'name', 'password', 'email']; + + // Append these inputs + for(a in reg_names) { + selector.find(reg_ids[a]).each(function() { + $(pathID).append( + '
' + + '' + + '' + + '
' + ); + }); + } + + return false; + } + + // Dataform? + selector.find('field').each(function() { + // We parse the received xml + var type = $(this).attr('type'); + var label = $(this).attr('label'); + var field = $(this).attr('var'); + var value = $(this).find('value:first').text(); + var required = ''; + + // No value? + if(!field) + return; + + // Required input? + if($(this).find('required').size()) + required = ' required=""'; + + // Compatibility fix + if(!label) + label = field; + + if(!type) + type = ''; + + // Generate some values + var input; + var hideThis = ''; + + // Fixed field + if(type == 'fixed') + $(pathID).append('
' + value.htmlEnc() + '
'); + + else { + // Hidden field + if(type == 'hidden') { + hideThis = ' style="display: none;"'; + input = ''; + } + + // Boolean field + else if(type == 'boolean') { + var checked; + + if(value == '1') + checked = 'checked'; + else + checked = ''; + + input = ''; + } + + // List-single/list-multi field + else if((type == 'list-single') || (type == 'list-multi')) { + var multiple = ''; + + // Multiple options? + if(type == 'list-multi') + multiple = ' multiple=""'; + + // Append the select field + input = ''; + } + + // Text-multi field + else if(type == 'text-multi') + input = ''; + + // JID-multi field + else if(type == 'jid-multi') { + // Put the XID into an array + var xid_arr = []; + + $(this).find('value').each(function() { + var cValue = $(this).text(); + + if(!existArrayValue(xid_arr, cValue)) + xid_arr.push(cValue); + }); + + // Sort the array + xid_arr.sort(); + + // Create the input + var xid_value = ''; + + if(xid_arr.length) { + for(i in xid_arr) { + // Any pre-value + if(xid_value) + xid_value += ', '; + + // Add the current XID + xid_value += xid_arr[i]; + } + } + + input = ''; + } + + // Other stuffs that are similar + else { + // Text-single field + var iType = 'text'; + + // Text-private field + if(type == 'text-private') + iType = 'password'; + + // JID-single field + else if(type == 'jid-single') + iType = 'email'; + + input = ''; + } + + // Append the HTML markup for this field + $(pathID).append( + '
' + + '' + + input + + '
' + ); + } + }); + + return false; +} + +// Gets the dataform type +function getDataFormType(host, node, id) { + var iq = new JSJaCIQ(); + iq.setID(id + '-' + genID()); + iq.setTo(host); + iq.setType('get'); + + var iqQuery = iq.setQuery(NS_DISCO_INFO); + + if(node) + iqQuery.setAttribute('node', node); + + con.send(iq, handleThisBrowse); +} + +// Handles the browse stanza +function handleThisBrowse(iq) { + /* REF: http://xmpp.org/registrar/disco-categories.html */ + + var id = iq.getID(); + var splitted = id.split('-'); + var target = splitted[0]; + var sessionID = target + '-' + splitted[1]; + var from = fullXID(getStanzaFrom(iq)); + var hash = hex_md5(from); + var handleXML = iq.getQuery(); + var pathID = '#' + target + ' .results[data-session=' + sessionID + ']'; + + // We first remove the waiting element + $(pathID + ' .disco-wait .' + hash).remove(); + + if($(handleXML).find('identity').attr('type')) { + var category = $(handleXML).find('identity').attr('category'); + var type = $(handleXML).find('identity').attr('type'); + var named = $(handleXML).find('identity').attr('name'); + + if(named) + gName = named; + else + gName = ''; + + var one, two, three, four, five; + + // Get the features that this entity supports + var findFeature = $(handleXML).find('feature'); + + for(i in findFeature) { + var current = findFeature.eq(i).attr('var'); + + switch(current) { + case NS_SEARCH: + one = 1; + break; + + case NS_MUC: + two = 1; + break; + + case NS_REGISTER: + three = 1; + break; + + case NS_COMMANDS: + four = 1; + break; + + case NS_DISCO_ITEMS: + five = 1; + break; + + default: + break; + } + } + + var buttons = Array(one, two, three, four, five); + + // We define the toolbox links depending on the supported features + var tools = ''; + var aTools = Array('search', 'join', 'subscribe', 'command', 'browse'); + var bTools = Array(_e("Search"), _e("Join"), _e("Subscribe"), _e("Command"), _e("Browse")); + + for(i in buttons) { + if(buttons[i]) + tools += ''; + } + + // As defined in the ref, we detect the type of each category to put an icon + switch(category) { + case 'account': + case 'auth': + case 'automation': + case 'client': + case 'collaboration': + case 'component': + case 'conference': + case 'directory': + case 'gateway': + case 'headline': + case 'hierarchy': + case 'proxy': + case 'pubsub': + case 'server': + case 'store': + break; + + default: + category = 'others'; + } + + // We display the item we found + $(pathID + ' .disco-' + category + ' .disco-category-title').after( + '
' + + '
' + + '
' + from + '
' + + '
' + gName + '
' + + '
' + tools + '
' + + '
' + ); + + // We display the category + $(pathID + ' .disco-' + category).show(); + } + + else { + $(pathID + ' .disco-others .disco-category-title').after( + '
' + + '
' + + '
' + from + '
' + + '
' + _e("Service offline or broken") + '
' + + '
' + ); + + // We display the category + $(pathID + ' .disco-others').show(); + } + + // We hide the waiting stuffs if there's no remaining loading items + if(!$(pathID + ' .disco-wait .' + target + '-oneresult').size()) + $(pathID + ' .disco-wait, #' + target + ' .wait').hide(); +} + +// Cleans the current data-form popup +function cleanDataForm(target) { + if(target == 'discovery') + cleanDiscovery(); + else + $('#' + target + ' div.results').empty(); +} + +// Displays the no result indicator +function noResultDataForm(path) { + $(path).prepend('

' + _e("Sorry, but the entity didn't return any result!") + '

'); +} diff --git a/sources/addons/jappixmini/jappix/js/datastore.js b/sources/addons/jappixmini/jappix/js/datastore.js new file mode 100644 index 00000000..b818b301 --- /dev/null +++ b/sources/addons/jappixmini/jappix/js/datastore.js @@ -0,0 +1,209 @@ +/* + +Jappix - An open social platform +These are the temporary/persistent data store functions + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 23/06/11 + +*/ + +// Temporary: returns whether it is available or not +function hasDB() { + if(window.sessionStorage) + return true; + + return false; +} + +// Temporary: used to read a database entry +function getDB(type, id) { + try { + return sessionStorage.getItem(type + '_' + id); + } + + catch(e) { + logThis('Error while getting a temporary database entry (' + type + ' -> ' + id + '): ' + e, 1); + + return null; + } +} + +// Temporary: used to update a database entry +function setDB(type, id, value) { + try { + sessionStorage.setItem(type + '_' + id, value); + + return true; + } + + catch(e) { + logThis('Error while writing a temporary database entry (' + type + ' -> ' + id + '): ' + e, 1); + + return false; + } +} + +// Temporary: used to remove a database entry +function removeDB(type, id) { + try { + sessionStorage.removeItem(type + '_' + id); + + return true; + } + + catch(e) { + logThis('Error while removing a temporary database entry (' + type + ' -> ' + id + '): ' + e, 1); + + return false; + } +} + +// Temporary: used to check a database entry exists +function existDB(type, id) { + var read = getDB(type, id); + + if(read != null) + return true; + + return false; +} + +// Temporary: used to clear all the database +function resetDB() { + try { + sessionStorage.clear(); + + logThis('Temporary database cleared.', 3); + + return true; + } + + catch(e) { + logThis('Error while clearing temporary database: ' + e, 1); + + return false; + } +} + +// Persistent: returns whether it is available or not +function hasPersistent() { + if(window.localStorage) + return true; + + return false; +} + +// Persistent: used to read a database entry +function getPersistent(type, id) { + try { + return localStorage.getItem(type + '_' + id); + } + + catch(e) { + logThis('Error while getting a persistent database entry (' + type + ' -> ' + id + '): ' + e, 1); + + return null; + } +} + +// Persistent: used to update a database entry +function setPersistent(type, id, value) { + try { + localStorage.setItem(type + '_' + id, value); + + return true; + } + + // Database might be full + catch(e) { + logThis('Retrying: could not write a persistent database entry (' + type + ' -> ' + id + '): ' + e, 2); + + // Flush it! + flushPersistent(); + + // Set the item again + try { + localStorage.setItem(type + '_' + id, value); + + return true; + } + + // New error! + catch(e) { + logThis('Aborted: error while writing a persistent database entry (' + type + ' -> ' + id + '): ' + e, 1); + + return false; + } + } +} + +// Persistent: used to remove a database entry +function removePersistent(type, id) { + try { + localStorage.removeItem(type + '_' + id); + + return true; + } + + catch(e) { + logThis('Error while removing a persistent database entry (' + type + ' -> ' + id + '): ' + e, 1); + + return false; + } +} + +// Persistent: used to check a database entry exists +function existPersistent(type, id) { + var read = getPersistent(type, id); + + if(read != null) + return true; + + return false; +} + +// Persistent: used to clear all the database +function resetPersistent() { + try { + localStorage.clear(); + + logThis('Persistent database cleared.', 3); + + return true; + } + + catch(e) { + logThis('Error while clearing persistent database: ' + e, 1); + + return false; + } +} + +// Persistent: used to flush the database +function flushPersistent() { + try { + // Get the stored session entry + var session = getPersistent('session', 1); + + // Clear the persistent database + localStorage.clear(); + + // Restaure the stored session entry + if(session) + setPersistent('session', 1, session); + + logThis('Persistent database flushed.', 3); + + return true; + } + + catch(e) { + logThis('Error while flushing persistent database: ' + e, 1); + + return false; + } +} diff --git a/sources/addons/jappixmini/jappix/js/date.js b/sources/addons/jappixmini/jappix/js/date.js new file mode 100644 index 00000000..adbe01c8 --- /dev/null +++ b/sources/addons/jappixmini/jappix/js/date.js @@ -0,0 +1,214 @@ +/* + +Jappix - An open social platform +These are the date related JS scripts for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 17/08/11 + +*/ + +// Gets a stamp from a date +function extractStamp(date) { + return Math.round(date.getTime() / 1000); +} + +// Gets the time from a date +function extractTime(date) { + return date.toLocaleTimeString(); +} + +// Gets the actual date stamp +function getTimeStamp() { + return extractStamp(new Date()); +} + +// Gets the last user activity in seconds +var LAST_ACTIVITY = 0; + +function getLastActivity() { + // Last activity not yet initialized? + if(LAST_ACTIVITY == 0) + return 0; + + return getTimeStamp() - LAST_ACTIVITY; +} + +// Gets the last user available presence in seconds +var PRESENCE_LAST_ACTIVITY = 0; + +function getPresenceLast() { + // Last presence stamp not yet initialized? + if(PRESENCE_LAST_ACTIVITY == 0) + return 0; + + return getTimeStamp() - PRESENCE_LAST_ACTIVITY; +} + +// Generates the time for XMPP +function getXMPPTime(location) { + /* FROM : http://trac.jwchat.org/jsjac/browser/branches/jsjac_1.0/jsextras.js?rev=221 */ + + // Initialize + var jInit = new Date(); + var year, month, day, hours, minutes, seconds; + + // Gets the UTC date + if(location == 'utc') { + year = jInit.getUTCFullYear(); + month = jInit.getUTCMonth(); + day = jInit.getUTCDate(); + hours = jInit.getUTCHours(); + minutes = jInit.getUTCMinutes(); + seconds = jInit.getUTCSeconds(); + } + + // Gets the local date + else { + year = jInit.getFullYear(); + month = jInit.getMonth(); + day = jInit.getDate(); + hours = jInit.getHours(); + minutes = jInit.getMinutes(); + seconds = jInit.getSeconds(); + } + + // Generates the date string + var jDate = year + '-'; + jDate += padZero(month + 1) + '-'; + jDate += padZero(day) + 'T'; + jDate += padZero(hours) + ':'; + jDate += padZero(minutes) + ':'; + jDate += padZero(seconds) + 'Z'; + + // Returns the date string + return jDate; +} + +// Generates then human time +function getCompleteTime() { + var init = new Date(); + var time = padZero(init.getHours()) + ':'; + time += padZero(init.getMinutes()) + ':'; + time += padZero(init.getSeconds()); + + return time; +} + +// Gets the TZO of a date +function getDateTZO() { + // Get the date + var date = new Date(); + var offset = date.getTimezoneOffset(); + + // Default vars + var sign = ''; + var hours = 0; + var minutes = 0; + + // Process a neutral offset + if(offset < 0) { + offset = offset * -1; + sign = '+'; + } + + // Get the values + var n_date = new Date(offset * 60 * 1000); + hours = n_date.getHours() - 1; + minutes = n_date.getMinutes(); + + // Process the TZO + tzo = sign + padZero(hours) + ':' + padZero(minutes); + + // Return the processed value + return tzo; +} + +// Parses a XMPP date (yyyy-mm-dd, hh-mm-ss) into an human-readable one +function parseDate(to_parse) { + var date = Date.jab2date(to_parse); + var parsed = date.toLocaleDateString() + ' (' + date.toLocaleTimeString() + ')'; + + return parsed; +} + +// Parses a XMPP date (yyyy-mm-dd) into an human-readable one +function parseDay(to_parse) { + var date = Date.jab2date(to_parse); + var parsed = date.toLocaleDateString(); + + return parsed; +} + +// Parses a XMPP date (hh-mm-ss) into an human-readable one +function parseTime(to_parse) { + var date = Date.jab2date(to_parse); + var parsed = date.toLocaleTimeString(); + + return parsed; +} + +// Parses a XMPP date stamp into a relative one +function relativeDate(to_parse) { + // Get the current date + var current_date = Date.jab2date(getXMPPTime('utc')); + var current_day = current_date.getDate(); + var current_stamp = current_date.getTime(); + + // Parse the given date + var old_date = Date.jab2date(to_parse); + var old_day = old_date.getDate(); + var old_stamp = old_date.getTime(); + var old_time = old_date.toLocaleTimeString(); + + // Get the day number between the two dates + var days = Math.round((current_stamp - old_stamp) / 86400000); + + // Invalid date? + if(isNaN(old_stamp) || isNaN(days)) + return getCompleteTime(); + + // Is it today? + if(current_day == old_day) + return old_time; + + // It is yesterday? + if(days <= 1) + return _e("Yesterday") + ' - ' + old_time; + + // Is it less than a week ago? + if(days <= 7) + return printf(_e("%s days ago"), days) + ' - ' + old_time; + + // Another longer period + return old_date.toLocaleDateString() + ' - ' + old_time; +} + +// Reads a message delay +function readMessageDelay(node) { + try { + // Initialize + var delay, d_delay; + + // Read the delay + d_delay = jQuery(node).find('delay[xmlns=' + NS_URN_DELAY + ']:first').attr('stamp'); + + // New delay (valid XEP) + if(d_delay) + delay = d_delay; + + // Old delay (obsolete XEP!) + else { + // Try to read the old-school delay + var x_delay = jQuery(node).find('x[xmlns=' + NS_DELAY + ']:first').attr('stamp'); + + if(x_delay) + delay = x_delay.replace(/^(\w{4})(\w{2})(\w{2})T(\w{2}):(\w{2}):(\w{2})Z?(\S+)?/, '$1-$2-$3T$4:$5:$6Z$7'); + } + + return delay; + } catch(e) {} +} diff --git a/sources/addons/jappixmini/jappix/js/directory.js b/sources/addons/jappixmini/jappix/js/directory.js new file mode 100644 index 00000000..ebe1a570 --- /dev/null +++ b/sources/addons/jappixmini/jappix/js/directory.js @@ -0,0 +1,87 @@ +/* + +Jappix - An open social platform +These are the directory JS scripts for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 03/03/11 + +*/ + +// Opens the directory popup +function openDirectory() { + // Popup HTML content + var html = + '
' + _e("User directory") + '
' + + + '
' + + '
' + + '
' + _e("Server to query") + '
' + + + '' + + '
' + + + '
' + + '
' + + + '
' + + '
' + + + '' + _e("Close") + '' + + '
'; + + // Create the popup + createPopup('directory', html); + + // Associate the events + launchDirectory(); + + // Start a search! + startDirectory(); + + return false; +} + +// Quits the directory popup +function closeDirectory() { + // Destroy the popup + destroyPopup('directory'); + + return false; +} + +// Launches a directory search +function startDirectory() { + // Get the server to query + var server = $('#directory .directory-server-input').val(); + + // Launch the search! + dataForm($('#directory .directory-server-input').val(), 'search', '', '', 'directory'); + + logThis('Directory search launched: ' + server); + + return false; +} + +// Plugin launcher +function launchDirectory() { + // Click event + $('#directory .bottom .finish').click(closeDirectory); + + // Keyboard event + $('#directory .directory-server-input').keyup(function(e) { + if(e.keyCode == 13) { + // No value? + if(!$(this).val()) + $(this).val(HOST_VJUD); + + // Start the directory search + startDirectory(); + + return false; + } + }); +} diff --git a/sources/addons/jappixmini/jappix/js/discovery.js b/sources/addons/jappixmini/jappix/js/discovery.js new file mode 100644 index 00000000..867037b2 --- /dev/null +++ b/sources/addons/jappixmini/jappix/js/discovery.js @@ -0,0 +1,169 @@ +/* + +Jappix - An open social platform +These are the discovery JS scripts for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 03/03/11 + +*/ + +// Opens the discovery popup +function openDiscovery() { + // Popup HTML content + var html = + '
' + _e("Service discovery") + '
' + + + '
' + + '
' + + '
' + _e("Server to query") + '
' + + + '' + + '
' + + + '
' + + '' + + + '
' + + '

' + _e("Authentications") + '

' + + '
' + + + '
' + + '

' + _e("Automation") + '

' + + '
' + + + '
' + + '

' + _e("Clients") + '

' + + '
' + + + '
' + + '

' + _e("Collaboration") + '

' + + '
' + + + '
' + + '

' + _e("Components") + '

' + + '
' + + + '
' + + '

' + _e("Rooms") + '

' + + '
' + + + '
' + + '

' + _e("Directories") + '

' + + '
' + + + '
' + + '

' + _e("Gateways") + '

' + + '
' + + + '
' + + '

' + _e("News") + '

' + + '
' + + + '
' + + '

' + _e("Hierarchy") + '

' + + '
' + + + '
' + + '

' + _e("Proxies") + '

' + + '
' + + + '
' + + '

' + _e("Publication/Subscription") + '

' + + '
' + + + '
' + + '

' + _e("Server") + '

' + + '
' + + + '
' + + '

' + _e("Storage") + '

' + + '
' + + + '
' + + '

' + _e("Others") + '

' + + '
' + + + '
' + + '

' + _e("Loading") + '

' + + '
' + + '
' + + '
' + + + '
' + + '
' + + + '' + _e("Close") + '' + + '
'; + + // Create the popup + createPopup('discovery', html); + + // Associate the events + launchDiscovery(); + + // We request a disco to the default server + startDiscovery(); + + return false; +} + +// Quits the discovery popup +function closeDiscovery() { + // Destroy the popup + destroyPopup('discovery'); + + return false; +} + +// Launches a discovery +function startDiscovery() { + /* REF: http://xmpp.org/extensions/xep-0030.html */ + + // We get the server to query + var discoServer = $('#discovery .disco-server-input').val(); + + // We launch the items query + dataForm(discoServer, 'browse', '', '', 'discovery'); + + logThis('Service discovery launched: ' + discoServer); + + return false; +} + +// Cleans the discovery results +function cleanDiscovery() { + // We remove the results + $('#discovery .discovery-oneresult, #discovery .oneinstructions, #discovery .onetitle, #discovery .no-results').remove(); + + // We clean the user info + $('#discovery .disco-server-info').text(''); + + // We hide the wait icon, the no result alert and the results + $('#discovery .wait, #discovery .disco-category').hide(); +} + +// Plugin launcher +function launchDiscovery() { + // Click event + $('#discovery .bottom .finish').click(closeDiscovery); + + // Keyboard event + $('#discovery .disco-server-input').keyup(function(e) { + if(e.keyCode == 13) { + // No value? + if(!$(this).val()) + $(this).val(HOST_MAIN); + + // Start the discovery + startDiscovery(); + + return false; + } + }); +} diff --git a/sources/addons/jappixmini/jappix/js/error.js b/sources/addons/jappixmini/jappix/js/error.js new file mode 100644 index 00000000..c16ca2a5 --- /dev/null +++ b/sources/addons/jappixmini/jappix/js/error.js @@ -0,0 +1,139 @@ +/* + +Jappix - An open social platform +These are the error functions for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 02/04/11 + +*/ + +// Shows the given error output +function showError(condition, reason, type) { + // Enough data to output the error + if(condition || reason) { + // Initialize the error text + var eText = ''; + + // Any error condition + if(condition) + eText += condition; + + // Any error type + if(type && eText) + eText += ' (' + type + ')'; + + // Any error reason + if(reason) { + if(eText) + eText += ' - '; + + eText += reason; + } + + // We reveal the error + openThisError(1); + + // Create the error text + $('#board .one-board.error[data-id=1] span').text(eText); + } + + // Not enough data to output the error: output a generic board + else + openThisError(2); +} + +// Handles the error from a packet and return true if any error +function handleError(packet) { + /* REF: http://xmpp.org/extensions/xep-0086.html */ + + // Initialize + var type, code, reason, condition; + var node = $(packet); + + // First level error (connection error) + if(node.is('error')) { + // Get the value + code = node.attr('code'); + + // Specific error reason + switch(code) { + case '401': + reason = _e("Authorization failed"); + break; + + case '409': + reason = _e("Registration failed, please choose a different username"); + break; + + case '503': + reason = _e("Service unavailable"); + break; + + case '500': + reason = _e("Internal server error, try later"); + break; + + default: + reason = node.find('text').text(); + break; + } + + // Remove the general wait item (security) + removeGeneralWait(); + + // Show reconnect pane + if(CURRENT_SESSION && CONNECTED) { + // Anonymous? + if(isAnonymous()) + createReconnect('anonymous'); + else + createReconnect('normal'); + } + + // Show the homepage (security) + else if(!CURRENT_SESSION || !CONNECTED) { + $('#home').show(); + pageTitle('home'); + } + + // Still connected? (security) + if(isConnected()) + con.disconnect(); + + logThis('First level error received.', 1); + } + + // Second level error (another error) + else if(node.find('error').size()) { + type = node.find('error').attr('type'); + reason = node.find('error text').text(); + condition = packet.getElementsByTagName('error').item(0).childNodes.item(0).nodeName.replace(/-/g, ' '); + + logThis('Second level error received.', 1); + } + + // No error + else + return false; + + // Show the error board + showError(condition, reason, type); + + // Return there's an error + return true; +} + +// Handles the error reply of a packet +function handleErrorReply(packet) { + return handleError(packet.getNode()); +} + +// Handles the error reply for a message +function handleMessageError(packet) { + if(!handleErrorReply(packet)) + handleMessage(packet); +} diff --git a/sources/addons/jappixmini/jappix/js/favorites.js b/sources/addons/jappixmini/jappix/js/favorites.js new file mode 100644 index 00000000..69a042e8 --- /dev/null +++ b/sources/addons/jappixmini/jappix/js/favorites.js @@ -0,0 +1,537 @@ +/* + +Jappix - An open social platform +These are the favorites JS scripts for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 23/06/11 + +*/ + +// Opens the favorites popup +function openFavorites() { + // Popup HTML content + var html = + '
' + _e("Manage favorite rooms") + '
' + + + '
' + + '
' + + '
' + + '
' + + + _e("Change favorites") + + '
' + + + '' + + '
' + + + '
' + + '
' + + '
' + + '
' + _e("Select a favorite") + '
' + + + '' + + '
' + + + '
' + + '
' + + '' + + + '' + + '
' + + + '
' + + '' + + + '' + + '
' + + + '
' + + '' + + + '' + + '
' + + + '
' + + '' + + + '' + + '
' + + + '
' + + '' + + + '' + + '
' + + + '
' + + '' + + + '' + + '
' + + + '' + + '
' + + '
' + + + '' + + '
' + + '
' + + + '
' + + '
' + + + '' + _e("Close") + '' + + '
'; + + // Create the popup + createPopup('favorites', html); + + // Load the favorites + loadFavorites(); + + // Associate the events + launchFavorites(); +} + +// Resets the favorites elements +function resetFavorites() { + var path = '#favorites '; + + $(path + '.wait, ' + path + '.fedit-terminate').hide(); + $(path + '.fedit-add').show(); + $(path + '.fsearch-oneresult').remove(); + $(path + 'input').val(''); + $(path + '.please-complete').removeClass('please-complete'); + $(path + '.fedit-nick').val(getNick()); + $(path + '.fsearch-head-server, ' + path + '.fedit-server').val(HOST_MUC); + $(path + '.fedit-autojoin').attr('checked', false); +} + +// Quits the favorites popup +function quitFavorites() { + // Destroy the popup + destroyPopup('favorites'); + + return false; +} + +// Adds a room to the favorites +function addThisFavorite(roomXID, roomName) { + // Button path + var button = '#favorites .fsearch-results div[data-xid=' + escape(roomXID) + '] a.one-button'; + + // Add a remove button instead of the add one + $(button + '.add').replaceWith('' + _e("Remove") + ''); + + // Click event + $(button + '.remove').click(function() { + return removeThisFavorite(roomXID, roomName); + }); + + // Hide the add button in the (opened?) groupchat + $('#' + hex_md5(roomXID) + ' .tools-add').hide(); + + // Add the database entry + displayFavorites(roomXID, explodeThis(' (', roomName, 0), getNick(), '0', ''); + + // Publish the favorites + favoritePublish(); + + return false; +} + +// Removes a room from the favorites +function removeThisFavorite(roomXID, roomName) { + // Button path + var button = '#favorites .fsearch-results div[data-xid=' + escape(roomXID) + '] a.one-button'; + + // Add a remove button instead of the add one + $(button + '.remove').replaceWith('' + _e("Add") + ''); + + // Click event + $(button + '.add').click(function() { + return addThisFavorite(roomXID, roomName); + }); + + // Show the add button in the (opened?) groupchat + $('#' + hex_md5(roomXID) + ' .tools-add').show(); + + // Remove the favorite + removeFavorite(roomXID, true); + + // Publish the favorites + favoritePublish(); + + return false; +} + +// Edits a favorite +function editFavorite() { + // Path to favorites + var favorites = '#favorites .'; + + // Reset the favorites + resetFavorites(); + + // Show the edit/remove button, hide the others + $(favorites + 'fedit-terminate').hide(); + $(favorites + 'fedit-edit').show(); + $(favorites + 'fedit-remove').show(); + + // We retrieve the values + var xid = $(favorites + 'fedit-head-select').val(); + var data = XMLFromString(getDB('favorites', xid)); + + // If this is not the default room + if(xid != 'none') { + // We apply the values + $(favorites + 'fedit-title').val($(data).find('name').text()); + $(favorites + 'fedit-nick').val($(data).find('nick').text()); + $(favorites + 'fedit-chan').val(getXIDNick(xid)); + $(favorites + 'fedit-server').val(getXIDHost(xid)); + $(favorites + 'fedit-password').val($(data).find('password').text()); + + if($(data).find('autojoin').text() == '1') + $(favorites + 'fedit-autojoin').attr('checked', true); + } + + else + resetFavorites(); +} + +// Adds a favorite +function addFavorite() { + // Path to favorites + var favorites = '#favorites .'; + + // We reset the inputs + $(favorites + 'fedit-title, ' + favorites + 'fedit-nick, ' + favorites + 'fedit-chan, ' + favorites + 'fedit-server, ' + favorites + 'fedit-password').val(''); + + // Show the add button, hide the others + $(favorites + 'fedit-terminate').hide(); + $(favorites + 'fedit-add').show(); +} + +// Terminate a favorite editing +function terminateThisFavorite(type) { + // Path to favorites + var favorites = '#favorites '; + + // We get the values of the current edited groupchat + var old_xid = $(favorites + '.fedit-head-select').val(); + + var title = $(favorites + '.fedit-title').val(); + var nick = $(favorites + '.fedit-nick').val(); + var room = $(favorites + '.fedit-chan').val(); + var server = $(favorites + '.fedit-server').val(); + var xid = room + '@' + server; + var password = $(favorites + '.fedit-password').val(); + var autojoin = '0'; + + if($(favorites + '.fedit-autojoin').filter(':checked').size()) + autojoin = '1'; + + // We check the missing values and send this if okay + if((type == 'add') || (type == 'edit')) { + if(title && nick && room && server) { + // Remove the edited room + if(type == 'edit') + removeFavorite(old_xid, true); + + // Display the favorites + displayFavorites(xid, title, nick, autojoin, password); + + // Reset the inputs + resetFavorites(); + } + + else { + $(favorites + 'input[required]').each(function() { + var select = $(this); + + if(!select.val()) + $(document).oneTime(10, function() { + select.addClass('please-complete').focus(); + }); + else + select.removeClass('please-complete'); + }); + } + } + + // Must remove a favorite? + else if(type == 'remove') { + removeFavorite(old_xid, true); + + // Reset the inputs + resetFavorites(); + } + + // Publish the new favorites + favoritePublish(); + + logThis('Action on this bookmark: ' + room + '@' + server + ' / ' + type, 3); + + return false; +} + +// Removes a favorite +function removeFavorite(xid, database) { + // We remove the target favorite everywhere needed + $('.buddy-conf-groupchat-select option[value=' + xid + ']').remove(); + $('.fedit-head-select option[value=' + xid + ']').remove(); + + // Must remove it from database? + if(database) + removeDB('favorites', xid); +} + +// Sends a favorite to the XMPP server +function favoritePublish() { + var iq = new JSJaCIQ(); + iq.setType('set'); + + var query = iq.setQuery(NS_PRIVATE); + var storage = query.appendChild(iq.buildNode('storage', {'xmlns': NS_BOOKMARKS})); + + // We generate the XML + for(var i = 0; i < sessionStorage.length; i++) { + // Get the pointer values + var current = sessionStorage.key(i); + + // If the pointer is on a stored favorite + if(explodeThis('_', current, 0) == 'favorites') { + var data = XMLFromString(sessionStorage.getItem(current)); + var xid = $(data).find('xid').text(); + var rName = $(data).find('name').text(); + var nick = $(data).find('nick').text(); + var password = $(data).find('password').text(); + var autojoin = $(data).find('autojoin').text(); + + // We create the node for this groupchat + var item = storage.appendChild(iq.buildNode('conference', {'name': rName, 'jid': xid, 'autojoin': autojoin, xmlns: NS_BOOKMARKS})); + item.appendChild(iq.buildNode('nick', {xmlns: NS_BOOKMARKS}, nick)); + + if(password) + item.appendChild(iq.buildNode('password', {xmlns: NS_BOOKMARKS}, password)); + + logThis('Bookmark sent: ' + xid, 3); + } + } + + con.send(iq); +} + +// Gets a list of the MUC items on a given server +function getGCList() { + var path = '#favorites .'; + var gcServer = $('.fsearch-head-server').val(); + + // We reset some things + $(path + 'fsearch-oneresult').remove(); + $(path + 'fsearch-noresults').hide(); + $(path + 'wait').show(); + + var iq = new JSJaCIQ(); + iq.setType('get'); + iq.setTo(gcServer); + + iq.setQuery(NS_DISCO_ITEMS); + + con.send(iq, handleGCList); +} + +// Handles the MUC items list +function handleGCList(iq) { + var path = '#favorites .'; + var from = fullXID(getStanzaFrom(iq)); + + if (!iq || (iq.getType() != 'result')) { + openThisError(3); + + $(path + 'wait').hide(); + + logThis('Error while retrieving the rooms: ' + from, 1); + } + + else { + var handleXML = iq.getQuery(); + + if($(handleXML).find('item').size()) { + // Initialize the HTML code + var html = ''; + + $(handleXML).find('item').each(function() { + var roomXID = $(this).attr('jid'); + var roomName = $(this).attr('name'); + + if(roomXID && roomName) { + // Escaped values + var escaped_xid = encodeOnclick(roomXID); + var escaped_name = encodeOnclick(roomName); + + // Initialize the room HTML + html += '
' + + '
' + roomName.htmlEnc() + '
' + + '' + _e("Join") + ''; + + // This room is yet a favorite + if(existDB('favorites', roomXID)) + html += '' + _e("Remove") + ''; + else + html += '' + _e("Add") + ''; + + // Close the room HTML + html += '
'; + } + }); + + // Append this code to the popup + $(path + 'fsearch-results').append(html); + } + + else + $(path + 'fsearch-noresults').show(); + + logThis('Rooms retrieved: ' + from, 3); + } + + $(path + 'wait').hide(); +} + +// Joins a groupchat from favorites +function joinFavorite(room) { + quitFavorites(); + checkChatCreate(room, 'groupchat', '', '', getXIDNick(room)); + + return false; +} + +// Displays a given favorite +function displayFavorites(xid, name, nick, autojoin, password) { + // Generate the HTML code + var html = ''; + + // Remove the existing favorite + removeFavorite(xid, false); + + // We complete the select forms + $('#buddy-list .gc-join-first-option, #favorites .fedit-head-select-first-option').after(html); + + // We store the informations + var value = '' + xid.htmlEnc() + '' + name.htmlEnc() + '' + nick.htmlEnc() + '' + autojoin.htmlEnc() + '' + password.htmlEnc() + ''; + setDB('favorites', xid, value); +} + +// Loads the favorites for the popup +function loadFavorites() { + // Initialize the HTML code + var html = ''; + + // Read the database + for(var i = 0; i < sessionStorage.length; i++) { + // Get the pointer values + var current = sessionStorage.key(i); + + // If the pointer is on a stored favorite + if(explodeThis('_', current, 0) == 'favorites') { + var data = XMLFromString(sessionStorage.getItem(current)); + + // Add the current favorite to the HTML code + html += ''; + } + } + + // Generate specific HTML code + var favorites_bubble = '' + html; + var favorites_popup = '' + html; + + // Append the HTML code + $('#buddy-list .buddy-conf-groupchat-select').html(favorites_bubble); + $('#favorites .fedit-head-select').html(favorites_popup); +} + +// Plugin launcher +function launchFavorites() { + var path = '#favorites .'; + + // Keyboard events + $(path + 'fsearch-head-server').keyup(function(e) { + if(e.keyCode == 13) { + // No value? + if(!$(this).val()) + $(this).val(HOST_MUC); + + // Get the list + getGCList(); + } + }); + + $(path + 'fedit-line input').keyup(function(e) { + if(e.keyCode == 13) { + // Edit a favorite + if($(path + 'fedit-edit').is(':visible')) + terminateThisFavorite('edit'); + + // Add a favorite + else + terminateThisFavorite('add'); + } + }); + + // Change events + $('.fedit-head-select').change(editFavorite); + + // Click events + $(path + 'room-switcher').click(function() { + $(path + 'favorites-content').hide(); + resetFavorites(); + }); + + $(path + 'room-list').click(function() { + $(path + 'favorites-edit').show(); + }); + + $(path + 'room-search').click(function() { + $(path + 'favorites-search').show(); + getGCList(); + }); + + $(path + 'fedit-add').click(function() { + return terminateThisFavorite('add'); + }); + + $(path + 'fedit-edit').click(function() { + return terminateThisFavorite('edit'); + }); + + $(path + 'fedit-remove').click(function() { + return terminateThisFavorite('remove'); + }); + + $(path + 'bottom .finish').click(function() { + return quitFavorites(); + }); +} diff --git a/sources/addons/jappixmini/jappix/js/features.js b/sources/addons/jappixmini/jappix/js/features.js new file mode 100644 index 00000000..4944be0a --- /dev/null +++ b/sources/addons/jappixmini/jappix/js/features.js @@ -0,0 +1,213 @@ +/* + +Jappix - An open social platform +This is the server features JS script for Jappix + +------------------------------------------------- + +License: AGPL +Author: Vanaryon +Last revision: 01/06/11 + +*/ + +// Gets the features of a server +function getFeatures() { + /* REF: http://xmpp.org/extensions/xep-0030.html */ + + // Get the main values + var to = getServer(); + var caps = con.server_caps; + var xml = null; + + // Try to get the stored data + if(caps) + xml = XMLFromString(getPersistent('caps', caps)); + + // Any stored data? + if(xml) { + handleFeatures(xml); + + logThis('Read server CAPS from cache.'); + } + + // Not stored (or no CAPS)! + else { + var iq = new JSJaCIQ(); + + iq.setTo(to); + iq.setType('get'); + iq.setQuery(NS_DISCO_INFO); + + con.send(iq, handleDiscoInfos); + + logThis('Read server CAPS from network.'); + } +} + +// Handles the features of a server +function handleFeatures(xml) { + // Selector + var selector = $(xml); + + // Markers + var pep = false; + var pubsub = false; + var archive = false; + var archive_auto = false; + var archive_manual = false; + var archive_manage = false; + var archive_pref = false; + var commands = false; + + // Scan the features + if(selector.find('identity[category=pubsub][type=pep]').size()) + pep = true; + if(selector.find('feature[var=' + NS_PUBSUB + ']').size()) + pubsub = true; + if(selector.find('feature[var=' + NS_URN_ARCHIVE + ']').size()) + archive = true; + if(selector.find('feature[var=' + NS_URN_AR_AUTO + ']').size()) + archive_auto = true; + if(selector.find('feature[var=' + NS_URN_AR_MANUAL + ']').size()) + archive_manual = true; + if(selector.find('feature[var=' + NS_URN_AR_MANAGE + ']').size()) + archive_manage = true; + if(selector.find('feature[var=' + NS_URN_AR_PREF + ']').size()) + archive_pref = true; + if(selector.find('feature[var=' + NS_COMMANDS + ']').size()) + commands = true; + + // Enable the pep elements if available + if(pep) { + // Update our database + enableFeature('pep'); + + // Get the microblog + getInitMicroblog(); + + // Get the notifications + getNotifications(); + + // Geolocate the user + geolocate(); + + // Enable microblogging send tools + waitMicroblog('sync'); + $('.postit.attach').css('display', 'block'); + + logThis('XMPP server supports PEP.', 3); + } + + // Disable microblogging send tools (no PEP!) + else { + waitMicroblog('unsync'); + + logThis('XMPP server does not support PEP.', 2); + } + + // Enable the pubsub features if available + if(pubsub) + enableFeature(NS_PUBSUB); + + // Enable the archiving features if available + if(archive) + enableFeature(NS_URN_ARCHIVE); + + // Enable the archiving sub-features if available + if(archive_pref) + enableFeature(NS_URN_AR_PREF); + if(archive_auto) + enableFeature(NS_URN_AR_AUTO); + if(archive_manual) + enableFeature(NS_URN_AR_MANUAL); + if(archive_manage) + enableFeature(NS_URN_AR_MANAGE); + + // Enable the commands features if available + if(commands) + enableFeature(NS_COMMANDS); + + // Hide the private life fieldset if nothing to show + if(!pep && !archive_pref) + $('#options fieldset.privacy').hide(); + + // Apply the features + applyFeatures('talk'); + + // Process the buddy-list height + if(pep) + adaptRoster(); + + return false; +} + +// The function to apply the features to an element +function applyFeatures(id) { + // Path to the elements + var path = '#' + id + ' .'; + + // PEP features + if(enabledPEP()) + $(path + 'pep-hidable').show(); + + // PubSub features + if(enabledPubSub()) + $(path + 'pubsub-hidable').show(); + + // Archives features + if(enabledArchives() || enabledArchives('auto') || enabledArchives('manual') || enabledArchives('manage')) { + $(path + 'archives-hidable:not(.pref)').show(); + + // Sub-feature: archives preferences + if(enabledArchives('pref')) + $(path + 'archives-hidable.pref').show(); + } + + // Commands features + if(enabledCommands()) + $(path + 'commands-hidable').show(); + + // XMPP links (browser feature) + if(navigator.registerProtocolHandler) + $(path + 'xmpplinks-hidable').show(); +} + +// Enables a feature +function enableFeature(feature) { + setDB('feature', feature, 'true'); +} + +// Checks if a feature is enabled +function enabledFeature(feature) { + if(getDB('feature', feature) == 'true') + return true; + else + return false; +} + +// Returns the XMPP server PEP support +function enabledPEP() { + return enabledFeature('pep'); +} + +// Returns the XMPP server PubSub support +function enabledPubSub() { + return enabledFeature(NS_PUBSUB); +} + +// Returns the XMPP server archives support +function enabledArchives(sub) { + var xmlns = NS_URN_ARCHIVE; + + // Any sub element sent? + if(sub) + xmlns += ':' + sub; + + return enabledFeature(xmlns); +} + +// Returns the XMPP server commands support +function enabledCommands() { + return enabledFeature(NS_COMMANDS); +} diff --git a/sources/addons/jappixmini/jappix/js/filter.js b/sources/addons/jappixmini/jappix/js/filter.js new file mode 100644 index 00000000..48e5238f --- /dev/null +++ b/sources/addons/jappixmini/jappix/js/filter.js @@ -0,0 +1,189 @@ +/* + +Jappix - An open social platform +These are the filtering JS script for Jappix + +------------------------------------------------- + +License: AGPL +Authors: Vanaryon, Maranda +Last revision: 04/08/11 + +*/ + +// Generates a given emoticon HTML code +function emoteImage(image, text, after) { + return ' ' + encodeQuotes(text) + ' ' + after; +} + +// Filters a given message +function filterThisMessage(neutralMessage, nick, html_encode) { + var filteredMessage = neutralMessage; + + // We encode the HTML special chars + if(html_encode) + filteredMessage = filteredMessage.htmlEnc(); + + // /me command + filteredMessage = filteredMessage.replace(/((^)|((.+)(>)))(\/me )([^<]+)/, nick + ' $7') + + // We replace the smilies text into images + .replace(/(:-?@)($|\s|<)/gi, emoteImage('angry', '$1', '$2')) + .replace(/(:-?\[)($|\s|<)/gi, emoteImage('bat', '$1', '$2')) + .replace(/(\(B\))($|\s|<)/g, emoteImage('beer', '$1', '$2')) + .replace(/((:-?D)|(XD))($|\s|<)/gi, emoteImage('biggrin', '$1', '$4')) + .replace(/(:-?\$)($|\s|<)/gi, emoteImage('blush', '$1', '$2')) + .replace(/(\(Z\))($|\s|<)/g, emoteImage('boy', '$1', '$2')) + .replace(/(\(W\))($|\s|<)/g, emoteImage('brflower', '$1', '$2')) + .replace(/((<\/3)|(\(U\)))($|\s|<)/g, emoteImage('brheart', '$1', '$4')) + .replace(/(\(C\))($|\s|<)/g, emoteImage('coffee', '$1', '$2')) + .replace(/((8-\))|(\(H\)))($|\s|<)/g, emoteImage('coolglasses', '$1', '$4')) + .replace(/(:'-?\()($|\s|<)/gi, emoteImage('cry', '$1', '$2')) + .replace(/(\(%\))($|\s|<)/g, emoteImage('cuffs', '$1', '$2')) + .replace(/(\]:-?>)($|\s|<)/gi, emoteImage('devil', '$1', '$2')) + .replace(/(\(D\))($|\s|<)/g, emoteImage('drink', '$1', '$2')) + .replace(/(@}->--)($|\s|<)/gi, emoteImage('flower', '$1', '$2')) + .replace(/((:-?\/)|(:-?S))($|\s|<)/gi, emoteImage('frowning', '$1', '$4')) + .replace(/(\(X\))($|\s|<)/g, emoteImage('girl', '$1', '$2')) + .replace(/((<3)|(\(L\)))($|\s|<)/g, emoteImage('heart', '$1', '$4')) + .replace(/(\(}\))($|\s|<)/g, emoteImage('hugleft', '$1', '$2')) + .replace(/(\({\))($|\s|<)/g, emoteImage('hugright', '$1', '$2')) + .replace(/(:-?{})($|\s|<)/gi, emoteImage('kiss', '$1', '$2')) + .replace(/(\(I\))($|\s|<)/g, emoteImage('lamp', '$1', '$2')) + .replace(/(:-?3)($|\s|<)/gi, emoteImage('lion', '$1', '$2')) + .replace(/(\(E\))($|\s|<)/g, emoteImage('mail', '$1', '$2')) + .replace(/(\(S\))($|\s|<)/g, emoteImage('moon', '$1', '$2')) + .replace(/(\(8\))($|\s|<)/g, emoteImage('music', '$1', '$2')) + .replace(/((=-?O)|(:-?O))($|\s|<)/gi, emoteImage('oh', '$1', '$4')) + .replace(/(\(T\))($|\s|<)/g, emoteImage('phone', '$1', '$2')) + .replace(/(\(P\))($|\s|<)/g, emoteImage('photo', '$1', '$2')) + .replace(/(:-?!)($|\s|<)/gi, emoteImage('puke', '$1', '$2')) + .replace(/(\(@\))($|\s|<)/g, emoteImage('pussy', '$1', '$2')) + .replace(/(\(R\))($|\s|<)/g, emoteImage('rainbow', '$1', '$2')) + .replace(/(:-?\))($|\s|<)/gi, emoteImage('smile', '$1', '$2')) + .replace(/(\(\*\))($|\s|<)/g, emoteImage('star', '$1', '$2')) + .replace(/(:-?\|)($|\s|<)/gi, emoteImage('stare', '$1', '$2')) + .replace(/(\(N\))($|\s|<)/g, emoteImage('thumbdown', '$1', '$2')) + .replace(/(\(Y\))($|\s|<)/g, emoteImage('thumbup', '$1', '$2')) + .replace(/(:-?P)($|\s|<)/gi, emoteImage('tongue', '$1', '$2')) + .replace(/(:-?\()($|\s|<)/gi, emoteImage('unhappy', '$1', '$2')) + .replace(/(;-?\))($|\s|<)/gi, emoteImage('wink', '$1', '$2')) + + // Text in bold + .replace(/(^|\s|>)((\*)([^<>'"]+)(\*))($|\s|<)/gi, '$1$2$6') + + // Italic text + .replace(/(^|\s|>)((\/)([^<>'"]+)(\/))($|\s|<)/gi, '$1$2$6') + + // Underlined text + .replace(/(^|\s|>)((_)([^<>'"]+)(_))($|\s|<)/gi, '$1$2$6'); + + // Add the links + if(html_encode) + filteredMessage = applyLinks(filteredMessage, 'desktop'); + + // Filter integratebox links + filteredMessage = filterIntegrateBox(filteredMessage); + + return filteredMessage; +} + +// Filters a xHTML message to be displayed in Jappix +function filterThisXHTML(code) { + // Allowed elements array + var elements = new Array( + 'a', + 'abbr', + 'acronym', + 'address', + 'blockquote', + 'body', + 'br', + 'cite', + 'code', + 'dd', + 'dfn', + 'div', + 'dt', + 'em', + 'h1', + 'h2', + 'h3', + 'h4', + 'h5', + 'h6', + 'head', + 'html', + 'img', + 'kbd', + 'li', + 'ol', + 'p', + 'pre', + 'q', + 'samp', + 'span', + 'strong', + 'title', + 'ul', + 'var' + ); + + // Allowed attributes array + var attributes = new Array( + 'accesskey', + 'alt', + 'charset', + 'cite', + 'class', + 'height', + 'href', + 'hreflang', + 'id', + 'longdesc', + 'profile', + 'rel', + 'rev', + 'src', + 'style', + 'tabindex', + 'title', + 'type', + 'uri', + 'version', + 'width', + 'xml:lang', + 'xmlns' + ); + + // Remove forbidden elements + $(code).find('html body *').each(function() { + // This element is not authorized + if(!existArrayValue(elements, (this).nodeName.toLowerCase())) + $(this).remove(); + }); + + // Remove forbidden attributes + $(code).find('html body *').each(function() { + // Put a pointer on this element (jQuery way & normal way) + var cSelector = $(this); + var cElement = (this); + + // Loop the attributes of the current element + $(cElement.attributes).each(function(index) { + // Read the current attribute + var cAttr = cElement.attributes[index]; + var cName = cAttr.name; + var cVal = cAttr.value; + + // This attribute is not authorized, or contains JS code + if(!existArrayValue(attributes, cName.toLowerCase()) || ((cVal.toLowerCase()).match(/(^|"|')javascript:/))) + cSelector.removeAttr(cName); + }); + }); + + // Filter some other elements + $(code).find('a').attr('target', '_blank'); + + return $(code).find('html body').html(); +} diff --git a/sources/addons/jappixmini/jappix/js/groupchat.js b/sources/addons/jappixmini/jappix/js/groupchat.js new file mode 100644 index 00000000..c8dd13b1 --- /dev/null +++ b/sources/addons/jappixmini/jappix/js/groupchat.js @@ -0,0 +1,283 @@ +/* + +Jappix - An open social platform +These are the groupchat JS scripts for Jappix + +------------------------------------------------- + +License: AGPL +Authors: Vanaryon, Maranda, Eric +Last revision: 28/08/11 + +*/ + +// Displays the MUC admin elements +function displayMucAdmin(affiliation, id, xid, statuscode) { + // We must be in the "login" mode + if(isAnonymous()) + return; + + // We check if the user is a room owner or administrator to give him privileges + if(affiliation == 'owner' || affiliation == 'admin') + $('#' + id + ' .tools-mucadmin').show(); + + // We check if the room hasn't been yet created + if(statuscode == 201) + openThisInfo(4); + + // We add the click event + $('#' + id + ' .tools-mucadmin').click(function() { + openMucAdmin(xid, affiliation); + }); +} + +// Initializes a connection with a MUC groupchat +function getMUC(room, nickname, password) { + // Room hash + var hash = hex_md5(room); + + // Reset the elements + $('#' + hash + ' .muc-ask').remove(); + $('#' + hash + ' .compose').show(); + + // No nickname? + if(!nickname) { + // Get some values + if(!isAnonymous()) + nickname = getNick(); + else + nickname = ANONYMOUS_NICK; + + // If the nickname could not be retrieved, ask it + if(!nickname) + generateMUCAsk('nickname', room, hash, nickname, password); + } + + // Got our nickname? + if(nickname) { + // Get our general presence + var show = getDB('presence-show', 1); + var status = getDB('options', 'presence-status'); + + // Set my nick + $('#' + hash).attr('data-nick', escape(nickname)); + + // Send the appropriate presence + sendPresence(room + '/' + nickname, '', show, status, '', true, password, handleMUC); + } + + return false; +} + +// Handles the MUC main elements +function handleMUC(presence) { + // We get the xml content + var xml = presence.getNode(); + var from = fullXID(getStanzaFrom(presence)); + var room = bareXID(from); + var nickname = thisResource(from); + var hash = hex_md5(room); + + // No ID: must fix M-Link bug + if(presence.getID() == null) + presence.setID(1); + + logThis('First MUC presence: ' + from, 3); + + // Catch the errors + if(!handleError(xml)) { + // Define some stuffs + var muc_user = $(xml).find('x[xmlns=' + NS_MUC_USER + ']'); + var affiliation = muc_user.find('item').attr('affiliation'); + var statuscode = parseInt(muc_user.find('status').attr('code')); + + // Handle my presence + handlePresence(presence); + + // Check if I am a room owner + displayMucAdmin(affiliation, hash, room, statuscode); + + // Tell the MUC we can notify the incoming presences + $(document).oneTime('15s', function() { + $('#' + hash).attr('data-initial', 'true'); + }); + + // Enable the chatting input + $(document).oneTime(10, function() { + $('#' + hash + ' .message-area').removeAttr('disabled').focus(); + }); + } + + // A password is required + else if($(xml).find('error[type=auth] not-authorized').size()) + generateMUCAsk('password', room, hash, nickname); + + // There's a nickname conflict + else if($(xml).find('error[type=cancel] conflict').size()) + generateMUCAsk('nickname', room, hash); +} + +// Generates a correct MUC asker +function generateMUCAsk(type, room, hash, nickname, password) { + // Generate the path to the elements + var path_to = '#' + hash + ' .muc-ask'; + + // Define the label text + var label_text; + + switch(type) { + case 'nickname': + label_text = _e("Nickname"); + break; + + case 'password': + label_text = _e("Password"); + break; + } + + // Create the HTML markup + $('#' + hash + ' .compose').hide(); + + $('#' + hash).append( + '
' + + '' + + '' + + '
' + ); + + // When a key is pressed in the input + $(path_to + ' input').keyup(function(e) { + var value_input = $(this).val(); + + // Enter key pressed + if((e.keyCode == 13) && value_input) { + if(type == 'nickname') + nickname = value_input; + else if(type == 'password') + password = value_input; + + return getMUC(room, nickname, password); + } + }); + + // Focus on the input + $(document).oneTime(10, function() { + $(path_to + ' input').focus(); + }); +} + +// Creates a new groupchat +function groupchatCreate(hash, room, chan, nickname, password) { + /* REF: http://xmpp.org/extensions/xep-0045.html */ + + logThis('New groupchat: ' + room, 3); + + // Create the chat content + generateChat('groupchat', hash, room, chan); + + // Create the chat switcher + generateSwitch('groupchat', hash, room, chan); + + // The icons-hover functions + tooltipIcons(room, hash); + + // Click event on the add tool + $('#' + hash + ' .tools-add').click(function() { + // Hide the icon (to tell the user all is okay) + $(this).hide(); + + // Add the groupchat to the user favorites + addThisFavorite(room, chan); + }); + + // Must show the add button? + if(!existDB('favorites', room)) + $('#' + hash + ' .tools-add').show(); + + // The event handlers + var inputDetect = $('#' + hash + ' .message-area'); + + // Focus event + inputDetect.focus(function() { + chanCleanNotify(hash); + }) + + // Blur event + inputDetect.blur(function() { + resetAutocompletion(hash); + }) + + // Lock to the input + inputDetect.keypress(function(e) { + // Enter key + if(e.keyCode == 13) { + // Add a new line + if(e.shiftKey) + inputDetect.val(inputDetect.val() + '\n'); + + // Send the message + else { + sendMessage(hash, 'groupchat'); + + // Reset the composing database entry + setDB('chatstate', room, 'off'); + } + + return false; + } + + // Tabulation key + else if(e.keyCode == 9) { + createAutocompletion(hash); + + return false; + } + + // Reset the autocompleter + else + resetAutocompletion(hash); + }); + + // Chatstate events + eventsChatState(inputDetect, room, hash); + + // Get the current muc informations and content + getMUC(room, nickname, password); +} + +// Joins the defined groupchats +function joinConfGroupchats() { + // Nothing to join? + if(!GROUPCHATS_JOIN) + return; + + // Values array + var muc_arr = [GROUPCHATS_JOIN]; + var new_arr = []; + + // Try to split it + if(GROUPCHATS_JOIN.indexOf(',') != -1) + muc_arr = GROUPCHATS_JOIN.split(','); + + for(i in muc_arr) { + // Get the current value + var muc_current = trim(muc_arr[i]); + + // No current value? + if(!muc_current) + continue; + + // Filter the current value + muc_current = generateXID(muc_current, 'groupchat'); + + // Add the current value + if(!existArrayValue(new_arr, muc_current)) + new_arr.push(muc_current); + } + + // Join the chats + if(new_arr.length) { + for(g in new_arr) + checkChatCreate(new_arr[g], 'groupchat'); + } +} diff --git a/sources/addons/jappixmini/jappix/js/home.js b/sources/addons/jappixmini/jappix/js/home.js new file mode 100644 index 00000000..5322501d --- /dev/null +++ b/sources/addons/jappixmini/jappix/js/home.js @@ -0,0 +1,371 @@ +/* + +Jappix - An open social platform +These are the homepage JS scripts for Jappix + +------------------------------------------------- + +License: AGPL +Authors: Vanaryon, LinkMauve +Last revision: 15/01/12 + +*/ + +// Allows the user to switch the difference home page elements +function switchHome(div) { + // Path to + var home = '#home .'; + var right = home + 'right '; + var current = right + '.homediv.' + div; + + // We switch the div + $(right + '.homediv, ' + right + '.top').hide(); + $(right + '.' + div).show(); + + // We reset the homedivs + $(home + 'homediv:not(.default), ' + home + 'top:not(.default)').remove(); + + // Get the HTML code to display + var disable_form = ''; + var lock_host = ''; + var code = ''; + + // Apply the previous link + switch(div) { + case 'loginer': + case 'anonymouser': + case 'registerer': + if(!exists(right + '.top.sub')) { + // Append the HTML code for previous link + $(right + '.top.default').after('

«

'); + + // Click event on previous link + $(home + 'top.sub a.previous').click(function() { + return switchHome('default'); + }); + } + + break; + } + + // Apply the form + switch(div) { + // Login tool + case 'loginer': + lock_host = disableInput(LOCK_HOST, 'on'); + code = '

' + printf(_e("Login to your existing XMPP account. You can also use the %s to join a groupchat."), '' + _e("anonymous mode") + '') + '

' + + + '
' + + '
' + + '' + _e("Required") + '' + + + '' + + '@' + + '' + + '' + + '' + + '' + + '
' + + + '' + _e("Advanced") + '' + + + '
' + + '' + _e("Advanced") + '' + + + '' + + '' + + '' + + '' + + '
' + + + '' + + '
'; + + break; + + // Anonymous login tool + case 'anonymouser': + disable_form = disableInput(ANONYMOUS, 'off'); + code = '

' + printf(_e("Enter the groupchat you want to join and the nick you want to have. You can also go back to the %s."), '' + _e("login page") + '') + '

' + + + '
' + + '
' + + '' + _e("Required") + '' + + + '' + + '' + + + '' + + '' + + '
' + + + '' + + '
' + + + '
' + + _e("Share this link with your friends:") + ' ' + + '
'; + + break; + + // Register tool + case 'registerer': + disable_form = disableInput(REGISTRATION, 'off'); + + if(!disable_form) + lock_host = disableInput(LOCK_HOST, 'on'); + + code = '

' + _e("Register a new XMPP account to join your friends on your own social cloud. That's simple!") + '

' + + + '
' + + '
' + + '' + _e("Required") + '' + + + '' + + '@' + + '' + + '' + + '' + + '
' + + + '' + + '
'; + + break; + } + + // Form disabled? + if(disable_form) + code += '
' + + _e("This tool has been disabled, you cannot use it!") + + '
'; + + // Create this HTML code + if(code && !exists(current)) { + // Append it! + $(right + '.homediv.default').after('
' + code + '
'); + + // Create the attached events + switch(div) { + // Login tool + case 'loginer': + $(current + ' a.to-anonymous').click(function() { + return switchHome('anonymouser'); + }); + + $(current + ' a.advanced').click(showAdvanced); + + $(current + ' form').submit(loginForm); + + break; + + // Anonymous login tool + case 'anonymouser': + $(current + ' a.to-home').click(function() { + return switchHome('loginer'); + }); + + $(current + ' form').submit(doAnonymous); + + // Keyup event on anonymous join's room input + $(current + ' input.room').keyup(function() { + var value = $(this).val(); + var report = current + ' .report'; + var span = report + ' span'; + + if(!value) { + $(report).hide(); + $(span).text(''); + } + + else { + $(report).show(); + $(span).text(JAPPIX_LOCATION + '?r=' + value); + } + }); + + break; + + // Register tool + case 'registerer': + $(current + ' form').submit(registerForm); + + break; + } + } + + // We focus on the first input + $(document).oneTime(10, function() { + $(right + 'input:visible:first').focus(); + }); + + return false; +} + +// Allows the user to display the advanced login options +function showAdvanced() { + // Hide the link + $('#home a.advanced').hide(); + + // Show the fieldset + $('#home fieldset.advanced').show(); + + return false; +} + +// Reads the login form values +function loginForm() { + // We get the values + var lPath = '#home .loginer '; + var lServer = $(lPath + '.server').val(); + var lNick = $(lPath + '.nick').val(); + var lPass = $(lPath + '.password').val(); + var lResource = $(lPath + '.resource').val(); + var lPriority = $(lPath + '.priority').val(); + var lRemember = $(lPath + '.remember').filter(':checked').size(); + + // Enough values? + if(lServer && lNick && lPass && lResource && lPriority) + doLogin(lNick, lServer, lPass, lResource, lPriority, lRemember); + + // Something is missing? + else { + $(lPath + 'input[type=text], ' + lPath + 'input[type=password]').each(function() { + var select = $(this); + + if(!select.val()) + $(document).oneTime(10, function() { + select.addClass('please-complete').focus(); + }); + else + select.removeClass('please-complete'); + }); + } + + return false; +} + +// Reads the register form values +function registerForm() { + var rPath = '#home .registerer '; + + // Remove the success info + $(rPath + '.success').remove(); + + // Get the values + var username = $(rPath + '.nick').val(); + var domain = $(rPath + '.server').val(); + var pass = $(rPath + '.password').val(); + var spass = $(rPath + '.spassword').val(); + + // Enough values? + if(domain && username && pass && spass && (pass == spass)) { + // We remove the not completed class to avoid problems + $('#home .registerer input').removeClass('please-complete'); + + // Fire the register event! + doRegister(username, domain, pass); + } + + // Something is missing? + else { + $(rPath + 'input[type=text], ' + rPath + 'input[type=password]').each(function() { + var select = $(this); + + if(!select.val() || (select.is('#spassword') && pass && (pass != spass))) + $(document).oneTime(10, function() { + select.addClass('please-complete').focus(); + }); + else + select.removeClass('please-complete'); + }); + } + + return false; +} + +// Plugin launcher +function launchHome() { + // Define the vars + var home = '#home '; + var button = home + 'button'; + var corp = home + '.corporation'; + var locale = home + '.locale'; + + // Removes the