'a','à'=>'a','ã'=>'a', 'ä'=>'a','â'=>'a', 'Á'=>'A','À'=>'A','Ã'=>'A', 'Ä'=>'A','Â'=>'A', 'é'=>'e','è'=>'e', 'ë'=>'e','ê'=>'e', 'É'=>'E','È'=>'E', 'Ë'=>'E','Ê'=>'E', 'í'=>'i','ì'=>'i', 'ï'=>'i','î'=>'i', 'Í'=>'I','Ì'=>'I', 'Ï'=>'I','Î'=>'I', 'ó'=>'o','ò'=>'o','õ'=>'o', 'ö'=>'o','ô'=>'o', 'Ó'=>'O','Ò'=>'O','Õ'=>'O', 'Ö'=>'O','Ô'=>'O', 'ú'=>'u','ù'=>'u', 'ü'=>'u','û'=>'u', 'Ú'=>'U','Ù'=>'U', 'Ü'=>'U','Û'=>'U', '$'=>'','@'=>'','!'=>'', '#'=>'','%'=>'','_'=>'', '^'=>'','&'=>'','*'=>'', '('=>'',')'=>'',' '=>'', '-'=>'','+'=>'','='=>'', '\\'=>'','|'=>'', '`'=>'','~'=>'','/'=>'', '\"'=>'','\''=>'', '<'=>'','>'=>'','?'=>'', ','=>'','ç'=>'c','Ç'=>'C'); $str = strtr ($str, $trade); return $str; } class Ajax { public function nameValidate ($section) { $section = validName ($section); $name = $_SESSION['UNIX_NAME']; if (file_exists ('instance/'. $name .'/section/'. $section)) { $count = 1; do { $aux = $section .'.'. str_pad ($count++, 3, '0', STR_PAD_LEFT); } while (file_exists ('instance/'. $name .'/section/'. $aux)); $section = $aux; } return $section; } public function saveForm ($name, $form) { // array_walk ($form, 'utfDecode'); $_SESSION['SECTION_PROPS_'. $name] = $form; return TRUE; } public function clear ($name) { if (isset ($_SESSION['SECTION_PROPS_'. $name])) unset ($_SESSION['SECTION_PROPS_'. $name]); return TRUE; } public function xoadGetMeta() { XOAD_Client::mapMethods ($this, array ('saveForm', 'clear', 'nameValidate')); XOAD_Client::publicMethods ($this, array ('saveForm', 'clear', 'nameValidate')); XOAD_Client::privateMethods ($this, array ()); } } $instance = Instance::singleton (); if (!isset ($_SESSION['UNIX_NAME'])) throw new Exception ('Houve perda de variáveis!'); $itemId = $_SESSION['UNIX_NAME']; if (!isset ($_GET['name'])) throw new Exception ('Hove perda de variáveis!'); $name = trim (str_replace (array ('..', '/', '\\'), '', $_GET['name'])); if ($name == '') throw new Exception ('Atenção! Ato ilícito detectado. Acesso negado ;)'); if (!isset ($_SESSION['PACKS_'. $itemId])) throw new Exception ('Houve perda de variáveis!'); $packages = $_SESSION['PACKS_'. $itemId]; $pack = $packages [$name]; //die (print_r ($pack)); $aux = array (); if (array_key_exists ('property', $pack)) $aux [$name] = $pack ['property']; if (array_key_exists ('depends', $pack)) { $depends = explode (',', $pack ['depends']); foreach ($depends as $trash => $package) if (isset ($packages [$package]['property'])) $aux [$package] = $packages [$package]['property']; } $properties = array (); $unique = array (); $form = array (); $ajax = new Ajax; foreach ($aux as $package => $array) { $form ['_UNIX_NAME_'. str_replace ('.', '_', $package)] = $ajax->nameValidate ($package); foreach ($array as $trash => $value) { if (!array_key_exists ('name', $value) || trim ($value ['name']) == '' || in_array ($value ['name'], $unique) || $value ['name'] == '_UNIX_NAME_') continue; $unique [] = $value ['name']; if (!array_key_exists ('label', $value)) $value ['label'] = '[undefined]'; $properties [$package][$value ['name']] = $value; $form [$value ['name']] = $value ['default']; } } if (!sizeof ($properties)) { $properties [$name] = array (); $form ['_UNIX_NAME_'. str_replace ('.', '_', $name)] = $ajax->nameValidate ($name); } $_SESSION['SECTION_PROPS_'. $name] = $form; //die (print_r ($properties)); function utfDecode (&$value, $key) { $value = utf8_decode ($value); } define ('XOAD_AUTOHANDLE', true); require_once $instance->getCorePath () .'xoad/xoad.php'; XOAD_Server::allowClasses ('Ajax'); if (XOAD_Server::runServer ()) exit (); require $instance->getCorePath () .'system/control.php'; $skin = Skin::singleton (); ?>