home.php 29 KB

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