Переход на HTML5 и Group_id to Role_id
This commit is contained in:
@ -280,7 +280,7 @@
|
||||
//Вернём значение прав доступа для запрошенного объекта
|
||||
//$allow=true;
|
||||
$allow=false;
|
||||
//$sql_query='select a.*,at.name from _Access a, _Actions at where a.del=false and at.id=a.action_id and at.name=\'Insert_'.$typename.'\' and a.group_id in (select group_id from _UsersRoles where user_id='.$_SESSION['USER_ID'].');'
|
||||
//$sql_query='select a.*,at.name from _Access a, _Actions at where a.del=false and at.id=a.action_id and at.name=\'Insert_'.$typename.'\' and a.role_id in (select group_id from _UsersRoles where user_id='.$_SESSION['USER_ID'].');'
|
||||
$sql_query='select '.$Schema.'p_getaccess('.getSQLValue(gettype($_SESSION['USER_ID']),$_SESSION['USER_ID']).',\'Insert_'.$typename.'\') as allow;';
|
||||
|
||||
$res = $db->query($sql_query);
|
||||
@ -293,7 +293,7 @@
|
||||
$currNode->setAttributeNode($xmlAttr);
|
||||
|
||||
$allow=false;
|
||||
//$sql_query='select a.*,at.name from _Access a, _Actions at where a.del=false and at.id=a.action_id and at.name=\'Update_'.$typename.'\' and a.group_id in (select group_id from _UsersRoles where user_id='.$_SESSION['USER_ID'].');';
|
||||
//$sql_query='select a.*,at.name from _Access a, _Actions at where a.del=false and at.id=a.action_id and at.name=\'Update_'.$typename.'\' and a.role_id in (select group_id from _UsersRoles where user_id='.$_SESSION['USER_ID'].');';
|
||||
$sql_query='select '.$Schema.'p_getaccess('.getSQLValue(gettype($_SESSION['USER_ID']),$_SESSION['USER_ID']).',\'Update_'.$typename.'\') as allow;';
|
||||
$res = $db->query($sql_query);
|
||||
while ($row = $res->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов
|
||||
@ -305,7 +305,7 @@
|
||||
$currNode->setAttributeNode($xmlAttr);
|
||||
|
||||
$allow=false;
|
||||
//$sql_query='select a.*,at.name from _Access a, _Actions at where a.del=false and at.id=a.action_id and at.name=\'Delete_'.$typename.'\' and a.group_id in (select group_id from _UsersRoles where user_id='.$_SESSION['USER_ID'].');';
|
||||
//$sql_query='select a.*,at.name from _Access a, _Actions at where a.del=false and at.id=a.action_id and at.name=\'Delete_'.$typename.'\' and a.role_id in (select group_id from _UsersRoles where user_id='.$_SESSION['USER_ID'].');';
|
||||
$sql_query='select '.$Schema.'p_getaccess('.getSQLValue(gettype($_SESSION['USER_ID']),$_SESSION['USER_ID']).',\'Delete_'.$typename.'\') as allow;';
|
||||
$res = $db->query($sql_query);
|
||||
while ($row = $res->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов
|
||||
@ -787,7 +787,7 @@
|
||||
//загружаем мета данные и смотрим какие поля должны передать клиенту
|
||||
$mdoc = new DOMDocument();
|
||||
try
|
||||
{ //$mdoc->load('metadata.xml');
|
||||
{
|
||||
$mdoc->loadXML($xmls);
|
||||
} catch (Exception $e)
|
||||
{ sendError($e->getMessage());
|
||||
@ -920,7 +920,7 @@
|
||||
$res = $db->query("select 1 from _Users where del=false and email = '$login';");
|
||||
if($res->rowCount()>0)
|
||||
{
|
||||
mail($login,'BigFootTrade.kz','Not implement',"Content-type: text/html; charset=utf-8\r\nFrom: BigFootTrade Site <info@bigfoottrade.kz>");
|
||||
mail($login,'rigor.kz','Not implement',"Content-type: text/html; charset=utf-8\r\nFrom: rigor Site <info@rigor.kz>");
|
||||
}
|
||||
}elseif($cmd==1) //Logout
|
||||
{
|
||||
@ -1007,6 +1007,27 @@
|
||||
}else
|
||||
if ($fn==8)//Получить отчёт как Excel.xls файл (почти тоже самое что и функция 4)
|
||||
{
|
||||
$dir='./temp/';
|
||||
|
||||
if(isset($_REQUEST['file'])) {
|
||||
$file = $_REQUEST['file'];
|
||||
$myFile = $dir.$file;
|
||||
if(file_exists($myFile))
|
||||
{
|
||||
header("Content-type: application/octet-stream");
|
||||
header('Content-Disposition: attachment; filename="'.$file.'"');
|
||||
header('Content-Length: '.filesize($myFile));
|
||||
readfile($myFile);
|
||||
exit();
|
||||
}else
|
||||
{
|
||||
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found", true, 404);
|
||||
echo 'File "'.$file.'" not found!';
|
||||
exit;
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
session_write_close(); //Разблокируем сессионный файл так как запросы могут быть достаточно долгими
|
||||
//if (!isset($_SESSION['USER_ID']) || $_SESSION['USER_ID']=='') sendError(trt('You are not logged in!'));
|
||||
|
||||
@ -1029,6 +1050,7 @@
|
||||
{
|
||||
$objXMLDocument=$currNode->ownerDocument;
|
||||
|
||||
$objListR = findFirstNode($nTypeR,'objects-list');
|
||||
//В переданном запросе может быть не полный фильтр заполняем серверный значениями из переданного
|
||||
$f1=findNodeOnPath($currNode,'objects-list/filter');
|
||||
$f2=findNodeOnPath($nTypeR,'objects-list/filter');
|
||||
@ -1116,6 +1138,10 @@
|
||||
$nextnode = $nextnode->nextSibling;
|
||||
}
|
||||
$sql_query=str_replace('${_user_id}',getSQLValue(gettype($_SESSION['USER_ID']),$_SESSION['USER_ID']),$sql_query);
|
||||
if($objListR!=null && $objListR->getAttribute('order')!='' && $objListR->getAttribute('order')!=null && $objListR->getAttribute('order')!='null')
|
||||
{
|
||||
$sql_query=str_replace('${_order}',findNodeOnAttribute(findFirstNode($currNode,'objects-list'), "column","n",$objListR->getAttribute("order"))->getAttribute("order"),$sql_query);
|
||||
}else $sql_query=str_replace('${_order}','1',$sql_query);
|
||||
|
||||
//Выполняем запрос
|
||||
try
|
||||
@ -1125,7 +1151,6 @@
|
||||
}
|
||||
|
||||
//Сохраняем результсет в файл в виде HTML с расширением XLS
|
||||
$dir='./temp/';
|
||||
$file='file_'.rand(0,1000).'.xls';
|
||||
$myFile = $dir.$file;
|
||||
|
||||
@ -1258,7 +1283,7 @@
|
||||
{
|
||||
session_write_close(); //Разблокируем сессионный файл так как запросы могут быть достаточно долгими
|
||||
//Клиент передаёт название таблицы, название поля, id поля
|
||||
$typename = $_REQUEST['t']; //Тип из metadata.xml
|
||||
$typename = $_REQUEST['t']; //Тип
|
||||
$field = $_REQUEST['f']; //Название поля с двоичными данными
|
||||
$name = $_REQUEST['n']; //поле с названием файла
|
||||
$idval = $_REQUEST['i']; //Идентификатор поля в базе
|
||||
@ -1277,7 +1302,7 @@
|
||||
//Ищем поле в метаданных
|
||||
$objXMLDocument = new DOMDocument();
|
||||
try
|
||||
{ //$objXMLDocument->load('metadata.xml');
|
||||
{
|
||||
$objXMLDocument->loadXML($xmls);
|
||||
} catch (Exception $e)
|
||||
{ echo $e->getMessage();
|
||||
|
||||
Reference in New Issue
Block a user