Moved the Agents into their own repo. Kept the agent.pl just for reference
This commit is contained in:
parent
22381be29a
commit
8680a02b13
18132 changed files with 0 additions and 2569420 deletions
|
|
@ -1,10 +0,0 @@
|
|||
h2>i{
|
||||
text-align:right;
|
||||
display:block;
|
||||
float:right;
|
||||
margin-right:5px;
|
||||
}
|
||||
|
||||
h2>i>a{
|
||||
background:black;padding:5px;
|
||||
}
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
table#circular{
|
||||
width:100%;
|
||||
}
|
||||
|
||||
table#circular>tbody>tr>td>input[type="text"],
|
||||
table#circular>tbody>tr>td>select,
|
||||
table#circular>tbody>tr>td>textarea{
|
||||
width:100%;
|
||||
}
|
||||
|
||||
#circular > tbody > tr:nth-child(1) > td:nth-child(1),
|
||||
#circular > tbody > tr:nth-child(3) > td:nth-child(1){
|
||||
width:90px !important;
|
||||
word-wrap:break-word;
|
||||
}
|
||||
|
||||
.ql-editor>h0, .ql-editor>h1, .ql-editor>h1,
|
||||
.ql-editor>h2, .ql-editor>h3, .ql-editor>h4,
|
||||
.ql-editor>h5, .ql-editor>h6, .ql-editor>legend,
|
||||
#circular_message>h0, #circular_message>h1, #circular_message>h1,
|
||||
#circular_message>h2, #circular_message>h3, #circular_message>h4,
|
||||
#circular_message>h5, #circular_message>h6, #circular_message>legend {
|
||||
all: initial;
|
||||
}
|
||||
|
||||
#circular_message{
|
||||
padding:20px;
|
||||
}
|
||||
|
||||
.ql-toolbar{
|
||||
background:white;
|
||||
}
|
||||
|
||||
#editor{
|
||||
height:400px;
|
||||
background:white;
|
||||
color:black;
|
||||
text-shadow:none;
|
||||
}
|
||||
|
||||
.status_0{
|
||||
content:url(../../images/online.png);
|
||||
}
|
||||
|
||||
.status_1{
|
||||
content:url(../../images/offline.png);
|
||||
}
|
||||
|
||||
table#circular_admin_list,
|
||||
table#circular_list{
|
||||
width:100%;
|
||||
}
|
||||
|
||||
table#circular_list > tbody > tr > td:first-child,
|
||||
table#circular_admin_list > tbody > tr > td:first-child{
|
||||
width:10px;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
table#circular_list > tbody > tr > td:last-child,
|
||||
table#circular_list > thead > tr > th:last-child,
|
||||
table#circular_admin_list > tbody > tr > td:last-child,
|
||||
table#circular_admin_list > thead > tr > th:last-child{
|
||||
width:150px;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
table#circular_list > tbody > tr > td{
|
||||
padding:5px;
|
||||
}
|
||||
|
||||
table#circular_admin_list>thead>tr>th,
|
||||
table#circular_list>thead>tr>th{
|
||||
background:black;
|
||||
color:white;
|
||||
}
|
||||
|
||||
table#circular_admin_list,
|
||||
table#circular_list{
|
||||
border:1px solid black;
|
||||
}
|
||||
|
||||
table#circular_admin_list>tbody>tr>td,
|
||||
table#circular_list>tbody>tr>td{
|
||||
border:1px solid gray;
|
||||
}
|
||||
|
|
@ -1,156 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
* Copyright (C) 2008 - 2018 The OGP Development Team
|
||||
*
|
||||
* http://www.opengamepanel.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
include 'modules/circular/functions.php';
|
||||
function exec_ogp_module()
|
||||
{
|
||||
global $db;
|
||||
if(isset($_POST['send_circular']))
|
||||
{
|
||||
send_circular($_POST);
|
||||
return;
|
||||
}
|
||||
|
||||
if(isset($_GET['get_circulars']))
|
||||
{
|
||||
$circulars = get_circulars(true);
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($circulars);
|
||||
return;
|
||||
}
|
||||
|
||||
if(isset($_POST['remove_circulars']))
|
||||
{
|
||||
if(isset($_POST['circulars_ids']) and is_array($_POST['circulars_ids']) and !empty($_POST['circulars_ids']))
|
||||
{
|
||||
foreach($_POST['circulars_ids'] as $circular_id)
|
||||
{
|
||||
remove_circular($circular_id, true);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
echo '<link rel="stylesheet" href="css/quill/quill.snow.css">'."\n".
|
||||
'<script type="text/javascript" src="js/quill/quill.js"></script>'."\n".
|
||||
'<script type="text/javascript" src="js/modules/circular.js"></script>';
|
||||
|
||||
if(isset($_GET['list']))
|
||||
{
|
||||
$circulars = get_circulars(true);
|
||||
if($circulars)
|
||||
{
|
||||
rsort($circulars);
|
||||
echo "<table id='circular_admin_list'><thead><tr>\n".
|
||||
"<th><input type=\"checkbox\" onclick=\"swap_all_checkboxes(this)\"></th>\n".
|
||||
"<th>".get_lang('subject')."</th>\n".
|
||||
"<th>".get_lang('users_not_read_circular')."</th>".
|
||||
"<th>".get_lang('date')."</th></thead>\n";
|
||||
|
||||
foreach($circulars as $key => $circular)
|
||||
{
|
||||
$users_not_readed = get_usernames_not_read_circular($circular['circular_id']);
|
||||
$users_not_readed = $users_not_readed ? $users_not_readed: "";
|
||||
echo '<tr><td><input type="checkbox" class="circular_checkbox" name="remove_circular[]" value="'.$circular['circular_id'].'"></td>'."\n".
|
||||
'<td><b>'.$circular['subject']."</b></td><td>$users_not_readed</td><td>".$circular['timestamp']."</td></tr>\n";
|
||||
}
|
||||
echo '<tr><td colspan=4><button onclick="remove_circulars()">'.get_lang('remove_selected_circulars')."</button></td></tr>\n".
|
||||
"</table>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print_failure(get_lang('there_are_no_circulars'));
|
||||
}
|
||||
echo '<p><a href="?m=circular"><< '.get_lang('back')."</a></p>\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$subusers_installed = $db->isModuleInstalled('subusers');
|
||||
echo "<h2>".get_lang('Circular')."</h2>";
|
||||
|
||||
//[]admins []users []subusers[of user] []groups[group]
|
||||
echo '<table id="circular"><tr>'."\n".
|
||||
'<td rowspan=2>'.get_lang('send_to').':</td>'."\n".
|
||||
'<td><input type="checkbox" onclick="toggle_all(this, \'select_admins\')" id="admins"><label for="admins">'.get_lang('admins').'</label></td>'."\n".
|
||||
'<td><input type="checkbox" onclick="toggle_all(this, \'select_users\')" id="users" ><label for="users" >'.get_lang('users') .'</label></td>'."\n".
|
||||
'<td><input type="checkbox" onclick="toggle_all(this, \'select_groups\')" id="groups"><label for="groups">'.get_lang('groups').'</label></td>'."\n";
|
||||
|
||||
if($subusers_installed){
|
||||
echo '<td><input type="checkbox" onclick="toggle_all(this, \'select_subusers_of_users\')" id="subusers_of_user"><label for="subusers_of_user">'.get_lang('subusers_of_user').'</label></td>'."\n";
|
||||
}
|
||||
|
||||
$users = $db->getUserList();
|
||||
echo '</tr><tr>'."\n".
|
||||
'<td><select id="select_admins" multiple>'."\n";
|
||||
if(!empty($users))
|
||||
{
|
||||
foreach($users as $user)
|
||||
{
|
||||
if($user['users_role'] == 'admin')
|
||||
echo '<option value="'.$user['user_id'].'">'.$user['users_login'].'</option>'."\n";
|
||||
}
|
||||
}
|
||||
echo '</select></td>'."\n".
|
||||
'<td><select id="select_users" multiple>'."\n";
|
||||
if(!empty($users))
|
||||
{
|
||||
foreach($users as $user)
|
||||
{
|
||||
if($user['users_role'] == 'user')
|
||||
echo '<option value="'.$user['user_id'].'">'.$user['users_login'].'</option>'."\n";
|
||||
}
|
||||
}
|
||||
echo '</select></td>'."\n".
|
||||
'<td><select id="select_groups" multiple>'."\n";
|
||||
$groups = $db->getGroupList();
|
||||
if(!empty($groups))
|
||||
{
|
||||
foreach($groups as $group)
|
||||
{
|
||||
if($db->listUsersInGroup($group['group_id']))
|
||||
echo '<option value="'.$group['group_id'].'">'.$group['group_name'].'</option>';
|
||||
}
|
||||
}
|
||||
echo '</select></td>'."\n";
|
||||
if($subusers_installed){
|
||||
echo '<td><select id="select_subusers_of_users" multiple>'."\n";
|
||||
if(!empty($users))
|
||||
{
|
||||
foreach($users as $user)
|
||||
{
|
||||
$sub_users_ids = $db->getUsersSubUsersIds($user['user_id']);
|
||||
if($user['users_role'] == 'user' and $sub_users_ids)
|
||||
echo '<option value="'.$user['user_id'].'">'.$user['users_login'].'</option>'."\n";
|
||||
}
|
||||
}
|
||||
echo '</select></td>'."\n";
|
||||
}
|
||||
$colspan = $subusers_installed ? '5':'4';
|
||||
echo '</tr>'."\n".
|
||||
'<tr><td>'.get_lang('subject').'</td><td colspan=4><input type="text" id="subject"></td></tr>'."\n".
|
||||
'<tr><td colspan='.$colspan.'>'.get_lang('message').'</td></td></tr>'."\n".
|
||||
'<tr><td colspan='.$colspan.'><div id="editor"></div></td></tr>'."\n".
|
||||
'<tr><td colspan='.$colspan.'><button onclick="send_circular()" >'.get_lang('send_circular').'</button></td></tr>'."\n".
|
||||
'</table>';
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,160 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
* Copyright (C) 2008 - 2018 The OGP Development Team
|
||||
*
|
||||
* http://www.opengamepanel.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
function get_usernames_not_read_circular($circular_id)
|
||||
{
|
||||
global $db;
|
||||
$circular_id = $db->real_escape_string($circular_id);
|
||||
$query = "SELECT user_id ".
|
||||
"FROM `OGP_DB_PREFIXcircular_recipients` ".
|
||||
"WHERE `circular_id` = '$circular_id' ".
|
||||
"AND `status` = '0'";
|
||||
$users = $db->resultQuery($query);
|
||||
if($users)
|
||||
{
|
||||
$user_names = array();
|
||||
foreach($users as $user)
|
||||
{
|
||||
$user_info = $db->getUserById($user['user_id']);
|
||||
$user_names[] = $user_info['users_login'];
|
||||
}
|
||||
return implode(', ', $user_names);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function remove_circular($circular_id, $admin = false)
|
||||
{
|
||||
global $db;
|
||||
$circular_id = $db->real_escape_string($circular_id);
|
||||
|
||||
if($admin)
|
||||
{
|
||||
$db->query("DELETE FROM `OGP_DB_PREFIXcircular_recipients` ".
|
||||
"WHERE `circular_id` = '$circular_id'");
|
||||
$db->query("DELETE FROM `OGP_DB_PREFIXcircular` ".
|
||||
"WHERE `circular_id` = '$circular_id'");
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->query("DELETE FROM `OGP_DB_PREFIXcircular_recipients` ".
|
||||
"WHERE `circular_id` = '$circular_id' ".
|
||||
"AND `user_id` = '$_SESSION[user_id]'");
|
||||
}
|
||||
}
|
||||
|
||||
function set_circular_readed($circular_id)
|
||||
{
|
||||
global $db;
|
||||
$circular_id = $db->real_escape_string($circular_id);
|
||||
$db->query("UPDATE `OGP_DB_PREFIXcircular_recipients` ".
|
||||
"SET `status` = '1' ".
|
||||
"WHERE `circular_id` = '$circular_id' ".
|
||||
"AND `user_id` = '$_SESSION[user_id]'");
|
||||
}
|
||||
|
||||
function get_circulars($all = false)
|
||||
{
|
||||
global $db;
|
||||
if($all)
|
||||
$query = "SELECT * FROM `OGP_DB_PREFIXcircular`";
|
||||
else
|
||||
$query = "SELECT * ".
|
||||
"FROM `OGP_DB_PREFIXcircular_recipients` ".
|
||||
"NATURAL JOIN `OGP_DB_PREFIXcircular` ".
|
||||
"WHERE user_id = $_SESSION[user_id]";
|
||||
|
||||
return $db->resultQuery($query);
|
||||
}
|
||||
|
||||
function send_to_user($user_id, $circular_id)
|
||||
{
|
||||
global $db;
|
||||
$user_id = $db->real_escape_string($user_id);
|
||||
$circular_id = $db->real_escape_string($circular_id);
|
||||
return $db->query("INSERT INTO `OGP_DB_PREFIXcircular_recipients` VALUES('$user_id','$circular_id','0');");
|
||||
}
|
||||
|
||||
function get_user_ids($type, $ids, &$user_ids)
|
||||
{
|
||||
global $db;
|
||||
foreach($ids as $id)
|
||||
{
|
||||
if($type == 'admins' or $type == 'users')
|
||||
{
|
||||
if(!in_array($id, $user_ids))
|
||||
$user_ids[] = $id;
|
||||
}
|
||||
elseif($type == 'groups')
|
||||
{
|
||||
$group_users = $db->listUsersInGroup($id);
|
||||
if($group_users and !empty($group_users))
|
||||
{
|
||||
foreach($group_users as $user)
|
||||
{
|
||||
if(!in_array($user['user_id'], $user_ids))
|
||||
$user_ids[] = $user['user_id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($type == 'subusers_of_users')
|
||||
{
|
||||
$sub_users_ids = $db->getUsersSubUsersIds($id);
|
||||
if($sub_users_ids and !empty($sub_users_ids))
|
||||
{
|
||||
foreach($sub_users_ids as $user_id)
|
||||
{
|
||||
if(!in_array($user_id, $user_ids))
|
||||
$user_ids[] = $user_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function send_circular($data)
|
||||
{
|
||||
global $db;
|
||||
$circular_id = $db->resultInsertId('circular', array('subject' => $data['subject'], 'message' => $data['message']));
|
||||
$user_ids = array();
|
||||
unset($data['subject'], $data['message']);
|
||||
foreach($data as $type => $ids)
|
||||
{
|
||||
if(is_array($ids) and !empty($ids))
|
||||
get_user_ids($type, $ids, $user_ids);
|
||||
}
|
||||
$failed_recipients = array();
|
||||
foreach($user_ids as $user_id)
|
||||
{
|
||||
if(!send_to_user($user_id, $circular_id))
|
||||
$failed_recipients[] = $user_id;
|
||||
}
|
||||
if(empty($failed_recipients))
|
||||
{
|
||||
echo "Circular sent to all recipients.";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Failed to send circular to users with the following ids:\n". implode(", ", $failed_recipients) . ".";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,119 +0,0 @@
|
|||
$('document').ready(function(){
|
||||
editor = document.getElementById('editor');
|
||||
if(editor)
|
||||
{
|
||||
var quill = new Quill('#editor', {
|
||||
theme: 'snow'
|
||||
});
|
||||
$.getJSON("home.php?m=circular&get_circulars=true&type=cleared", function(data){
|
||||
if(data.length > 0)
|
||||
{
|
||||
$("head").append('<link rel="stylesheet" href="modules/circular/admin_notification.css">');
|
||||
$("h2").append('<i>There are ' + data.length + ' notifications <a href="?m=circular&list=true" >Manage Notifications</a></i>');
|
||||
}
|
||||
}).fail(function(){
|
||||
console.log('Failed reading JSON for circulars');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function remove_circulars()
|
||||
{
|
||||
checkboxes = document.getElementsByClassName('circular_checkbox');
|
||||
var ids = [];
|
||||
for(var i = 0; i < checkboxes.length; i++)
|
||||
{
|
||||
if(checkboxes[i].checked)
|
||||
{
|
||||
ids.push(checkboxes[i].value);
|
||||
}
|
||||
}
|
||||
|
||||
if(ids.length > 0)
|
||||
{
|
||||
var addpost = {};
|
||||
addpost["remove_circulars"] = "true";
|
||||
addpost["circulars_ids"] = ids;
|
||||
var destURL = "home.php?m=circular&list=true";
|
||||
var destURLCleared = destURL + "&type=cleared";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: destURLCleared,
|
||||
data: addpost,
|
||||
success: function(data){
|
||||
location.href = destURL;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function swap_all_checkboxes(obj)
|
||||
{
|
||||
checkboxes = document.getElementsByClassName('circular_checkbox');
|
||||
for(var i = 0; i < checkboxes.length; i++)
|
||||
{
|
||||
checkboxes[i].checked = obj.checked;
|
||||
}
|
||||
}
|
||||
|
||||
function toggle_all(obj, selectBox)
|
||||
{
|
||||
if(typeof selectBox == "string")
|
||||
{
|
||||
selectBox = document.getElementById(selectBox);
|
||||
if(selectBox.type == "select-multiple")
|
||||
{
|
||||
for(var i = 0; i < selectBox.options.length; i++)
|
||||
{
|
||||
selectBox.options[i].selected = obj.checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function send_circular()
|
||||
{
|
||||
var addpost = {};
|
||||
addpost['admins'] = $('#select_admins').val(),
|
||||
addpost['users'] = $('#select_users').val(),
|
||||
addpost['groups'] = $('#select_groups').val(),
|
||||
addpost['subusers_of_users'] = $('#select_subusers_of_users').val(),
|
||||
addpost['subject'] = $('#subject').val().trim(),
|
||||
addpost['message'] = document.getElementById("editor").getElementsByClassName("ql-editor")[0].innerHTML,
|
||||
addpost['send_circular'] = "send";
|
||||
|
||||
if(addpost['admins'] == null && addpost['users'] == null && addpost['groups'] == null && addpost['subusers_of_users'] == null)
|
||||
{
|
||||
alert('Select at least one recipient (Send To).');
|
||||
return;
|
||||
}
|
||||
|
||||
if(addpost['subject'] == null || addpost['subject'] == "")
|
||||
{
|
||||
alert('Introduce a subject.');
|
||||
return;
|
||||
}
|
||||
|
||||
if(addpost['message'] == "<p><br></p>")
|
||||
{
|
||||
alert('Introduce a Message.');
|
||||
return;
|
||||
}
|
||||
|
||||
var destURL = "home.php?m=circular";
|
||||
var destURLCleared = destURL + "&type=cleared";
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: destURLCleared,
|
||||
data: addpost,
|
||||
success: function(data){
|
||||
alert(data);
|
||||
location.href = destURL;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
$('document').ready(function(){
|
||||
$.getJSON("home.php?m=circular&p=show_circular&type=cleared", function(data){
|
||||
if(data.length > 0)
|
||||
{
|
||||
$("head").append('<link rel="stylesheet" href="modules/circular/notification.css">');
|
||||
$("body").append('<div id="notification">You have ' + data.length + ' pending notifications.<br><a href="?m=circular&p=show_circular&list=true" >Read Notifications</a></div>');
|
||||
}
|
||||
}).fail(function(){
|
||||
console.log('Failed reading JSON for circulars');
|
||||
});
|
||||
});
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
* Copyright (C) 2008 - 2017 The OGP Development Team
|
||||
*
|
||||
* http://www.opengamepanel.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
define('OGP_LANG_your_circulars', "Your Notifications");
|
||||
define('OGP_LANG_status', "Status");
|
||||
define('OGP_LANG_subject', "Subject");
|
||||
define('OGP_LANG_users_not_red_circular', "Not Seen by");
|
||||
define('OGP_LANG_date', "Date");
|
||||
define('OGP_LANG_remove_selected_circulars', "Remove Selected");
|
||||
define('OGP_LANG_back', "Back");
|
||||
define('OGP_LANG_Circular', "Notification");
|
||||
define('OGP_LANG_send_to', "Send To");
|
||||
define('OGP_LANG_admins', "Admins");
|
||||
define('OGP_LANG_users', "Users");
|
||||
define('OGP_LANG_groups', "Groups");
|
||||
define('OGP_LANG_subusers_of_user', "Subusers");
|
||||
define('OGP_LANG_message', "Message");
|
||||
define('OGP_LANG_send_circular', "Send Notification");
|
||||
?>
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
* Copyright (C) 2008 - 2017 The OGP Development Team
|
||||
*
|
||||
* http://www.opengamepanel.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
$module_title = "Circular";
|
||||
$module_version = "0.1";
|
||||
$db_version = 0;
|
||||
$module_required = false;
|
||||
$module_menus = array(
|
||||
array(
|
||||
'subpage' => '',
|
||||
'name' => 'Notification',
|
||||
'group' => 'admin',
|
||||
)
|
||||
);
|
||||
|
||||
$install_queries[0] = array(
|
||||
"DROP TABLE IF EXISTS `".OGP_DB_PREFIX."circular`",
|
||||
"CREATE TABLE IF NOT EXISTS `".OGP_DB_PREFIX."circular` (
|
||||
`circular_id` int NOT NULL AUTO_INCREMENT,
|
||||
`subject` TEXT NOT NULL,
|
||||
`message` TEXT NOT NULL,
|
||||
`timestamp` TIMESTAMP,
|
||||
PRIMARY KEY (`circular_id`)
|
||||
);",
|
||||
"DROP TABLE IF EXISTS `".OGP_DB_PREFIX."circular_recipients`",
|
||||
"CREATE TABLE IF NOT EXISTS `".OGP_DB_PREFIX."circular_recipients` (
|
||||
`user_id` int NOT NULL,
|
||||
`circular_id` int NOT NULL,
|
||||
`status` tinyint NOT NULL,
|
||||
PRIMARY KEY (`user_id`, `circular_id`)
|
||||
);"
|
||||
);
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
<navigation>
|
||||
<page key="default" file="circular.php" access="admin" />
|
||||
<page key="show_circular" file="show_circular.php" access="admin,user,subuser" />
|
||||
</navigation>
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
#notification{
|
||||
background:black;
|
||||
color:white;
|
||||
position:absolute;
|
||||
z-index:101;
|
||||
padding:10px;
|
||||
right:20px;
|
||||
top:0px
|
||||
}
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
* Copyright (C) 2008 - 2018 The OGP Development Team
|
||||
*
|
||||
* http://www.opengamepanel.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
include 'modules/circular/functions.php';
|
||||
function exec_ogp_module()
|
||||
{
|
||||
$circulars = get_circulars();
|
||||
if(isset($_GET['list']))
|
||||
{
|
||||
echo '<h2>'.get_lang('your_circulars').'</h2>';
|
||||
rsort($circulars);
|
||||
echo "<table id='circular_list'>\n".
|
||||
"<thead><tr><th>".get_lang('status')."</th><th>".get_lang('subject')."</th><th>".get_lang('date')."</th></tr></thead><tbody>\n";
|
||||
foreach($circulars as $key => $circular)
|
||||
{
|
||||
echo '<tr><td><i class="status_'.$circular['status'].'"></i></td><td><a href="?m=circular&p=show_circular&read_circular='.$circular['circular_id'].'">'.$circular['subject']."</a></td><td>".$circular['timestamp']."</td></tr>\n";
|
||||
}
|
||||
echo "</tbody></table>\n";
|
||||
}
|
||||
elseif(isset($_GET['read_circular']) and is_numeric($_GET['read_circular']))
|
||||
{
|
||||
foreach($circulars as $circular)
|
||||
if($circular['circular_id'] == $_GET['read_circular'])
|
||||
break;
|
||||
echo '<div id="circular_message">'.$circular['message']."</div>\n".
|
||||
'<p><a href="?m=circular&p=show_circular&list"><< '.get_lang('back')."</a></p>\n";
|
||||
if($circular['status'] == "0")
|
||||
set_circular_readed($circular['circular_id']);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($circulars as $key => $circular)
|
||||
if($circular['status'] == "1")
|
||||
unset($circulars[$key]);
|
||||
sort($circulars);
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($circulars);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue