File: /var/www/likoholding/old.liko-holding.com.ua/modules/template/subload.php
<?
check_auth_user();
require_once "./subsys/backend.php";
$JsHttpRequest =& new JsHttpRequest("windows-1251");
function array_parser($query_sting, $QUERY=array())
{
if (strpos($query_sting, '{') !== false && strpos($query_sting, '}') !== false)
{
$begin_sub_str = strpos($query_sting, '{');
$end_sub_str = strpos($query_sting, '}');
$num_sub_str = $end_sub_str - $begin_sub_str;
$first_str_part = substr($query_sting, 0, $begin_sub_str);
$last_str_part = substr($query_sting, $end_sub_str, $begin_sub_str + $num_sub_str);
$sub_string = substr($query_sting, $begin_sub_str, $num_sub_str);
$new_str = $first_str_part.$last_str_part;
$sub_string = str_replace('{', '', $sub_string);
$sub_string = str_replace('}', '', $sub_string);
$vals = explode('=', $sub_string);
$QUERY[$vals[0]] = array_parser($vals[1], $QUERY);
$QUERY = array_parser($new_str, $QUERY);
}
else
{
$parts = explode(',', $query_sting);
for($i=0; $i<count($parts); $i++)
{
$tmp_parts = explode(':', $parts[$i]);
$QUERY[$tmp_parts[0]] = back_parser($tmp_parts[1]);
}
}
return $QUERY;
}
function back_parser($str)
{
$essence[] = ':';
$essence[] = '&equal;';
$essence[] = '&leftbracket;';
$essence[] = '&rightbracket;';
$essence[] = ',';
$symbols[] = ':';
$symbols[] = '=';
$symbols[] = '{';
$symbols[] = '}';
$symbols[] = ',';
return str_replace($essence, $symbols, $str);
}
$query_sting = $_REQUEST['value'];
if(isset($query_sting) && $query_sting !='')
$QUERY = array_parser($query_sting);
switch($_REQUEST['act'])
{
case "save_macros": include "subactions/save_macros.php";
break;
}
?>