diff --git a/admin/index.php b/admin/index.php index f996467..c390b4a 100644 --- a/admin/index.php +++ b/admin/index.php @@ -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); diff --git a/admin/options.php b/admin/options.php index fecfed7..fed9918 100644 --- a/admin/options.php +++ b/admin/options.php @@ -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()) { +
diff --git a/classes/configuration.class.php b/classes/configuration.class.php index 24711dc..1f7eaa5 100644 --- a/classes/configuration.class.php +++ b/classes/configuration.class.php @@ -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"); diff --git a/index.php b/index.php index 3b5432f..7366149 100644 --- a/index.php +++ b/index.php @@ -129,7 +129,10 @@ $template = new plantillas($conf->template); $template->mostrarPlantilla(); break; case "4": - $register["title"] = ($register["title"]=="")? $register["url"] : $register["title"]; + 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,7 +227,10 @@ $template = new plantillas($conf->template); $template->mostrarPlantilla(); break; case "4": - $register["title"] = ($register["title"]=="")? $register["url"] : $register["title"]; + 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); diff --git a/update.php b/update.php index 2f6da07..ef7b3ae 100644 --- a/update.php +++ b/update.php @@ -36,6 +36,10 @@ $sqlStr = "INSERT INTO `".Table_prefix."options` VALUES ('offset_city', 'Mexico/ $db->ejecutarConsulta($sqlStr); $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);