Exemple #1
0
$encoder = new Encoder();
$ok = $oPage->getRequestValue('OK');
$notify = $oPage->getRequestValue('Notify');
$domain = $oPage->getRequestValue('Domain');
$newURL = $oPage->getRequestValue('NewURL');
if ($ok) {
    if (strlen(trim($newURL)) && preg_match("/^(?:[;\\/?:@&=+\$,]|(?:[^\\W_]|[-_.!~*#\\()\\[\\] ])|(?:%[\\da-fA-F]{2}))*\$/", $newURL)) {
        $encoder->setDataValue('ExpireDate', $oPage->getRequestValue('ExpireDate'));
        if ($encoder->saveUrl($newURL, $domain)) {
            $oUser->addStatusMessage(_('Url was saved') . ': ' . $newURL, 'success');
            if ($notify) {
                $mail = new EaseMail($notify, _('LinkQuick: You URL Shortcut'), $newURL . "\n = \n" . $encoder->getShortCutURL());
                $mail->send();
            }
            $newURL = '';
            $oPage->addItem(new EaseJQueryDialog('NewUrlSuccess', _('Zkratka byla vytvořena'), $encoder->getDataValue('title'), 'ui-icon-circle-check', new \Ease\HtmlATag($encoder->getCode(), 'http://' . LQEncoder::getDomain() . $encoder->getShortCutURL())));
        }
    } else {
        $oUser->addStatusMessage(_('This is not an web address!') . ': ' . $newURL, 'warning');
    }
}
//Hlavička stránek
$oPage->addItem(new PageTop(_('LinkQuick: Your URL shortener')));
$domains = Encoder::getDomainList();
$actualDomain = Encoder::getDomain();
if (!in_array($actualDomain, $domains)) {
    $domains[] = $actualDomain;
}
$domainTabs = new \Ease\TWB\Tabs('DomainTabs');
foreach ($domains as $domain) {
    $nextCode = Encoder::getNextCode($domain);