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:
parent
504c4d18f9
commit
e46f1de22c
4 changed files with 29 additions and 9 deletions
18
README.md
18
README.md
|
@ -6,10 +6,10 @@ It is based on [wojtek77/chat](https://github.com/wojtek77/chat), itself based o
|
|||
## Features
|
||||
|
||||
- No need for users to register. Just need the web address.
|
||||
- On connection, the page is feeded with the 50 last messages.
|
||||
- Optional *get* arguments to specify the user name and the room.
|
||||
- On connection, the page is feeded with the 50 last messages of the day
|
||||
- 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`
|
||||
- Mono room (for now)
|
||||
- Optionaly multi room
|
||||
|
||||
## Installation
|
||||
### 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`
|
||||
### Otherwise
|
||||
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
|
||||
![screenshot](https://raw.githubusercontent.com/chtixof/databank/master/minchat_ynh/minchat_ynh_screenshot01.gif)
|
|
@ -49,13 +49,19 @@ if (isset($_REQUEST['room'])) {
|
|||
$room = stripslashes(htmlspecialchars($_REQUEST['room']));
|
||||
}
|
||||
|
||||
// no auth = single room = no room specified
|
||||
if ($auth[0]==""){$room="";}
|
||||
|
||||
// check args
|
||||
if ($name.$room=="") {
|
||||
// no args
|
||||
$prompt = "Please fill in the form to continue:";
|
||||
} else {
|
||||
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(":".$room,$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 $name;
|
||||
echo '"/></p>';
|
||||
if ($auth[0]!==""){
|
||||
echo '<p><label for="room">Room:</label><input type="text" name="room" id="room" value="';
|
||||
echo $room;
|
||||
echo '"/></p>';
|
||||
}
|
||||
echo '<br/><input type="submit" value="Enter" /></p></form></div>';
|
||||
} else {
|
||||
deleteOldHistory();
|
||||
|
|
|
@ -25,7 +25,7 @@ $name = isset($_POST['name']) ? $_POST['name'] : '';
|
|||
$room = isset($_POST['room']) ? $_POST['room'] : '';
|
||||
$delay = isset($_POST['delay']) ? $_POST['delay'] : '';
|
||||
|
||||
if ($text === '' || $name === '' || $room === '' || $delay === '') return;
|
||||
if ($text === '' || $name === '' || $delay === '') return;
|
||||
|
||||
$isApc = extension_loaded('apc');
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ function vvv($var, & $result = null, $is_view = true)
|
|||
$id = isset($_POST['id']) ? $_POST['id'] : '';
|
||||
$room = isset($_POST['room']) ? $_POST['room'] : '';
|
||||
|
||||
if ($id === '' || $room === '') return;
|
||||
if ($id === '' ) return;
|
||||
|
||||
$isApc = extension_loaded('apc');
|
||||
$cache = $isApc ? apc_fetch('chat') : @unserialize(file_get_contents('./history/'.$room.'cache2100-01-01'));
|
||||
|
|
Loading…
Reference in a new issue