public static function getList($blog, $limit = null) { $list = array(); $sql = "\n SELECT\n comment.id,\n comment.post,\n DATE_FORMAT(comment.date, '%d | %m | %Y') as date,\n comment.text,\n comment.user\n FROM comment\n INNER JOIN user\n ON user.id = comment.user\n AND (user.hide = 0 OR user.hide IS NULL)\n WHERE comment.post IN (SELECT id FROM post WHERE blog = ?)\n ORDER BY comment.date DESC, comment.id DESC\n "; if (!empty($limit)) { $sql .= "LIMIT {$limit}"; } $query = static::query($sql, array($blog)); foreach ($query->fetchAll(\PDO::FETCH_CLASS, __CLASS__) as $comment) { $comment->user = \Goteo\Model\User::getMini($comment->user); // reconocimiento de enlaces y saltos de linea $comment->text = nl2br(Text::urlink($comment->text)); $list[$comment->id] = $comment; } return $list; }
public static function getAll($project, $lang = null) { $messages = array(); $query = static::query("\n SELECT\n message.id as id,\n message.user as user,\n message.project as project,\n message.thread as thread,\n message.date as date,\n IFNULL(message_lang.message, message.message) as message,\n message.blocked as blocked,\n message.closed as closed\n FROM message\n LEFT JOIN message_lang\n ON message_lang.id = message.id\n AND message_lang.lang = :lang\n WHERE message.project = :project\n AND message.thread IS NULL\n ORDER BY date ASC, id ASC\n ", array(':project' => $project, ':lang' => $lang)); foreach ($query->fetchAll(\PDO::FETCH_CLASS, __CLASS__) as $message) { // datos del usuario $message->user = User::getMini($message->user); // reconocimiento de enlaces y saltos de linea $message->message = nl2br(Text::urlink($message->message)); //hace tanto $message->timeago = Feed::time_ago($message->date); $query = static::query("\n SELECT id\n FROM message\n WHERE thread = ?\n ORDER BY date ASC, id ASC\n ", array($message->id)); foreach ($query->fetchAll(\PDO::FETCH_CLASS) as $response) { $message->responses[] = self::get($response->id); } $messages[] = $message; } return $messages; }
* but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Goteo. If not, see <http://www.gnu.org/licenses/agpl.txt>. * */ use Goteo\Model\User\Interest, Goteo\Model\User\Skill, Goteo\Library\Text; $user = $this['user']; $user->about = nl2br(Text::urlink($user->about)); $interests = Interest::getAll(); $skills = Skill::getAll(null,true); ?> <div class="widget user-about"> <?php if (!empty($user->about)): ?> <div class="about"> <h4><?php echo Text::get('profile-about-header'); ?></h4> <p><?php echo $user->about ?></p> </div> <?php endif ?>
* but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Goteo. If not, see <http://www.gnu.org/licenses/agpl.txt>. * */ use Goteo\Library\Text; $project = $this['project']; //tratamos los saltos de linea y los links en las descripciones del proyecto $project->description = nl2br(Text::urlink($project->description)); $project->about = nl2br(Text::urlink($project->about)); $project->motivation = nl2br(Text::urlink($project->motivation)); $project->goal = nl2br(Text::urlink($project->goal)); $project->related = nl2br(Text::urlink($project->related)); $level = (int) $this['level'] ?: 3; ?> <?php if (count($project->gallery) > 1) { ?> <script type="text/javascript" > $(function(){ $('#prjct-gallery').slides({ container: 'prjct-gallery-container', paginationClass: 'slderpag', generatePagination: false, play: 0 }); }); </script>
* * You should have received a copy of the GNU Affero General Public License * along with Goteo. If not, see <http://www.gnu.org/licenses/agpl.txt>. * */ use Goteo\Library\Text, Goteo\Model\Blog\Post; $post = Post::get($this['post'], LANG); $level = (int) $this['level'] ?: 3; if ($this['show'] == 'list') { $post->text = Text::recorta($post->text, 500); } if (empty($this['url'])) { $url = '/blog/'; } else { $url = $this['url']; $post->text = nl2br(Text::urlink($post->text)); } ?> <?php if (count($post->gallery) > 1) { ?> <script type="text/javascript" > $(function(){ $('#post-gallery<?php echo $post->id; ?> ').slides({ container: 'post-gallery-container', paginationClass: 'slderpag', generatePagination: false, play: 0