From 2949a49c3061fcdaa17a6f67333fc7a488b7149f Mon Sep 17 00:00:00 2001 From: pecesama Date: Tue, 28 Oct 2008 05:20:36 +0000 Subject: [PATCH] Archive generator and some minor fixes --- admin/css/archive.css | 119 +++++++++++++++++++ api.php | 2 +- archive.php | 251 +++++++++++++++++++++++++++++++++++++++ classes/functions.php | 5 +- classes/gelato.class.php | 12 +- entry.php | 5 +- notice.txt | 10 +- 7 files changed, 383 insertions(+), 21 deletions(-) create mode 100644 admin/css/archive.css create mode 100644 archive.php diff --git a/admin/css/archive.css b/admin/css/archive.css new file mode 100644 index 0000000..5de5ee3 --- /dev/null +++ b/admin/css/archive.css @@ -0,0 +1,119 @@ +body { + background: white; + font-family: "Lucida Sans"; + font-size: 15px; + letter-spacing: 2px; + line-height: 30px; +} + +#dash { + margin: 35px auto 0px auto; + padding: 10px; + width: 85%; +} + +#options { + width:100%; + text-align: center; + border-bottom: thin solid white; +} + +li { + list-style: none; + margin-bottom: 5px; +} + +ul { + padding: 0px; + margin: 0px; +} + +h4 { + margin-top: 0px; + font-size: 12px; + font-weight: bold; + font-variant: small-caps; + text-align: center; +} + +#options li { + display: inline; + padding: 10px; + color: #999; + font-variant: small-caps; +} + +#options li a { + text-decoration: none; + padding:10px 20px; + color: #999; +} + +#options li a:hover { + background-color: #382513; + color: #FFF; +} + +#options li a.selected { + background-color: #382513; + color: #FFF; +} + +#content { + padding: 25px; + width:auto; +} + +.item { + height: 110px; + width: 110px; + padding: 5px; + overflow: hidden; + border: thin solid #CCC; + border-top: 2px solid #444; + float:left; + margin: 10px; + color: #222; + text-align: left; + background-color: #FEFEFE; + font-size: 11px; + line-height: normal; +} + +.link { + font-size: 16px; +} + +div.user_hover { + background-color:#000000; + color:#FFFFFF; + display:none; + font-family:Helvetica,sans-serif; + font-size:18px; + font-size-adjust:none; + font-stretch:normal; + font-style:normal; + font-variant:normal; + font-weight:bold; + line-height:normal; + opacity:0.75; + padding:5px; + position:absolute; + text-align:center; + z-index:10; + height:113px; + width: 112px; + margin:10px; + cursor: pointer; +} + +li:hover div.user_hover { + display:block; +} + +ul.item_list { + width:112px; + float:left; + position:relative; + margin:10px; +} \ No newline at end of file diff --git a/api.php b/api.php index 2102b67..e7cde67 100644 --- a/api.php +++ b/api.php @@ -82,7 +82,7 @@ if(!defined('entry')) define('entry',true); urlGelato."/", $register["url"]); ?> - + + + =========================== */ +?> +getPosts($tumble->getPostsNumber()); +if ($tumble->contarRegistros()>0) { + while($register = mysql_fetch_assoc($rs)) { + $output = handleNode($register); + + $theType = type2Text($register["type"]); + + switch($theType) { + case 'quote': + $quote[] = $output; + continue; + case 'conversation': + $conversation[] = $output; + continue; + case 'url': + $link[] = $output; + continue; + case 'photo': + $photo[] = $output; + continue; + case 'post': + $regular[] = $output; + continue; + case 'video': + $video[] = $output; + continue; + } + } +} + +function handleNode($node) { + global $user, $tumble, $conf; + $dateTmp = null; + $formatedDate = gmdate("M d", strtotime($node["date"]) + transform_offset($conf->offsetTime)); + + $output = array(); + $output['url'] = $tumble->getPermalink($node["id_post"]); + $output['date'] = $formatedDate; + + $theType = type2Text($node["type"]); + + switch($theType) { + case 'quote': + $output['quote'] = $node["description"]; + $output['source'] = $node["title"]; + break; + case 'conversation': + $output['lines'] = $tumble->formatConversation($node["description"]); + break; + case 'url': + $node["title"] = (empty($node["title"]))? $node["url"] : $node["title"]; + $output['text'] = $node["title"]; + $output['link'] = $node["url"]; + break; + case 'photo': + $fileName = "uploads/".getFileName($node["url"]); + $x = @getimagesize($fileName); + if ($x[0] > 500) { + $photoPath = $conf->urlGelato."/classes/imgsize.php?w=500&img=".$node["url"]; + } else { + $photoPath = str_replace("../", $conf->urlGelato."/", $node["url"]); + } + $output['caption'] = $node["description"]; + $output['photo'] = $photoPath; + break; + case 'post': + $output['title'] = $node["title"]; + $output['body'] = $node["description"]; + break; + case 'video': + $output['caption'] = $node["description"]; + $temp = $tumble->getVideoPlayer($node["url"]); + $patterns[0] = "/width='[0-9]+'/"; + $patterns[1] = "/height='[0-9]+'/"; + $replace[0] = "width='100'"; + $replace[1] = "height='75'"; + $embed = preg_replace($patterns, $replace, $temp); + $output['embed'] = $embed; + } + return $output; + } +?> + + + + + + + " /> + + "/> + <?php echo $conf->title." » ".__(" archive"); ?> + + + + + + + +
+ + + +
+
+ +
    +
  • +
    +
      +
    • +
    +
    +
    +

    +
    +
  • +
+ +
+ + + + + + + + + + + +
+ +
+ +
+ + + + \ No newline at end of file diff --git a/classes/functions.php b/classes/functions.php index 091bb36..fa32a1b 100644 --- a/classes/functions.php +++ b/classes/functions.php @@ -488,8 +488,9 @@ if(!defined('entry') || !entry) die('Not a valid page'); } function trimString($string, $len = "") { - if($len>strlen($string) or $len<1) - return $string; + if($len>strlen($string) or $len<1) { + return strip_tags($string); + } $string = strip_tags($string); $len = (empty($len)) ? "50" : $len ; return ( strpos($string, " ", $len) ) ? substr_replace($string, "...", $len) : $string ; diff --git a/classes/gelato.class.php b/classes/gelato.class.php index fcec137..985fafd 100644 --- a/classes/gelato.class.php +++ b/classes/gelato.class.php @@ -199,14 +199,6 @@ class gelato extends Conexion_Mysql { $out .= ($this->conf->urlFriendly) ? "/post/" : "/index.php?post="; $out .= $post_id.$strEnd; return $out; - } - - function getPermalink($post_id){ - $strEnd = ($this->conf->urlFriendly) ? "/" : ""; - $out = $this->conf->urlGelato; - $out .= ($this->conf->urlFriendly) ? "/post/" : "/index.php?post="; - $out .= $post_id.$strEnd; - return $out; - } + } } -?> +?> diff --git a/entry.php b/entry.php index fd22776..6940095 100644 --- a/entry.php +++ b/entry.php @@ -81,6 +81,5 @@ if($installed){ $feeds = new feeds(); $feeds->updateFeeds(); unset($feeds); -} -?> - +} +?> \ No newline at end of file diff --git a/notice.txt b/notice.txt index 650180c..dc900f8 100644 --- a/notice.txt +++ b/notice.txt @@ -11,8 +11,12 @@ Juan del Rio [ http://elcaminante.net/ ] = COPYRIGHT NOTICES = This product includes code and libraries developed by third parties, which are governed by different licenses. These components, and their licenses, are listed below. += Archive based on code from: simple Tumblr API processor = +Copyright (c) Vivek, http://www.stageleftstudios.com +simple Tumblr API processor is available under Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License. + = markItUp! Universal MarkUp Engine, JQuery plugin = -Copyright (C) 2007-2008 Jay Salvat, http://markitup.jaysalvat.com/ +Copyright (c) 2007-2008 Jay Salvat, http://markitup.jaysalvat.com/ markItUp is available under a dual licensed the MIT and GPL licenses. = NicEdit - Micro Inline WYSIWYG = @@ -47,10 +51,6 @@ Clase Conexion_Mysql available under MIT license. Copyright (c) Victor De la Rocha, http://www.mis-algoritmos.com/ Digg Style Paginator Class available under MIT license. -= Clase plantillas = -Copyright (c) Pedro Santana, http://www.pecesama.net/weblog/ -Clase plantillas available under MIT license. - = Textile class = Copyright (c) 2003-2004, Dean Allen, http://textile.thresholdstate.com/ Textile class available under GNU General Public License.