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.')); } } } ?> <?php echo $page_title; ?> blog->name) => '', __('Medias sharing') => '' )). dcPage::notices(); ?> '.__('No alias').'

'; } else { $root_url = html::escapeHTML($media->root_url); echo '
'. '
'. ''. ''. ''. ''. ''. ''; foreach ($aliases as $k => $v) { $url = $core->blog->url.$core->url->getBase('filesalias').'/'.html::escapeHTML($v['filesalias_url']); $link = ''.__('link').''; $v['filesalias_disposable'] = isset ($v['filesalias_disposable']) ? $v['filesalias_disposable'] : false; echo ''. ''. ''. ''. ''. ''; } echo '
'.__('Aliases list').'
'.__('Destination').' - '.$root_url.'(-?-)'.__('Alias').' - '.$core->blog->url.$core->url->getBase('filesalias').'/'.'(-?-)'.__('Disposable').''.__('Password').'
'.form::field(array('a['.$k.'][filesalias_destination]'),40,255,html::escapeHTML($v['filesalias_destination'])).''.form::field(array('a['.$k.'][filesalias_url]'),20,255,html::escapeHTML($v['filesalias_url'])).''.__('link').''.form::checkbox(array('a['.$k.'][filesalias_disposable]'),1,$v['filesalias_disposable']).''.form::field(array('a['.$k.'][filesalias_password]'),10,255,html::escapeHTML($v['filesalias_password'])).'
'. '

'.__('To remove a link, empty its alias or destination.').'

'. '

'.$core->formNonce(). '

'. '
'. '
'; } echo '

'.__('New alias').'

'.form::field('filesalias_destination',70,255).'

'.__('Destination file must be in media manager.').'

'.sprintf(__('Root URL "%s" will be automatically removed.'),$media->root_url).'

'.__('Leave empty to get a randomize alias.').'

'.form::checkbox('filesalias_disposable',1).'

'.$core->formNonce().'

'; dcPage::helpBlock('filesAlias'); ?>