예제 #1
0
파일: about.php 프로젝트: isbkch/Goteo
 public function index($id = null)
 {
     // si llegan a la de mantenimiento sin estar en mantenimiento
     if ($id == 'maintenance' && GOTEO_MAINTENANCE !== true) {
         $id = 'credits';
     }
     // paginas especificas
     if ($id == 'faq' || $id == 'contact') {
         throw new Redirection('/' . $id, Redirection::TEMPORARY);
     }
     // en estos casos se usa el contenido de goteo
     if ($id == 'howto') {
         if (!$_SESSION['user'] instanceof Model\User) {
             throw new Redirection('/');
         }
         $page = Page::get($id);
         return new View('view/about/howto.html.php', array('name' => $page->name, 'description' => $page->description, 'content' => $page->content));
     }
     // el tipo de contenido de la pagina about es diferente
     if (empty($id) || $id == 'about') {
         $id = 'about';
         $posts = Model\Info::getAll(true, \GOTEO_NODE);
         return new View('view/about/info.html.php', array('posts' => $posts));
     }
     // resto de casos
     $page = Page::get($id);
     return new View('view/about/sample.html.php', array('name' => $page->name, 'description' => $page->description, 'content' => $page->content));
 }
예제 #2
0
 public function activity($option = 'summary', $action = 'view')
 {
     // quitamos el stepped para que no nos lo coja para el siguiente proyecto que editemos
     if (isset($_SESSION['stepped'])) {
         unset($_SESSION['stepped']);
     }
     $user = $_SESSION['user'];
     $viewData = array('menu' => self::menu(), 'section' => __FUNCTION__, 'option' => $option, 'action' => $action);
     // portada
     if ($option == 'summary') {
         $page = Page::get('dashboard');
         $viewData['message'] = \str_replace('%USER_NAME%', $_SESSION['user']->name, $page->content);
         $viewData['lists'] = Dashboard\Activity::projList($user);
         $viewData['status'] = Model\Project::status();
     }
     //@TODO: if ($option == 'wall') Dashboard\Activity::wall($user);
     // si es un salto a otro panel
     if (in_array($option, array('admin', 'review', 'translate'))) {
         if (ACL::check('/' . $option)) {
             throw new Redirection('/' . $option, Redirection::TEMPORARY);
         } else {
             throw new Redirection('/dashboard', Redirection::TEMPORARY);
         }
     }
     return new View('view/dashboard/index.html.php', $viewData);
 }
예제 #3
0
파일: faq.php 프로젝트: anvnguyen/Goteo
 public function index($current = 'node')
 {
     // si llega una pregunta  ?q=70
     if (isset($_GET['q'])) {
         $current = null;
         $show = $_GET['q'];
     } else {
         $show = null;
     }
     $page = Page::get('faq');
     $faqs = array();
     $sections = Model\Faq::sections();
     $colors = Model\Faq::colors();
     foreach ($sections as $id => $name) {
         $qs = Model\Faq::getAll($id);
         if (empty($qs)) {
             if ($id == $current && $current != 'node') {
                 throw new \Goteo\Core\Redirection('/faq');
             }
             unset($sections[$id]);
             continue;
         }
         $faqs[$id] = $qs;
         foreach ($faqs[$id] as &$question) {
             $question->description = nl2br(str_replace(array('%SITE_URL%'), array(SITE_URL), $question->description));
             if (isset($show) && $show == $question->id) {
                 $current = $id;
             }
         }
     }
     return new View('view/faq.html.php', array('faqs' => $faqs, 'current' => $current, 'sections' => $sections, 'colors' => $colors, 'show' => $show));
 }
예제 #4
0
파일: legal.php 프로젝트: anvnguyen/Goteo
 public function index($id = null)
 {
     if (empty($id)) {
         throw new Redirection('/about/legal', Redirection::PERMANENT);
     }
     $page = Page::get($id);
     return new View('view/about/sample.html.php', array('name' => $page->name, 'description' => $page->description, 'content' => $page->content));
 }
예제 #5
0
파일: service.php 프로젝트: isbkch/Goteo
 public function index($id = null)
 {
     if (empty($id)) {
         $id = 'service';
     }
     $page = Page::get($id);
     return new View('view/about/sample.html.php', array('name' => $page->name, 'description' => $page->description, 'content' => $page->content));
 }
예제 #6
0
 public function index($show = 'activity', $category = null)
 {
     if (defined('GOTEO_EASY') && \GOTEO_EASY === true) {
         throw new Redirection('/');
     }
     $page = Page::get('community');
     $items = array();
     $shares = array();
     if (!in_array($show, array('sharemates', 'activity'))) {
         $show = 'activity';
     }
     $viewData = array('description' => $page->description, 'show' => $show);
     switch ($show) {
         // compartiendo intereses global
         case 'sharemates':
             $categories = Interest::getAll();
             foreach ($categories as $catId => $catName) {
                 $gente = Interest::shareAll($catId);
                 if (count($gente) == 0) {
                     continue;
                 }
                 $shares[$catId] = $gente;
             }
             $viewData['category'] = $category;
             $viewData['categories'] = $categories;
             $viewData['shares'] = $shares;
             // top ten cofinanciadores en Goteo
             $projects = Invest::projects(true);
             $investors = array();
             foreach ($projects as $projectId => $projectName) {
                 foreach (Invest::investors($projectId) as $key => $investor) {
                     if (\array_key_exists($investor->user, $investors)) {
                         // si es otro proyecto y ya está en el array, añadir uno
                         if ($investors[$investor->user]->lastproject != $projectId) {
                             ++$investors[$investor->user]->projects;
                             $investors[$investor->user]->lastproject = $projectId;
                         }
                         $investors[$investor->user]->amount += $investor->amount;
                         $investors[$investor->user]->date = $investor->date;
                     } else {
                         $investors[$investor->user] = (object) array('user' => $investor->user, 'name' => $investor->name, 'projects' => 1, 'lastproject' => $projectId, 'avatar' => $investor->avatar, 'worth' => $investor->worth, 'amount' => $investor->amount, 'date' => $investor->date);
                     }
                 }
             }
             $viewData['investors'] = $investors;
             break;
             // feed público
         // feed público
         case 'activity':
             $items = array();
             $items['goteo'] = Feed::getAll('goteo', 'public', 50);
             $items['projects'] = Feed::getAll('projects', 'public', 50);
             $items['community'] = Feed::getAll('community', 'public', 50);
             $viewData['items'] = $items;
             break;
     }
     return new View('view/community.html.php', $viewData);
 }
예제 #7
0
파일: pages.php 프로젝트: isbkch/Goteo
 public static function process($action = 'list', $id = null)
 {
     $node = isset($_SESSION['admin_node']) ? $_SESSION['admin_node'] : \GOTEO_NODE;
     $errors = array();
     switch ($action) {
         case 'add':
             if ($_SERVER['REQUEST_METHOD'] == 'POST') {
                 $page = new Page();
                 $page->id = $_POST['id'];
                 $page->name = $_POST['name'];
                 if ($page->add($errors)) {
                     Message::Info('La página <strong>' . $page->name . '</strong> se ha creado correctamente, se puede editar ahora.');
                     throw new Redirection("/admin/pages/edit/{$page->id}");
                 } else {
                     Message::Error('No se ha creado bien ' . implode('<br />', $errors));
                     throw new Redirection("/admin/pages/add");
                 }
             }
             return new View('view/admin/index.html.php', array('folder' => 'pages', 'file' => 'add'));
             break;
         case 'edit':
             if ($node != \GOTEO_NODE && !in_array($id, static::_node_pages())) {
                 Message::Info('No puedes gestionar la página <strong>' . $id . '</strong>');
                 throw new Redirection("/admin/pages");
             }
             // si estamos editando una página
             $page = Page::get($id, $node, \GOTEO_DEFAULT_LANG);
             // si llega post, vamos a guardar los cambios
             if ($_SERVER['REQUEST_METHOD'] == 'POST') {
                 $page->name = $_POST['name'];
                 $page->description = $_POST['description'];
                 $page->content = $_POST['content'];
                 if ($page->save($errors)) {
                     // Evento Feed
                     $log = new Feed();
                     if ($node != \GOTEO_NODE && in_array($id, static::_node_pages())) {
                         $log->setTarget($node, 'node');
                     }
                     $log->populate(Text::_('modificacion de página institucional (admin)'), '/admin/pages', \vsprintf("El admin %s ha %s la página institucional %s", array(Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id), Feed::item('relevant', 'Modificado'), Feed::item('relevant', $page->name, $page->url))));
                     $log->doAdmin('admin');
                     unset($log);
                     Message::Info('La página ' . $page->name . ' se ha actualizado correctamente');
                     throw new Redirection("/admin/pages");
                 } else {
                     Message::Error(implode('<br />', $errors));
                 }
             }
             // sino, mostramos para editar
             return new View('view/admin/index.html.php', array('folder' => 'pages', 'file' => 'edit', 'page' => $page));
             break;
         case 'list':
             // si estamos en la lista de páginas
             $pages = Page::getList($node);
             return new View('view/admin/index.html.php', array('folder' => 'pages', 'file' => 'list', 'pages' => $pages, 'node' => $node));
             break;
     }
 }
예제 #8
0
파일: review.php 프로젝트: kenjs/Goteo
 public function index()
 {
     $page = Page::get('review');
     $message = \str_replace('%USER_NAME%', $_SESSION['user']->name, $page->content);
     $user = $_SESSION['user'];
     $reviews = Model\Review::assigned($user->id);
     // si no hay proyectos asignados no tendria que estar aqui
     if (count($reviews) == 0) {
         $message = Text::_('No tienes asignada ninguna revisión de proyectos');
     }
     return new View('view/review/index.html.php', array('message' => $message, 'menu' => self::menu(), 'section' => 'activity', 'option' => 'summary', 'reviews' => $reviews));
 }
예제 #9
0
 *  it under the terms of the GNU Affero General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Goteo is distributed in the hope that it will be useful,
 *  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, Goteo\Library\Page;
$page = Page::get($this['id'], $_SESSION['translator_lang']);
$original = Page::get($this['id'], \GOTEO_DEFAULT_LANG);
$bodyClass = 'admin';
?>
<script type="text/javascript" src="/view/js/ckeditor/ckeditor.js"></script>

<script type="text/javascript">
$(document).ready(function(){
	// Lanza wysiwyg contenido
	CKEDITOR.replace('richtext_content', {
		toolbar: 'Full',
		toolbar_Full: [
				['Source','-'],
				['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'],
				['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
				'/',
				['Bold','Italic','Underline','Strike'],
예제 #10
0
파일: news.php 프로젝트: isbkch/Goteo
 public function index()
 {
     $page = Page::get('news');
     $news = Model\News::getAll();
     return new View('view/news.html.php', array('name' => $page->name, 'title' => $page->description, 'content' => $page->content, 'news' => $news));
 }
예제 #11
0
파일: translate.php 프로젝트: kenjs/Goteo
 public function index($table = '', $action = 'list', $id = null, $auxAction = 'list', $contentId = null)
 {
     $_SESSION['user']->translangs = Model\User\Translate::getLangs($_SESSION['user']->id);
     if (empty($_SESSION['user']->translangs)) {
         Message::Error(Text::_('No tienes ningún idioma, contacta con el administrador'));
         throw new Redirection('/dashboard');
     }
     if (empty($_SESSION['translate_lang']) || !isset($_SESSION['user']->translangs[$_SESSION['translate_lang']])) {
         if (count($_SESSION['user']->translangs) > 1 && isset($_SESSION['user']->translangs['en'])) {
             $_SESSION['translate_lang'] = 'en';
         } else {
             $_SESSION['translate_lang'] = current(array_keys($_SESSION['user']->translangs));
         }
     }
     if ($table == '') {
         return new View('view/translate/index.html.php', array('menu' => self::menu()));
     }
     // para el breadcrumbs segun el contenido
     $section = $table == 'news' || $table == 'promote' ? 'home' : 'contents';
     // muy especial para traducción de nodo
     if ($table == 'node') {
         $BC = self::menu(array('section' => 'node', 'node' => $action, 'option' => $id, 'action' => $auxAction, 'id' => $contentId));
     } else {
         $BC = self::menu(array('section' => $section, 'option' => $table, 'action' => $action, 'id' => $id));
     }
     define('ADMIN_BCPATH', $BC);
     $errors = array();
     // la operación según acción
     switch ($table) {
         case 'texts':
             // comprobamos los filtros
             $filters = array();
             $fields = array('group', 'text', 'pending');
             if (!isset($_GET['pending'])) {
                 $_GET['pending'] = 0;
             }
             foreach ($fields as $field) {
                 if (isset($_GET[$field])) {
                     $filters[$field] = $_GET[$field];
                     $_SESSION['translate_filters']['texts'][$field] = (string) $_GET[$field];
                 } elseif (!empty($_SESSION['translate_filters']['texts'][$field])) {
                     // si no lo tenemos en el get, cogemos de la sesion pero no lo pisamos
                     $filters[$field] = $_SESSION['translate_filters']['texts'][$field];
                 }
             }
             $filter = "?group={$filters['group']}&text={$filters['text']}&pending={$filters['pending']}";
             // si llega post, vamos a guardar los cambios
             if ($action == 'edit' && $_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['save'])) {
                 if (Text::save(array('id' => $id, 'text' => $_POST['text'], 'lang' => $_POST['lang']), $errors)) {
                     // Evento Feed
                     /*
                     $log = new Feed();
                     $log->populate('texto traducido (traductor)', '/translate/texts',
                         \vsprintf('El traductor %s ha %s el texto %s al %s', array(
                             Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id),
                             Feed::item('relevant', 'Traducido'),
                             Feed::item('blog', $id),
                             Feed::item('relevant', Lang::get($_POST['lang'])->name)
                     )));
                     $log->doAdmin('admin');
                     unset($log);
                     */
                     Message::Info('Texto <strong>' . $id . '</strong> traducido correctamente al <strong>' . Lang::get($_POST['lang'])->name . '</strong>');
                     throw new Redirection("/translate/texts/{$filter}&page=" . $_GET['page']);
                 } else {
                     // Evento Feed
                     $log = new Feed();
                     $log->setTarget($_SESSION['user']->id, 'user');
                     $log->populate('texto traducido (traductor)', '/translate/texts', \vsprintf('Al traductor %s  le ha %s el texto %s al %s', array(Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id), Feed::item('relevant', 'Fallado al traducir'), Feed::item('blog', $id), Feed::item('relevant', Lang::get($_POST['lang'])->name))));
                     $log->doAdmin('admin');
                     unset($log);
                     Message::Error('Ha habido algun ERROR al traducir el Texto <strong>' . $id . '</strong> al <strong>' . Lang::get($_POST['lang'])->name . '</strong><br />' . implode('<br />', $errors));
                 }
             }
             // sino, mostramos la lista
             return new View('view/translate/index.html.php', array('section' => 'texts', 'action' => $action, 'id' => $id, 'filter' => $filter, 'filters' => $filters, 'errors' => $errors));
             break;
         case 'node':
             // parametros especiales
             $node = $action;
             $action = $auxAction;
             $contentTable = $id;
             // si llega post, vamos a guardar los cambios
             if ($action == 'edit' && $_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['save'])) {
                 switch ($contentTable) {
                     case 'banner':
                         if (Content::save(array('id' => $contentId, 'table' => $contentTable, 'title' => $_POST['title'], 'description' => $_POST['description'], 'lang' => $_POST['lang']), $errors)) {
                             Message::Info('El Banner <strong>' . $contentId . '</strong> del nodo <strong>' . $node . '</strong> traducido correctamente al <strong>' . Lang::get($_POST['lang'])->name . '</strong>');
                             throw new Redirection("/translate/node/{$node}/{$contentTable}/list");
                         } else {
                             Message::Error('Ha habido algun ERROR al traducir el Banner <strong>' . $contentId . '</strong> del nodo <strong>' . $node . '</strong> al <strong>' . Lang::get($_POST['lang'])->name . '</strong><br />' . implode('<br />', $errors));
                         }
                         break;
                     case 'page':
                         $page = Page::get($contentId, $node);
                         if ($page->update($contentId, $_POST['lang'], $node, $_POST['name'], $_POST['description'], $_POST['content'], $errors)) {
                             Message::Info('La página <strong>' . $contentId . '</strong> del nodo <strong>' . $node . '</strong> traducido correctamente al <strong>' . Lang::get($_POST['lang'])->name . '</strong>');
                             throw new Redirection("/translate/node/{$node}/{$contentTable}/list");
                         } else {
                             Message::Error('Ha habido algun ERROR al traducir la página <strong>' . $contentId . '</strong> del nodo <strong>' . $node . '</strong> al <strong>' . Lang::get($_POST['lang'])->name . '</strong><br />' . implode('<br />', $errors));
                         }
                         break;
                     case 'post':
                         if (Content::save(array('id' => $contentId, 'table' => $contentTable, 'title' => $_POST['title'], 'text' => $_POST['text'], 'legend' => $_POST['legend'], 'lang' => $_POST['lang']), $errors)) {
                             Message::Info('La entrada <strong>' . $contentId . '</strong> del nodo <strong>' . $node . '</strong> traducido correctamente al <strong>' . Lang::get($_POST['lang'])->name . '</strong>');
                             throw new Redirection("/translate/node/{$node}/{$contentTable}/list");
                         } else {
                             Message::Error('Ha habido algun ERROR al traducir la Entrada <strong>' . $contentId . '</strong> del nodo <strong>' . $node . '</strong> al <strong>' . Lang::get($_POST['lang'])->name . '</strong><br />' . implode('<br />', $errors));
                         }
                         break;
                     default:
                         $node = Model\Node::get($node);
                         $node->lang_lang = $_SESSION['translate_lang'];
                         $node->subtitle_lang = $_POST['subtitle'];
                         $node->description_lang = $_POST['description'];
                         if ($node->updateLang($errors)) {
                             Message::Info('La Descripción del nodo <strong>' . $node->id . '</strong> traducido correctamente al <strong>' . Lang::get($_POST['lang'])->name . '</strong>');
                             throw new Redirection("/translate/node/{$node->id}");
                         } else {
                             Message::Error('Ha habido algun ERROR al traducir la Descripción del nodo <strong>' . $node->id . '</strong> al <strong>' . Lang::get($_POST['lang'])->name . '</strong><br />' . implode('<br />', $errors));
                         }
                 }
                 return new View('view/translate/index.html.php', array('section' => 'node', 'action' => 'edit_' . $contentTable, 'option' => $contentTable, 'id' => $contentId, 'node' => $node));
             } elseif ($action == 'edit') {
                 return new View('view/translate/index.html.php', array('section' => 'node', 'action' => 'edit_' . $contentTable, 'option' => $contentTable, 'id' => $contentId, 'node' => $node));
             } elseif ($contentTable == 'data') {
                 return new View('view/translate/index.html.php', array('section' => 'node', 'action' => 'edit_' . $contentTable, 'option' => $contentTable, 'id' => $node, 'node' => $node));
             } else {
                 // sino, mostramos la lista
                 return new View('view/translate/index.html.php', array('section' => 'node', 'action' => 'list_' . $contentTable, 'option' => $contentTable, 'node' => $node));
             }
             break;
         case 'pages':
             // si llega post, vamos a guardar los cambios
             if ($action == 'edit' && $_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['save'])) {
                 if (Page::update($id, $_POST['lang'], $_POST['node'], $_POST['name'], $_POST['description'], $_POST['content'], $errors)) {
                     Message::Info('Contenido de la Pagina <strong>' . $id . '</strong> traducido correctamente al <strong>' . Lang::get($_POST['lang'])->name . '</strong>');
                     throw new Redirection("/translate/pages");
                 } else {
                     // Evento Feed
                     $log = new Feed();
                     $log->setTarget($_SESSION['user']->id, 'user');
                     $log->populate('pagina traducida (traductor)', '/translate/pages', \vsprintf('Al traductor %s le ha %s la página %s del nodo %s al %s', array(Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id), Feed::item('relevant', 'Fallado al traducir'), Feed::item('blog', $id), Feed::item('blog', $_POST['node']), Feed::item('relevant', Lang::get($_POST['lang'])->name))));
                     $log->doAdmin('admin');
                     unset($log);
                     Message::Error('Ha habido algun ERROR al traducir el contenido de la pagina <strong>' . $id . '</strong> al <strong>' . Lang::get($_POST['lang'])->name . '</strong><br />' . implode('<br />', $errors));
                 }
             }
             // sino, mostramos la lista
             return new View('view/translate/index.html.php', array('section' => 'pages', 'action' => $action, 'id' => $id, 'errors' => $errors));
             break;
         default:
             // comprobamos los filtros
             $filters = array();
             $fields = array('type', 'text', 'pending');
             if (!isset($_GET['pending'])) {
                 $_GET['pending'] = 0;
             }
             foreach ($fields as $field) {
                 if (isset($_GET[$field])) {
                     $filters[$field] = $_GET[$field];
                     $_SESSION['translate_filters']['contents'][$field] = (string) $_GET[$field];
                 } elseif (!empty($_SESSION['translate_filters']['contents'][$field])) {
                     // si no lo tenemos en el get, cogemos de la sesion pero no lo pisamos
                     $filters[$field] = $_SESSION['translate_filters']['contents'][$field];
                 }
             }
             $filter = "?type={$filters['type']}&text={$filters['text']}&pending={$filters['pending']}";
             // si llega post, vamos a guardar los cambios
             if ($action == 'edit' && $_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['save'])) {
                 if (!in_array($table, \array_keys(Content::_tables()))) {
                     $errors[] = Text::_("Tabla ") . $table . Text::_(" desconocida");
                     break;
                 }
                 if (Content::save($_POST, $errors)) {
                     // Evento Feed
                     /*
                     $log = new Feed();
                     $log->populate('contenido traducido (traductor)', '/translate/'.$table,
                         \vsprintf('El traductor %s ha %s el contenido del registro %s de la tabla %s al %s', array(
                         Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id),
                         Feed::item('relevant', 'Traducido'),
                         Feed::item('blog', $id),
                         Feed::item('blog', $table),
                         Feed::item('relevant', Lang::get($_SESSION['translate_lang'])->name)
                     )));
                     $log->doAdmin('admin');
                     unset($log);
                     */
                     Message::Info('Contenido del registro <strong>' . $id . '</strong> de la tabla <strong>' . $table . '</strong> traducido correctamente al <strong>' . Lang::get($_POST['lang'])->name . '</strong>');
                     if (isset($_SESSION['translate_node'])) {
                         throw new Redirection('/dashboard/translates/' . $table . 's');
                     }
                     throw new Redirection("/translate/{$table}/{$filter}&page=" . $_GET['page']);
                 } else {
                     // Evento Feed
                     $log = new Feed();
                     $log->setTarget($_SESSION['user']->id, 'user');
                     $log->populate('contenido traducido (traductor)', '/translate/' . $table, \vsprintf('El traductor %s le ha %s el contenido del registro %s de la tabla %s al %s', array(Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id), Feed::item('relevant', 'Fallado al traducir'), Feed::item('blog', $id), Feed::item('blog', $table), Feed::item('relevant', Lang::get($_SESSION['translate_lang'])->name))));
                     $log->doAdmin('admin');
                     unset($log);
                     Message::Error('Ha habido algun ERROR al traducir el contenido del registro <strong>' . $id . '</strong> de la tabla <strong>' . $table . '</strong> al <strong>' . Lang::get($_POST['lang'])->name . '</strong><br />' . implode('<br />', $errors));
                 }
             }
             // sino, mostramos la lista
             return new View('view/translate/index.html.php', array('section' => 'contents', 'action' => $action, 'table' => $table, 'id' => $id, 'filter' => $filter, 'filters' => $filters, 'errors' => $errors));
     }
     // si no pasa nada de esto, a la portada
     return new View('view/translate/index.html.php', array('menu' => self::menu()));
 }
예제 #12
0
 *  Goteo is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Goteo is distributed in the hope that it will be useful,
 *  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, Goteo\Core\View, Goteo\Library\Page;
$page = Page::get('credits');
include 'view/prologue.html.php';
include 'view/header.html.php';
?>

    <div id="sub-header">
        <div>
            <h2><?php 
echo $error->getMessage();
?>
!</h2>
        </div>
    </div>

    <div id="main">
        <div class="widget">
예제 #13
0
파일: contact.php 프로젝트: anvnguyen/Goteo
 public function index()
 {
     $page = Page::get('contact');
     $errors = array();
     if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['send'])) {
         // verificamos referer
         $URL = NODE_ID != GOTEO_NODE ? NODE_URL : SITE_URL;
         $referer = $URL . '/contact';
         // verificamos token
         if (!isset($_POST['msg_token']) || $_POST['msg_token'] != $_SESSION['msg_token'] || $_SERVER['HTTP_REFERER'] != $referer) {
             header("HTTP/1.1 400 Bad request");
             die('Token incorrect');
         }
         $name = $_POST['name'];
         // si falta mensaje, email o asunto, error
         if (empty($_POST['email'])) {
             $errors['email'] = Text::get('error-contact-email-empty');
         } elseif (!\Goteo\Library\Check::mail($_POST['email'])) {
             $errors['email'] = Text::get('error-contact-email-invalid');
         } else {
             $email = $_POST['email'];
         }
         if (empty($_POST['subject'])) {
             $errors['subject'] = Text::get('error-contact-subject-empty');
         } else {
             $subject = $_POST['subject'];
         }
         if (empty($_POST['message'])) {
             $errors['message'] = Text::get('error-contact-message-empty');
         } else {
             $msg_content = nl2br(\strip_tags($_POST['message']));
         }
         // verificamos el captcha
         require 'library/recaptchalib.php';
         $resp = recaptcha_check_answer(RECAPTCHA_PRIVATE_KEY, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response"]);
         if (!$resp->is_valid) {
             $errors['recaptcha'] = Text::get('error-contact-captcha');
         }
         $data = array('subject' => $_POST['subject'], 'name' => $_POST['name'], 'email' => $_POST['email'], 'message' => $_POST['message']);
         if (empty($errors)) {
             // Obtenemos la plantilla para asunto y contenido
             $template = Template::get(1);
             // Sustituimos los datos
             $subject = str_replace('%SUBJECT%', $subject, $template->title);
             $to = \GOTEO_CONTACT_MAIL;
             $toName = \GOTEO_MAIL_NAME;
             // En el contenido:
             $search = array('%TONAME%', '%MESSAGE%', '%USEREMAIL%');
             $replace = array($toName, $msg_content, $email);
             $content = \str_replace($search, $replace, $template->text);
             $mailHandler = new Mail();
             $mailHandler->to = $to;
             $mailHandler->toName = $toName;
             $mailHandler->subject = $subject;
             $mailHandler->content = $content;
             $mailHandler->reply = $email;
             $mailHandler->html = true;
             $mailHandler->template = $template->id;
             if ($mailHandler->send($errors)) {
                 Message::Info('Mensaje de contacto enviado correctamente.');
                 $data = array();
             } else {
                 Message::Error('Ha fallado al enviar el mensaje.');
             }
             unset($mailHandler);
         }
     }
     return new View('view/about/contact.html.php', array('data' => $data, 'errors' => $errors));
 }
예제 #14
0
파일: press.php 프로젝트: isbkch/Goteo
 public function index()
 {
     $page = Page::get('press', \NODE_ID);
     return new View('view/about/sample.html.php', array('name' => $page->name, 'description' => $page->description, 'content' => $page->content));
 }
예제 #15
0
 *  it under the terms of the GNU Affero General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Goteo is distributed in the hope that it will be useful,
 *  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\Page, Goteo\Library\Text;
$bodyClass = 'about';
$page = Page::get('contact');
include 'view/prologue.html.php';
include 'view/header.html.php';
?>
    <div id="sub-header">
        <div>
            <h2><?php 
echo $page->description;
?>
</h2>
        </div>
    </div>

<?php 
if (isset($_SESSION['messages'])) {
    include 'view/header/message.html.php';