home.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705
  1. <?php
  2. /**
  3. * Copyright 2021, 2024 5 Mode
  4. *
  5. * This file is part of Homomm.
  6. *
  7. * Homomm 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. * Homomm 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 Homomm. If not, see <https://www.gnu.org/licenses/>.
  19. *
  20. * home.php
  21. *
  22. * Homomm home page.
  23. *
  24. * @author Daniele Bonini <my25mb@aol.com>
  25. * @copyrights (c) 2021, 2024, 5 Mode
  26. */
  27. $msgHistory = [];
  28. $cmd = PHP_STR;
  29. $opt = PHP_STR;
  30. $param1 = PHP_STR;
  31. $param2 = PHP_STR;
  32. $param3 = PHP_STR;
  33. $user = PHP_STR;
  34. $userName = PHP_STR;
  35. $userHint = PHP_STR;
  36. $userHintResolved = PHP_STR;
  37. $picPath = PHP_STR;
  38. function showHistory() {
  39. global $msgHistory;
  40. global $user;
  41. global $curPath;
  42. global $picPath;
  43. $i = 1;
  44. //echo "curPath=$curPath<br>";
  45. $oldDate = "";
  46. foreach($msgHistory as $val) {
  47. if ((mb_stripos($val, "-master") !== false) && ($user == "MASTER")) {
  48. $float = "right";
  49. $bgcolor = "#E3FAE3";
  50. } else if ((mb_stripos($val, "-master") === false) && ($user != "MASTER")) {
  51. $float = "right";
  52. $bgcolor = "#E3FAE3";
  53. } else {
  54. $float = "left";
  55. $bgcolor = "#FFFFFF";
  56. }
  57. echo("<div style='width:100%;height:auto;border:0px solid red;margin-bottom:12px;'>");
  58. $val = rtrim($val,"\n");
  59. // grab the date
  60. $date = left($val, 8);
  61. $date = date("l j F", mktime(0,0,0,substr($date,4,2),right($date,2),left($date,4)));
  62. if ($date!=$oldDate) {
  63. echo("<div style='text-align:center;'><span style='background-color:gray;color:#FFFFFF'>$date</span></div><br>");
  64. $oldDate = $date;
  65. }
  66. // grab the time
  67. preg_match('/^.+-(\d{4})-/i', $val, $matches);
  68. $time = $matches[1];
  69. $time = ltrim(left($time,2),"0") . ":" . right($time,2);
  70. // parsing for file ext
  71. $fileext = strtolower(pathinfo($val, PATHINFO_EXTENSION));
  72. if ($fileext === "png" || $fileext === "jpg" || $fileext === "jpeg" || $fileext === "gif") {
  73. // display the img
  74. $img = substr($picPath, strlen(APP_PATH)) . DIRECTORY_SEPARATOR . $val;
  75. echo("<div style='background-color:$bgcolor;float:$float;padding:5px;max-width:300px;min-width:260px;border-radius:2px;'><img src='$img' style='width:100%;'><div style='float:right;font-size:9px;'>$time</div></div><br><br><br>");
  76. } else {
  77. // display the msg
  78. $msg = HTMLencode(file_get_contents($curPath . DIRECTORY_SEPARATOR . "msgs" . DIRECTORY_SEPARATOR . $val));
  79. echo("<div style='background-color:$bgcolor;float:$float;padding:5px;max-width:300px;min-width:260px;border-radius:2px;white-space:normal;'>".str_replace("\n", "<br>", $msg)."<div style='float:right;font-size:9px;'>$time</div></div><br><br><br>");
  80. }
  81. echo("<div style='clear:both;'></div>");
  82. echo("</div>");
  83. $i++;
  84. }
  85. }
  86. function updateHistory(&$update, $maxItems) {
  87. global $msgHistory;
  88. global $curPath;
  89. global $picPath;
  90. // Making enough space in $msgHistory for the update..
  91. $shift = (count($msgHistory) + count($update)) - $maxItems;
  92. if ($shift > 0) {
  93. $msgHistory = array_slice($msgHistory, $shift, $maxItems);
  94. }
  95. // Adding $msgHistory update..
  96. if (count($update) > $maxItems) {
  97. $beginUpd = count($update) - ($maxItems-1);
  98. } else {
  99. $beginUpd = 0;
  100. }
  101. $update = array_slice($update, $beginUpd, $maxItems);
  102. foreach($update as $val) {
  103. $msgHistory[] = $val;
  104. }
  105. // Deleting unused message files..
  106. foreach (glob($curPath . DIRECTORY_SEPARATOR . "msgs" . DIRECTORY_SEPARATOR . "*.msg") as $msgFilePath) {
  107. $msgFileName = basename($msgFilePath);
  108. if (!in_array($msgFileName."\n", $msgHistory)) {
  109. unlink($curPath . DIRECTORY_SEPARATOR . "msgs" . DIRECTORY_SEPARATOR . $msgFileName);
  110. }
  111. }
  112. // Deleting unused pic files..
  113. foreach (glob($picPath . DIRECTORY_SEPARATOR . "*") as $imgFilePath) {
  114. $imgFileName = basename($imgFilePath);
  115. if (!in_array($imgFileName."\n", $msgHistory)) {
  116. unlink($picPath . DIRECTORY_SEPARATOR . $imgFileName);
  117. }
  118. }
  119. // Writing out $msgHistory on disk..
  120. $filepath = $curPath . DIRECTORY_SEPARATOR . ".HMM_history";
  121. file_put_contents($filepath, implode('', $msgHistory));
  122. }
  123. function parseCommand() {
  124. global $command;
  125. global $cmd;
  126. global $opt;
  127. global $param1;
  128. global $param2;
  129. global $param3;
  130. $str = trim($command);
  131. $ipos = stripos($str, PHP_SPACE);
  132. if ($ipos > 0) {
  133. $cmd = left($str, $ipos);
  134. $str = substr($str, $ipos+1);
  135. } else {
  136. $cmd = $str;
  137. return;
  138. }
  139. if (left($str, 1) === "-") {
  140. $ipos = stripos($str, PHP_SPACE);
  141. if ($ipos > 0) {
  142. $opt = left($str, $ipos);
  143. $str = substr($str, $ipos+1);
  144. } else {
  145. $opt = $str;
  146. return;
  147. }
  148. }
  149. $ipos = stripos($str, PHP_SPACE);
  150. if ($ipos > 0) {
  151. $param1 = left($str, $ipos);
  152. $str = substr($str, $ipos+1);
  153. } else {
  154. $param1 = $str;
  155. return;
  156. }
  157. $ipos = stripos($str, PHP_SPACE);
  158. if ($ipos > 0) {
  159. $param2 = left($str, $ipos);
  160. $str = substr($str, $ipos+1);
  161. } else {
  162. $param2 = $str;
  163. return;
  164. }
  165. $ipos = stripos($str, PHP_SPACE);
  166. if ($ipos > 0) {
  167. $param3 = left($str, $ipos);
  168. $str = substr($str, $ipos+1);
  169. } else {
  170. $param3 = $str;
  171. return;
  172. }
  173. }
  174. function upload() {
  175. global $curPath;
  176. global $user;
  177. global $userName;
  178. global $picPath;
  179. //if (trim($message,"\n")!==PHP_STR) {
  180. // myExecSendMessage();
  181. //}
  182. //if (!empty($_FILES['files'])) {
  183. if (!empty($_FILES['files']['tmp_name'][0])) {
  184. $uploads = (array)fixMultipleFileUpload($_FILES['files']);
  185. //no file uploaded
  186. if ($uploads[0]['error'] === PHP_UPLOAD_ERR_NO_FILE) {
  187. //updateHistoryWithErr("No file uploaded.", false);
  188. return;
  189. }
  190. foreach($uploads as &$upload) {
  191. switch ($upload['error']) {
  192. case PHP_UPLOAD_ERR_OK:
  193. break;
  194. case PHP_UPLOAD_ERR_NO_FILE:
  195. //updateHistoryWithErr("One or more uploaded files are missing.", false);
  196. return;
  197. case PHP_UPLOAD_ERR_INI_SIZE:
  198. //updateHistoryWithErr("File exceeded INI size limit.", false);
  199. return;
  200. case PHP_UPLOAD_ERR_FORM_SIZE:
  201. //updateHistoryWithErr("File exceeded form size limit.", false);
  202. return;
  203. case PHP_UPLOAD_ERR_PARTIAL:
  204. //updateHistoryWithErr("File only partially uploaded.", false);
  205. return;
  206. case PHP_UPLOAD_ERR_NO_TMP_DIR:
  207. //updateHistoryWithErr("TMP dir doesn't exist.", false);
  208. return;
  209. case PHP_UPLOAD_ERR_CANT_WRITE:
  210. //updateHistoryWithErr("Failed to write to the disk.", false);
  211. return;
  212. case PHP_UPLOAD_ERR_EXTENSION:
  213. //updateHistoryWithErr("A PHP extension stopped the file upload.", false);
  214. return;
  215. default:
  216. //updateHistoryWithErr("Unexpected error happened.", false);
  217. return;
  218. }
  219. if (!is_uploaded_file($upload['tmp_name'])) {
  220. //updateHistoryWithErr("One or more file have not been uploaded.", false);
  221. return;
  222. }
  223. // name
  224. $name = (string)substr((string)filter_var($upload['name']), 0, 255);
  225. if ($name == PHP_STR) {
  226. //updateHistoryWithErr("Invalid file name: " . $name, false);
  227. return;
  228. }
  229. $upload['name'] = $name;
  230. // fileType
  231. $fileType = substr((string)filter_var($upload['type']), 0, 30);
  232. $upload['type'] = $fileType;
  233. // tmp_name
  234. $tmp_name = substr((string)filter_var($upload['tmp_name']), 0, 300);
  235. if ($tmp_name == PHP_STR || !file_exists($tmp_name)) {
  236. //updateHistoryWithErr("Invalid file temp path: " . $tmp_name, false);
  237. return;
  238. }
  239. $upload['tmp_name'] = $tmp_name;
  240. //size
  241. $size = substr((string)filter_var($upload['size'], FILTER_SANITIZE_NUMBER_INT), 0, 12);
  242. if ($size == "") {
  243. //updateHistoryWithErr("Invalid file size.", false);
  244. return;
  245. }
  246. $upload["size"] = $size;
  247. $tmpFullPath = $upload["tmp_name"];
  248. $originalFilename = pathinfo($name, PATHINFO_FILENAME);
  249. $originalFileExt = pathinfo($name, PATHINFO_EXTENSION);
  250. $fileExt = strtolower(pathinfo($name, PATHINFO_EXTENSION));
  251. if ($originalFileExt!==PHP_STR) {
  252. //$destFileName = $originalFilename . "." . $fileExt;
  253. if ($user === "master") {
  254. $destFileName = date("Ymd-Hm") . "-" . mt_rand(100000, 999999) . "-master.$fileExt";
  255. } else {
  256. $destFileName = date("Ymd-Hm") . "-" . mt_rand(100000, 999999) . "-$userName.$fileExt";
  257. }
  258. } else {
  259. return;
  260. }
  261. $destFullPath = $picPath . DIRECTORY_SEPARATOR . $destFileName;
  262. if (file_exists($destFullPath)) {
  263. //updateHistoryWithErr("destination already exists", false);
  264. return;
  265. }
  266. copy($tmpFullPath, $destFullPath);
  267. // Updating history..
  268. $output = [];
  269. $output[] = $destFileName . "\n";
  270. updateHistory($output, HISTORY_MAX_ITEMS);
  271. // Cleaning up..
  272. // Delete the tmp file..
  273. unlink($tmpFullPath);
  274. }
  275. }
  276. }
  277. function myExecSendMessage() {
  278. global $curPath;
  279. global $message;
  280. global $user;
  281. global $userName;
  282. global $sendSMS;
  283. global $CONFIG;
  284. global $userHintResolved;
  285. if (!empty($message)) {
  286. if ($user == "MASTER") {
  287. $fileName = date("Ymd-Hm") . "-" . mt_rand(100000, 999999) . "-master.msg";
  288. } else {
  289. $fileName = date("Ymd-Hm") . "-" . mt_rand(100000, 999999) . "-$userName.msg";
  290. }
  291. $msg = HTMLencode($message);
  292. if (right($msg,1)!="\n") {
  293. $msg = $msg . "\n";
  294. }
  295. // Creating the msg file..
  296. file_put_contents($curPath . DIRECTORY_SEPARATOR . "msgs" . DIRECTORY_SEPARATOR . $fileName, $msg);
  297. // Updating message history..
  298. $output = [];
  299. $output[] = $fileName . "\n";
  300. updateHistory($output, HISTORY_MAX_ITEMS);
  301. if ($user == "MASTER") {
  302. $smsUser = $userHintResolved;
  303. } else {
  304. $smsUser = "MASTER";
  305. }
  306. // Sending out the sms notifcation..
  307. if ($sendSMS && SMS_USERNAME!=PHP_STR) {
  308. $message = array(
  309. 'To'=>$CONFIG['AUTH'][$smsUser]['PHONE'],
  310. 'MessagingServiceSid'=>SMS_MESSAGING_SERVICE,
  311. 'Body'=>SMS_BODY
  312. );
  313. sendSMS($message, SMS_API_URL, SMS_USERNAME, SMS_PASSWORD);
  314. }
  315. }
  316. }
  317. $password = filter_input(INPUT_POST, "Password");
  318. $command = filter_input(INPUT_POST, "CommandLine");
  319. $message = filter_input(INPUT_POST, "MessageLine");
  320. $sendSMS1 = filter_input(INPUT_POST, "chkSMS");
  321. if ($sendSMS1!="") {
  322. $sendSMS = true;
  323. } else {
  324. $sendSMS = false;
  325. }
  326. $pwd = PHP_STR;
  327. $userHint = filter_input(INPUT_POST, "userHint");
  328. $userHintResolved = PHP_STR;
  329. if ($userHint!=PHP_STR) {
  330. $found=false;
  331. foreach ($CONFIG['AUTH'] as $key => $val) {
  332. if ($userHint==$val['USERNAME']) {
  333. $userHintResolved = $key;
  334. $found=true;
  335. break;
  336. }
  337. }
  338. if (!$found) {
  339. die("Invalid chat!");
  340. }
  341. }
  342. $hideSplash = filter_input(INPUT_POST, "hideSplash");
  343. $hideHCSplash = filter_input(INPUT_POST, "hideHCSplash");
  344. //echo "password=*$password*<br>";
  345. if ($password != PHP_STR) {
  346. $hash = hash("sha256", $password . APP_SALT, false);
  347. $found=false;
  348. foreach ($CONFIG['AUTH'] as $key => $val) {
  349. //echo ("username=".$val['USERNAME']."<br>");
  350. if ($hash==$val['HASH']) {
  351. $user = $key;
  352. if ($userHintResolved==PHP_STR) {
  353. $userHintResolved = $key;
  354. }
  355. $found=true;
  356. break;
  357. }
  358. }
  359. if (!$found) {
  360. $password=PHP_STR;
  361. }
  362. if ($password != PHP_STR) {
  363. $userName = $CONFIG['AUTH'][$user]['USERNAME'];
  364. $pwd = APP_REPO_PATH . DIRECTORY_SEPARATOR . $CONFIG['AUTH'][$userHintResolved]['REPO_FOLDER'];
  365. $picPath = APP_PIC_PATH . DIRECTORY_SEPARATOR . $CONFIG['AUTH'][$userHintResolved]['PIC_FOLDER'];
  366. }
  367. }
  368. $curPath = APP_REPO_PATH;
  369. if ($pwd!==PHP_STR) {
  370. if (left($pwd, strlen(APP_REPO_PATH)) === APP_REPO_PATH) {
  371. $curPath = $pwd;
  372. chdir($curPath);
  373. if (!file_exists($curPath . DIRECTORY_SEPARATOR . ".HMM_history")) {
  374. $output = [];
  375. file_put_contents($curPath . DIRECTORY_SEPARATOR . ".HMM_history", $output);
  376. }
  377. if (!file_exists($curPath . DIRECTORY_SEPARATOR . "msgs")) {
  378. mkdir("msgs", 0777);
  379. }
  380. }
  381. }
  382. $ipos = strripos($curPath, PHP_SLASH);
  383. $curDir = substr($curPath, $ipos);
  384. if ($password !== PHP_STR) {
  385. $msgHistory = file($curPath . DIRECTORY_SEPARATOR . ".HMM_history");
  386. parseCommand($command);
  387. //echo("cmd=" . $cmd . "<br>");
  388. //echo("opt=" . $opt . "<br>");
  389. //echo("param1=" . $param1 . "<br>");
  390. //echo("param2=" . $param2 . "<br>");
  391. //upload();
  392. if (mb_stripos(CMDLINE_VALIDCMDS, "|" . $command . "|")) {
  393. if ($command === "sendmsg") {
  394. if (trim($message,"\n")!==PHP_STR) {
  395. myExecSendMessage();
  396. upload();
  397. }
  398. }
  399. } else if (mb_stripos(CMDLINE_VALIDCMDS, "|" . $cmd . "|")) {
  400. } else {
  401. // if I'm not saving data..
  402. //if (empty($editBoardParams) || $editBoardParams[0]['location']===PHP_STR) {
  403. // if (empty($_FILES['files']['tmp_name'][0])) {
  404. // updateHistoryWithErr("invalid command");
  405. // }
  406. //}
  407. }
  408. } else {
  409. $msgHistory = [];
  410. }
  411. ?>
  412. <!DOCTYPE html>
  413. <html lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
  414. <head>
  415. <meta charset="UTF-8"/>
  416. <meta name="style" content="day1"/>
  417. <meta name="viewport" content="width=device-width, initial-scale=1"/>
  418. <!--
  419. Copyright 2021, 2024 5 Mode
  420. This file is part of Homomm.
  421. Homomm is free software: you can redistribute it and/or modify
  422. it under the terms of the GNU General Public License as published by
  423. the Free Software Foundation, either version 3 of the License, or
  424. (at your option) any later version.
  425. Homomm is distributed in the hope that it will be useful,
  426. but WITHOUT ANY WARRANTY; without even the implied warranty of
  427. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  428. GNU General Public License for more details.
  429. You should have received a copy of the GNU General Public License
  430. along with Homomm. If not, see <https://www.gnu.org/licenses/>.
  431. -->
  432. <title>Homomm: every person its messages..</title>
  433. <link rel="shortcut icon" href="./res/favicon.ico?v=<?php echo(time()); ?>" />
  434. <meta name="description" content="Welcome to <?php echo(APP_NAME); ?>"/>
  435. <meta name="author" content="5 Mode"/>
  436. <meta name="robots" content="noindex"/>
  437. <script src="./js/jquery-3.1.0.min.js" type="text/javascript"></script>
  438. <script src="./js/common.js" type="text/javascript"></script>
  439. <script src="./js/bootstrap.min.js" type="text/javascript"></script>
  440. <script src="./js/sha.js" type="text/javascript"></script>
  441. <script src="./js/home.js" type="text/javascript" defer></script>
  442. <link href="./css/bootstrap.min.css" type="text/css" rel="stylesheet">
  443. <link href="./css/style.css?v=<?php echo(time()); ?>" type="text/css" rel="stylesheet">
  444. <script>
  445. function upload() {
  446. <?PHP if ($password!==PHP_STR): ?>
  447. $("input#files").click();
  448. <?PHP endif; ?>
  449. }
  450. window.addEventListener("load", function() {
  451. <?php if($password===PHP_STR):?>
  452. $("#Password").addClass("emptyfield");
  453. <?php endif; ?>
  454. maxY = document.getElementById("Console").scrollHeight;
  455. //alert(maxY);
  456. document.getElementById("MessageLine").focus();
  457. document.getElementById("Console").scrollTop=maxY;
  458. }, true);
  459. function hideTitle() {
  460. $("#myh1").hide("slow");
  461. }
  462. function startApp() {
  463. $("#HCsplash").hide("slow");
  464. $(document.body).css("background","#ffffff");
  465. $("#frmHC").show();
  466. <?php if (APP_SPLASH): ?>
  467. $(document.body).css("overflow-y","auto");
  468. <?php endif; ?>
  469. }
  470. <?php if($hideHCSplash!=="1"): ?>
  471. window.addEventListener("load", function() {
  472. //$("#HCsplash").show();
  473. //setTimeout("startApp()", 5000);
  474. $(document.body).css("background","#000000");
  475. $("#HCsplash").show("slow");
  476. setTimeout("hideTitle()", 2000);
  477. setTimeout("startApp()", 4000);
  478. }, true);
  479. <?php else: ?>
  480. window.addEventListener("load", function() {
  481. startApp();
  482. });
  483. <?php endif; ?>
  484. </script>
  485. </head>
  486. <body>
  487. <div id="HCsplash" style="padding-top: 160px; text-align:center;color:#ffffff;display:none;">
  488. <div id="myh1"><H1>Homomm</H1></div><br>
  489. <img src="./Public/static/res/HMMlogo2.png" style="width:310px;">
  490. </div>
  491. <form id="frmHC" method="POST" action="/" target="_self" enctype="multipart/form-data" style="display:<?php echo(($hideHCSplash==="1"?"inline":"none"));?>;">
  492. <div class="header">
  493. <a href="http://homomm.org" target="_blank" style="color:black; text-decoration: none;"><img src="/res/HMMlogo2.png" style="width:48px;">&nbsp;Homomm</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://github.com/par7133/Homomm" style="color:#000000"><span style="color:#119fe2">on</span> github</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="mailto:info@homomm.com" 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:black;height:27px;text-decoration:none;">&nbsp;&nbsp;get support&nbsp;&nbsp;</a>
  494. </div>
  495. <div style="clear:both; float:left; padding:8px; width:25%; max-width:250px; height:100%; text-align:center;">
  496. <?php if ($user!="MASTER"): ?>
  497. <br><br>
  498. <img src="/res/HMMgenius.png" alt="HC Genius" title="HC Genius" style="position:relative; left:+6px; width:90%; border: 1px dashed #EEEEEE;">
  499. <?php else: ?>
  500. <div style="text-align:left;">&nbsp;Friends</div><br>
  501. <div style="position:relative;top:-10px;left:+6px; width:90%; overflow-y:auto; height:244px; border: 1px dashed #EEEEEE;">
  502. <?php foreach($CONFIG['AUTH'] as $key => $val):
  503. $myusername = $val['USERNAME'];
  504. $currentChatClass = PHP_STR;
  505. if ($myusername == $userHint) {
  506. $currentChatClass = "friend-selected";
  507. }
  508. echo("<div class=\"friend $currentChatClass\" onclick=\"changeChat('$myusername')\" style=\"text-align:left;cursor:pointer;\">&nbsp;&nbsp;$myusername</div>");
  509. endforeach; ?>
  510. </div>
  511. <?php endif; ?>
  512. <div id="upload-cont"><input id="files" name="files[]" type="file" accept=".gif,.png,.jpg,.jpeg" style="visibility: hidden;"></div>
  513. &nbsp;<br><br>
  514. <div style="text-align:left;white-space:nowrap;">
  515. &nbsp;&nbsp;<input type="text" id="Password" name="Password" placeholder="password" style="font-size:10px; background:#393939; color:#ffffff; width: 60%; border-radius:3px;" value="<?php echo($password);?>" autocomplete="off">&nbsp;<input type="submit" value="Go" style="text-align:left;width:25%;"><br>
  516. &nbsp;&nbsp;<input type="text" id="Salt" placeholder="salt" style="position:relative; top:+5px; font-size:10px; background:#393939; color:#ffffff; width: 90%; border-radius:3px;" autocomplete="off"><br>
  517. <div style="text-align:center;">
  518. <a href="#" onclick="showEncodedPassword();" style="position:relative; left:-2px; top:+5px; color:#000000; font-size:12px;">Hash Me!</a>
  519. </div>
  520. </div>
  521. </div>
  522. <div style="float:left; width:75%; max-width:950px; height:600px; padding:8px; border-left: 1px solid #2c2f34;">
  523. <?php if (APP_SPLASH): ?>
  524. <?php if ($hideSplash !== PHP_STR): ?>
  525. <div id="splash" style="border-radius:20px; position:relative; left:+3px; width:98%; background-color: #33aced; padding: 20px; margin-bottom:8px;">
  526. <button type="button" class="close" aria-label="Close" onclick="closeSplash();" style="position:relative; left:-10px;">
  527. <span aria-hidden="true">&times;</span>
  528. </button>
  529. Hello and welcome to Homomm!<br><br>
  530. Homomm is a light and simple software on premise to exchange multimedia messages with friends.<br><br>
  531. Homomm is released under GPLv3 license, it is supplied AS-IS and we do not take any responsibility for its misusage.<br><br>
  532. Homomm name comes from the two words: "homines" meaning our choise to give chance to the human beings to come first
  533. and "mm" for "multimedia messaging".<br><br>
  534. Homomm doesn't want to be a replacement of Whats App, Telegram, Wechat, etc. but simply wants to be their alter ago.<br><br>
  535. First step, use the left side panel password and salt fields to create the hash to insert in the config file for every user. Remember to manually set there also the salt value.<br><br>
  536. As you are going to run Homomm in the PHP process context, using a limited web server or phpfpm user, you must follow some simple directives for an optimal first setup:<br>
  537. <ol>
  538. <li>Check the permissions of your "Repo" folder in your web app private path; and set its path in the config file.</li>
  539. <li>In the Repo path create a "user" folder for each user and give to this folder the write permission. Set it appropriately in the config file.</li>
  540. <li>Check the permissions of your "hmm-img" folder in your web app public path; and set its path in the config file.</li>
  541. <li>In hmm-img path create a "user" folder for each user and give to this folder the write permission. Set it appropriately in the config file.</li>
  542. <li>In the config file, set every "user" information appropriately like in the examples given.</li>
  543. <li>Configure your <a href="http://twilio.com" style="color:#e6d236;">Twilio</a> account information appropriately to send out sms notification.</li>
  544. <li>Configure the max history items as required (default: 50).</li>
  545. </ol>
  546. <br>
  547. Hope you can enjoy it and let us know about any feedback: <a href="mailto:info@homomm.org" style="color:#e6d236;">info@homomm.org</a>
  548. </div>
  549. <?php endif; ?>
  550. <?php endif; ?>
  551. &nbsp;Message board<br>
  552. <div id="Console" style="height:433px; overflow-y:auto; margin-top:10px;">
  553. <!--<div id="Console" style="height:493px; margin-top:10px;">-->
  554. <pre id="Consolep" style="min-height:433px;margin-left:5px;padding:10px;border:0px;background:url('/res/console-bg.png'); background-size:cover; color: #000000;">
  555. <?php showHistory($msgHistory); ?>
  556. <div style="clear:both"></div>
  557. </pre>
  558. </div>
  559. <pre id="Messagep" style="position:relative;top:-10px;margin-left:5px;padding:10px;padding-top:0px;border:0px;background:url('/res/console-bg.png'); background-size:cover; color: #000000;">
  560. <div id="MessageL" style="width:100%;position:relative;white-space:nowrap;top:-23px;border:0px solid black;"><div id="MessageK" style="float:left;width:93%;background:url('/res/send-opts-bg.png');white-space:nowrap;position:relative; top:+40px;border:0px solid black;"><textarea id="MessageLine" name="MessageLine" type="text" autocomplete="off" rows="3" placeholder="Message" style="float:left;position:relative;top:+1px;width:80%;resize:none; background-color:white; color:black; border:0px; border-bottom: 1px dashed #EEEEEE;font-weight:900;"></textarea><div id="sendOptions" style="float:left;position:relative;top:-1px;width:16%;min-width:50px;height:59px;white-space:nowrap;padding:3px;font-weight:900;"><input type="checkbox" name="chkSMS" value="sms">&nbsp;SMS&nbsp;<br><div onclick="upload();" style="position:relative;top:+5px;left:+5px;cursor:pointer;"><img src="/res/upload.png" style="width:32px;"></div><div id="del-attach" onclick="clearUpload()" style="position:relative;top:-48px;left:-60px;display:none;cursor:pointer;"><img src="/res/del-attach.png" style="width:64px;"></div></div></div><div style="float:left;width:7%;position:relative;top:+40px;cursor:pointer;" onclick="sendMessage()"><img src="/res/send.png" style="float:left;width:63px;"></div></div>
  561. <div style="clear:both"></div>
  562. </pre>
  563. </div>
  564. <div class="footer">
  565. <div id="footerCont">&nbsp;</div>
  566. <div id="footer"><span style="background:#FFFFFF;opacity:1.0;margin-right:10px;">&nbsp;&nbsp;A <a href="http://5mode.com">5 Mode</a> project and <a href="http://wysiwyg.systems">WYSIWYG</a> system. Some rights reserved.</span></div>
  567. </div>
  568. <input type="hidden" id="CommandLine" name="CommandLine">
  569. <input type="hidden" name="pwd" value="<?php echo($curPath); ?>" style="color:black">
  570. <input type="hidden" id="userHint" name="userHint" value="<?php echo($userHint); ?>">
  571. <input type="hidden" name="hideSplash" value="<?php echo($hideSplash); ?>">
  572. <input type="hidden" name="hideHCSplash" value="1">
  573. </form>
  574. </body>
  575. </html>