Файл: groups/admin.php
Строк: 106
<?php
require_once '../incfiles/core.php';
require_once '../incfiles/func.php';
require_once '../incfiles/auth.php';
require_once '../incfiles/user.php';
if (empty($user_id)) go(URL);
$title = lang('Управление сообществами','Управління спільнотами');
require_once 'handler/new_group.php';
require_once '../incfiles/head.php';
?>
<script type="text/javascript">
$(function(){
$('#form').on('submit', function(e){
e.preventDefault();
var $that = $(this),
formData = new FormData($that.get(0));
$.ajax({
url: $that.attr('action'),
type: $that.attr('method'),
contentType: false,
processData: false,
data: formData,
success: function(response){
if(response){
$('.content').html(response);
}
}
});
});
});
</script>
<?
$all = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `groups` WHERE `user_id` = '".$user_id."'"),0);
echo '<div class="title">
<a href="'.URL.'/?id='.$user_id.'" onclick="Page.Go(this.href); return false">'.$user['name'].' '.$user['surname'].'</a>
<a href="'.URL.'/groups/my.php?id='.$user_id.'" onclick="Page.Go(this.href); return false">'.lang('Сообщества','Спільноти').'</a>';
if (!empty($user_id) && $device == 'Computer')echo'<a class="title_a_hover" href="'.URL.'/groups/admin.php" onclick="Title.Open(); return false">'.lang('Управление','Керування').' <img src="'.URL.'/design/img/title_menu.png"/></a>
</div>';
if (!empty($user_id) && $device == 'Mobile')echo'<a class="title_a_hover" href="'.URL.'/groups/admin.php?&act=create" onclick="Page.Go(this.href); return false">'.lang('Управление','Керування').' <img src="'.URL.'/design/img/title_menu.png"/></a>
</div>';
if ($user['level'] == 1 || $all < 3) echo '<div id="title_menu">
<div class="title">'.lang('Создать сообщество','Створити спільноту').'</div>
<div class="block">
'.lang('Название','Назва').':
<form id="form" method="post" action="'.URL.'/groups/admin.php">
<input class="input" type="text" name="name" value=""/>
'.lang('Тип сообщества','Тип спільноти').':
<select class="input2" name="type">
<option value="0">'.lang('Открытое','Відкрита').'</option>
<option value="1">'.lang('Закрытое','Закрита').'</option>
</select><br/>
<input class="button2" type="submit" value="'.lang('Создать','Створити').'"/>
</form>
</div></div>';
$act = htmlentities(trim($_GET['act']));
switch($act)
{
default:
break;
case 'create':
if ($user['level'] == 1 || $all < 3) echo '<div class="title">
<div class="title">'.lang('Создать сообщество','Створити спільноту').'</div>
<div class="block">
'.lang('Название','Назва').':
<form id="form" method="post" action="'.URL.'/groups/admin.php">
<input class="input" type="text" name="name" value=""/>
'.lang('Тип сообщества','Тип спільноти').':
<select class="input2" name="type">
<option value="0">'.lang('Открытое','Відкрита').'</option>
<option value="1">'.lang('Закрытое','Закрита').'</option>
</select><br/>
<input class="button2" type="submit" value="'.lang('Создать','Створити').'"/>
</form>
</div></div>';
break;
}
if ($all > 0)
{
$cp = ceil($all/10);
$p = (isset($_GET['p']) and is_numeric($_GET['p']) and $_GET['p']>1 and $_GET['p']<=$cp) ? $_GET['p'] : 1;
$start = $p*10-10;
$res = mysql_query("SELECT * FROM `groups` WHERE `user_id` = '".$user_id."' ORDER by `time` DESC LIMIT $start,10");
while ($array = mysql_fetch_array($res)) echo '<div class="block">'.group_name($array['id']).'</div>';
navi($p,$cp,'/groups/admin.php?');
}
require_once '../incfiles/foot.php';
?>