home.php 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  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="width:100%;height:fit-content;position:fixed;background:yellow;color:darkorange;text-align:center;cursor:pointer;" onclick="showHowTo();"><br><?PHP echo(getResource0("How-to: Manage your avatars in Avatar Free", $lang));?><br><br></div>
  295. <form id="frmUpload" role="form" method="post" action="/<?PHP echo(AVATAR_NAME);?>?hl=<?PHP echo($lang);?>" target="_self" enctype="multipart/form-data">
  296. <div class="dragover" style="width:100%;height:100%;border:0px solid red;" dropzone="copy">
  297. <img id="picavatar" src="/img?av=<?PHP echo(AVATAR_NAME);?>&pic=<?PHP echo($profilePic);?>" align="middle" style="position:absolute;width:255px;height:255px;border-radius: 90%; display:none;">
  298. <input type="hidden" id="a" name="a">
  299. <input type="hidden" id="f" name="f">
  300. </div>
  301. <div class="tools" style="position:fixed;top:12px;width:120px;height:620px;display:none;">
  302. <div class="settingson" style="float:left;width:120px;height:150px;border:0px solid black;background:url(/res/settingsoff.png);background-size:cover;cursor:pointer;display:none;" onclick="settingsOn();"></div>
  303. <?PHP if ($magicJar1 == 0): ?>
  304. <div class="magicjar1" style="float:left;width:120px;height:120px;border:0px solid black;background:url(/res/magicjar1dis.png);background-size:120px 120px;cursor:pointer;" onclick="setJar1On()"></div>
  305. <?PHP else: ?>
  306. <div class="magicjar1" style="float:left;width:120px;height:120px;border:0px solid black;background:url(/res/magicjar1.png);background-size:120px 120px;cursor:pointer;" onclick="setJar1Off()"></div>
  307. <?PHP endif; ?>
  308. <?PHP if ($magicJar2 == 0): ?>
  309. <div class="magicjar2" style="float:left;width:120px;height:120px;border:0px solid black;background:url(/res/magicjar2dis.png);background-size:120px 120px;cursor:pointer;" onclick="setJar2On()"></div>
  310. <?PHP else: ?>
  311. <div class="magicjar2" style="float:left;width:120px;height:120px;border:0px solid black;background:url(/res/magicjar2.png);background-size:120px 120px;cursor:pointer;" onclick="setJar2Off()"></div>
  312. <?PHP endif; ?>
  313. <?PHP if ($magicJar3 == 0): ?>
  314. <div class="magicjar3" style="float:left;width:120px;height:120px;border:0px solid black;background:url(/res/magicjar3dis.png);background-size:120px 120px;cursor:pointer;" onclick="setJar3On()"></div>
  315. <?PHP else: ?>
  316. <div class="magicjar3" style="float:left;width:120px;height:120px;border:0px solid black;background:url(/res/magicjar3.png);background-size:120px 120px;cursor:pointer;" onclick="setJar3Off()"></div>
  317. <?PHP endif; ?>
  318. <div class="settingsoff" style="float:left;width:120px;height:150px;border:0px solid black;background:url(/res/settingson.png);background-size:cover;cursor:pointer;" onclick="settingsOff();"></div>
  319. </div>
  320. <input type="hidden" id="txtMagicJar1" name="txtMagicJar1" value="<?PHP echo($magicJar1);?>">
  321. <input type="hidden" id="txtMagicJar2" name="txtMagicJar2" value="<?PHP echo($magicJar2);?>">
  322. <input type="hidden" id="txtMagicJar3" name="txtMagicJar3" value="<?PHP echo($magicJar3);?>">
  323. <input type="hidden" id="Password" name="Password" value="<?PHP echo($password);?>">
  324. </form>
  325. <div id="footerCont">&nbsp;</div>
  326. <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>
  327. <?PHP else: ?>
  328. <body style="background:#dadada no-repeat; background-size: cover; background-attachment: fixed; background-position: center;">
  329. <div id="AFHint" style="width:100%;height:fit-content;position:fixed;top:-5px;background:yellow;color:darkorange;text-align:center;cursor:pointer;z-index:99999;">
  330. <button type="button" class="close" aria-label="Close" onclick="closeMe(this);" style="position:relative; top:5px; left:-7px;">
  331. <span aria-hidden="true" style="color:black; font-weight:900;">&times;</span>
  332. </button>
  333. <br>
  334. <span onclick="showHowTo();"><?PHP echo(getResource0("How-to: Manage your avatars in Avatar Free", $lang));?></span>
  335. <br><br>
  336. </div>
  337. <div class="header" style="margin-top:18px;margin-bottom:18px;">
  338. <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>
  339. </div>
  340. <form id="frmUpload" role="form" method="post" action="/<?PHP echo(AVATAR_NAME);?>?hl=<?PHP echo($lang);?>" target="_self" enctype="multipart/form-data">
  341. <div id="title" style="position:relative;top:20px;left:50px;width:100%;float:left;font-size:25px;font-family:'Press Start 2P';border:0px solid blue;">
  342. <div id="cudoz" style="width:255px;height:255px;float:left;border:0px solid yellow;">
  343. <img id="picavatar" src="/img?av=<?PHP echo(AVATAR_NAME);?>&pic=<?PHP echo($profilePic);?>" align="middle" style="width:255px;height:255px;border-radius: 90%;">
  344. </div>
  345. <div id="cudoz" style="width:250px;height:255px;padding-top:122px;float:left;border:0px solid yellow;vertical-align:middle;">
  346. &nbsp;<?PHP echo(strtoupper(AVATAR_NAME));?>&nbsp;&nbsp;&nbsp;
  347. </div>
  348. <div id="cudoz" style="width:250px;height:255px;padding-top:116px;float:left;border:0px solid green;vertical-align:middle;">
  349. <?PHP for ($i=1;$i<=$CUDOZ;$i++): ?>
  350. <img id="cudozentry<?PHP echo($i);?>" src="/res/chicca_<?PHP echo($shortLang);?>.png" style="float:left;width:46px">
  351. <?PHP endfor; ?>
  352. <?PHP for ($i=$CUDOZ+1;$i<=5;$i++): ?>
  353. <img id="cudozentry<?PHP echo($i);?>" src="/res/chiccadis.png" style="float:left;width:46px">
  354. <?PHP endfor; ?>
  355. </div>
  356. <div id="cvs" style="float:right;border:3px solid darkgray;border-radius:4px;padding:4px;background:#dadada;font-size:20px;font-family:'Press Start 2P';font-weight:900;">
  357. <div style="float:left;width:47px;margin-top:20px;margin-left:7px;"><?PHP echo(getResource0("CV", $lang));?></div>
  358. <?PHP
  359. $pattern = $CV_PATH . DIRECTORY_SEPARATOR . "*";
  360. $aFilePaths = glob($pattern);
  361. if (empty($aFilePaths)): ?>
  362. <img src="/res/wordicondis.png" style="float:left;width:64px">&nbsp;&nbsp;<img src="/res/pdficondis.png" style="float:left;width:64px">
  363. <?PHP else: ?>
  364. <?PHP
  365. $CUDOZ++;
  366. $pattern = $CV_PATH . DIRECTORY_SEPARATOR . "*.doc";
  367. $aFilePaths = glob($pattern);
  368. if (empty($aFilePaths)): ?>
  369. <img src="/res/wordicondis.png" style="float:left;width:64px">&nbsp;&nbsp;
  370. <?PHP else: ?>
  371. <a href="/doc?av=<?PHP echo(AVATAR_NAME);?>&re=cv&doc=<?PHP echo(basename($aFilePaths[0]));?>"><img src="/res/wordicon.png" style="float:left;width:64px"></a>&nbsp;&nbsp;
  372. <?PHP endif; ?>
  373. <?PHP
  374. $pattern = $CV_PATH . DIRECTORY_SEPARATOR . "*.pdf";
  375. $aFilePaths = glob($pattern);
  376. if (empty($aFilePaths)): ?>
  377. <img src="/res/pdficondis.png" style="float:left;width:64px">
  378. <?PHP else: ?>
  379. <a href="/doc?av=<?PHP echo(AVATAR_NAME);?>&re=cv&doc=<?PHP echo(basename($aFilePaths[0]));?>"><img src="/res/pdficon.png" style="float:left;width:64px"></a>
  380. <?PHP endif; ?>
  381. <?PHP endif; ?>
  382. </div>
  383. </div>
  384. <br>
  385. <div id="blog" style="height:fit-content;float:left;margin:6%;margin-top:130px;margin-bottom:5px;width:90%;font-size:15px;font-family:'Press Start 2P';color:#000000;">
  386. <?PHP
  387. $pattern = $BLOG_PATH . DIRECTORY_SEPARATOR . "*.txt";
  388. $aFilePaths = glob($pattern);
  389. if (empty($aFilePaths)): ?>
  390. <div class="blog-content" style="width:100%;float:left;border:3px solid darkgray;border-radius:4px;color:#000000;">
  391. <div class="blog-entry" style="width:100%;margin-bottom:0px;min-height:120px;background:#FFFFFF;border:1px solid black;padding:30px;">
  392. <?PHP echo(getResource0("Hello from 5 Mode", $lang));?>,<br>
  393. <?PHP echo(getResource0("This is just an example of blog entry", $lang));?>.
  394. </div>
  395. </div>
  396. <?PHP else: ?>
  397. <?PHP
  398. $CUDOZ++;
  399. $iEntry = 1;
  400. arsort($aFilePaths, SORT_STRING);
  401. foreach ($aFilePaths as $filePath) {
  402. if ($iEntry>APP_BLOG_MAX_POSTS) {
  403. break;
  404. }
  405. $s=file_get_contents($filePath);
  406. if ($iEntry === count($aFilePaths) || $iEntry==APP_BLOG_MAX_POSTS) {
  407. $marginbottom = "0px";
  408. } else {
  409. $marginbottom = "5px";
  410. }
  411. ?>
  412. <div class="blog-content" style="margin-bottom:<?PHP echo($marginbottom);?>;width:100%;float:left;border:3px solid darkgray;border-radius:4px;color:#000000;">
  413. <div class="blog-entry" style="min-height:120px;background:#FFFFFF;border:1px solid black;padding:30px;">
  414. <?PHP echo(HTMLencode($s, true));?>
  415. </div>
  416. </div>
  417. <?PHP
  418. $iEntry++;
  419. }?>
  420. <?PHP endif; ?>
  421. </div>
  422. <div id="gallery" style="float:left;margin:6%;margin-top:0px;margin-bottom:5px;width:90%;font-size:15px;font-family:Arial,Sans,Verdana;color:#000000;background:#C2DBF2;">
  423. <div class="gallery-content" style="width:100%;float:left;border:3px solid darkgray;border-radius:4px;color:#000000;">
  424. <?PHP
  425. $pattern = $GALLERY_PATH . DIRECTORY_SEPARATOR . "*";
  426. $aFilePaths = glob($pattern);
  427. if (empty($aFilePaths)): ?>
  428. <div class="image-entry" style="height:fit-content;min-height:120px;float:left;width:fit-content;border:0px solid green;padding:10px;text-align:center;">
  429. <div style="width:100%;border:0px solid black;"><img src="/res/imgicon.png" align="center" style="width:64px;border:1px solid gray;"></div>
  430. <div style="margin-top:10px;"><?PHP echo(getResource0("Sample", $lang));?></div>
  431. </div>
  432. <?PHP else: ?>
  433. <?PHP
  434. $CUDOZ++;
  435. $iEntry = 1;
  436. foreach ($aFilePaths as $filePath) {
  437. $orifilename = basename($filePath);
  438. $filename = explode("|",basename($filePath))[1];
  439. if ($iEntry === count($aFilePaths)) {
  440. $marginbottom = "0px";
  441. } else {
  442. $marginbottom = "5px";
  443. }
  444. ?>
  445. <div class="image-entry" style="height:fit-content;min-height:120px;float:left;width:fit-content;border:0px solid green;padding:10px;text-align:center;">
  446. <a href="/img?av=<?PHP echo(AVATAR_NAME);?>&pic=<?PHP echo($orifilename);?>">
  447. <div style="width:100%;border:0px solid black;"><img src="/res/imgicon.png" align="center" style="width:64px;border:1px solid gray;"></div>
  448. <div style="margin-top:10px;"><?PHP echo($filename);?> </div>
  449. </a>
  450. </div>
  451. <?PHP
  452. $iEntry++;
  453. }?>
  454. <?PHP endif; ?>
  455. </div>
  456. </div>
  457. <?PHP
  458. $pattern = $MAGICJAR1_PATH . DIRECTORY_SEPARATOR . "*";
  459. $aFilePaths = glob($pattern);
  460. if (!empty($aFilePaths)): ?>
  461. <div id="magicjar1" style="float:left;margin:6%;margin-top:0px;margin-bottom:5px;width:90%;font-size:15px;font-family:Arial,Sans,Verdana;color:#000000;background:#f7ecb5;">
  462. <div class="magicjar1-content" style="width:100%;float:left;border:3px solid darkgray;border-radius:4px;color:#000000;">
  463. <div style="float:right;margin-right:2px;background:yellow;color:darkorange;">&nbsp;1&nbsp;</div>
  464. <?PHP
  465. $iEntry = 1;
  466. foreach ($aFilePaths as $filePath) {
  467. $orifilename = basename($filePath);
  468. $filename = explode("|",basename($filePath))[1];
  469. if ($iEntry === count($aFilePaths)) {
  470. $marginbottom = "0px";
  471. } else {
  472. $marginbottom = "5px";
  473. }
  474. ?>
  475. <div class="file-entry" style="height:fit-content;min-height:120px;float:left;width:fit-content;border:0px solid green;padding:10px;text-align:center;">
  476. <a href="/file?av=<?PHP echo(AVATAR_NAME);?>&jar=1&fn=<?PHP echo($orifilename);?>">
  477. <div style="width:100%;border:0px solid black;"><img src="/res/fileicon.png" align="center" style="width:64px;border:0px solid gray;"></div>
  478. <div style="margin-top:10px;"><?PHP echo($filename);?> </div>
  479. </a>
  480. </div>
  481. <?PHP
  482. $iEntry++;
  483. }?>
  484. </div>
  485. </div>
  486. <?PHP endif; ?>
  487. <?PHP
  488. $pattern = $MAGICJAR2_PATH . DIRECTORY_SEPARATOR . "*";
  489. $aFilePaths = glob($pattern);
  490. if (!empty($aFilePaths)): ?>
  491. <div id="magicjar2" style="float:left;margin:6%;margin-top:0px;margin-bottom:5px;width:90%;font-size:15px;font-family:Arial,Sans,Verdana;color:#000000;background:#f7ecb5;">
  492. <div class="magicjar2-content" style="width:100%;float:left;border:3px solid darkgray;border-radius:4px;color:#000000;">
  493. <div style="float:right;margin-right:2px;background:yellow;color:darkorange;">&nbsp;2&nbsp;</div>
  494. <?PHP
  495. $iEntry = 1;
  496. foreach ($aFilePaths as $filePath) {
  497. $orifilename = basename($filePath);
  498. $filename = explode("|",basename($filePath))[1];
  499. if ($iEntry === count($aFilePaths)) {
  500. $marginbottom = "0px";
  501. } else {
  502. $marginbottom = "5px";
  503. }
  504. ?>
  505. <div class="file-entry" style="height:fit-content;min-height:120px;float:left;width:fit-content;border:0px solid green;padding:10px;text-align:center;">
  506. <a href="/file?av=<?PHP echo(AVATAR_NAME);?>&jar=2&fn=<?PHP echo($orifilename);?>">
  507. <div style="width:100%;border:0px solid black;"><img src="/res/fileicon.png" align="center" style="width:64px;border:0px solid gray;"></div>
  508. <div style="margin-top:10px;"><?PHP echo($filename);?> </div>
  509. </a>
  510. </div>
  511. <?PHP
  512. $iEntry++;
  513. }?>
  514. </div>
  515. </div>
  516. <?PHP endif; ?>
  517. <?PHP
  518. $pattern = $MAGICJAR3_PATH . DIRECTORY_SEPARATOR . "*";
  519. $aFilePaths = glob($pattern);
  520. if (!empty($aFilePaths)): ?>
  521. <div id="magicjar3" style="float:left;margin:6%;margin-top:0px;margin-bottom:5px;width:90%;font-size:15px;font-family:Arial,Sans,Verdana;color:#000000;background:#f7ecb5;">
  522. <div class="magicjar3-content" style="width:100%;float:left;border:3px solid darkgray;border-radius:4px;color:#000000;">
  523. <div style="float:right;margin-right:2px;background:yellow;color:darkorange;">&nbsp;3&nbsp;</div>
  524. <?PHP
  525. $iEntry = 1;
  526. foreach ($aFilePaths as $filePath) {
  527. $orifilename = basename($filePath);
  528. $filename = explode("|",basename($filePath))[1];
  529. if ($iEntry === count($aFilePaths)) {
  530. $marginbottom = "0px";
  531. } else {
  532. $marginbottom = "5px";
  533. }
  534. ?>
  535. <div class="file-entry" style="height:fit-content;min-height:120px;float:left;width:fit-content;border:0px solid green;padding:10px;text-align:center;">
  536. <a href="/file?av=<?PHP echo(AVATAR_NAME);?>&jar=3&fn=<?PHP echo($orifilename);?>">
  537. <div style="width:100%;border:0px solid black;"><img src="/res/fileicon.png" align="center" style="width:64px;border:0px solid gray;"></div>
  538. <div style="margin-top:10px;"><?PHP echo($filename);?> </div>
  539. </a>
  540. </div>
  541. <?PHP
  542. $iEntry++;
  543. }?>
  544. </div>
  545. </div>
  546. <?PHP endif; ?>
  547. <div id="friends" style="float:left;margin:6%;margin-top:50px;width:90%;font-size:15px;font-family:Arial,Sans,Verdana;color:#000000;background:#dadada">
  548. <div class="friends-content" style="width:100%;float:left;border:3px solid transparent;border-radius:4px;color:#000000;padding-top:10px;text-align:center;">
  549. <div style="font-family:'Press Start 2P';width:fit-content;margin:auto;color:#245269;"><?PHP echo(getResource0("My Network", $lang));?>:<br><br>
  550. <?PHP
  551. $pattern = $FRIENDS_PATH . DIRECTORY_SEPARATOR . "*.txt";
  552. $aFilePaths = glob($pattern);
  553. if (empty($aFilePaths)): ?>
  554. <div class="friend-entry" style="height:fit-content;min-height:120px;float:left;width:fit-content;border:0px solid green;padding:10px;text-align:center;">
  555. <a href="http://5mode.com">
  556. <div style="width:100%;border:0px solid black;"><img src="/res/pic1.png" align="center" style="width:64px;border:0px solid gray;"></div>
  557. <div style="margin-top:10px;"><?PHP echo(getResource0("Sample", $lang));?></div>
  558. </a>
  559. </div>
  560. <?PHP else: ?>
  561. <?PHP
  562. $CUDOZ++;
  563. $iEntry = 1;
  564. foreach ($aFilePaths as $filePath) {
  565. $orifilename = basename($filePath);
  566. $link=file_get_contents($filePath);
  567. $filename = pathinfo($filePath, PATHINFO_FILENAME);
  568. if ($iEntry === count($aFilePaths)) {
  569. $marginbottom = "0px";
  570. } else {
  571. $marginbottom = "5px";
  572. }
  573. ?>
  574. <div class="friend-entry" style="height:fit-content;min-height:120px;float:left;width:fit-content;border:0px solid green;padding:10px;text-align:center;">
  575. <a href="<?PHP echo($link);?>">
  576. <div style="width:100%;border:0px solid black;"><img src="/res/pic1.png" align="center" style="width:64px;border:0px solid gray;"></div>
  577. <div style="margin-top:10px;"><?PHP echo($filename);?> </div>
  578. </a>
  579. </div>
  580. <?PHP
  581. $iEntry++;
  582. }?>
  583. <?PHP endif; ?>
  584. </div>
  585. </div>
  586. </div>
  587. <div id="passworddisplay" style="float:left;position:fixed;top:680px;left:50px;width:255px;height:120px;background:darkgray;text-align:left;white-space:nowrap; font-family:'Bungee Hairline'; color:#000000; font-weight:900;z-index:99999;">
  588. <br>
  589. &nbsp;&nbsp;<input type="password" id="Password" name="Password" placeholder="password" style="font-size:18px; background:transparent; width: 60%; border-radius:3px; font-weight:900;" 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>
  590. &nbsp;&nbsp;<input type="text" id="Salt" placeholder="salt" style="position:relative; top:+5px; font-size:18px; background:transparent; width: 90%; border-radius:3px; font-weight:900;" autocomplete="off"><br>
  591. <div style="text-align:center;">
  592. <a href="#" onclick="showEncodedPassword();" style="position:relative; left:-2px; top:+5px; font-size:18px; font-weight:900; color:#000000;"><?PHP echo(getResource0("Hash Me", $lang));?>!</a>
  593. </div>
  594. </div>
  595. </form>
  596. <div id="footerCont">&nbsp;</div>
  597. <div id="footer">
  598. <div style="float:left">
  599. <select id="cbLang" style="margin-left:22px;font-size:10px;" onchange="changeLang(this);">
  600. <option value="en-US" <?PHP echo($lang==PHP_EN?"selected":"");?>>en</option>
  601. <option value="it-IT" <?PHP echo($lang==PHP_IT?"selected":"");?>>it</option>
  602. <option value="zh-CN" <?PHP echo($lang==PHP_CN?"selected":"");?>>cn</option>
  603. </select>
  604. </div>
  605. <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>
  606. <?PHP endif; ?>
  607. <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>
  608. <?php if (file_exists(APP_PATH . DIRECTORY_SEPARATOR . "metrics.html")): ?>
  609. <?php include("/metrics.html"); ?>
  610. <?php endif; ?>
  611. </body>
  612. </html>