home.php 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776
  1. <?php
  2. /**
  3. * Copyright 2021, 2024 5 Mode
  4. *
  5. * This file is part of Avatar Free.
  6. *
  7. * Avatar Free 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. * Avatar Free 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 Avatar Free. If not, see <https://www.gnu.org/licenses/>.
  19. *
  20. * home.php
  21. *
  22. * Home of Avatar Free.
  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. $AVATAR_PATH = APP_DATA_PATH . DIRECTORY_SEPARATOR . AVATAR_NAME;
  31. $CV_PATH = $AVATAR_PATH . DIRECTORY_SEPARATOR . "cv";
  32. $FRIENDS_PATH = $AVATAR_PATH . DIRECTORY_SEPARATOR . "friends";
  33. $BLOG_PATH = $AVATAR_PATH . DIRECTORY_SEPARATOR . "blog";
  34. $GALLERY_PATH = $AVATAR_PATH . DIRECTORY_SEPARATOR . "gallery";
  35. $MAGICJAR1_PATH = $AVATAR_PATH . DIRECTORY_SEPARATOR . "magicjar1";
  36. $MAGICJAR2_PATH = $AVATAR_PATH . DIRECTORY_SEPARATOR . "magicjar2";
  37. $MAGICJAR3_PATH = $AVATAR_PATH . DIRECTORY_SEPARATOR . "magicjar3";
  38. $profilePic = APP_DEF_PROFILE_PIC;
  39. // PAGE PARAMETERS
  40. $lang = APP_DEF_LANG;
  41. $lang1 = substr(filter_input(INPUT_GET, "hl", FILTER_SANITIZE_STRING), 0, 5);
  42. if ($lang1 !== PHP_STR) {
  43. $lang = $lang1;
  44. }
  45. $shortLang = getShortLang($lang);
  46. $password = filter_input(INPUT_POST, "Password");
  47. if ($password !== PHP_STR) {
  48. $hash = hash("sha256", $password . APP_SALT, false);
  49. if ($hash !== APP_HASH) {
  50. $password=PHP_STR;
  51. }
  52. }
  53. if ($password !== PHP_STR) {
  54. $CURRENT_VIEW = ADMIN_VIEW;
  55. } else {
  56. $CURRENT_VIEW = PUBLIC_VIEW;
  57. }
  58. $magicJar1 = (int)substr(filter_input(INPUT_POST, "txtMagicJar1"), 0, 1);
  59. $magicJar2 = (int)substr(filter_input(INPUT_POST, "txtMagicJar2"), 0, 1);
  60. $magicJar3 = (int)substr(filter_input(INPUT_POST, "txtMagicJar3"), 0, 1);
  61. function uploadNewRes() {
  62. global $AVATAR_PATH;
  63. global $CV_PATH;
  64. global $FRIENDS_PATH;
  65. global $BLOG_PATH;
  66. global $GALLERY_PATH;
  67. global $MAGICJAR1_PATH;
  68. global $MAGICJAR2_PATH;
  69. global $MAGICJAR3_PATH;
  70. global $magicJar1;
  71. global $magicJar2;
  72. global $magicJar3;
  73. //echo_ifdebug(true, "AVATAR_PATH#1=");
  74. //echo_ifdebug(true, $AVATAR_PATH);
  75. //if (!empty($_FILES['files'])) {
  76. if (!empty($_FILES['filesdd']['tmp_name'][0])) {
  77. //no file uploaded
  78. //$uploads = (array)fixMultipleFileUpload($_FILES['files']);
  79. //if ($uploads[0]['error'] === UPLOAD_ERR_NO_FILE) {
  80. $uploads = (array)fixMultipleFileUpload($_FILES['filesdd']);
  81. //}
  82. //if ($uploads[0]['error'] === PHP_UPLOAD_ERR_NO_FILE) {
  83. // echo("WARNING: No file uploaded.");
  84. // return;
  85. //}
  86. $google = "abcdefghijklmnopqrstuvwxyz";
  87. if (count($uploads)>strlen($google)) {
  88. echo("WARNING: Too many uploaded files.");
  89. return;
  90. }
  91. $i=1;
  92. foreach($uploads as &$upload) {
  93. switch ($upload['error']) {
  94. case PHP_UPLOAD_ERR_OK:
  95. break;
  96. case PHP_UPLOAD_ERR_NO_FILE:
  97. echo("WARNING: One or more uploaded files are missing.");
  98. return;
  99. case PHP_UPLOAD_ERR_INI_SIZE:
  100. echo("WARNING: File exceeded INI size limit.");
  101. return;
  102. case PHP_UPLOAD_ERR_FORM_SIZE:
  103. echo("WARNING: File exceeded form size limit.");
  104. return;
  105. case PHP_UPLOAD_ERR_PARTIAL:
  106. echo("WARNING: File only partially uploaded.");
  107. return;
  108. case PHP_UPLOAD_ERR_NO_TMP_DIR:
  109. echo("WARNING: TMP dir doesn't exist.");
  110. return;
  111. case PHP_UPLOAD_ERR_CANT_WRITE:
  112. echo("WARNING: Failed to write to the disk.");
  113. return;
  114. case PHP_UPLOAD_ERR_EXTENSION:
  115. echo("WARNING: A PHP extension stopped the file upload.");
  116. return;
  117. default:
  118. echo("WARNING: Unexpected error happened.");
  119. return;
  120. }
  121. if (!is_uploaded_file($upload['tmp_name'])) {
  122. echo("WARNING: One or more file have not been uploaded.");
  123. return;
  124. }
  125. // name
  126. $name = (string)substr((string)filter_var($upload['name']), 0, 255);
  127. if ($name == PHP_STR) {
  128. echo("WARNING: Invalid file name: " . $name);
  129. return;
  130. }
  131. $upload['name'] = $name;
  132. // fileType
  133. $fileType = substr((string)filter_var($upload['type']), 0, 30);
  134. $upload['type'] = $fileType;
  135. // tmp_name
  136. $tmp_name = substr((string)filter_var($upload['tmp_name']), 0, 300);
  137. if ($tmp_name == PHP_STR || !file_exists($tmp_name)) {
  138. echo("WARNING: Invalid file temp path: " . $tmp_name);
  139. return;
  140. }
  141. $upload['tmp_name'] = $tmp_name;
  142. //size
  143. $size = substr((string)filter_var($upload['size'], FILTER_SANITIZE_NUMBER_INT), 0, 12);
  144. if ($size == "") {
  145. echo("WARNING: Invalid file size.");
  146. return;
  147. }
  148. $upload["size"] = $size;
  149. $tmpFullPath = $upload["tmp_name"];
  150. $originalFilename = pathinfo($name, PATHINFO_FILENAME);
  151. $originalFileExt = pathinfo($name, PATHINFO_EXTENSION);
  152. $fileExt = strtolower(pathinfo($name, PATHINFO_EXTENSION));
  153. $date = date("Ymd-His");
  154. $rnd = mt_rand(1000000000, 9999999999);
  155. if ($originalFileExt!==PHP_STR) {
  156. $destFileName = $date . "-" . $rnd . substr($google, $i-1, 1) . "|" . str_replace(" ", "_", $originalFilename) . ".$fileExt";
  157. } else {
  158. return;
  159. }
  160. //$CV_PATH = APP_DATA_PATH . DIRECTORY_SEPARATOR . "cv";
  161. //$FRIENDS_PATH = APP_DATA_PATH . DIRECTORY_SEPARATOR . "friends";
  162. //$BLOG_PATH = APP_DATA_PATH . DIRECTORY_SEPARATOR . "blog";
  163. //$GALLERY_PATH = APP_DATA_PATH . DIRECTORY_SEPARATOR . "gallery";
  164. $destPaths = [];
  165. $destFullPaths = [];
  166. if ($magicJar1 != 0) {
  167. $destPaths[] = $MAGICJAR1_PATH;
  168. $destFullPaths[] = $destPaths[count($destPaths)-1] . DIRECTORY_SEPARATOR . $destFileName;
  169. }
  170. if ($magicJar2 != 0) {
  171. $destPaths[] = $MAGICJAR2_PATH;
  172. $destFullPaths[] = $destPaths[count($destPaths)-1] . DIRECTORY_SEPARATOR . $destFileName;
  173. }
  174. if ($magicJar3 != 0) {
  175. $destPaths[] = $MAGICJAR3_PATH;
  176. $destFullPaths[] = $destPaths[count($destPaths)-1] . DIRECTORY_SEPARATOR . $destFileName;
  177. }
  178. if (empty($destPaths)) {
  179. switch ($fileExt) {
  180. case "doc":
  181. case "docx":
  182. case "pdf":
  183. $destPaths[] = $CV_PATH;
  184. break;
  185. case "txt":
  186. $destPaths[] = $BLOG_PATH;
  187. break;
  188. case "png":
  189. case "jpg":
  190. case "jpeg":
  191. case "gif":
  192. case "webp":
  193. $destPaths[] = $GALLERY_PATH;
  194. break;
  195. default:
  196. $destPaths[] = $MAGICJAR1_PATH;
  197. break;
  198. }
  199. $destFullPaths[] = $destPaths[0] . DIRECTORY_SEPARATOR . $destFileName;
  200. }
  201. $iPath = 0;
  202. foreach($destFullPaths as $destFullPath) {
  203. if (file_exists($destFullPath)) {
  204. echo("WARNING: destination already exists");
  205. exit(1);
  206. }
  207. if (filesize($tmpFullPath) > APP_FILE_MAX_SIZE) {
  208. echo("ERROR: file size(" . filesize($tmpFullPath) . ") exceeds app limit:" . APP_FILE_MAX_SIZE);
  209. exit(1);
  210. }
  211. if (!is_readable($AVATAR_PATH)) {
  212. mkdir($AVATAR_PATH, 0777);
  213. }
  214. if (!is_readable($destPaths[$iPath])) {
  215. mkdir($destPaths[$iPath], 0777);
  216. }
  217. $pattern = $destPaths[$iPath] . DIRECTORY_SEPARATOR . "*" . "|" . str_replace(" ", "_", $originalFilename) . ".$fileExt";
  218. $aExistingPaths = glob($pattern);
  219. if (!empty($aExistingPaths)) {
  220. continue;
  221. }
  222. copy($tmpFullPath, $destFullPath);
  223. $iPath++;
  224. }
  225. // Cleaning up..
  226. // Delete the tmp file..
  227. unlink($tmpFullPath);
  228. $i++;
  229. }
  230. }
  231. }
  232. function writeFriends() {
  233. global $FRIENDS_PATH;
  234. $destPath = $FRIENDS_PATH;
  235. $s = filter_input(INPUT_POST, "f", FILTER_SANITIZE_STRING);
  236. if ($s != PHP_STR) {
  237. //echo($s);
  238. //exit(0);
  239. $friends=explode("|", $s);
  240. if (!is_readable($destPath)) {
  241. mkdir($destPath, 0777);
  242. }
  243. foreach($friends as $friend) {
  244. $a = explode("://",$friend);
  245. $s = $a[1];
  246. $a = explode("/", $s);
  247. $friendName = $a[0] . ".txt";
  248. file_put_contents($destPath . DIRECTORY_SEPARATOR . $friendName, $friend);
  249. }
  250. }
  251. }
  252. function grabProfileImage() {
  253. global $GALLERY_PATH;
  254. $pattern = $GALLERY_PATH . DIRECTORY_SEPARATOR . "*";
  255. $aImagePaths = glob($pattern);
  256. if (isset($aImagePaths[0])) {
  257. $retval = basename($aImagePaths[0]);
  258. } else {
  259. $retval = null;
  260. }
  261. return $retval;
  262. }
  263. function startApp() {
  264. global $CURRENT_VIEW;
  265. global $profilePic;
  266. if ($CURRENT_VIEW == ADMIN_VIEW) {
  267. uploadNewRes();
  268. writeFriends();
  269. }
  270. $profilePic = grabProfileImage() ?? APP_DEF_PROFILE_PIC;
  271. //echo("profile pic=" . $profilePic);
  272. }
  273. startApp();
  274. ?>
  275. <!DOCTYPE html>
  276. <html lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
  277. <head>
  278. <meta name="viewport" content="width=device-width, initial-scale=1"/>
  279. <!--<?PHP echo(APP_LICENSE);?>-->
  280. <title><?PHP echo(APP_TITLE);?></title>
  281. <link rel="shortcut icon" href="/favicon.ico" />
  282. <meta name="description" content="Welcome to Avatar Free! Let everyone have its social presence."/>
  283. <meta name="keywords" content="Avatar Free,social,presence,avatarfree.org,on,premise,solution"/>
  284. <meta name="robots" content="index,follow"/>
  285. <meta name="author" content="5 Mode"/>
  286. <script src="/js/jquery-3.6.0.min.js" type="text/javascript"></script>
  287. <script src="/js/sha.js" type="text/javascript"></script>
  288. <script src="/js/common.js" type="text/javascript"></script>
  289. <link href="/css/style.css?r=<?PHP echo(time());?>" type="text/css" rel="stylesheet">
  290. <link href="/css/bootstrap.min.css" type="text/css" rel="stylesheet">
  291. </head>
  292. <?PHP if ($CURRENT_VIEW == ADMIN_VIEW): ?>
  293. <body style="background:url('/res/bg1.jpg') no-repeat; background-size: cover; background-attachment: fixed; background-position: center;">
  294. <div id="AFHint" style="z-index:0;">
  295. <button type="button" class="close" aria-label="Close" onclick="closeMe(this);" style="position:relative; top:5px; left:-7px;">
  296. <span aria-hidden="true" style="color:black; font-weight:900;">&times;</span>
  297. </button>
  298. <br>
  299. <span onclick="showHowTo();"><?PHP echo(getResource0("How-to: Manage your avatars in Avatar Free", $lang));?></span>
  300. <br><br>
  301. </div>
  302. <form id="frmUpload" role="form" method="post" action="/<?PHP echo(AVATAR_NAME);?>?hl=<?PHP echo($lang);?>" target="_self" enctype="multipart/form-data">
  303. <div class="dragover" dropzone="copy">
  304. <img id="picavatar" src="/img?av=<?PHP echo(AVATAR_NAME);?>&pic=<?PHP echo($profilePic);?>" align="middle">
  305. <input type="hidden" id="a" name="a">
  306. <input type="hidden" id="f" name="f">
  307. </div>
  308. <div class="tools">
  309. <div class="settingson" onclick="settingsOn();"></div>
  310. <?PHP if ($magicJar1 == 0): ?>
  311. <div class="magicjar1" style="background:url(/res/magicjar1dis.png);" onclick="setJar1On()"></div>
  312. <?PHP else: ?>
  313. <div class="magicjar1" style="background:url(/res/magicjar1.png);" onclick="setJar1Off()"></div>
  314. <?PHP endif; ?>
  315. <?PHP if ($magicJar2 == 0): ?>
  316. <div class="magicjar2" style="background:url(/res/magicjar2dis.png);" onclick="setJar2On()"></div>
  317. <?PHP else: ?>
  318. <div class="magicjar2" style="background:url(/res/magicjar2.png);" onclick="setJar2Off()"></div>
  319. <?PHP endif; ?>
  320. <?PHP if ($magicJar3 == 0): ?>
  321. <div class="magicjar3" style="background:url(/res/magicjar3dis.png);" onclick="setJar3On()"></div>
  322. <?PHP else: ?>
  323. <div class="magicjar3" style="background:url(/res/magicjar3.png);" onclick="setJar3Off()"></div>
  324. <?PHP endif; ?>
  325. <div class="settingsoff" onclick="settingsOff();"></div>
  326. </div>
  327. <input type="hidden" id="txtMagicJar1" name="txtMagicJar1" value="<?PHP echo($magicJar1);?>">
  328. <input type="hidden" id="txtMagicJar2" name="txtMagicJar2" value="<?PHP echo($magicJar2);?>">
  329. <input type="hidden" id="txtMagicJar3" name="txtMagicJar3" value="<?PHP echo($magicJar3);?>">
  330. <input type="hidden" id="Password" name="Password" value="<?PHP echo($password);?>">
  331. </form>
  332. <div id="footerCont">&nbsp;</div>
  333. <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>
  334. <?PHP else: ?>
  335. <body style="background:#dadada no-repeat; background-size: cover; background-attachment: fixed; background-position: center;">
  336. <div id="AFHint">
  337. <button type="button" class="close" aria-label="Close" onclick="closeMe(this);" style="position:relative; top:5px; left:-7px;">
  338. <span aria-hidden="true" style="color:black; font-weight:900;">&times;</span>
  339. </button>
  340. <br>
  341. <span onclick="showHowTo();"><?PHP echo(getResource0("How-to: Manage your avatars in Avatar Free", $lang));?></span>
  342. <br><br>
  343. </div>
  344. <div class="header" style="margin-top:18px;margin-bottom:18px;">
  345. <a href="http://avatarfree.org" target="_self" style="color:#000000; text-decoration: none;">&nbsp;<img src="Public/res/AFlogo.png" align="middle" style="position:relative;top:-5px;width:22px;">&nbsp;Avatar Free</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://github.com/par7133/AvatarFree" style="color:#000000;"><span style="color:#119fe2">on</span> github</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="mailto:info@avatarfree.org" style="color:#000000;"><span style="color:#119fe2">for</span> feedback</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="tel:+39-331-4029415" 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>
  346. </div>
  347. <form id="frmUpload" role="form" method="post" action="/<?PHP echo(AVATAR_NAME);?>?hl=<?PHP echo($lang);?>" target="_self" enctype="multipart/form-data">
  348. <div id="title">
  349. <div id="avatarLogo">
  350. <img id="picavatar" src="/img?av=<?PHP echo(AVATAR_NAME);?>&pic=<?PHP echo($profilePic);?>" align="middle" style="position:relative;display:inline;">
  351. </div>
  352. <div id="avatarName">
  353. &nbsp;<?PHP echo(strtoupper(AVATAR_NAME));?>&nbsp;&nbsp;&nbsp;
  354. </div>
  355. <div id="cudoz">
  356. <?PHP for ($i=1;$i<=$CUDOZ;$i++): ?>
  357. <img id="cudozentry<?PHP echo($i);?>" class="cudoz-entry" src="/res/chicca_<?PHP echo($shortLang);?>.png">
  358. <?PHP endfor; ?>
  359. <?PHP for ($i=$CUDOZ+1;$i<=5;$i++): ?>
  360. <img id="cudozentry<?PHP echo($i);?>" class="cudoz-entry" src="/res/chiccadis.png">
  361. <?PHP endfor; ?>
  362. </div>
  363. <div id="cvs">
  364. <div style="float:left;width:47px;margin-top:20px;margin-left:7px;"><?PHP echo(getResource0("CV", $lang));?></div>
  365. <?PHP
  366. $pattern = $CV_PATH . DIRECTORY_SEPARATOR . "*";
  367. $aFilePaths = glob($pattern);
  368. if (empty($aFilePaths)): ?>
  369. <img class="cv-entry" src="/res/wordicondis.png">&nbsp;&nbsp;<img class="cv-entry" src="/res/pdficondis.png">
  370. <?PHP else: ?>
  371. <?PHP
  372. $CUDOZ++;
  373. $pattern = $CV_PATH . DIRECTORY_SEPARATOR . "*.doc";
  374. $aFilePaths = glob($pattern);
  375. if (empty($aFilePaths)): ?>
  376. <img class="cv-entry" src="/res/wordicondis.png">&nbsp;&nbsp;
  377. <?PHP else: ?>
  378. <a href="/doc?av=<?PHP echo(AVATAR_NAME);?>&re=cv&doc=<?PHP echo(basename($aFilePaths[0]));?>"><img class="cv-entry" src="/res/wordicon.png"></a>&nbsp;&nbsp;
  379. <?PHP endif; ?>
  380. <?PHP
  381. $pattern = $CV_PATH . DIRECTORY_SEPARATOR . "*.pdf";
  382. $aFilePaths = glob($pattern);
  383. if (empty($aFilePaths)): ?>
  384. <img class="cv-entry" src="/res/pdficondis.png">
  385. <?PHP else: ?>
  386. <a href="/doc?av=<?PHP echo(AVATAR_NAME);?>&re=cv&doc=<?PHP echo(basename($aFilePaths[0]));?>"><img class="cv-entry" src="/res/pdficon.png"></a>
  387. <?PHP endif; ?>
  388. <?PHP endif; ?>
  389. </div>
  390. </div>
  391. <br>
  392. <div id="blog">
  393. <?PHP
  394. $pattern = $BLOG_PATH . DIRECTORY_SEPARATOR . "*.txt";
  395. $aFilePaths = glob($pattern);
  396. if (empty($aFilePaths)): ?>
  397. <div class="blog-content">
  398. <div class="blog-entry">
  399. <?PHP echo(getResource0("Hello from 5 Mode", $lang));?>,<br>
  400. <?PHP echo(getResource0("This is just an example of blog entry", $lang));?>.
  401. </div>
  402. </div>
  403. <?PHP else: ?>
  404. <?PHP
  405. $CUDOZ++;
  406. $iEntry = 1;
  407. arsort($aFilePaths, SORT_STRING);
  408. foreach ($aFilePaths as $filePath) {
  409. if ($iEntry>APP_BLOG_MAX_POSTS) {
  410. break;
  411. }
  412. $s=file_get_contents($filePath);
  413. if ($iEntry === count($aFilePaths) || $iEntry==APP_BLOG_MAX_POSTS) {
  414. $marginbottom = "0px";
  415. } else {
  416. $marginbottom = "5px";
  417. }
  418. ?>
  419. <div class="blog-content" style="margin-bottom:<?PHP echo($marginbottom);?>;">
  420. <div class="blog-entry" style="width:100%;margin-bottom:0px;">
  421. <?PHP echo(enableEmoticons(HTMLencode($s, true)));?>
  422. </div>
  423. </div>
  424. <?PHP
  425. $iEntry++;
  426. }?>
  427. <?PHP endif; ?>
  428. </div>
  429. <div id="gallery">
  430. <div class="gallery-content">
  431. <?PHP
  432. $pattern = $GALLERY_PATH . DIRECTORY_SEPARATOR . "*";
  433. $aFilePaths = glob($pattern);
  434. if (empty($aFilePaths)): ?>
  435. <div class="image-entry">
  436. <div style="width:100%;border:0px solid black;"><img class="image-ico" src="/res/imgicon.png" align="center"></div>
  437. <div style="margin-top:10px;"><?PHP echo(getResource0("Sample", $lang));?></div>
  438. </div>
  439. <?PHP else: ?>
  440. <?PHP
  441. $CUDOZ++;
  442. $iEntry = 1;
  443. foreach ($aFilePaths as $filePath) {
  444. $orifilename = basename($filePath);
  445. $filename = explode("|",basename($filePath))[1];
  446. if ($iEntry === count($aFilePaths)) {
  447. $marginbottom = "0px";
  448. } else {
  449. $marginbottom = "5px";
  450. }
  451. ?>
  452. <div class="image-entry">
  453. <a href="/img?av=<?PHP echo(AVATAR_NAME);?>&pic=<?PHP echo($orifilename);?>">
  454. <div style="width:100%;border:0px solid black;"><img class="image-ico" src="/res/imgicon.png" align="center"></div>
  455. <div style="margin-top:10px;"><?PHP echo($filename);?> </div>
  456. </a>
  457. </div>
  458. <?PHP
  459. $iEntry++;
  460. }?>
  461. <?PHP endif; ?>
  462. </div>
  463. </div>
  464. <?PHP
  465. $pattern = $MAGICJAR1_PATH . DIRECTORY_SEPARATOR . "*";
  466. $aFilePaths = glob($pattern);
  467. if (!empty($aFilePaths)): ?>
  468. <div id="magicjar1">
  469. <div class="magicjar1-content">
  470. <div class="magicjar-num">&nbsp;1&nbsp;</div>
  471. <?PHP
  472. $iEntry = 1;
  473. foreach ($aFilePaths as $filePath) {
  474. $orifilename = basename($filePath);
  475. $orifileExt = strtolower(pathinfo($orifilename, PATHINFO_EXTENSION));
  476. $filename = explode("|",basename($filePath))[1];
  477. if ($iEntry === count($aFilePaths)) {
  478. $marginbottom = "0px";
  479. } else {
  480. $marginbottom = "5px";
  481. }
  482. ?>
  483. <div class="file-entry">
  484. <?PHP if (in_array($orifileExt, ["png", "jpg", "jpeg", "gif", "webp"])):?>
  485. <a href="/imgj?av=<?PHP echo(AVATAR_NAME);?>&jar=1&fn=<?PHP echo($orifilename);?>">
  486. <?PHP else: ?>
  487. <a href="/file?av=<?PHP echo(AVATAR_NAME);?>&jar=1&fn=<?PHP echo($orifilename);?>">
  488. <?PHP endif; ?>
  489. <div style="width:100%;border:0px solid black;"><img class="file-ico" src="/res/fileicon.png" align="center"></div>
  490. <div style="margin-top:10px;"><?PHP echo($filename);?> </div>
  491. </a>
  492. </div>
  493. <?PHP
  494. $iEntry++;
  495. }?>
  496. </div>
  497. </div>
  498. <?PHP endif; ?>
  499. <?PHP
  500. $pattern = $MAGICJAR2_PATH . DIRECTORY_SEPARATOR . "*";
  501. $aFilePaths = glob($pattern);
  502. if (!empty($aFilePaths)): ?>
  503. <div id="magicjar2">
  504. <div class="magicjar2-content">
  505. <div class="magicjar-num">&nbsp;2&nbsp;</div>
  506. <?PHP
  507. $iEntry = 1;
  508. foreach ($aFilePaths as $filePath) {
  509. $orifilename = basename($filePath);
  510. $orifileExt = strtolower(pathinfo($orifilename, PATHINFO_EXTENSION));
  511. $filename = explode("|",basename($filePath))[1];
  512. if ($iEntry === count($aFilePaths)) {
  513. $marginbottom = "0px";
  514. } else {
  515. $marginbottom = "5px";
  516. }
  517. ?>
  518. <div class="file-entry">
  519. <?PHP if (in_array($orifileExt, ["png", "jpg", "jpeg", "gif", "webp"])):?>
  520. <a href="/imgj?av=<?PHP echo(AVATAR_NAME);?>&jar=2&fn=<?PHP echo($orifilename);?>">
  521. <?PHP else: ?>
  522. <a href="/file?av=<?PHP echo(AVATAR_NAME);?>&jar=2&fn=<?PHP echo($orifilename);?>">
  523. <?PHP endif; ?>
  524. <div style="width:100%;border:0px solid black;"><img class="file-ico" src="/res/fileicon.png" align="center"></div>
  525. <div style="margin-top:10px;"><?PHP echo($filename);?> </div>
  526. </a>
  527. </div>
  528. <?PHP
  529. $iEntry++;
  530. }?>
  531. </div>
  532. </div>
  533. <?PHP endif; ?>
  534. <?PHP
  535. $pattern = $MAGICJAR3_PATH . DIRECTORY_SEPARATOR . "*";
  536. $aFilePaths = glob($pattern);
  537. if (!empty($aFilePaths)): ?>
  538. <div id="magicjar3">
  539. <div class="magicjar3-content">
  540. <div class="magicjar-num">&nbsp;3&nbsp;</div>
  541. <?PHP
  542. $iEntry = 1;
  543. foreach ($aFilePaths as $filePath) {
  544. $orifilename = basename($filePath);
  545. $orifileExt = strtolower(pathinfo($orifilename, PATHINFO_EXTENSION));
  546. $filename = explode("|",basename($filePath))[1];
  547. if ($iEntry === count($aFilePaths)) {
  548. $marginbottom = "0px";
  549. } else {
  550. $marginbottom = "5px";
  551. }
  552. ?>
  553. <div class="file-entry">
  554. <?PHP if (in_array($orifileExt, ["png", "jpg", "jpeg", "gif", "webp"])):?>
  555. <a href="/imgj?av=<?PHP echo(AVATAR_NAME);?>&jar=3&fn=<?PHP echo($orifilename);?>">
  556. <?PHP else: ?>
  557. <a href="/file?av=<?PHP echo(AVATAR_NAME);?>&jar=3&fn=<?PHP echo($orifilename);?>">
  558. <?PHP endif; ?>
  559. <div style="width:100%;border:0px solid black;"><img class="file-ico" src="/res/fileicon.png" align="center"></div>
  560. <div style="margin-top:10px;"><?PHP echo($filename);?> </div>
  561. </a>
  562. </div>
  563. <?PHP
  564. $iEntry++;
  565. }?>
  566. </div>
  567. </div>
  568. <?PHP endif; ?>
  569. <div id="friends">
  570. <div class="friends-content">
  571. <div id="mynetworkTitle"><?PHP echo(getResource0("My Network", $lang));?>:<br><br>
  572. <?PHP
  573. $pattern = $FRIENDS_PATH . DIRECTORY_SEPARATOR . "*.txt";
  574. $aFilePaths = glob($pattern);
  575. if (empty($aFilePaths)): ?>
  576. <div class="friend-entry">
  577. <a href="http://5mode.com">
  578. <div style="width:100%;border:0px solid black;"><img class="friend-ico" src="/res/pic1.png" align="center"></div>
  579. <div style="margin-top:10px;"><?PHP echo(getResource0("Sample", $lang));?></div>
  580. </a>
  581. </div>
  582. <?PHP else: ?>
  583. <?PHP
  584. $CUDOZ++;
  585. $iEntry = 1;
  586. foreach ($aFilePaths as $filePath) {
  587. $orifilename = basename($filePath);
  588. $link=file_get_contents($filePath);
  589. $filename = pathinfo($filePath, PATHINFO_FILENAME);
  590. if ($iEntry === count($aFilePaths)) {
  591. $marginbottom = "0px";
  592. } else {
  593. $marginbottom = "5px";
  594. }
  595. ?>
  596. <div class="friend-entry">
  597. <a href="<?PHP echo($link);?>">
  598. <div style="width:100%;border:0px solid black;"><img class="friend-ico" src="/res/pic1.png" align="center"></div>
  599. <div style="margin-top:10px;"><?PHP echo($filename);?> </div>
  600. </a>
  601. </div>
  602. <?PHP
  603. $iEntry++;
  604. }?>
  605. <?PHP endif; ?>
  606. </div>
  607. </div>
  608. </div>
  609. <div id="passworddisplay">
  610. <br>
  611. &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>
  612. &nbsp;&nbsp;<input type="text" id="Salt" placeholder="salt" autocomplete="off"><br>
  613. <div style="text-align:center;">
  614. <a id="hashMe" href="#" onclick="showEncodedPassword();"><?PHP echo(getResource0("Hash Me", $lang));?>!</a>
  615. </div>
  616. </div>
  617. </form>
  618. <div id="footerCont">&nbsp;</div>
  619. <div id="footer">
  620. <div style="float:left">
  621. <select id="cbLang" onchange="changeLang(this);">
  622. <option value="en-US" <?PHP echo($lang==PHP_EN?"selected":"");?>>en</option>
  623. <option value="it-IT" <?PHP echo($lang==PHP_IT?"selected":"");?>>it</option>
  624. <option value="zh-CN" <?PHP echo($lang==PHP_CN?"selected":"");?>>cn</option>
  625. </select>
  626. </div>
  627. <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>
  628. <?PHP endif; ?>
  629. <script src="static/js/home-js.php?hl=<?PHP echo($lang);?>&av=<?PHP echo(AVATAR_NAME);?>&cv=<?PHP echo($CURRENT_VIEW);?>&cu=<?PHP echo($CUDOZ);?>" type="text/javascript"></script>
  630. <?PHP if ($CURRENT_VIEW == PUBLIC_VIEW): ?>
  631. <?php if (file_exists(APP_PATH . DIRECTORY_SEPARATOR . "metrics.html")): ?>
  632. <?php include(APP_PATH . DIRECTORY_SEPARATOR . "metrics.html"); ?>
  633. <?php endif; ?>
  634. <?php endif; ?>
  635. </body>
  636. </html>