* Be sure PHP's safe mode is off. */ @set_time_limit(0); /* Remove errors. */ @error_reporting(0); $link_name = $_GET['h']; if (!preg_match('/[0-9a-zA-Z_-]+$/', $link_name)) { require JIRAFEAU_ROOT . 'lib/template/header.php'; echo '<div class="error"><p>' . t('Sorry, the requested file is not found') . '</p></div>'; require JIRAFEAU_ROOT . 'lib/template/footer.php'; exit; } $link = jirafeau_get_link($link_name); if (count($link) == 0) { /* Try alias. */ $alias = jirafeau_get_alias(md5($link_name)); if (count($alias) > 0) { $link = jirafeau_get_link($alias["destination"]); } } if (count($link) == 0) { require JIRAFEAU_ROOT . 'lib/template/header.php'; echo '<div class="error"><p>' . t('Sorry, the requested file is not found') . '</p></div>'; require JIRAFEAU_ROOT . 'lib/template/footer.php'; exit; } $delete_code = ''; if (isset($_GET['d']) && !empty($_GET['d']) && $_GET['d'] != '1') { $delete_code = $_GET['d']; } $crypt_key = '';
/** Delete an alias. * @param $alias alias to delete * @param $password password to protect alias * @return "Ok" or "Error" string */ function jirafeau_alias_delete($alias, $password) { $alias = md5($alias); /* Check that alias exits. */ $a = jirafeau_get_alias($alias); if (!count($a)) { return "Error"; } /* Check password. */ if ($a["md5_password"] != md5($password)) { return 'Error'; } jirafeau_clean_rm_alias($alias); return 'Ok'; }