home.php 34 KB

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