home.php 31 KB

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