filealias; $aliases = $o->getAliases(); $media = new dcMedia($core); $a= new aliasMedia($core); # Update aliases if (isset($_POST['a']) && is_array($_POST['a'])) { try { $o->updateAliases($_POST['a']); http::redirect($p_url.'&up=1'); } catch (Exception $e) { $core->error->add($e->getMessage()); } } # New alias if (isset($_POST['filesalias_url'])) { $url = empty($_POST['filesalias_url']) ? PallazzoTools::rand_uniqid() : $_POST['filesalias_url']; $target = $_POST['filesalias_destination']; $totrash = isset ($_POST['filesalias_disposable']) ? true : false; $password = empty($_POST['filesalias_password'])? '' : $_POST['filesalias_password']; if (preg_match('/^'.preg_quote($media->root_url,'/').'/',$target)) { $target = preg_replace('/^'.preg_quote($media->root_url,'/').'/','',$target); $media = $a->getMediaId($target); if (!empty($media)) { try { $o->createAlias($url,$target,$totrash,$password); http::redirect($p_url.'&created=1'); } catch (Exception $e) { $core->error->add($e->getMessage()); } } else { $core->error->add(__('Target is not in medias manager.')); } } else { $media = $a->getMediaId($target); if (!empty($media)) { try { $o->createAlias($url,$target,$totrash,$password); http::redirect($p_url.'&created=1'); } catch (Exception $e) { $core->error->add($e->getMessage()); } } else { $core->error->add(__('Target is not in medias manager.')); } } } ?>