home.php 28 KB

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