Shorten long link with abbrr.com

master
vbracco 2007-09-18 19:10:32 +00:00
parent 7598eed6bd
commit 643ed9be2b
5 changed files with 28 additions and 2 deletions

View File

@ -391,6 +391,9 @@ if ($user->isAdmin()) {
$template->mostrarPlantilla();
break;
case "4":
if($conf->shorten_links){
$register["url"] = _file_get_contents("http://api.abbrr.com/api.php?out=link&url=".$register["url"]);
}
$register["title"] = ($register["title"]=="")? $register["url"] : $register["title"];
$input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{URL}", "{Name}", "{Description}", "{URL_Tumble}");
$output = array($register["id_post"], $formatedDate, $permalink, $register["url"], $register["title"], $register["description"], $conf->urlGelato);

View File

@ -48,6 +48,11 @@ if ($user->isAdmin()) {
die();
}
if (!$tumble->saveOption($_POST["shorten_links"], "shorten_links")) {
header("Location: ".$conf->urlGelato."/admin/options.php?error=1&des=".$conf->merror);
die();
}
header("Location: ".$conf->urlGelato."/admin/options.php?modified=true");
die();
} else {
@ -196,6 +201,12 @@ if ($user->isAdmin()) {
<option value="12,Pacific/Fiji" <?php echo ($conf->offsetCity=="Pacific/Fiji")? "selected=\"selected\"":"" ?>>(GMT +12:00) Fiji, Kamchatka, Marshall Is.</option>
</select>
</li>
<li class="select"><label for="shorten_links"><?php echo __("Shorten long URLs:")?></label>
<select name="shorten_links" id="shorten_links">
<option value="1" <?php if($conf->shorten_links) echo "selected"; ?>><?php echo __("Active")?></option>
<option value="0" <?php if(!$conf->shorten_links) echo "selected"; ?>><?php echo __("Deactive")?></option>
</select>
</li>
</ul>
</fieldset>
<p>

View File

@ -28,6 +28,7 @@ class configuration extends Conexion_Mysql {
var $richText;
var $offset_city;
var $offset_time;
var $shorten_links;
function configuration() {
@ -52,6 +53,7 @@ class configuration extends Conexion_Mysql {
$this->offsetCity = $this->get_option("offset_city");
$this->offsetTime = $this->get_option("offset_time");
$this->allowComments = $this->get_option("allow_comments");
$this->shorten_links = $this->get_option("shorten_links");
} else {
if($isFeed) {
header("HTTP/1.0 503 Service Unavailable");

View File

@ -129,6 +129,9 @@ $template = new plantillas($conf->template);
$template->mostrarPlantilla();
break;
case "4":
if($conf->shorten_links){
$register["url"] = _file_get_contents("http://api.abbrr.com/api.php?out=link&url=".$register["url"]);
}
$register["title"] = ($register["title"]=="")? $register["url"] : $register["title"];
$input = array("{Date_Added}", "{Permalink}", "{URL}", "{Name}", "{Description}", "{URL_Tumble}");
$output = array($formatedDate, $permalink, $register["url"], $register["title"], $register["description"], $conf->urlGelato);
@ -224,6 +227,9 @@ $template = new plantillas($conf->template);
$template->mostrarPlantilla();
break;
case "4":
if($conf->shorten_links){
$register["url"] = _file_get_contents("http://api.abbrr.com/api.php?out=link&url=".$register["url"]);
}
$register["title"] = ($register["title"]=="")? $register["url"] : $register["title"];
$input = array("{Date_Added}", "{Permalink}", "{URL}", "{Name}", "{Description}", "{URL_Tumble}");
$output = array($formatedDate, $permalink, $register["url"], $register["title"], $register["description"], $conf->urlGelato);

View File

@ -39,6 +39,10 @@ $sqlStr = "INSERT INTO `".Table_prefix."options` VALUES ('offset_time', '-6');";
$db->ejecutarConsulta($sqlStr);
$sqlStr = "INSERT INTO `".Table_prefix."options` VALUES ('shorten_links', '0');";
$db->ejecutarConsulta($sqlStr);
echo "<p><em>Finished!</em></p>";
echo "<p>Now you are running on the new <strong>0.90</strong> version!!!</p>";