home.php 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934
  1. <?php
  2. /**
  3. * Copyright 2021, 2024 5 Mode
  4. *
  5. * This file is part of FoatingBuds.
  6. *
  7. * FoatingBuds is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * FoatingBuds is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with FoatingBuds. If not, see <https://www.gnu.org/licenses/>.
  19. *
  20. * home.php
  21. *
  22. * Home of FoatingBuds.
  23. *
  24. * @author Daniele Bonini <my25mb@aol.com>
  25. * @copyrights (c) 2016, 2024, 5 Mode
  26. */
  27. // CONSTANTS AND VARIABLE DECLARATION
  28. $CURRENT_VIEW = PUBLIC_VIEW;
  29. $CUDOZ = 1;
  30. $BUD_PATH = APP_DATA_PATH . DIRECTORY_SEPARATOR . BUD_NAME;
  31. $CV_PATH = $BUD_PATH . DIRECTORY_SEPARATOR . "cv";
  32. $FRIENDS_PATH = $BUD_PATH . DIRECTORY_SEPARATOR . "friends";
  33. $BLOG_PATH = $BUD_PATH . DIRECTORY_SEPARATOR . "blog";
  34. $GALLERY_PATH = $BUD_PATH . DIRECTORY_SEPARATOR . "gallery";
  35. $MAGICJAR1_PATH = $BUD_PATH . DIRECTORY_SEPARATOR . "magicjar1";
  36. $MAGICJAR2_PATH = $BUD_PATH . DIRECTORY_SEPARATOR . "magicjar2";
  37. $MAGICJAR3_PATH = $BUD_PATH . DIRECTORY_SEPARATOR . "magicjar3";
  38. $profilePic = APP_DEF_PROFILE_PIC;
  39. // PAGE PARAMETERS
  40. $lang = APP_DEF_LANG;
  41. $lang1 = substr(strip_tags(filter_input(INPUT_GET, "hl")??""), 0, 5);
  42. if ($lang1 !== PHP_STR) {
  43. $lang = $lang1;
  44. }
  45. $shortLang = getShortLang($lang);
  46. $blogSP = (int)substr(strip_tags(filter_input(INPUT_GET, "blogSP")??""), 0, 5);
  47. $userName = PHP_STR;
  48. $password = strip_tags(substr(filter_input(INPUT_POST, "password")??"",0,25));
  49. if ($password!==PHP_STR) {
  50. $hash = hash("sha256", $password . APP_SALT, false);
  51. foreach($CONFIG['AUTH'] as $key => $val) {
  52. if ($CONFIG['AUTH'][$key]['HASH'] === $hash) {
  53. define('USER_NAME', $key);
  54. $NICKNAME = $CONFIG['AUTH'][$key]['NICKNAME'];
  55. $PROFILE_PIC = $CONFIG['AUTH'][$key]['PROFILE_PIC'];
  56. $USER_COLOR = $CONFIG['AUTH'][$key]['COLOR'];
  57. $USER_LOCALE = $CONFIG['AUTH'][$key]['LOCALE'];
  58. $lang = $USER_LOCALE;
  59. $shortLang = getShortLang($lang);
  60. break;
  61. }
  62. }
  63. if (!defined("USER_NAME")) {
  64. $password=PHP_STR;
  65. }
  66. }
  67. if ($password===PHP_STR): ?>
  68. <?PHP if (defined("BUD_NAME") && BUD_NAME!==""):?>
  69. <!DOCTYPE html>
  70. <html lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
  71. <head>
  72. <meta name="viewport" content="width=device-width, initial-scale=1"/>
  73. <!--<?PHP echo(APP_LICENSE);?>-->
  74. <title><?PHP echo(APP_TITLE);?></title>
  75. <link rel="shortcut icon" href="/favicon.ico" />
  76. <meta name="description" content="Welcome to Avatar Free! Let everyone have its social presence."/>
  77. <meta name="keywords" content="Avatar Free,social,presence,avatarfree.org,on,premise,solution"/>
  78. <meta name="robots" content="index,follow"/>
  79. <meta name="author" content="5 Mode"/>
  80. <script src="/js/jquery-3.6.0.min.js" type="text/javascript"></script>
  81. <script src="/js/sha.js" type="text/javascript"></script>
  82. <script src="/js/common.js" type="text/javascript"></script>
  83. <link href="/css/style.css?r=<?PHP echo(time());?>" type="text/css" rel="stylesheet">
  84. <link href="/css/bootstrap.min.css" type="text/css" rel="stylesheet">
  85. </head>
  86. <body style="background:#FFFFFF;">
  87. <form action="/<?PHP echo(str_replace(".","~",BUD_NAME));?>" method="post" target="_self" style="width:100%;height:1000px;text-align:center;">
  88. <?PHP else:
  89. die("Invalid CHAT NAME");
  90. endif; ?>
  91. <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
  92. <span id="labLogin">Login with your password:</span><br>
  93. <input id="password" name="password" type="password" value="" maxlength="25" placeholder="PASSWORD">
  94. </form>
  95. <body>
  96. <?PHP
  97. exit(0);
  98. endif;
  99. // if ($password !== PHP_STR) {
  100. // $CURRENT_VIEW = ADMIN_VIEW;
  101. // } else {
  102. // $CURRENT_VIEW = PUBLIC_VIEW;
  103. //}
  104. $magicJar1 = (int)substr(strip_tags(filter_input(INPUT_POST, "txtMagicJar1")??""), 0, 1);
  105. $magicJar2 = (int)substr(strip_tags(filter_input(INPUT_POST, "txtMagicJar2")??""), 0, 1);
  106. $magicJar3 = (int)substr(strip_tags(filter_input(INPUT_POST, "txtMagicJar3")??""), 0, 1);
  107. function uploadNewRes() {
  108. global $BUD_PATH;
  109. global $CV_PATH;
  110. global $FRIENDS_PATH;
  111. global $BLOG_PATH;
  112. global $GALLERY_PATH;
  113. global $MAGICJAR1_PATH;
  114. global $MAGICJAR2_PATH;
  115. global $MAGICJAR3_PATH;
  116. global $magicJar1;
  117. global $magicJar2;
  118. global $magicJar3;
  119. //echo_ifdebug(true, "BUD_PATH#1=");
  120. //echo_ifdebug(true, $BUD_PATH);
  121. if (!empty($_FILES['files']['tmp_name'][0]) || !empty($_FILES['filesdd']['tmp_name'][0])) {
  122. $uploads = (array)fixMultipleFileUpload($_FILES['files']);
  123. if ($uploads[0]['error'] === PHP_UPLOAD_ERR_NO_FILE) {
  124. $uploads = (array)fixMultipleFileUpload($_FILES['filesdd']);
  125. }
  126. //if ($uploads[0]['error'] === PHP_UPLOAD_ERR_NO_FILE) {
  127. // echo("WARNING: No file uploaded.");
  128. // return;
  129. //}
  130. $google = "abcdefghijklmnopqrstuvwxyz";
  131. if (count($uploads)>strlen($google)) {
  132. echo("WARNING: Too many uploaded files.");
  133. return;
  134. }
  135. $i=1;
  136. foreach($uploads as &$upload) {
  137. switch ($upload['error']) {
  138. case PHP_UPLOAD_ERR_OK:
  139. break;
  140. case PHP_UPLOAD_ERR_NO_FILE:
  141. echo("WARNING: One or more uploaded files are missing.");
  142. return;
  143. case PHP_UPLOAD_ERR_INI_SIZE:
  144. echo("WARNING: File exceeded INI size limit.");
  145. return;
  146. case PHP_UPLOAD_ERR_FORM_SIZE:
  147. echo("WARNING: File exceeded form size limit.");
  148. return;
  149. case PHP_UPLOAD_ERR_PARTIAL:
  150. echo("WARNING: File only partially uploaded.");
  151. return;
  152. case PHP_UPLOAD_ERR_NO_TMP_DIR:
  153. echo("WARNING: TMP dir doesn't exist.");
  154. return;
  155. case PHP_UPLOAD_ERR_CANT_WRITE:
  156. echo("WARNING: Failed to write to the disk.");
  157. return;
  158. case PHP_UPLOAD_ERR_EXTENSION:
  159. echo("WARNING: A PHP extension stopped the file upload.");
  160. return;
  161. default:
  162. echo("WARNING: Unexpected error happened.");
  163. return;
  164. }
  165. if (!is_uploaded_file($upload['tmp_name'])) {
  166. echo("WARNING: One or more file have not been uploaded.");
  167. return;
  168. }
  169. // name
  170. $name = (string)substr((string)filter_var($upload['name']), 0, 255);
  171. if ($name == PHP_STR) {
  172. echo("WARNING: Invalid file name: " . $name);
  173. return;
  174. }
  175. $upload['name'] = $name;
  176. // fileType
  177. $fileType = substr((string)filter_var($upload['type']), 0, 30);
  178. $upload['type'] = $fileType;
  179. // tmp_name
  180. $tmp_name = substr((string)filter_var($upload['tmp_name']), 0, 300);
  181. if ($tmp_name == PHP_STR || !file_exists($tmp_name)) {
  182. echo("WARNING: Invalid file temp path: " . $tmp_name);
  183. return;
  184. }
  185. $upload['tmp_name'] = $tmp_name;
  186. //size
  187. $size = substr((string)filter_var($upload['size'], FILTER_SANITIZE_NUMBER_INT), 0, 12);
  188. if ($size == "") {
  189. echo("WARNING: Invalid file size.");
  190. return;
  191. }
  192. $upload["size"] = $size;
  193. $tmpFullPath = $upload["tmp_name"];
  194. $originalFilename = pathinfo($name, PATHINFO_FILENAME);
  195. $originalFileExt = pathinfo($name, PATHINFO_EXTENSION);
  196. $fileExt = strtolower(pathinfo($name, PATHINFO_EXTENSION));
  197. $date = date("Ymd-His");
  198. $rnd = mt_rand(1000000000, 9999999999);
  199. if ($originalFileExt!==PHP_STR) {
  200. $destFileName = $date . "-" . $rnd . substr($google, $i-1, 1) . "|" . USER_NAME . "|" . str_replace(" ", "_", $originalFilename) . ".$fileExt";
  201. } else {
  202. return;
  203. }
  204. //$CV_PATH = APP_DATA_PATH . DIRECTORY_SEPARATOR . "cv";
  205. //$FRIENDS_PATH = APP_DATA_PATH . DIRECTORY_SEPARATOR . "friends";
  206. //$BLOG_PATH = APP_DATA_PATH . DIRECTORY_SEPARATOR . "blog";
  207. //$GALLERY_PATH = APP_DATA_PATH . DIRECTORY_SEPARATOR . "gallery";
  208. $destPaths = [];
  209. $destFullPaths = [];
  210. if ($magicJar1 != 0) {
  211. $destPaths[] = $MAGICJAR1_PATH;
  212. $destFullPaths[] = $destPaths[count($destPaths)-1] . DIRECTORY_SEPARATOR . $destFileName;
  213. }
  214. if ($magicJar2 != 0) {
  215. $destPaths[] = $MAGICJAR2_PATH;
  216. $destFullPaths[] = $destPaths[count($destPaths)-1] . DIRECTORY_SEPARATOR . $destFileName;
  217. }
  218. if ($magicJar3 != 0) {
  219. $destPaths[] = $MAGICJAR3_PATH;
  220. $destFullPaths[] = $destPaths[count($destPaths)-1] . DIRECTORY_SEPARATOR . $destFileName;
  221. }
  222. if (empty($destPaths)) {
  223. switch ($fileExt) {
  224. case "doc":
  225. case "docx":
  226. case "pdf":
  227. $destPaths[] = $CV_PATH;
  228. break;
  229. case "txt":
  230. $destPaths[] = $BLOG_PATH;
  231. break;
  232. case "png":
  233. case "jpg":
  234. case "jpeg":
  235. case "gif":
  236. case "webp":
  237. $destPaths[] = $GALLERY_PATH;
  238. break;
  239. default:
  240. $destPaths[] = $MAGICJAR1_PATH;
  241. break;
  242. }
  243. $destFullPaths[] = $destPaths[0] . DIRECTORY_SEPARATOR . $destFileName;
  244. }
  245. $iPath = 0;
  246. foreach($destFullPaths as $destFullPath) {
  247. if (file_exists($destFullPath)) {
  248. echo("WARNING: destination already exists");
  249. exit(1);
  250. }
  251. if (filesize($tmpFullPath) > APP_FILE_MAX_SIZE) {
  252. echo("ERROR: file size(" . filesize($tmpFullPath) . ") exceeds app limit:" . APP_FILE_MAX_SIZE);
  253. exit(1);
  254. }
  255. if (!is_readable($BUD_PATH)) {
  256. mkdir($BUD_PATH, 0777);
  257. }
  258. if (!is_readable($destPaths[$iPath])) {
  259. mkdir($destPaths[$iPath], 0777);
  260. }
  261. $pattern = $destPaths[$iPath] . DIRECTORY_SEPARATOR . "*" . "|" . str_replace(" ", "_", $originalFilename) . ".$fileExt";
  262. $aExistingPaths = glob($pattern);
  263. if (!empty($aExistingPaths)) {
  264. continue;
  265. }
  266. copy($tmpFullPath, $destFullPath);
  267. $iPath++;
  268. }
  269. // Cleaning up..
  270. // Delete the tmp file..
  271. unlink($tmpFullPath);
  272. $i++;
  273. }
  274. } else {
  275. //echo("WARNING: No file uploaded (err-pip-po).");
  276. }
  277. }
  278. function writeFriends() {
  279. global $FRIENDS_PATH;
  280. $destPath = $FRIENDS_PATH;
  281. $s = filter_input(INPUT_POST, "f")??"";
  282. $s = strip_tags($s);
  283. if ($s != PHP_STR) {
  284. //echo($s);
  285. //exit(0);
  286. $friends=explode("|", $s);
  287. if (!is_readable($destPath)) {
  288. mkdir($destPath, 0777);
  289. }
  290. foreach($friends as $friend) {
  291. $a = explode("://",$friend);
  292. $s = $a[1];
  293. $a = explode("/", $s);
  294. $friendName = $a[0] . ".txt";
  295. file_put_contents($destPath . DIRECTORY_SEPARATOR . $friendName, $friend);
  296. }
  297. }
  298. }
  299. function grabProfileImage() {
  300. global $GALLERY_PATH;
  301. $pattern = $GALLERY_PATH . DIRECTORY_SEPARATOR . "*";
  302. $aImagePaths = glob($pattern);
  303. if (isset($aImagePaths[0])) {
  304. $retval = basename($aImagePaths[0]);
  305. } else {
  306. $retval = null;
  307. }
  308. return $retval;
  309. }
  310. function startApp() {
  311. global $CURRENT_VIEW;
  312. global $profilePic;
  313. if ($CURRENT_VIEW == $CURRENT_VIEW) {
  314. uploadNewRes();
  315. writeFriends();
  316. }
  317. $profilePic = grabProfileImage() ?? APP_DEF_PROFILE_PIC;
  318. //echo("profile pic=" . $profilePic);
  319. }
  320. startApp();
  321. ?>
  322. <!DOCTYPE html>
  323. <html lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
  324. <head>
  325. <meta name="viewport" content="width=device-width, initial-scale=1"/>
  326. <!--<?PHP echo(APP_LICENSE);?>-->
  327. <title><?PHP echo(APP_TITLE);?></title>
  328. <link rel="shortcut icon" href="/favicon.ico" />
  329. <meta name="description" content="Welcome to Avatar Free! Let everyone have its social presence."/>
  330. <meta name="keywords" content="Avatar Free,social,presence,avatarfree.org,on,premise,solution"/>
  331. <meta name="robots" content="index,follow"/>
  332. <meta name="author" content="5 Mode"/>
  333. <script src="/js/jquery-3.6.0.min.js" type="text/javascript"></script>
  334. <script src="/js/sha.js" type="text/javascript"></script>
  335. <script src="/js/common.js" type="text/javascript"></script>
  336. <link href="/css/style.css?r=<?PHP echo(time());?>" type="text/css" rel="stylesheet">
  337. <link href="/css/bootstrap.min.css" type="text/css" rel="stylesheet">
  338. </head>
  339. <?PHP if ($CURRENT_VIEW == ADMIN_VIEW): ?>
  340. <body style="background:url('/res/bg1.jpg') no-repeat; background-size: cover; background-attachment: fixed; background-position: center;">
  341. <div id="AFHint" style="z-index:0;">
  342. <button type="button" class="close" aria-label="Close" onclick="closeMe(this);" style="position:relative; top:5px; left:-7px;">
  343. <span aria-hidden="true" style="color:black; font-weight:900;">&times;</span>
  344. </button>
  345. <br>
  346. <span onclick="showHowTo();"><?PHP echo(getResource0("How-to: Manage your avatars in Avatar Free", $lang));?></span>
  347. <br><br>
  348. </div>
  349. <form id="frmUpload" role="form" method="post" action="/<?PHP echo(BUD_NAME);?>?hl=<?PHP echo($lang);?>" target="_self" enctype="multipart/form-data">
  350. <div class="dragover" dropzone="copy">
  351. <div id="fireupload" onclick="$('#files').click()">
  352. <img id="picavatar" src="/img?av=<?PHP echo(BUD_NAME);?>&pic=<?PHP echo($profilePic);?>" align="middle">
  353. </div>
  354. <input id="files" name="files[]" type="file" accept=".*" style="visibility: hidden;" multiple>
  355. <input type="hidden" id="a" name="a">
  356. <input type="hidden" id="f" name="f">
  357. </div>
  358. <div class="tools">
  359. <div class="settingson" onclick="settingsOn();"></div>
  360. <?PHP if ($magicJar1 == 0): ?>
  361. <div class="magicjar1" style="background:url(/res/magicjar1dis.png);" onclick="setJar1On()"></div>
  362. <?PHP else: ?>
  363. <div class="magicjar1" style="background:url(/res/magicjar1.png);" onclick="setJar1Off()"></div>
  364. <?PHP endif; ?>
  365. <?PHP if ($magicJar2 == 0): ?>
  366. <div class="magicjar2" style="background:url(/res/magicjar2dis.png);" onclick="setJar2On()"></div>
  367. <?PHP else: ?>
  368. <div class="magicjar2" style="background:url(/res/magicjar2.png);" onclick="setJar2Off()"></div>
  369. <?PHP endif; ?>
  370. <?PHP if ($magicJar3 == 0): ?>
  371. <div class="magicjar3" style="background:url(/res/magicjar3dis.png);" onclick="setJar3On()"></div>
  372. <?PHP else: ?>
  373. <div class="magicjar3" style="background:url(/res/magicjar3.png);" onclick="setJar3Off()"></div>
  374. <?PHP endif; ?>
  375. <div class="settingsoff" onclick="settingsOff();"></div>
  376. </div>
  377. <input type="hidden" id="txtMagicJar1" name="txtMagicJar1" value="<?PHP echo($magicJar1);?>">
  378. <input type="hidden" id="txtMagicJar2" name="txtMagicJar2" value="<?PHP echo($magicJar2);?>">
  379. <input type="hidden" id="txtMagicJar3" name="txtMagicJar3" value="<?PHP echo($magicJar3);?>">
  380. <input type="hidden" id="Password" name="Password" value="<?PHP echo($password);?>">
  381. </form>
  382. <div id="footerCont">&nbsp;</div>
  383. <div id="footer"><span style="background:#FFFFFF; opacity:0.7;">&nbsp;&nbsp;<a class="aaa" href="dd.html">Disclaimer</a>.&nbsp;&nbsp;A <a href="http://5mode.com" class="aaa">5 Mode</a> project and <a href="http://demo.5mode.com" class="aaa">WYSIWYG</a> system. <?PHP echo(getResource0("Some rights reserved", $lang));?></span></div>
  384. <?PHP else: ?>
  385. <body style="background:#FFFFFF no-repeat; background-size: cover; background-attachment: fixed; background-position: center;">
  386. <?php if (file_exists(APP_PATH . DIRECTORY_SEPARATOR . "jscheck.html")): ?>
  387. <?php include(APP_PATH . DIRECTORY_SEPARATOR . "jscheck.html"); ?>
  388. <?php endif; ?>
  389. <!--<div id="AFHint">
  390. <button type="button" class="close" aria-label="Close" onclick="closeMe(this);" style="position:relative; top:5px; left:-7px;">
  391. <span aria-hidden="true" style="color:black; font-weight:900;">&times;</span>
  392. </button>
  393. <br>
  394. <span onclick="showHowTo();"><?PHP echo(getResource0("How-to: Manage your avatars in Avatar Free", $lang));?></span>
  395. <br><br>
  396. </div> -->
  397. <div id="header" class="header" style="margin-top:18px;margin-bottom:18px;">
  398. <a href="http://floatingbuds.5mode-foss.eu" target="_self" style="color:#000000; text-decoration: none;">&nbsp;<img src="/res/AFlogo.png" align="middle" style="position:relative;top:-5px;width:22px;">&nbsp;Floating Buds</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://github.com/par7133/FloatingBuds" style="color:#000000;"><span style="color:#119fe2">on</span> github</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="mailto:code@gaox.io" style="color:#000000;"><span style="color:#119fe2">for</span> feedback</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="tel:+39-378-0812391" style="font-size:13px;background-color:#15c60b;border:2px solid #15c60b;color:#000000;height:27px;text-decoration:none;">&nbsp;&nbsp;get support&nbsp;&nbsp;</a>
  399. </div>
  400. <div id="headerMob" class="header" style="margin-top:18px;margin-bottom:18px;display:none">
  401. <br><a href="http://floatingbuds.5mode-foss.eu" target="_self" style="color:#000000; text-decoration: none;">&nbsp;<img src="/res/AFlogo.png" align="middle" style="position:relative;top:-5px;width:22px;">&nbsp;Floating Buds</a>
  402. </div>
  403. <form id="frmUpload" role="form" method="post" action="/<?PHP echo(BUD_NAME);?>?hl=<?PHP echo($lang);?>" target="_self" enctype="multipart/form-data">
  404. <div class="dragover" dropzone="copy">
  405. <br><br>
  406. <div id="title">
  407. <div style="min-width:550px;white-space: nowrap;">
  408. <div id="avatarLogo" onclick="$('#files').click()" style="float:left">
  409. <img id="picavatar" src="<?PHP echo($PROFILE_PIC);?>" align="middle" style="position:relative;display:inline;">
  410. </div>
  411. <div id="avatarName" style="float:left">
  412. &nbsp;<?PHP echo(strtoupper($NICKNAME));?>&nbsp;&nbsp;&nbsp;
  413. </div>
  414. </div>
  415. <div id="drop-img">
  416. <div id="fireupload" onclick="$('#files').click()">
  417. <img src="/res/dnd2.gif"><br>
  418. </div>
  419. </div>
  420. <div id="cudoz" style="display:none;">
  421. <?PHP for ($i=1;$i<=$CUDOZ;$i++): ?>
  422. <img id="cudozentry<?PHP echo($i);?>" class="cudoz-entry" src="/res/chicca_<?PHP echo($shortLang);?>.png">
  423. <?PHP endfor; ?>
  424. <?PHP for ($i=$CUDOZ+1;$i<=5;$i++): ?>
  425. <img id="cudozentry<?PHP echo($i);?>" class="cudoz-entry" src="/res/chiccadis.png">
  426. <?PHP endfor; ?>
  427. </div>
  428. <?PHP $CUDOZ++; ?>
  429. </div>
  430. <div id="blog">
  431. <?PHP
  432. $pattern = $BLOG_PATH . DIRECTORY_SEPARATOR . "*.txt";
  433. $aFilePaths = glob($pattern);
  434. if (empty($aFilePaths)): ?>
  435. <div class="blog-content">
  436. <span class="blog-entry-nickname" style="color:#000000;">5 Mode:</span>
  437. <div class="blog-entry">
  438. <?PHP echo(getResource0("Hello from 5 Mode", $lang));?>,<br><br>
  439. <?PHP echo(getResource0("This is just an example of blog entry", $lang));?>.<br><br>
  440. <?PHP echo(getResource0("Drag-n-drop .txt files to shape the blog", $lang));?>.<br>
  441. <?PHP echo(getResource0("Drag-n-drop .png or .jpg files to shape the gallery", $lang));?>.<br>
  442. <?PHP echo(getResource0("The other files will land in the *magic pot*", $lang));?>.<br><br>
  443. <?PHP echo(getResource0("Attention: everyone who know the blog uri can partecipate or watch by loggin-in", $lang));?>.<br>
  444. </div>
  445. </div>
  446. <?PHP else: ?>
  447. <?PHP
  448. $CUDOZ++;
  449. $iEntry = 1;
  450. $iCurEntry = 1;
  451. //arsort($aFilePaths, SORT_STRING);
  452. //echo("blogSP=".$blogSP);
  453. foreach ($aFilePaths as $filePath) {
  454. //echo("iCurEntry=".$iCurEntry);
  455. if ($iCurEntry<($blogSP+1)) {
  456. $iCurEntry++;
  457. continue;
  458. }
  459. if ($iEntry>APP_BLOG_MAX_POSTS) {
  460. break;
  461. }
  462. $s=file_get_contents($filePath);
  463. $fileName = basename($filePath);
  464. $aNameParts = explode("|",$fileName);
  465. $myUserName = strtoupper($aNameParts[1]);
  466. if (isset($CONFIG['AUTH'][$myUserName]['NICKNAME'])) {
  467. $myNickName = $CONFIG['AUTH'][$myUserName]['NICKNAME'];
  468. $myUserColor = $CONFIG['AUTH'][$myUserName]['COLOR'];
  469. } else {
  470. $myNickName = "Unknow (Attention!)";
  471. $myUserColor = "#000000";
  472. }
  473. if ($iEntry === count($aFilePaths) || $iEntry==APP_BLOG_MAX_POSTS) {
  474. $marginbottom = "0px";
  475. } else {
  476. $marginbottom = "5px";
  477. }
  478. ?>
  479. <div class="blog-content" style="margin-bottom:<?PHP echo($marginbottom);?>">
  480. <span class="blog-entry-nickname" style="color:<?PHP echo($myUserColor); ?>"><?PHP echo($myNickName); ?>:</span>
  481. <div class="blog-entry" style="width:100%;margin-bottom:0px;">
  482. <?PHP echo(enableEmoticons(HTMLencode($s, true)));?>
  483. </div>
  484. </div>
  485. <?PHP
  486. $iEntry++;
  487. $iCurEntry++;
  488. }?>
  489. <?PHP endif; ?>
  490. <?PHP
  491. $totPages = (int)(count($aFilePaths)/APP_BLOG_MAX_POSTS);
  492. if ($totPages < (count($aFilePaths)/APP_BLOG_MAX_POSTS)) {
  493. $totPages++;
  494. }
  495. $firstPost = 0;
  496. $prevPost = $blogSP - APP_BLOG_MAX_POSTS;
  497. if ($prevPost < 0) {
  498. $prevPost = 0;
  499. }
  500. $nextPost = $blogSP + APP_BLOG_MAX_POSTS;
  501. if ($nextPost > (($totPages - 1) * APP_BLOG_MAX_POSTS)) {
  502. $nextPost = (($totPages - 1) * APP_BLOG_MAX_POSTS);
  503. }
  504. if ($nextPost < 0) {
  505. $nextPost = 0;
  506. }
  507. $lastPost = (($totPages - 1) * APP_BLOG_MAX_POSTS);
  508. if ($lastPost < 0) {
  509. $lastPost = 0;
  510. }
  511. ?>
  512. <?PHP if (defined("APP_PAGINATION") && APP_PAGINATION): ?>
  513. <br><br>
  514. <div style="text-align:center;">
  515. <a href="/<?PHP echo(BUD_NAME); ?>/?blogSP=<?PHP echo($firstPost);?>"><img src="/res/first.png" style="width:45px;"></a>
  516. <a href="/<?PHP echo(BUD_NAME); ?>/?blogSP=<?PHP echo($prevPost);?>"><img src="/res/arrow-left2.png" style="width:45px;"></a>
  517. <a href="/<?PHP echo(BUD_NAME); ?>/?blogSP=<?PHP echo($nextPost);?>"><img src="/res/arrow-right2.png" style="width:45px;"></a>
  518. <a href="/<?PHP echo(BUD_NAME); ?>/?blogSP=<?PHP echo($lastPost);?>"><img src="/res/last.png" style="width:45px;"></a>
  519. </div>
  520. <?PHP endif; ?>
  521. <br><br>
  522. </div>
  523. <div style="clear:both; margin:auto;">
  524. <br><br>
  525. </div>
  526. <div id="gallery">
  527. <div class="gallery-content">
  528. <?PHP
  529. $pattern = $GALLERY_PATH . DIRECTORY_SEPARATOR . "*";
  530. $aFilePaths = glob($pattern);
  531. if (empty($aFilePaths)): ?>
  532. <div class="image-entry">
  533. <div style="width:100%;border:0px solid black;"><img class="image-ico" src="/res/imgicon.png" align="center"></div>
  534. <div style="margin-top:10px;"><?PHP echo(getResource0("Sample", $lang));?>.png</div>
  535. </div>
  536. <?PHP else: ?>
  537. <?PHP
  538. $CUDOZ++;
  539. $iEntry = 1;
  540. foreach ($aFilePaths as $filePath) {
  541. $orifilename = basename($filePath);
  542. $filename = explode("|",basename($filePath))[2];
  543. if ($iEntry === count($aFilePaths)) {
  544. $marginbottom = "0px";
  545. } else {
  546. $marginbottom = "5px";
  547. }
  548. ?>
  549. <div class="image-entry">
  550. <a href="/img?av=<?PHP echo(BUD_NAME);?>&pic=<?PHP echo($orifilename);?>">
  551. <div style="width:100%;border:0px solid black;"><img class="image-ico" src="/res/imgicon.png" align="center"></div>
  552. <div style="margin-top:10px;"><?PHP echo($filename);?> </div>
  553. </a>
  554. </div>
  555. <?PHP
  556. $iEntry++;
  557. }?>
  558. <?PHP endif; ?>
  559. </div>
  560. </div>
  561. <?PHP
  562. $pattern = $MAGICJAR1_PATH . DIRECTORY_SEPARATOR . "*";
  563. $aFilePaths = glob($pattern);
  564. if (empty($aFilePaths)): ?>
  565. <div id="magicjar1">
  566. <div class="magicjar1-content">
  567. <div class="magicjar-num">&nbsp;1&nbsp;</div>
  568. <div class="file-entry">
  569. <div style="width:100%;border:0px solid black;"><img class="image-ico" src="/res/fileicon.png" align="center"></div>
  570. <div style="margin-top:10px;"><?PHP echo(getResource0("Sample", $lang));?>.doc</div>
  571. </div>
  572. </div>
  573. </div>
  574. <?PHP else: ?>
  575. <div id="magicjar1">
  576. <div class="magicjar1-content">
  577. <div class="magicjar-num">&nbsp;1&nbsp;</div>
  578. <?PHP
  579. $iEntry = 1;
  580. foreach ($aFilePaths as $filePath) {
  581. $orifilename = basename($filePath);
  582. $orifileExt = strtolower(pathinfo($orifilename, PATHINFO_EXTENSION));
  583. $filename = explode("|",basename($filePath))[2];
  584. if ($iEntry === count($aFilePaths)) {
  585. $marginbottom = "0px";
  586. } else {
  587. $marginbottom = "5px";
  588. }
  589. ?>
  590. <div class="file-entry">
  591. <?PHP if (in_array($orifileExt, ["png", "jpg", "jpeg", "gif", "webp"])):?>
  592. <a href="/imgj?av=<?PHP echo(BUD_NAME);?>&jar=1&fn=<?PHP echo($orifilename);?>">
  593. <?PHP else: ?>
  594. <a href="/file?av=<?PHP echo(BUD_NAME);?>&jar=1&fn=<?PHP echo($orifilename);?>">
  595. <?PHP endif; ?>
  596. <div style="width:100%;border:0px solid black;"><img class="file-ico" src="/res/fileicon.png" align="center"></div>
  597. <div style="margin-top:10px;"><?PHP echo($filename);?> </div>
  598. </a>
  599. </div>
  600. <?PHP
  601. $iEntry++;
  602. }?>
  603. </div>
  604. </div>
  605. <?PHP endif; ?>
  606. <?PHP
  607. $pattern = $MAGICJAR2_PATH . DIRECTORY_SEPARATOR . "*";
  608. $aFilePaths = glob($pattern);
  609. if (!empty($aFilePaths)): ?>
  610. <div id="magicjar2">
  611. <div class="magicjar2-content">
  612. <div class="magicjar-num">&nbsp;2&nbsp;</div>
  613. <?PHP
  614. $iEntry = 1;
  615. foreach ($aFilePaths as $filePath) {
  616. $orifilename = basename($filePath);
  617. $orifileExt = strtolower(pathinfo($orifilename, PATHINFO_EXTENSION));
  618. $filename = explode("|",basename($filePath))[1];
  619. if ($iEntry === count($aFilePaths)) {
  620. $marginbottom = "0px";
  621. } else {
  622. $marginbottom = "5px";
  623. }
  624. ?>
  625. <div class="file-entry">
  626. <?PHP if (in_array($orifileExt, ["png", "jpg", "jpeg", "gif", "webp"])):?>
  627. <a href="/imgj?av=<?PHP echo(BUD_NAME);?>&jar=2&fn=<?PHP echo($orifilename);?>">
  628. <?PHP else: ?>
  629. <a href="/file?av=<?PHP echo(BUD_NAME);?>&jar=2&fn=<?PHP echo($orifilename);?>">
  630. <?PHP endif; ?>
  631. <div style="width:100%;border:0px solid black;"><img class="file-ico" src="/res/fileicon.png" align="center"></div>
  632. <div style="margin-top:10px;"><?PHP echo($filename);?> </div>
  633. </a>
  634. </div>
  635. <?PHP
  636. $iEntry++;
  637. }?>
  638. </div>
  639. </div>
  640. <?PHP endif; ?>
  641. <?PHP
  642. $pattern = $MAGICJAR3_PATH . DIRECTORY_SEPARATOR . "*";
  643. $aFilePaths = glob($pattern);
  644. if (!empty($aFilePaths)): ?>
  645. <div id="magicjar3">
  646. <div class="magicjar3-content">
  647. <div class="magicjar-num">&nbsp;3&nbsp;</div>
  648. <?PHP
  649. $iEntry = 1;
  650. foreach ($aFilePaths as $filePath) {
  651. $orifilename = basename($filePath);
  652. $orifileExt = strtolower(pathinfo($orifilename, PATHINFO_EXTENSION));
  653. $filename = explode("|",basename($filePath))[1];
  654. if ($iEntry === count($aFilePaths)) {
  655. $marginbottom = "0px";
  656. } else {
  657. $marginbottom = "5px";
  658. }
  659. ?>
  660. <div class="file-entry">
  661. <?PHP if (in_array($orifileExt, ["png", "jpg", "jpeg", "gif", "webp"])):?>
  662. <a href="/imgj?av=<?PHP echo(BUD_NAME);?>&jar=3&fn=<?PHP echo($orifilename);?>">
  663. <?PHP else: ?>
  664. <a href="/file?av=<?PHP echo(BUD_NAME);?>&jar=3&fn=<?PHP echo($orifilename);?>">
  665. <?PHP endif; ?>
  666. <div style="width:100%;border:0px solid black;"><img class="file-ico" src="/res/fileicon.png" align="center"></div>
  667. <div style="margin-top:10px;"><?PHP echo($filename);?> </div>
  668. </a>
  669. </div>
  670. <?PHP
  671. $iEntry++;
  672. }?>
  673. </div>
  674. </div>
  675. <?PHP endif; ?>
  676. <div id="friends">
  677. <div class="friends-content">
  678. <div id="mynetworkTitle"><?PHP echo(getResource0("My Network", $lang));?>:<br><br>
  679. <?PHP
  680. $pattern = $FRIENDS_PATH . DIRECTORY_SEPARATOR . "*.txt";
  681. $aFilePaths = glob($pattern);
  682. if (empty($aFilePaths)): ?>
  683. <div class="friend-entry">
  684. <a href="http://5mode.com">
  685. <div style="width:100%;border:0px solid black;"><img class="friend-ico" src="/res/pic1.png" align="center"></div>
  686. <div style="margin-top:10px;"><?PHP echo(getResource0("5 Mode", $lang));?></div>
  687. </a>
  688. </div>
  689. <?PHP else: ?>
  690. <?PHP
  691. $CUDOZ++;
  692. $iEntry = 1;
  693. foreach ($aFilePaths as $filePath) {
  694. $orifilename = basename($filePath);
  695. $link=file_get_contents($filePath);
  696. $filename = pathinfo($filePath, PATHINFO_FILENAME);
  697. if ($iEntry === count($aFilePaths)) {
  698. $marginbottom = "0px";
  699. } else {
  700. $marginbottom = "5px";
  701. }
  702. ?>
  703. <div class="friend-entry">
  704. <a href="<?PHP echo($link);?>">
  705. <div style="width:100%;border:0px solid black;"><img class="friend-ico" src="/res/pic1.png" align="center"></div>
  706. <div style="margin-top:10px;"><?PHP echo($filename);?> </div>
  707. </a>
  708. </div>
  709. <?PHP
  710. $iEntry++;
  711. }?>
  712. <?PHP endif; ?>
  713. </div>
  714. </div>
  715. </div>
  716. <!--
  717. <div id="passworddisplay">
  718. <br>
  719. &nbsp;&nbsp;<input type="password" id="Password" name="Password" placeholder="password" value="<?php echo($password);?>" autocomplete="off">&nbsp;<input type="submit" value="<?PHP echo(getResource0("Go", $lang));?>" style="text-align:left;width:25%;color:#000000;"><br>
  720. &nbsp;&nbsp;<input type="text" id="Salt" placeholder="salt" autocomplete="off"><br>
  721. <div style="text-align:center;">
  722. <a id="hashMe" href="#" onclick="showEncodedPassword();"><?PHP echo(getResource0("Hash Me", $lang));?>!</a>
  723. </div>
  724. </div>
  725. -->
  726. <input id="files" name="files[]" type="file" accept=".*" style="visibility: hidden;" multiple>
  727. <input type="hidden" id="a" name="a">
  728. <input type="hidden" id="f" name="f">
  729. <input type="hidden" id="password" name="password" value="<?PHP echo($password);?>">
  730. </div>
  731. </form>
  732. <div id="footerCont">&nbsp;</div>
  733. <div id="footer">
  734. <div style="float:left">
  735. <select id="cbLang" onchange="changeLang(this);">
  736. <option value="en-US" <?PHP echo($lang==PHP_EN?"selected":"");?>>en</option>
  737. <option value="it-IT" <?PHP echo($lang==PHP_IT?"selected":"");?>>it</option>
  738. <option value="zh-CN" <?PHP echo($lang==PHP_CN?"selected":"");?>>cn</option>
  739. </select>
  740. </div>
  741. <span style="background:#FFFFFF; opacity:0.7;">&nbsp;&nbsp;A <a href="http://5mode.com" class="aaa">5 Mode</a> project and <a href="http://demo.5mode.com" class="aaa">WYSIWYG</a> system. <?PHP echo(getResource0("Some rights reserved", $lang));?>.</span></div>
  742. <?PHP endif; ?>
  743. <script src="/static/js/home-js.php?hl=<?PHP echo($lang);?>&av=<?PHP echo(BUD_NAME);?>&cv=<?PHP echo($CURRENT_VIEW);?>&cu=<?PHP echo($CUDOZ);?>" type="text/javascript"></script>
  744. <?PHP if ($CURRENT_VIEW == PUBLIC_VIEW): ?>
  745. <!-- SKINNER CODE -->
  746. <?php if (is_readable($BUD_PATH . DIRECTORY_SEPARATOR . "skinner.html")): ?>
  747. <?php include($BUD_PATH . DIRECTORY_SEPARATOR . "skinner.html"); ?>
  748. <?php else: ?>
  749. <?php if (file_exists(APP_PATH . DIRECTORY_SEPARATOR . "skinner.html")): ?>
  750. <?php include(APP_PATH . DIRECTORY_SEPARATOR . "skinner.html"); ?>
  751. <?php endif; ?>
  752. <?php endif; ?>
  753. <!-- METRICS CODE -->
  754. <?php if (file_exists(APP_PATH . DIRECTORY_SEPARATOR . "metrics.html")): ?>
  755. <?php include(APP_PATH . DIRECTORY_SEPARATOR . "metrics.html"); ?>
  756. <?php endif; ?>
  757. <?php endif; ?>
  758. </body>
  759. </html>