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

Commit

Permalink
Versión 2.0 beta 1:
Browse files Browse the repository at this point in the history
- Nueva interfaz unificada para todas las plataformas.
- Eliminados los elementos multimedia.
  • Loading branch information
carlos committed Mar 5, 2014
1 parent 141610c commit ccc103c
Show file tree
Hide file tree
Showing 118 changed files with 8,762 additions and 10,677 deletions.
66 changes: 26 additions & 40 deletions base/fs_controller.php
@@ -1,7 +1,7 @@
<?php
/*
* This file is part of FeedStorm
* Copyright (C) 2013 Carlos Garcia Gomez neorazorx@gmail.com
* Copyright (C) 2014 Carlos Garcia Gomez neorazorx@gmail.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand All @@ -27,23 +27,16 @@ abstract class fs_controller
private $messages;
private $mongo;
public $page;
public $page_title;
public $title;
public $template;
public $visitor;
public $template;
public $noindex;

public function __construct($name, $ptitle, $title, $template)
public function __construct($name, $title)
{
if( !defined('FS_MASTER_KEY') )
define('FS_MASTER_KEY', '');

if( !defined('FS_MOD_REWRITE') )
define('FS_MOD_REWRITE', FALSE);

$tiempo = explode(' ', microtime());
$this->uptime = $tiempo[1] + $tiempo[0];
$this->page = $name;
$this->page_title = $ptitle;
$this->title = $title;
$this->errors = array();
$this->messages = array();
Expand All @@ -54,10 +47,7 @@ public function __construct($name, $ptitle, $title, $template)
{
$visitor = $this->visitor->get($_COOKIE['key']);
if($visitor)
{
$this->visitor = $visitor;
$this->visitor->login();
}
else
$this->new_error_msg('No se encuentra el usuario.');
}
Expand All @@ -67,15 +57,15 @@ public function __construct($name, $ptitle, $title, $template)
$this->new_message(FS_NAME.' usa cookies propias y de terceros para
mejorar tu experiencia de navegación y realizar tareas de análisis.
Al continuar con tu navegación entendemos que das tu consentimiento
a nuestra <a target="_blank" href="index.php?page=help#cookies">política de cookies</a>.');
a nuestra política de cookies.');
}

$this->visitor->login();
if( $this->visitor->save() )
{
setcookie('key', $this->visitor->get_id(), time()+FS_MAX_AGE, FS_PATH);
}

$this->set_template($template);
$this->template = $name;
$this->noindex = TRUE;
}

public function __destruct()
Expand All @@ -85,7 +75,7 @@ public function __destruct()

public function version()
{
return '1.4';
return '2.0b1';
}

public function php_version()
Expand All @@ -98,14 +88,6 @@ public function mongo_version()
return $this->mongo->version();
}

protected function set_template($tpl='main')
{
if( !$this->visitor->mobile() )
$this->template = 'mobile/'.$tpl;
else
$this->template = 'desktop/'.$tpl;
}

public function new_error_msg($msg)
{
if( $msg )
Expand Down Expand Up @@ -151,31 +133,35 @@ public function duration()

public function url()
{
if(FS_MOD_REWRITE)
return FS_PATH.'/'.$this->page;
else
return FS_PATH.'/index.php?page='.$this->page;
return FS_PATH.'/'.$this->page;
}

public function domain()
{
if( mb_substr($_SERVER["SERVER_NAME"], 0, 4) == 'www.')
return 'http://'.$_SERVER["SERVER_NAME"].FS_PATH;
return 'http://'.$_SERVER["SERVER_NAME"];
else
return 'http://www.'.$_SERVER["SERVER_NAME"].FS_PATH;
return 'http://www.'.$_SERVER["SERVER_NAME"];
}

public function page_url($name='')
/// devulve TRUE si el número aleatorio es igual a 0
public function random($num=9)
{
if(FS_MOD_REWRITE)
return FS_PATH.'/'.$name;
else
return FS_PATH.'/index.php?page='.$name;
return mt_rand(0, $num) == 0;
}

public function random($num)
public function split_stories(&$stories, $cols=3, $col=1)
{
return mt_rand(0, $num) == 0;
$cut = max( array(1, ceil( count($stories)/$cols) ) );
$list = array();

foreach($stories as $i => $value)
{
if($i >= $cut*($col-1) AND $i < $cut*$col)
$list[] = $value;
}

return $list;
}
}

Expand Down
18 changes: 1 addition & 17 deletions config_sample.php
Expand Up @@ -23,16 +23,11 @@
define('FS_MONGO_HOST', 'localhost');
define('FS_MONGO_DBNAME', 'ponme_un_nombre');

/// Número de historias máximo para cada feed y para la portada.
/// Número de artículos en portada, búsquedas, etc...
define('FS_MAX_STORIES', 50);

/*
* Caducidad de los elementos, en segundos.
* Se eliminarán:
* - los usuarios que no hayan vuelto en un máximo de FS_MAX_AGE segundos.
* - las historias con una edad superior a FS_MAX_AGE segundos.
* - las ediciones con una edad superior a FS_MAX_AGE segundos.
* - los elementos multimedia con una edad superior a FS_MAX_AGE segundos.
*/
define('FS_MAX_AGE', 5184000);

Expand All @@ -43,14 +38,6 @@
*/
define('FS_TIMEOUT', 10);

/*
* Cuando se comprueba una fuente, se extraen las historias, y para
* cada una se buscan imáganes asociadas. Pues esta constante
* define el número máximo de imáganes descargadas de una sóla vez.
* Cuanto mayor el número, más tarda.
*/
define('FS_MAX_DOWNLOADS', 10);

/*
* Contraseña maestra, necesaria para tareas como eliminar fuentes.
*/
Expand All @@ -62,7 +49,4 @@
*/
define('FS_DEBUG', FALSE);

/// ¿Tienes activado el mod_rewrite de apache?
define('FS_MOD_REWRITE', FALSE);

?>
28 changes: 7 additions & 21 deletions controller/comments.php
@@ -1,7 +1,7 @@
<?php
/*
* This file is part of FeedStorm
* Copyright (C) 2013 Carlos Garcia Gomez neorazorx@gmail.com
* Copyright (C) 2014 Carlos Garcia Gomez neorazorx@gmail.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand All @@ -21,31 +21,17 @@

class comments extends fs_controller
{
public $comment;
public $txt_comment;
public $comments;

public function __construct()
{
parent::__construct('comments', 'Comentarios', 'Comentarios &lsaquo; '.FS_NAME, 'comments');
parent::__construct('comments', 'Foro &lsaquo; '.FS_NAME);

$this->comment = new comment();
$this->txt_comment = '¡Escribe algo!';
$comment = new comment();
$this->comments = $comment->all();

if( isset($_POST['comment']) )
{
if($this->visitor->human() AND $_POST['human'] == '' )
{
$comment2 = new comment();
$comment2->nick = $this->visitor->nick;
$comment2->text = $_POST['comment'];
$comment2->save();
}
else
{
$this->new_error_msg('Tienes que borrar el número para demostrar que eres humano.');
$this->txt_comment = $_POST['comment'];
}
}
if( count($this->comments) == 0 )
$this->new_message('Aun no hay comentarios :-(');
}

public function get_description()
Expand Down
4 changes: 2 additions & 2 deletions controller/discover_stories.php
@@ -1,7 +1,7 @@
<?php
/*
* This file is part of FeedStorm
* Copyright (C) 2013 Carlos Garcia Gomez neorazorx@gmail.com
* Copyright (C) 2014 Carlos Garcia Gomez neorazorx@gmail.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand All @@ -26,7 +26,7 @@ class discover_stories extends fs_controller

public function __construct()
{
parent::__construct('discover_stories', 'Descubrir', 'Descubrir &lsaquo; '.FS_NAME, 'discover');
parent::__construct('discover_stories', 'Descubrir &lsaquo; '.FS_NAME);

$this->stories = array();

Expand Down

0 comments on commit ccc103c

Please sign in to comment.