/** * получить массив REQUEST_ASSOC * * @param array $vars * @return array */ function parseRequestVars(&$vars) { if (!is_array($vars)) { return; } for ($i = 1; $i < count($vars) - 1; $i += 2) { if (strrpos($vars[$i + 1], '=')) { $tok = strtok($vars[$i + 1], '&'); while ($tok) { if (is_array($inarr = explode('=', $tok))) { $RQV[$inarr[0]] = XCODE::utf2win(urldecode($inarr[1])); if (strpos($RQV[$inarr[0]], '|') !== false) { $RQV[$inarr[0]] = explode('|', $RQV[$inarr[0]]); } $tok = strtok('&'); } } } else { if (strpos($vars[$i + 1], '|') !== false) { $vars[$i + 1] = explode('|', $vars[$i + 1]); } $RQV = $vars[$i + 1]; } $REQUEST_ASSOC[$vars[$i]] = $RQV; $RQV = null; } return $REQUEST_ASSOC; }
function catalogExport($params) { global $TMS, $_PATH; $this->_tree->recursiveChildCollect($params['id'], '%', array('obj_type' => array('_CATGROUP', '_CATOBJ')), $order = 'ASC', array('_CATGROUP', '_CATOBJ')); $p = array(); $idc = array($params['id'] => $this->_tree->getNodeInfo($params['id'])); if ($params['Property_sets']) { $p += array('Property_set' => $params['Property_sets']); } $this->exportSettings = $p; if (is_array($this->_tree->EXPcache)) { $TMS->AddFileSection(Common::get_site_tpl($this->_module_name, $params['Template'])); $this->recursiveExport($params['id'], 1); if ($params['encoding'] != 'utf8') { $s = XCODE::utf2win($TMS->parseSection('export_head'), $params['encoding']); } else { $s = $TMS->parseSection('export_head'); } if (XFILES::filewrite($_PATH['PATH_EXPORT'] . $params['filename'], $s)) { $this->result['uploadfile'] = $_PATH['WEB_PATH_EXPORT'] . $params['filename']; } else { $this->result['ERROR'] = 2; } //cant_write_file } else { $this->result['ERROR'] = 1; } //objects not found }