Exemple #1
0
 /**
  * Suplantando al usuario
  * @param string $id   user->id
  */
 public function index()
 {
     $admin = $_SESSION['user'];
     if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST['id']) && !empty($_POST['impersonate'])) {
         $impersonator = $_SESSION['user']->id;
         session_unset();
         $_SESSION['user'] = User::get($_POST['id']);
         $_SESSION['impersonating'] = true;
         $_SESSION['impersonator'] = $impersonator;
         unset($_SESSION['admin_menu']);
         /*
          * Evento Feed
          */
         // Evento Feed
         $log = new Feed();
         $log->setTarget($_SESSION['user']->id, 'user');
         $log->populate('Suplantación usuario (admin)', '/admin/users', \vsprintf('El admin %s ha %s al usuario %s', array(Feed::item('user', $admin->name, $admin->id), Feed::item('relevant', 'Suplantado'), Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id))));
         $log->doAdmin('user');
         unset($log);
         throw new Redirection('/dashboard');
     } else {
         Message::Error(Text::get('impersonate-error'));
         throw new Redirection('/dashboard');
     }
 }
Exemple #2
0
 public static function process($action = 'list', $id = null)
 {
     $model = 'Goteo\\Model\\Blog\\Post\\Tag';
     $url = '/admin/tags';
     $errors = array();
     switch ($action) {
         case 'add':
             return new View('view/admin/index.html.php', array('folder' => 'base', 'file' => 'edit', 'data' => (object) array(), 'form' => array('action' => "{$url}/edit/", 'submit' => array('name' => 'update', 'label' => Text::_('Añadir')), 'fields' => array('id' => array('label' => '', 'name' => 'id', 'type' => 'hidden'), 'name' => array('label' => Text::_('Tag'), 'name' => 'name', 'type' => 'text')))));
             break;
         case 'edit':
             // gestionar post
             if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['update'])) {
                 $errors = array();
                 // instancia
                 $item = new $model(array('id' => $_POST['id'], 'name' => $_POST['name']));
                 if ($item->save($errors)) {
                     Message::Info(Text::get('admin-tags-info-udate'));
                     throw new Redirection($url);
                 } else {
                     Message::Error(Text::get('admin-tags-error-save-fail') . implode('<br />', $errors));
                 }
             } else {
                 $item = $model::get($id);
             }
             return new View('view/admin/index.html.php', array('folder' => 'base', 'file' => 'edit', 'data' => $item, 'form' => array('action' => "{$url}/edit/{$id}", 'submit' => array('name' => 'update', 'label' => Text::get('regular-save')), 'fields' => array('id' => array('label' => '', 'name' => 'id', 'type' => 'hidden'), 'name' => array('label' => Text::_('Tag'), 'name' => 'name', 'type' => 'text')))));
             break;
         case 'remove':
             if ($model::delete($id)) {
                 throw new Redirection($url);
             }
             break;
     }
     return new View('view/admin/index.html.php', array('folder' => 'base', 'file' => 'list', 'model' => 'tag', 'addbutton' => Text::_('Nuevo tag'), 'data' => $model::getList(1), 'columns' => array('edit' => '', 'name' => Text::_('Tag'), 'used' => Text::_('Entradas'), 'translate' => '', 'remove' => ''), 'url' => "{$url}"));
 }
Exemple #3
0
 public static function process($action = 'list', $id = null)
 {
     $node = isset($_SESSION['admin_node']) ? $_SESSION['admin_node'] : \GOTEO_NODE;
     $model = 'Goteo\\Model\\Sponsor';
     $url = '/admin/sponsors';
     $errors = array();
     switch ($action) {
         case 'add':
             return new View('view/admin/index.html.php', array('folder' => 'base', 'file' => 'edit', 'data' => (object) array('order' => $model::next($node), 'node' => $node), 'form' => array('action' => "{$url}/edit/", 'submit' => array('name' => 'update', 'label' => Text::_('Añadir')), 'fields' => array('id' => array('label' => '', 'name' => 'id', 'type' => 'hidden'), 'node' => array('label' => '', 'name' => 'node', 'type' => 'hidden'), 'name' => array('label' => Text::_('Patrocinador'), 'name' => 'name', 'type' => 'text'), 'url' => array('label' => Text::_('Enlace'), 'name' => 'url', 'type' => 'text', 'properties' => 'size=100'), 'image' => array('label' => Text::_('Logo'), 'name' => 'image', 'type' => 'image'), 'order' => array('label' => Text::_('Posición'), 'name' => 'order', 'type' => 'text')))));
             break;
         case 'edit':
             // gestionar post
             if ($_SERVER['REQUEST_METHOD'] == 'POST') {
                 // instancia
                 $item = new $model(array('id' => $_POST['id'], 'name' => $_POST['name'], 'node' => $_POST['node'], 'image' => $_POST['image'], 'url' => $_POST['url'], 'order' => $_POST['order']));
                 // tratar si quitan la imagen
                 $current = $_POST['image'];
                 // la actual
                 if (isset($_POST['image-' . $current . '-remove'])) {
                     $image = Model\Image::get($current);
                     $image->remove('sponsor');
                     $item->image = '';
                     $removed = true;
                 }
                 // tratar la imagen y ponerla en la propiedad image
                 if (!empty($_FILES['image']['name'])) {
                     $item->image = $_FILES['image'];
                 }
                 if ($item->save($errors)) {
                     Message::Info(Text::_('Datos grabados correctamente'));
                     throw new Redirection($url);
                 } else {
                     Message::Error(Text::_('No se ha grabado correctamente. ') . implode(', ', $errors));
                 }
             } else {
                 $item = $model::get($id);
             }
             return new View('view/admin/index.html.php', array('folder' => 'base', 'file' => 'edit', 'data' => $item, 'form' => array('action' => "{$url}/edit/{$id}", 'submit' => array('name' => 'update', 'label' => Text::get('regular-save')), 'fields' => array('id' => array('label' => '', 'name' => 'id', 'type' => 'hidden'), 'node' => array('label' => '', 'name' => 'node', 'type' => 'hidden'), 'name' => array('label' => Text::_('Patrocinador'), 'name' => 'name', 'type' => 'text'), 'url' => array('label' => Text::_('Enlace'), 'name' => 'url', 'type' => 'text', 'properties' => 'size=100'), 'image' => array('label' => Text::_('Logo'), 'name' => 'image', 'type' => 'image'), 'order' => array('label' => Text::_('Posición'), 'name' => 'order', 'type' => 'text')))));
             break;
         case 'up':
             $model::up($id, $node);
             throw new Redirection($url);
             break;
         case 'down':
             $model::down($id, $node);
             throw new Redirection($url);
             break;
         case 'remove':
             if ($model::delete($id)) {
                 Message::Info(Text::_('Se ha eliminado el registro'));
                 throw new Redirection($url);
             } else {
                 Message::Info(Text::_('No se ha podido eliminar el registro'));
             }
             break;
     }
     return new View('view/admin/index.html.php', array('folder' => 'base', 'file' => 'list', 'addbutton' => Text::_('Nuevo patrocinador'), 'data' => $model::getAll($node), 'columns' => array('edit' => '', 'name' => Text::_('Patrocinador'), 'url' => Text::_('Enlace'), 'image' => Text::_('Imagen'), 'order' => Text::_('Posición'), 'up' => '', 'down' => '', 'remove' => ''), 'url' => "{$url}"));
 }
Exemple #4
0
 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;
     }
 }
Exemple #5
0
 public function index()
 {
     if (isset($_GET['error'])) {
         throw new \Goteo\Core\Error('418', Text::html('fatal-error-teapot'));
     }
     // orden de los elementos en portada
     $order = Home::getAll();
     // si estamos en easy mode, quitamos el feed
     if (defined('GOTEO_EASY') && \GOTEO_EASY === true && isset($order['feed'])) {
         unset($order['feed']);
     }
     // entradas de blog
     if (isset($order['posts'])) {
         // entradas en portada
         $posts = Post::getAll();
     }
     // Proyectos destacados
     if (isset($order['promotes'])) {
         $promotes = Promote::getAll(true);
         foreach ($promotes as $key => &$promo) {
             try {
                 $promo->projectData = Project::getMedium($promo->project, LANG);
             } catch (\Goteo\Core\Error $e) {
                 unset($promotes[$key]);
             }
         }
     }
     // actividad reciente
     if (isset($order['feed'])) {
         $feed = array();
         $feed['goteo'] = Feed::getAll('goteo', 'public', 15);
         $feed['projects'] = Feed::getAll('projects', 'public', 15);
         $feed['community'] = Feed::getAll('community', 'public', 15);
     }
     // Banners siempre
     /*            $banners   = Banner::getAll(true);
     
                 foreach ($banners as $id => &$banner) {
                     
                     if (!empty($banner->project)) {
                         try {
                             $banner->project = Project::get($banner->project, LANG);
                         } catch (\Goteo\Core\Error $e) {
                             unset($banners[$id]);
                         }
                     }
                     
                 }*/
     $template = VIEW_PATH . '/index.html.php';
     return new View($template, array('banners' => $banners, 'posts' => $posts, 'promotes' => $promotes, 'order' => $order));
 }
Exemple #6
0
 public static function process($action = 'list', $id = null)
 {
     $model = 'Goteo\\Model\\News';
     $url = '/admin/news';
     $errors = array();
     switch ($action) {
         case 'add':
             return new View('view/admin/index.html.php', array('folder' => 'base', 'file' => 'edit', 'data' => (object) array('order' => $model::next()), 'form' => array('action' => "{$url}/edit/", 'submit' => array('name' => 'update', 'label' => 'Añadir'), 'fields' => array('id' => array('label' => '', 'name' => 'id', 'type' => 'hidden'), 'title' => array('label' => 'Noticia', 'name' => 'title', 'type' => 'text', 'properties' => 'size="100" maxlength="100"'), 'description' => array('label' => 'Entradilla', 'name' => 'description', 'type' => 'textarea', 'properties' => 'cols="100" rows="2"'), 'url' => array('label' => 'Enlace', 'name' => 'url', 'type' => 'text', 'properties' => 'size=100'), 'order' => array('label' => 'Posición', 'name' => 'order', 'type' => 'text')))));
             break;
         case 'edit':
             // gestionar post
             if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['update'])) {
                 // instancia
                 $item = new $model(array('id' => $_POST['id'], 'title' => $_POST['title'], 'description' => $_POST['description'], 'url' => $_POST['url'], 'order' => $_POST['order']));
                 if ($item->save($errors)) {
                     if (empty($_POST['id'])) {
                         // Evento Feed
                         $log = new Feed();
                         $log->populate('nueva micronoticia (admin)', '/admin/news', \vsprintf('El admin %s ha %s la micronoticia "%s"', array(Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id), Feed::item('relevant', 'Publicado'), Feed::item('news', $_POST['title'], '#news' . $item->id))));
                         $log->doAdmin('admin');
                         unset($log);
                     }
                     throw new Redirection($url);
                 } else {
                     Message::Error(implode('<br />', $errors));
                 }
             } else {
                 $item = $model::get($id);
             }
             return new View('view/admin/index.html.php', array('folder' => 'base', 'file' => 'edit', 'data' => $item, 'form' => array('action' => "{$url}/edit/{$id}", 'submit' => array('name' => 'update', 'label' => Text::get('regular-save')), 'fields' => array('id' => array('label' => '', 'name' => 'id', 'type' => 'hidden'), 'title' => array('label' => 'Noticia', 'name' => 'title', 'type' => 'text', 'properties' => 'size="100"  maxlength="80"'), 'description' => array('label' => 'Entradilla', 'name' => 'description', 'type' => 'textarea', 'properties' => 'cols="100" rows="2"'), 'url' => array('label' => 'Enlace', 'name' => 'url', 'type' => 'text', 'properties' => 'size=100'), 'order' => array('label' => 'Posición', 'name' => 'order', 'type' => 'text')))));
             break;
         case 'up':
             $model::up($id);
             break;
         case 'down':
             $model::down($id);
             break;
         case 'remove':
             $tempData = $model::get($id);
             if ($model::delete($id)) {
                 // Evento Feed
                 $log = new Feed();
                 $log->populate('micronoticia quitada (admin)', '/admin/news', \vsprintf('El admin %s ha %s la micronoticia "%s"', array(Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id), Feed::item('relevant', 'Quitado'), Feed::item('blog', $tempData->title))));
                 $log->doAdmin('admin');
                 unset($log);
                 throw new Redirection($url);
             }
             break;
     }
     return new View('view/admin/index.html.php', array('folder' => 'base', 'file' => 'list', 'model' => 'news', 'addbutton' => 'Nueva noticia', 'data' => $model::getAll(), 'columns' => array('edit' => '', 'title' => 'Noticia', 'order' => 'Posición', 'up' => '', 'down' => '', 'translate' => '', 'remove' => ''), 'url' => "{$url}"));
 }
Exemple #7
0
 public function save(&$errors = array())
 {
     if (!$this->validate($errors)) {
         return false;
     }
     try {
         $sql = "REPLACE INTO project_account (project, bank, bank_owner, paypal, paypal_owner, allowpp) VALUES(:project, :bank, :bank_owner, :paypal, :paypal_owner, :allowpp)";
         $values = array(':project' => $this->project, ':bank' => $this->bank, ':bank_owner' => $this->bank_owner, ':paypal' => $this->paypal, ':paypal_owner' => $this->paypal_owner, ':allowpp' => $this->allowpp);
         self::query($sql, $values);
         return true;
     } catch (\PDOException $e) {
         $errors[] = Text::_("Las cuentas no se han asignado correctamente. Por favor, revise los datos.") . $e->getMessage();
         return false;
     }
 }
Exemple #8
0
 public static function process($action = 'list', $id = null)
 {
     $model = 'Goteo\\Model\\Skill';
     $url = '/admin/skills';
     $errors = array();
     switch ($action) {
         case 'add':
             if (isset($_GET['word'])) {
                 $item = (object) array('name' => $_GET['word']);
             } else {
                 $item = (object) array();
             }
             $parent_skill = $model::getAllParent();
             return new View('view/admin/index.html.php', array('folder' => 'skills', 'file' => 'edit', 'data' => $item, 'parent_skill' => $parent_skill, 'form' => array('action' => "{$url}/edit/", 'submit' => array('name' => 'update', 'label' => Text::_('Añadir')), 'fields' => array('id' => array('label' => '', 'name' => 'id', 'type' => 'hidden'), 'name' => array('label' => Text::_('Skill'), 'name' => 'name', 'type' => 'text'), 'description' => array('label' => Text::_('Descripción'), 'name' => 'description', 'type' => 'textarea', 'properties' => 'cols="100" rows="2"')))));
             break;
         case 'edit':
             // gestionar post
             if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['update'])) {
                 // instancia
                 $item = new $model(array('id' => $_POST['id'], 'name' => $_POST['name'], 'description' => $_POST['description'], 'parent_skill_id' => $_POST['parent_skill_id']));
                 if ($item->save($errors)) {
                     throw new Redirection($url);
                 } else {
                     Message::Error(implode('<br />', $errors));
                 }
             } else {
                 $item = $model::get($id);
             }
             $parent_skill = $model::getAllParent();
             return new View('view/admin/index.html.php', array('folder' => 'skills', 'file' => 'edit', 'data' => $item, 'parent_skill' => $parent_skill, 'form' => array('action' => "{$url}/edit/{$id}", 'submit' => array('name' => 'update', 'label' => 'Guardar'), 'fields' => array('id' => array('label' => '', 'name' => 'id', 'type' => 'hidden'), 'name' => array('label' => 'Skill', 'name' => 'name', 'type' => 'text'), 'description' => array('label' => 'Descripción', 'name' => 'description', 'type' => 'textarea', 'properties' => 'cols="100" rows="2"')))));
             break;
         case 'up':
             $model::up($id);
             break;
         case 'down':
             $model::down($id);
             break;
         case 'remove':
             if ($model::delete($id)) {
                 throw new Redirection($url);
             }
             break;
         case 'keywords':
             return new View('view/admin/index.html.php', array('folder' => 'keywords', 'file' => 'list', 'skills' => $model::getList(), 'words' => $model::getKeyWords()));
             break;
     }
     return new View('view/admin/index.html.php', array('folder' => 'skills', 'file' => 'list', 'model' => 'skill', 'addbutton' => Text::_('New skill'), 'otherbutton' => '<a href="/admin/skills/keywords" class="button">' . Text::get('admin-skill_keyword') . '</a>', 'data' => $model::getAll(), 'columns' => array('edit' => '', 'name' => 'Skill', 'numProj' => 'Proyectos', 'numUser' => 'Usuarios', 'order' => 'Prioridad', 'translate' => '', 'up' => '', 'down' => '', 'translate' => '', 'remove' => ''), 'url' => "{$url}"));
 }
Exemple #9
0
 public static function process($action = 'list', $id = null, $filters = array())
 {
     // valores de filtro
     $groups = Text::groups();
     // metemos el todos
     \array_unshift($groups, Text::_('Todas las agrupaciones'));
     //@fixme temporal hasta pasar las agrupaciones a tabal o arreglar en el list.html.php
     // I dont know if this must serve in default lang or in current navigation lang
     $data = Text::getAll($filters, 'original');
     foreach ($data as $key => $item) {
         $data[$key]->group = $groups[$item->group];
     }
     switch ($action) {
         case 'list':
             return new View('view/admin/index.html.php', array('folder' => 'texts', 'file' => 'list', 'data' => $data, 'columns' => array('edit' => '', 'text' => Text::_('Texto'), 'group' => Text::_('Agrupación')), 'url' => '/admin/texts', 'filters' => array('filtered' => $filters['filtered'], 'group' => array('label' => Text::_('Filtrar por agrupación:'), 'type' => 'select', 'options' => $groups, 'value' => $filters['group']), 'text' => array('label' => Text::_('Buscar texto:'), 'type' => 'input', 'options' => null, 'value' => $filters['text']))));
             break;
         case 'edit':
             // gestionar post
             if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['update'])) {
                 $errors = array();
                 $id = $_POST['id'];
                 $text = $_POST['text'];
                 $data = array('id' => $id, 'text' => $_POST['text']);
                 if (Text::update($data, $errors)) {
                     Message::Info(Text::_('El texto ha sido actualizado'));
                     throw new Redirection("/admin/texts");
                 } else {
                     Message::Error(implode('<br />', $errors));
                 }
             } else {
                 //@TODO: this must get the text in the GOTEO_DEFAULT_LANG or it will be overwrited
                 $text = Text::getPurpose($id);
                 // Julian Canaves  23 nov 2013
                 // right now getPurpose gets the spanish text.
                 // In future this spanish text will be moved to the `Text` table
                 //  and the `Purpose` table will distribute to database text or to gettext
                 //  and there will be no hardcoded strings
                 //  and will be all happy, fun and joy
             }
             return new View('view/admin/index.html.php', array('folder' => 'texts', 'file' => 'edit', 'data' => (object) array('id' => $id, 'text' => $text), 'form' => array('action' => '/admin/texts/edit/' . $id, 'submit' => array('name' => 'update', 'label' => Text::_('Aplicar')), 'fields' => array('idtext' => array('label' => '', 'name' => 'id', 'type' => 'hidden', 'properties' => ''), 'newtext' => array('label' => Text::_('Texto'), 'name' => 'text', 'type' => 'textarea', 'properties' => 'cols="100" rows="6"')))));
             break;
         default:
             throw new Redirection("/admin");
     }
 }
Exemple #10
0
 public function index($post = null)
 {
     if (!empty($post)) {
         $show = 'post';
         // -- Mensaje azul molesto para usuarios no registrados
         if (empty($_SESSION['user'])) {
             $_SESSION['jumpto'] = '/blog/' . $post;
             Message::Info(Text::html('user-login-required'));
         }
     } else {
         $show = 'list';
     }
     // sacamos su blog
     $blog = Model\Blog::get(\GOTEO_NODE, 'node');
     $filters = array();
     if (isset($_GET['tag'])) {
         $tag = Model\Blog\Post\Tag::get($_GET['tag']);
         if (!empty($tag->id)) {
             $filters['tag'] = $tag->id;
         }
     } else {
         $tag = null;
     }
     if (isset($_GET['author'])) {
         $author = Model\User::getMini($_GET['author']);
         if (!empty($author->id)) {
             $filters['author'] = $author->id;
         }
     } else {
         $author = null;
     }
     if (!empty($filters)) {
         $blog->posts = Model\Blog\Post::getList($filters);
     }
     if (isset($post) && !isset($blog->posts[$post]) && $_GET['preview'] != $_SESSION['user']->id) {
         throw new \Goteo\Core\Redirection('/blog');
     }
     // segun eso montamos la vista
     return new View('view/blog/index.html.php', array('blog' => $blog, 'show' => $show, 'filters' => $filters, 'post' => $post, 'owner' => \GOTEO_NODE));
 }
Exemple #11
0
 public function post($post, $project = null)
 {
     if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['message'])) {
         $comment = new Model\Blog\Post\Comment(array('user' => $_SESSION['user']->id, 'post' => $post, 'date' => date('Y-m-d H:i:s'), 'text' => $_POST['message']));
         if ($comment->save($errors)) {
             // a ver los datos del post
             $postData = Model\Blog\Post::get($post);
             // Evento Feed
             $log = new Feed();
             if (!empty($project)) {
                 $projectData = Model\Project::getMini($project);
                 $log->setTarget($projectData->id);
                 $log_html = \vsprintf('%s ha escrito un %s en la entrada "%s" en las %s del proyecto %s', array(Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id), Feed::item('message', 'Comentario'), Feed::item('update-comment', $postData->title, $projectData->id . '/updates/' . $postData->id . '#comment' . $comment->id), Feed::item('update-comment', 'Novedades', $projectData->id . '/updates/'), Feed::item('project', $projectData->name, $projectData->id)));
             } else {
                 $log->setTarget('goteo', 'blog');
                 $log_html = \vsprintf('%s ha escrito un %s en la entrada "%s" del blog de %s', array(Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id), Feed::item('message', 'Comentario'), Feed::item('blog', $postData->title, $postData->id . '#comment' . $comment->id), Feed::item('blog', 'Goteo', '/')));
             }
             $log->populate('usuario escribe comentario en blog/novedades', '/admin/projects', $log_html);
             $log->doAdmin('user');
             // Evento público
             if (!empty($project)) {
                 $projectData = Model\Project::getMini($project);
                 $log_html = Text::html('feed-updates-comment', Feed::item('update-comment', $postData->title, $projectData->id . '/updates/' . $postData->id . '#comment' . $comment->id), Feed::item('update-comment', 'Novedades', $projectData->id . '/updates/'), Feed::item('project', $projectData->name, $projectData->id));
             } else {
                 $log_html = Text::html('feed-blog-comment', Feed::item('blog', $postData->title, $postData->id . '#comment' . $comment->id), Feed::item('blog', 'Goteo', '/'));
             }
             $log->populate($_SESSION['user']->name, '/user/profile/' . $_SESSION['user']->id, $log_html, $_SESSION['user']->avatar->id);
             $log->doPublic('community');
             unset($log);
             //Notificación al autor del proyecto
             // Obtenemos la plantilla para asunto y contenido
             $template = Template::get(31);
             // Sustituimos los datos
             $subject = str_replace('%PROJECTNAME%', $projectData->name, $template->title);
             $response_url = SITE_URL . '/user/profile/' . $_SESSION['user']->id . '/message';
             $project_url = SITE_URL . '/project/' . $projectData->id . '/updates/' . $postData->id . '#comment' . $comment->id;
             $search = array('%MESSAGE%', '%OWNERNAME%', '%USERNAME%', '%PROJECTNAME%', '%PROJECTURL%', '%RESPONSEURL%');
             $replace = array($_POST['message'], $projectData->user->name, $_SESSION['user']->name, $projectData->name, $project_url, $response_url);
             $content = \str_replace($search, $replace, $template->text);
             $mailHandler = new Mail();
             $mailHandler->to = $projectData->user->email;
             $mailHandler->toName = $projectData->user->name;
             $mailHandler->subject = $subject;
             $mailHandler->content = $content;
             $mailHandler->html = true;
             $mailHandler->template = $template->id;
             $mailHandler->send($errors);
             unset($mailHandler);
         } else {
             // error
         }
     }
     if (!empty($project)) {
         throw new Redirection("/project/{$project}/updates/{$post}#comment" . $comment->id, Redirection::TEMPORARY);
     } else {
         throw new Redirection("/blog/{$post}#comment" . $comment->id, Redirection::TEMPORARY);
     }
 }
Exemple #12
0
        ?>
</div>
            <?php 
    }
} else {
    ?>
            <div class="subhead-banner"><?php 
    echo Text::html('main-banner-header');
    ?>
</div>
            <?php 
}
?>
        </div>
        <div class="mod-pojctopen"><?php 
echo Text::html('open-banner-header', $fbCode);
?>
</div>
    </div>
    <div class="sliderbanners-ctrl">
        <a class="prev">prev</a>
        <ul class="paginacion"></ul>
        <a class="next">next</a>
    </div>
</div>

<?php 
if (isset($_SESSION['messages'])) {
    include 'view/header/message.html.php';
}
?>
Exemple #13
0
        $title   = Text::get('regular-hello') . " $name";
//        $message = Text::get('project-invest-login');
        break;
    case 'confirm':
        $title   = Text::get('regular-hello') . " $name";
//        $message = Text::get('project-invest-confirm');
        break;
    case 'continue':
        $title   = Text::get('regular-hello') . " $name";
//        $message = Text::get('project-invest-continue');
        break;
    case 'ok':
        $title   = Text::get('regular-thanks') . " {$name}!";
//        $message = Text::get('project-invest-ok');
        break;
    case 'fail':
        $title   = Text::get('regular-sorry') . " {$name}";
//        $message = Text::get('project-invest-fail');
        break;
}

$level = (int) $this['level'] ?: 3;

?>
<div class="widget invest-message">
    <h2><?php echo $avatarhtml; ?><span><?php echo $title; ?></span><?/*<br />
    <span class="message"><?php echo $message; ?></span></h2>*/?>


</div>
Exemple #14
0
        ?>
                        <li><a href="/admin"><span><?php 
        echo Text::get('regular-admin_board');
        ?>
</span></a></li>
                        <?php 
    }
    ?>
                        <li class="logout"><a href="/user/logout"><span><?php 
    echo Text::get('regular-logout');
    ?>
</span></a></li>
                    </ul>
                </div>
            </li>            
            <?php 
} else {
    ?>
            
            <li class="login">
                <a href="/user/login"><?php 
    echo Text::get('regular-login');
    ?>
</a>
            </li>
            
            <?php 
}
?>
        </ul>
    </div>
Exemple #15
0
                    <select id="orig-lang" name="lang">
                        <?php 
foreach ($langs as $item) {
    ?>
                            <option value="<?php 
    echo $item->id;
    ?>
"<?php 
    if ($project->lang == $item->id || empty($project->lang) && $item->id == 'es') {
        echo ' selected="selected"';
    }
    ?>
><?php 
    echo $item->name;
    ?>
</option>
                        <?php 
}
?>
                    </select>
                </td>
            </tr>
        </table>


       <input type="submit" name="save" value="<?php 
echo Text::_("Guardar");
?>
" />
    </form>
</div>
Exemple #16
0
        <p>
            <label for="faq-order"><?php 
echo Text::_("Posición");
?>
:</label><br />
            <select name="move">
                <option value="same" selected="selected" disabled><?php 
echo Text::_("Tal cual");
?>
</option>
                <option value="up"><?php 
echo Text::_("Antes de ");
?>
</option>
                <option value="down"><?php 
echo Text::_("Después de ");
?>
</option>
            </select>&nbsp;
            <input type="text" name="order" id="faq-order" value="<?php 
echo $this['faq']->order;
?>
" size="4" />
            &nbsp;de&nbsp;<span id="faq-num"><?php 
echo $this['faq']->cuantos;
?>
</span>
        </p>


        <input type="submit" name="save" value="Guardar" />
Exemple #17
0
    }
    ?>
                <div class="description"><?php 
    if ($post->id == 728) {
        echo Text::recorta($post->text, 400);
    } else {
        echo Text::recorta($post->text, 600);
    }
    ?>
</div>

                <div class="read_more"><a href="<?php 
    echo $post->owner_type == 'project' ? '/project/' . $post->owner_id . '/updates/' . $post->id : '/blog/' . $post->id;
    ?>
"><?php 
    echo Text::get('regular-read_more');
    ?>
</a></div>
            </div>
        </div>
        <?php 
    $i++;
}
?>
    </div>
    <a class="prev">prev</a>
    <ul class="slderpag">
        <?php 
$i = 1;
foreach ($posts as $post) {
    ?>
Exemple #18
0
                    <ul>
                    <?php 
                    $cnt = 1;
                    foreach ($sharemates as $mate) :
                        if (empty($this['category']) && $cnt > 6) break;
                    ?>
                        <li class="<?php if($cnt < 3) echo " bordertop"?>">
                            <div class="user">
                                <a href="/user/<?php echo htmlspecialchars($mate->user) ?>" class="expand">&nbsp;</a>
                                <div class="avatar"><a href="/user/<?php echo htmlspecialchars($mate->user) ?>"><img src="<?php echo $mate->avatar->getLink(43, 43, true) ?>" /></a></div>
                                <h4><a href="/user/<?php echo htmlspecialchars($mate->user) ?>"><?php echo htmlspecialchars($mate->name) ?></a></h4>
                                <span class="projects"><?php echo Text::get('regular-projects'); ?> (<?php echo $mate->projects ?>)</span>
                                <span class="invests"><?php echo Text::get('regular-investing'); ?> (<?php echo $mate->invests ?>)</span><br/>
                                <span class="profile"><a href="/user/profile/<?php echo htmlspecialchars($mate->user) ?>"><?php echo Text::get('profile-widget-button'); ?></a> </span>
                                <span class="contact"><a href="/user/profile/<?php echo htmlspecialchars($mate->user) ?>/message"><?php echo Text::get('regular-send_message'); ?></a></span>
                            </div>
                        </li>
                    <?php 
                    $cnt ++;
                    endforeach; ?>
                    </ul>
                </div>
        <?php if (empty($this['category'])) : ?>
            <a class="more" href="/community/sharemates/<?php echo $catId ?>"><?php echo Text::get('regular-see_more'); ?></a>
        <?php else : ?>
            <a class="more" href="/community/sharemates"><?php echo Text::get('regular-see_all'); ?></a>
        <?php endif; ?>
        </div>
        <?php endforeach; ?>
        <!-- fin detalle de categoría (cabecera de categoría) -->
Exemple #19
0
 public static function _types()
 {
     return array('description' => Text::_('Descripción'), 'url' => Text::_('Enlace'), 'name' => Text::_('Nombre'), 'text' => Text::_('Texto extenso'), 'legend' => Text::_('Leyenda'), 'title' => Text::_('Título'));
 }
Exemple #20
0
            if ($project->status > 2) {
                ?>
                      <div id="widget-code" style="float:none;width:250px;margin-left:25px;">
                          <div class="wc-embed" onclick="$('#widget_code').focus();$('#widget_code').select()"><?php 
                echo Text::get('dashboard-embed_code');
                ?>
</div>
                        <textarea id="widget_code" style="width:230px;margin:0 0 10px;" onclick="this.focus();this.select()" readonly="readonly"><?php 
                echo htmlentities($widget_code);
                ?>
</textarea>
                      </div>

                      <div id="widget-code" style="float:none;width:250px;margin-left:25px;">
                        <div class="wc-embed" onclick="$('#investor_code').focus();$('#investor_code').select()"><?php 
                echo Text::get('dashboard-embed_code_investor');
                ?>
</div>
                        <textarea id="investor_code" style="width:230px;margin:0 0 10px;" onclick="this.focus();this.select()" readonly="readonly"><?php 
                echo htmlentities($widget_code_investor);
                ?>
</textarea>
                      </div>
                <?php 
            }
            ?>
                </div>
                <?php 
        }
        ?>
Exemple #21
0
 /**
  *  Genera codigo html para feed público
  *
  *  segun tenga imagen, ebnlace, titulo, tipo de enlace
  *
  */
 public static function subItem($item)
 {
     $pub_timeago = Text::get('feed-timeago-published', $item->timeago);
     $content = '<div class="subitem">';
     // si enlace -> título como texto del enlace
     if (!empty($item->url)) {
         // si imagen -> segun enlace:
         if (!empty($item->image)) {
             if (substr($item->url, 0, 5) == '/user') {
                 $content .= '<div class="content-avatar">
                     <a href="' . $item->url . '" class="avatar"><img src="' . SRC_URL . '/image/' . $item->image . '/32/32/1" /></a>
                     <a href="' . $item->url . '" class="username">' . $item->title . '</a>
                     <span class="datepub">' . $pub_timeago . '</span>
                     </div>';
             } else {
                 $content .= '<div class="content-image">
                     <a href="' . $item->url . '" class="image"><img src="' . SRC_URL . '/image/' . $item->image . '/90/60/1" /></a>
                     <a href="' . $item->url . '" class="project light-blue">' . $item->title . '</a>
                     <span class="datepub">' . $pub_timeago . '</span>
                     </div>';
             }
         } else {
             // solo titulo con enlace
             $content .= '<div class="content-title">
                     <h5 class="light-blue"><a href="' . $item->url . '" class="project light-blue">' . $item->title . '</a></h5>
                     <span class="datepub">' . $pub_timeago . '</span>
                </div>';
         }
     } else {
         // solo el timeago
         $content .= '<span class="datepub">' . $pub_timeago . '</span>';
     }
     // y lo que venga en el html
     $content .= '<div class="content-pub">' . $item->html . '</div>';
     $content .= '</div>';
     return $content;
 }
Exemple #22
0
        <?php 
    }
    ?>
    <?php 
} else {
    ?>
        <p><?php 
    echo Text::get('form-errors-total', $total_errors);
    ?>
</p>
        <?php 
    foreach ($project->errors as $st => $errors) {
        if (!empty($errors)) {
            ?>
            <h4 class="title"><?php 
            echo Text::get('step-' . $st);
            ?>
</h4>
            <ul class="sf-footer-errors">
            <?php 
            foreach ($errors as $id => $error) {
                ?>
                <li><?php 
                echo $error;
                ?>
</li>
            <?php 
            }
            ?>
            </ul>
        <?php 
Exemple #23
0
    'type'      => 'group',
    'children'  => array(
        'errors' => array(
            'title' => Text::get('form-footer-errors_title'),
            'view'  => new View('view/project/edit/errors.html.php', array(
                'project'   => $project,
                'step'      => $this['step']
            ))                    
        ),
        'buttons'  => array(
            'type'  => 'group',
            'children' => array(
                'next' => array(
                    'type'  => 'submit',
                    'name'  => 'view-step-costs',
                    'label' => Text::get('form-next-button'),
                    'class' => 'next'
                )
            )
        )
    )
);

foreach ($superform['elements'] as $id => &$element) {
    
    if (!empty($this['errors'][$this['step']][$id])) {
        $element['errors'] = arrray();
    }
    
}
Exemple #24
0
        <input type="hidden" name="group" value="<?php 
echo $this['template']->group;
?>
" />
        <p>
            <label for="tpltitle"><?php 
echo Text::_('Título');
?>
:</label><br />
            <input id="tpltitle" type="text" name="title" size="120" value="<?php 
echo $this['template']->title;
?>
" />
        </p>

        <p>
            <label for="tpltext"><?php 
echo Text::_('Contenido');
?>
:</label><br />
            <textarea id="tpltext" name="text" cols="100" rows="20"><?php 
echo $this['template']->text;
?>
</textarea>
        </p>
        <input type="submit" name="save" value="<?php 
echo Text::_('Guardar');
?>
" />
    </form>
</div>
Exemple #25
0
                    <td width="<?php 
                echo round($per) - 5;
                ?>
%"><?php 
                echo is_object($item) ? $item->{$key} : $item[$key];
                ?>
</td>
                <?php 
            }
            ?>
            <?php 
        }
        ?>
            </tr>
        <?php 
    }
    ?>
        </tbody>
    </table>
    <?php 
} else {
    ?>
    <p><?php 
    echo Text::_("No se han encontrado registros");
    ?>
</p>
    <?php 
}
?>
</div>
Exemple #26
0
                </script>
                <div id="bocadillo"></div>
                <input type="hidden" name="username" value="<?php 
    echo $investData->user->name;
    ?>
" />
                <textarea rows="5" cols="50" name="message" id="message"></textarea>
                <a class="preview" href="#preview" id="a-preview" target="_blank"><?php 
    echo Text::get('regular-preview');
    ?>
</a>
                <div style="display:none">
                    <div style="width:400px;height:300px;overflow:auto;" id="preview"></div>
                </div>
                <button type="submit" class="green"><?php 
    echo Text::get('project-messages-send_message-button');
    ?>
</button>
            </div>
        </form>
    </div>

<?php 
}
?>
<script type="text/javascript">
    function msgto(reward) {
        document.getElementById('msg_reward-'+reward).checked = 'checked';
        document.location.href = '#message';
        $("#message").focus();
    }
Exemple #27
0
                <?php 
        }
        ?>
                <td><a href="/admin/criteria/remove/<?php 
        echo $criteria->id;
        ?>
" onclick="return confirm('<?php 
        echo Text::_("Seguro que deseas eliminar este registro?");
        ?>
');">[<?php 
        echo Text::_("Quitar");
        ?>
]</a></td>
            </tr>
            <?php 
    }
    ?>
        </tbody>

    </table>
    <?php 
} else {
    ?>
    <p><?php 
    echo Text::_('No se han encontrado registros');
    ?>
</p>
    <?php 
}
?>
</div>
Exemple #28
0
 *  along with Goteo.  If not, see <http://www.gnu.org/licenses/agpl.txt>.
 *
 */

use Goteo\Library\Text;

$bodyClass = 'admin';

// no cache para textos
define('GOTEO_ADMIN_NOCACHE', true);

$text = new stdClass();

$text->id = $this['id'];
$text->purpose = Text::getPurpose($this['id']);
$text->text = Text::getTrans($this['id']);

?>
<div class="widget board">
    <fieldset>
        <legend>Texto en español</legend>
        <blockquote><?php echo htmlentities(utf8_decode($text->purpose)); ?></blockquote>
    </fieldset>

    <form action="/translate/texts/edit/<?php echo $text->id ?>/<?php echo $this['filter'] . '&page=' . $_GET['page'] ?>" method="post" >
        <input type="hidden" name="lang" value="<?php echo $_SESSION['trancelate_lang'] ?>" />
        <textarea name="text" cols="100" rows="10"><?php echo $text->text; ?></textarea><br />
        <input type="submit" name="save" value="Guardar" />

    </form>
</div>
Exemple #29
0
" class="navi-discover-group navi-discover-group-<?php 
        echo $type;
        ?>
"><?php 
        echo $group;
        ?>
</a></li>
                    <?php 
    }
    ?>
                </ul>
                <a class="all" href="/discover/view/<?php 
    echo $type;
    ?>
"><?php 
    echo Text::get('regular-see_all');
    ?>
</a>
            </div>


        </div>

    <?php 
}
?>

    </div>

    <?php 
include 'view/footer.html.php';
Exemple #30
0
 public static function process($action = 'list', $id = null, $filters = array())
 {
     switch ($action) {
         case 'fulfill':
             $sql = "UPDATE invest_reward SET fulfilled = 1 WHERE invest = ?";
             if (Model\Invest::query($sql, array($id))) {
                 Message::Info(Text::get('admin-rewards-info-status-completed'));
             } else {
                 Message::Error(Text::get('admin-rewards-error-statuschage-fail'));
             }
             throw new Redirection('/admin/rewards');
             break;
         case 'unfill':
             $sql = "UPDATE invest_reward SET fulfilled = 0 WHERE invest = ?";
             if (Model\Invest::query($sql, array($id))) {
                 Message::Info(Text::get('admin-rewards-info-status-completed-pending'));
             } else {
                 message::Error('Ha fallado al desmarcar');
             }
             throw new Redirection('/admin/rewards');
             break;
     }
     // edicion
     if ($action == 'edit' && !empty($id)) {
         $invest = Model\Invest::get($id);
         $projectData = Model\Project::get($invest->project);
         $userData = Model\User::getMini($invest->user);
         $status = Model\Project::status();
         // si tratando post
         if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['update'])) {
             $errors = array();
             // la recompensa:
             $chosen = $_POST['selected_reward'];
             if (empty($chosen)) {
                 // renuncia a las recompensas, bien por el/ella!
                 $invest->rewards = array();
             } else {
                 $invest->rewards = array($chosen);
             }
             $invest->anonymous = $_POST['anonymous'];
             // dirección de envio para la recompensa
             // y datos fiscales por si fuera donativo
             $invest->address = (object) array('name' => $_POST['name'], 'nif' => $_POST['nif'], 'address' => $_POST['address'], 'zipcode' => $_POST['zipcode'], 'location' => $_POST['location'], 'country' => $_POST['country']);
             if ($invest->update($errors)) {
                 Message::Info(Text::get('admin-rewards-info-update'));
                 throw new Redirection('/admin/rewards');
             } else {
                 Message::Error('No se han actualizado correctamente los datos del aporte. ERROR: ' . implode(', ', $errors));
             }
         }
         return new View('view/admin/index.html.php', array('folder' => 'rewards', 'file' => 'edit', 'invest' => $invest, 'project' => $projectData, 'user' => $userData, 'status' => $status));
     }
     // listado de proyectos
     $projects = Model\Invest::projects();
     $status = array('nok' => Text::_("Pendiente"), 'ok' => Text::_("Cumplida"));
     // listado de aportes
     if ($filters['filtered'] == 'yes') {
         $list = Model\Project\Reward::getChossen($filters);
     } else {
         $list = array();
     }
     return new View('view/admin/index.html.php', array('folder' => 'rewards', 'file' => 'list', 'list' => $list, 'filters' => $filters, 'projects' => $projects, 'status' => $status));
 }