|
|
@ -8,6 +8,7 @@ |
|
|
|
* @filesource |
|
|
|
* @filesource |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Если был referer, то перенапрявляем на него |
|
|
|
* Если был referer, то перенапрявляем на него |
|
|
|
* |
|
|
|
* |
|
|
@ -75,27 +76,34 @@ |
|
|
|
$AVE_Template->assign('logs', $logs); |
|
|
|
$AVE_Template->assign('logs', $logs); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Список пользователей за последние $onlinetime секунд |
|
|
|
* Список пользователей за последние $onlinetime секунд |
|
|
|
* |
|
|
|
* |
|
|
|
* @param int $onlinetime количество секунд |
|
|
|
* @param int $onlinetime количество секунд |
|
|
|
* @return Array массив из пользователей отсортированный по последней активности |
|
|
|
* @return Array массив из пользователей отсортированный по последней активности |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function get_online_users($onlinetime=USERS_TIME_SHOW) |
|
|
|
function get_online_users($onlinetime = USERS_TIME_SHOW) |
|
|
|
{ |
|
|
|
{ |
|
|
|
global $AVE_DB, $AVE_Template; |
|
|
|
global $AVE_DB, $AVE_Template; |
|
|
|
|
|
|
|
|
|
|
|
$time=(time()-intval($onlinetime)); |
|
|
|
$time=(time()-intval($onlinetime)); |
|
|
|
|
|
|
|
|
|
|
|
$sql=@$AVE_DB->Query("SELECT * FROM ".PREFIX."_users WHERE last_visit>".$time." ORDER BY last_visit DESC"); |
|
|
|
$sql=@$AVE_DB->Query("SELECT * FROM ".PREFIX."_users WHERE last_visit>".$time." ORDER BY last_visit DESC"); |
|
|
|
|
|
|
|
|
|
|
|
$online_users=Array(); |
|
|
|
$online_users=Array(); |
|
|
|
|
|
|
|
|
|
|
|
while ($row = $sql->FetchRow()) |
|
|
|
while ($row = $sql->FetchRow()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$row->user_name = get_username_by_id($row->Id); |
|
|
|
$row->user_name = get_username_by_id($row->Id); |
|
|
|
$row->user_group_name = get_usergroup_by_id($row->user_group); |
|
|
|
$row->user_group_name = get_usergroup_by_id($row->user_group); |
|
|
|
array_push($online_users,$row); |
|
|
|
array_push($online_users,$row); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$AVE_Template->assign('online_users', $online_users); |
|
|
|
$AVE_Template->assign('online_users', $online_users); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Форматированный вывод размера |
|
|
|
* Форматированный вывод размера |
|
|
|
* |
|
|
|
* |
|
|
@ -105,21 +113,13 @@ |
|
|
|
function format_size($file_size) |
|
|
|
function format_size($file_size) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ($file_size >= 1073741824) |
|
|
|
if ($file_size >= 1073741824) |
|
|
|
{ |
|
|
|
|
|
|
|
$file_size = round($file_size / 1073741824 * 100) / 100 . ' Gb'; |
|
|
|
$file_size = round($file_size / 1073741824 * 100) / 100 . ' Gb'; |
|
|
|
} |
|
|
|
|
|
|
|
elseif ($file_size >= 1048576) |
|
|
|
elseif ($file_size >= 1048576) |
|
|
|
{ |
|
|
|
|
|
|
|
$file_size = round($file_size / 1048576 * 100) / 100 . ' Mb'; |
|
|
|
$file_size = round($file_size / 1048576 * 100) / 100 . ' Mb'; |
|
|
|
} |
|
|
|
|
|
|
|
elseif ($file_size >= 1024) |
|
|
|
elseif ($file_size >= 1024) |
|
|
|
{ |
|
|
|
|
|
|
|
$file_size = round($file_size / 1024 * 100) / 100 . ' Kb'; |
|
|
|
$file_size = round($file_size / 1024 * 100) / 100 . ' Kb'; |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
|
|
|
|
$file_size = $file_size . ' b'; |
|
|
|
$file_size = $file_size . ' b'; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $file_size; |
|
|
|
return $file_size; |
|
|
|
} |
|
|
|
} |
|
|
@ -135,37 +135,50 @@ |
|
|
|
$cnts = array(); |
|
|
|
$cnts = array(); |
|
|
|
|
|
|
|
|
|
|
|
$cnts['templates'] = $AVE_DB->Query("SELECT COUNT(*) FROM " . PREFIX . "_templates")->GetCell(); |
|
|
|
$cnts['templates'] = $AVE_DB->Query("SELECT COUNT(*) FROM " . PREFIX . "_templates")->GetCell(); |
|
|
|
$cnts['documents'] = $AVE_DB->Query("SELECT COUNT(*) FROM " . PREFIX . "_documents")->GetCell(); |
|
|
|
$cnts['request'] = $AVE_DB->Query("SELECT COUNT(*) FROM " . PREFIX . "_request")->GetCell(); |
|
|
|
$cnts['request'] = $AVE_DB->Query("SELECT COUNT(*) FROM " . PREFIX . "_request") ->GetCell(); |
|
|
|
$cnts['rubrics'] = $AVE_DB->Query("SELECT COUNT(*) FROM " . PREFIX . "_rubrics")->GetCell(); |
|
|
|
$cnts['rubrics'] = $AVE_DB->Query("SELECT COUNT(*) FROM " . PREFIX . "_rubrics") ->GetCell(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$sql = $AVE_DB->Query(" |
|
|
|
$sql = $AVE_DB->Query(" |
|
|
|
SELECT |
|
|
|
SELECT |
|
|
|
`ModuleStatus`, |
|
|
|
`ModuleStatus`, |
|
|
|
COUNT(`ModuleStatus`) AS cntStatus |
|
|
|
COUNT(`ModuleStatus`) AS cntStatus |
|
|
|
FROM " . PREFIX . "_module |
|
|
|
FROM |
|
|
|
|
|
|
|
" . PREFIX . "_module |
|
|
|
GROUP BY `ModuleStatus` |
|
|
|
GROUP BY `ModuleStatus` |
|
|
|
"); |
|
|
|
"); |
|
|
|
|
|
|
|
|
|
|
|
while ($row = $sql->FetchRow()) |
|
|
|
while ($row = $sql->FetchRow()) |
|
|
|
{ |
|
|
|
|
|
|
|
$cnts['modules_' . $row->ModuleStatus] = $row->cntStatus; |
|
|
|
$cnts['modules_' . $row->ModuleStatus] = $row->cntStatus; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$sql = $AVE_DB->Query(" |
|
|
|
$sql = $AVE_DB->Query(" |
|
|
|
SELECT |
|
|
|
SELECT |
|
|
|
status, |
|
|
|
status, |
|
|
|
COUNT(status) AS cntStatus |
|
|
|
COUNT(status) AS cntStatus |
|
|
|
FROM " . PREFIX . "_users |
|
|
|
FROM |
|
|
|
|
|
|
|
" . PREFIX . "_users |
|
|
|
GROUP BY status |
|
|
|
GROUP BY status |
|
|
|
"); |
|
|
|
"); |
|
|
|
|
|
|
|
|
|
|
|
while ($row = $sql->FetchRow()) |
|
|
|
while ($row = $sql->FetchRow()) |
|
|
|
{ |
|
|
|
|
|
|
|
$cnts['users_' . $row->status] = $row->cntStatus; |
|
|
|
$cnts['users_' . $row->status] = $row->cntStatus; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$AVE_Template->assign('cnts', $cnts); |
|
|
|
$AVE_Template->assign('cnts', $cnts); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function countDocuments($rubric_id = null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
global $AVE_DB; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (is_numeric($rubric_id) && $rubric_id > 0) |
|
|
|
|
|
|
|
$count = $AVE_DB->Query("SELECT COUNT(*) FROM " . PREFIX . "_documents WHERE rubric_id = '".$rubric_id."'")->GetCell(); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
$count = $AVE_DB->Query("SELECT COUNT(*) FROM " . PREFIX . "_documents")->GetCell(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo $count; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Размер дириктории |
|
|
|
* Размер дириктории |
|
|
|
* |
|
|
|
* |
|
|
@ -175,12 +188,16 @@ |
|
|
|
function get_dir_size($directory) |
|
|
|
function get_dir_size($directory) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!is_dir($directory)) return -1; |
|
|
|
if (!is_dir($directory)) return -1; |
|
|
|
|
|
|
|
|
|
|
|
$size = 0; |
|
|
|
$size = 0; |
|
|
|
|
|
|
|
|
|
|
|
if ($DIR = opendir($directory)) |
|
|
|
if ($DIR = opendir($directory)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
while (($dirfile = readdir($DIR)) !== false) |
|
|
|
while (($dirfile = readdir($DIR)) !== false) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (@is_link($directory . '/' . $dirfile) || $dirfile == '.' || $dirfile == '..') continue; |
|
|
|
if (@is_link($directory . '/' . $dirfile) || $dirfile == '.' || $dirfile == '..') |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
if (@is_file($directory . '/' . $dirfile)) |
|
|
|
if (@is_file($directory . '/' . $dirfile)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$size += filesize($directory . '/' . $dirfile); |
|
|
|
$size += filesize($directory . '/' . $dirfile); |
|
|
@ -188,22 +205,21 @@ |
|
|
|
elseif (@is_dir($directory . '/' . $dirfile)) |
|
|
|
elseif (@is_dir($directory . '/' . $dirfile)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$dirSize = get_dir_size($directory . '/' . $dirfile); |
|
|
|
$dirSize = get_dir_size($directory . '/' . $dirfile); |
|
|
|
|
|
|
|
|
|
|
|
if ($dirSize >= 0) |
|
|
|
if ($dirSize >= 0) |
|
|
|
{ |
|
|
|
|
|
|
|
$size += $dirSize; |
|
|
|
$size += $dirSize; |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
|
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
closedir($DIR); |
|
|
|
closedir($DIR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $size; |
|
|
|
return $size; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Размер базы данных |
|
|
|
* Размер базы данных |
|
|
|
* |
|
|
|
* |
|
|
@ -214,11 +230,11 @@ |
|
|
|
global $AVE_DB; |
|
|
|
global $AVE_DB; |
|
|
|
|
|
|
|
|
|
|
|
$mysql_size = 0; |
|
|
|
$mysql_size = 0; |
|
|
|
|
|
|
|
|
|
|
|
$sql = $AVE_DB->Query("SHOW TABLE STATUS LIKE '" . PREFIX . "_%'"); |
|
|
|
$sql = $AVE_DB->Query("SHOW TABLE STATUS LIKE '" . PREFIX . "_%'"); |
|
|
|
|
|
|
|
|
|
|
|
while ($row = $sql->FetchAssocArray()) |
|
|
|
while ($row = $sql->FetchAssocArray()) |
|
|
|
{ |
|
|
|
|
|
|
|
$mysql_size += $row['Data_length'] + $row['Index_length']; |
|
|
|
$mysql_size += $row['Data_length'] + $row['Index_length']; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return format_size($mysql_size); |
|
|
|
return format_size($mysql_size); |
|
|
|
} |
|
|
|
} |
|
|
@ -392,14 +408,19 @@ |
|
|
|
|
|
|
|
|
|
|
|
$handle = fopen($filename, 'rb'); |
|
|
|
$handle = fopen($filename, 'rb'); |
|
|
|
|
|
|
|
|
|
|
|
if ($handle === false) return false; |
|
|
|
if ($handle === false) |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
while (!feof($handle)) |
|
|
|
while (!feof($handle)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$buffer = fread($handle, $chunksize); |
|
|
|
$buffer = fread($handle, $chunksize); |
|
|
|
|
|
|
|
|
|
|
|
echo $buffer; |
|
|
|
echo $buffer; |
|
|
|
|
|
|
|
|
|
|
|
flush(); |
|
|
|
flush(); |
|
|
|
if ($retbytes) $cnt += strlen($buffer); |
|
|
|
|
|
|
|
|
|
|
|
if ($retbytes) |
|
|
|
|
|
|
|
$cnt += strlen($buffer); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$status = fclose($handle); |
|
|
|
$status = fclose($handle); |
|
|
@ -504,7 +525,9 @@ |
|
|
|
$row->canDelete = 0; |
|
|
|
$row->canDelete = 0; |
|
|
|
$row->canEndDel = 0; |
|
|
|
$row->canEndDel = 0; |
|
|
|
$row->canOpenClose = 0; |
|
|
|
$row->canOpenClose = 0; |
|
|
|
$row->rubric_admin_teaser_template=@eval2var(' ?>'.($row->rubric_admin_teaser_template>'' ? @showrequestelement($row,$row->rubric_admin_teaser_template) : '').'<?php '); |
|
|
|
$row->rubric_admin_teaser_template = @eval2var(' ?>'.($row->rubric_admin_teaser_template > '' |
|
|
|
|
|
|
|
? @showrequestelement($row, $row->rubric_admin_teaser_template) |
|
|
|
|
|
|
|
: '').'<?php '); |
|
|
|
|
|
|
|
|
|
|
|
// разрешаем редактирование и удаление |
|
|
|
// разрешаем редактирование и удаление |
|
|
|
// если автор имеет право изменять свои документы в рубрике |
|
|
|
// если автор имеет право изменять свои документы в рубрике |
|
|
@ -549,7 +572,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
function showrubricName($id) |
|
|
|
function showrubricName($id) |
|
|
|
{ |
|
|
|
{ |
|
|
|
global $AVE_DB, $AVE_Template; |
|
|
|
global $AVE_DB; |
|
|
|
|
|
|
|
|
|
|
|
$sql = $AVE_DB->Query("SELECT rubric_title FROM " . PREFIX . "_rubrics WHERE Id='$id'"); |
|
|
|
$sql = $AVE_DB->Query("SELECT rubric_title FROM " . PREFIX . "_rubrics WHERE Id='$id'"); |
|
|
|
$row = $sql->fetchrow(); |
|
|
|
$row = $sql->fetchrow(); |
|
|
@ -558,7 +581,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
function showuserName($id) |
|
|
|
function showuserName($id) |
|
|
|
{ |
|
|
|
{ |
|
|
|
global $AVE_DB, $AVE_Template; |
|
|
|
global $AVE_DB; |
|
|
|
|
|
|
|
|
|
|
|
$sql = $AVE_DB->Query("SELECT user_name FROM " . PREFIX . "_users WHERE Id='$id'"); |
|
|
|
$sql = $AVE_DB->Query("SELECT user_name FROM " . PREFIX . "_users WHERE Id='$id'"); |
|
|
|
$row = $sql->fetchrow(); |
|
|
|
$row = $sql->fetchrow(); |
|
|
@ -569,13 +592,16 @@ |
|
|
|
{ |
|
|
|
{ |
|
|
|
global $AVE_Template; |
|
|
|
global $AVE_Template; |
|
|
|
|
|
|
|
|
|
|
|
$showCache = format_size(get_dir_size($AVE_Template->compile_dir)+get_dir_size($AVE_Template->cache_dir_root)); |
|
|
|
$showCache = format_size(get_dir_size($AVE_Template->cache_dir_root)); |
|
|
|
echo json_encode(array($showCache, 'accept')); |
|
|
|
echo json_encode(array($showCache, 'accept')); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function templateName($id) |
|
|
|
function templateName($id) |
|
|
|
{ |
|
|
|
{ |
|
|
|
global $AVE_DB, $AVE_Template; |
|
|
|
global $AVE_DB; |
|
|
|
|
|
|
|
|
|
|
|
$sql = $AVE_DB->Query(" |
|
|
|
$sql = $AVE_DB->Query(" |
|
|
|
SELECT * FROM " . PREFIX . "_templates |
|
|
|
SELECT * FROM " . PREFIX . "_templates |
|
|
@ -588,7 +614,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
function groupName($id) |
|
|
|
function groupName($id) |
|
|
|
{ |
|
|
|
{ |
|
|
|
global $AVE_DB, $AVE_Template; |
|
|
|
global $AVE_DB; |
|
|
|
|
|
|
|
|
|
|
|
$sql = $AVE_DB->Query(" |
|
|
|
$sql = $AVE_DB->Query(" |
|
|
|
SELECT * FROM " . PREFIX . "_user_groups |
|
|
|
SELECT * FROM " . PREFIX . "_user_groups |
|
|
|