function run() { global $_out, $_sec; if (ap::isCurrentModule($this)) { ap::addMessage($this->getMessage()); if ($form = $this->getForm()) { $form->replaceURI(array('ID' => $_sec->getId(), 'MD' => $this->getId(), 'PARENT' => $this->getSection()->GetParent()->getId())); switch ($action = param('action')) { case 'save': $values = $this->initImages($form, true); $values = array_merge($_REQUEST, $values); $form->save($values); $this->updateImagesSize($form); $this->redirect('save_ok'); break; case 'fileinfo': if (($path = urldecode(param('path'))) && ($f = ap::getFileInfo($_SERVER['DOCUMENT_ROOT'] . $path))) { $f['path'] = $path; $xml = new xml(null, 'file', false); foreach ($f as $tagName => $value) { $xml->de()->appendChild($xml->createElement($tagName, null, $value)); } ap::ajaxResponse($xml); } vdump('Error file not found ' . $path); break; } $this->initImages($form, false); $form->load(); $_out->elementIncludeTo($form->getRootElement(), '/page/section'); } else { throw new Exception('Form not found', EXCEPTION_XML); } } }