1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/minchat_ynh.git synced 2024-09-03 19:36:29 +02:00

README updated and corrections

This commit is contained in:
Chtixof 2015-04-11 00:42:20 +02:00
parent 504c4d18f9
commit e46f1de22c
4 changed files with 29 additions and 9 deletions

View file

@ -6,10 +6,10 @@ It is based on [wojtek77/chat](https://github.com/wojtek77/chat), itself based o
## Features ## Features
- No need for users to register. Just need the web address. - No need for users to register. Just need the web address.
- On connection, the page is feeded with the 50 last messages. - On connection, the page is feeded with the 50 last messages of the day
- Optional *get* arguments to specify the user name and the room. - Args are in the URL as *get* arguments, so that you can share the URL or make it a favorite
Example : `https://yourdomain.org/minchat/?room=Living&name=John` Example : `https://yourdomain.org/minchat/?room=Living&name=John`
- Mono room (for now) - Optionaly multi room
## Installation ## Installation
### On Yunohost ### On Yunohost
@ -17,5 +17,17 @@ Via the admin web console, type in: <https://github.com/chtixof/minchat_ynh>
Or on ssh : `sudo yunohost app install https://github.com/chtixof/minchat_ynh` Or on ssh : `sudo yunohost app install https://github.com/chtixof/minchat_ynh`
### Otherwise ### Otherwise
Download, unzip and just copy the content of the `sources` folder to any folder of your web site. Download, unzip and just copy the content of the `sources` folder to any folder of your web site.
## Setup
On the application folder of your site, edit the file `conf/setup.ini`. The interesting parameter is `auth` that indicates which user is authorized to which room.
In this example `auth = John:Game,Mary:Game,John:Family,Tim:Family,admin:,:Public`,
- John can access the Game room, the Family room and the Public room
- Mary can access the Game room and the Public room
- Tim can access the Family room and the Public room
- admin can access all rooms
- other users can only acccess the Public room
If `auth` is not set (default), there is a single unnamed room, opened to all users.
## Screen shot ## Screen shot
![screenshot](https://raw.githubusercontent.com/chtixof/databank/master/minchat_ynh/minchat_ynh_screenshot01.gif) ![screenshot](https://raw.githubusercontent.com/chtixof/databank/master/minchat_ynh/minchat_ynh_screenshot01.gif)

View file

@ -49,13 +49,19 @@ if (isset($_REQUEST['room'])) {
$room = stripslashes(htmlspecialchars($_REQUEST['room'])); $room = stripslashes(htmlspecialchars($_REQUEST['room']));
} }
// no auth = single room = no room specified
if ($auth[0]==""){$room="";}
// check args // check args
if ($name.$room=="") { if ($name.$room=="") {
// no args // no args
$prompt = "Please fill in the form to continue:"; $prompt = "Please fill in the form to continue:";
} else { } else {
if ($name=="") {$prompt = "<em>User name missing.</em>";} if ($name=="") {$prompt = "<em>User name missing.</em>";}
else if ($room=="") {$prompt="<em>Room missing.</em>";} else if ($room=="") {
if ($auth[0]==""){$prompt="";}
else {$prompt="<em>Room missing.</em>";}
}
else if (in_array($name.":".$room,$auth)) {$prompt="";} else if (in_array($name.":".$room,$auth)) {$prompt="";}
else if (in_array(":".$room,$auth)) {$prompt="";} else if (in_array(":".$room,$auth)) {$prompt="";}
else if (in_array($name.":",$auth)) {$prompt="";} else if (in_array($name.":",$auth)) {$prompt="";}
@ -79,9 +85,11 @@ if ($name.$room=="") {
echo '</p><form action="" method="get" class="tform"><p><label for="name">Name:</label><input type="text" name="name" id="name" value="'; echo '</p><form action="" method="get" class="tform"><p><label for="name">Name:</label><input type="text" name="name" id="name" value="';
echo $name; echo $name;
echo '"/></p>'; echo '"/></p>';
echo '<p><label for="room">Room:</label><input type="text" name="room" id="room" value="'; if ($auth[0]!==""){
echo $room; echo '<p><label for="room">Room:</label><input type="text" name="room" id="room" value="';
echo '"/></p>'; echo $room;
echo '"/></p>';
}
echo '<br/><input type="submit" value="Enter" /></p></form></div>'; echo '<br/><input type="submit" value="Enter" /></p></form></div>';
} else { } else {
deleteOldHistory(); deleteOldHistory();

View file

@ -25,7 +25,7 @@ $name = isset($_POST['name']) ? $_POST['name'] : '';
$room = isset($_POST['room']) ? $_POST['room'] : ''; $room = isset($_POST['room']) ? $_POST['room'] : '';
$delay = isset($_POST['delay']) ? $_POST['delay'] : ''; $delay = isset($_POST['delay']) ? $_POST['delay'] : '';
if ($text === '' || $name === '' || $room === '' || $delay === '') return; if ($text === '' || $name === '' || $delay === '') return;
$isApc = extension_loaded('apc'); $isApc = extension_loaded('apc');

View file

@ -23,7 +23,7 @@ function vvv($var, & $result = null, $is_view = true)
$id = isset($_POST['id']) ? $_POST['id'] : ''; $id = isset($_POST['id']) ? $_POST['id'] : '';
$room = isset($_POST['room']) ? $_POST['room'] : ''; $room = isset($_POST['room']) ? $_POST['room'] : '';
if ($id === '' || $room === '') return; if ($id === '' ) return;
$isApc = extension_loaded('apc'); $isApc = extension_loaded('apc');
$cache = $isApc ? apc_fetch('chat') : @unserialize(file_get_contents('./history/'.$room.'cache2100-01-01')); $cache = $isApc ? apc_fetch('chat') : @unserialize(file_get_contents('./history/'.$room.'cache2100-01-01'));