Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Pequeñas correcciones a chan11.
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoRazorX committed Dec 21, 2014
1 parent 68b7e7f commit 95d7534
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 13 deletions.
37 changes: 26 additions & 11 deletions bots/chan11/cron.php
Expand Up @@ -24,7 +24,7 @@ class chan11
{
public function __construct()
{
if( Date('m') != Date('m', strtotime('+1 day')) AND !file_exists('tmp/special/'.$this->mes(Date('m')).'_'.Date('Y').'.json') )
if( Date('m') != Date('m', strtotime('+2 hours')) AND !file_exists('tmp/special/'.$this->mes(Date('m')).'_'.Date('Y').'.json') )
{
$data = array(
'title' => 'Resumen de '.$this->mes(Date('m')).' de '.Date('Y'),
Expand Down Expand Up @@ -206,20 +206,35 @@ private function mes($num)
private function share_special_page($name, &$data)
{
$story = new story();
foreach($story->published_stories() as $ps)
$story->link = 'http://'.FS_DOMAIN.FS_PATH.'special/'.$name;
$story->featured = TRUE;
$story->published = time();
$story->title = $data['title'];
$story->description = $data['stories']['total'].' artículos publicados en este periodo, ';
$story->description .= $data['feeds']['total'].' fuentes y ';
$story->description .= $data['topics']['total'].' temas. Este es el '.$data['title'].'. ';
$story->description .= 'Haz clic en el enlace para ver con detalle este resumen elaborado por chan11 ;-)';
$story->save();

$comm = new comment();
$comm->thread = $story->get_id();
$comm->nick = __CLASS__;
switch ( mt_rand(0,2) )
{
$story->link = 'http://'.FS_DOMAIN.FS_PATH.'special/'.$name;
$story->featured = TRUE;
$story->published = time();
$story->title = $data['title'];
case 0:
$comm->text = "Se admiten sugerencias para el próximo resumen ;-)";
break;

$story->description = $data['stories']['total'].' artículos publicados en este periodo, ';
$story->description .= $data['feeds']['total'].' fuentes y ';
$story->description .= $data['topics']['total'].' temas.';
case 1:
$comm->text = "Para los que creen que este resumen es sectario, aquí tenéis mi código fuente "
. "https://github.com/NeoRazorX/feedstorm/blob/master/bots/chan11/cron.php :D";
break;

$story->save();
break;
default:
$comm->text = "Este es el mejor resumen del mes, y si no ¡Desmiéntemelo!";
break;
}
$comm->save();
}
}

Expand Down
37 changes: 36 additions & 1 deletion controller/special.php
Expand Up @@ -31,7 +31,7 @@ class special extends fs_controller
public function __construct()
{
parent::__construct(__CLASS__, 'Especial');

$this->noindex = FALSE;
$this->preview = new story_preview();

$this->data = FALSE;
Expand All @@ -45,6 +45,8 @@ public function __construct()

if($this->data)
{
$this->title = $this->data->title;

$this->stories = array();
$story = new story();
foreach($this->data->stories->popular as $sid)
Expand Down Expand Up @@ -141,4 +143,37 @@ public function get_children($tid)

return $tlist;
}

public function get_description()
{
if($this->data)
{
return $this->data->title.': un análisis de todos los artículos, sus fuentes y los temas relacionados.';
}
else
return '';
}

public function get_keywords()
{
if($this->stories)
{
$keys = '';
foreach($this->stories as $sto)
{
if($keys == '')
{
$keys = $sto->keywords;
}
else
{
$keys .= ', '.$sto->keywords;
}
}

return $keys;
}
else
return '';
}
}
2 changes: 1 addition & 1 deletion view/special.html
Expand Up @@ -34,7 +34,7 @@
</script>

<div class="jumbotron" style="padding-bottom: 10px;">
<h1>{$fsc->data->title} en {$name}</h1>
<h1>{$fsc->data->title}</h1>
<div class="btn-group" role="group" aria-label="...">
<button type="button" id="b_articulos" class="btn btn-default active">Artículos</button>
<button type="button" id="b_fuentes" class="btn btn-default">Fuentes</button>
Expand Down

0 comments on commit 95d7534

Please sign in to comment.