示例#1
0
文件: news.php 项目: isbkch/Goteo
 public static function getAll($highlights = false)
 {
     $list = array();
     $sql = static::query("\n                SELECT\n                    news.id as id,\n                    IFNULL(news_lang.title, news.title) as title,\n                    IFNULL(news_lang.description, news.description) as description,\n                    news.url as url,\n                    news.order as `order`\n                FROM news\n                LEFT JOIN news_lang\n                    ON  news_lang.id = news.id\n                    AND news_lang.lang = :lang\n                ORDER BY `order` ASC, title ASC\n                ", array(':lang' => \LANG));
     foreach ($sql->fetchAll(\PDO::FETCH_CLASS, __CLASS__) as $item) {
         if ($highlights) {
             $item->title = Text::recorta($item->title, 80);
         }
         $list[] = $item;
     }
     return $list;
 }
示例#2
0
 public static function getAll($activeonly = false, $node = \GOTEO_NODE)
 {
     // estados
     $status = Project::status();
     $promos = array();
     $sqlFilter = $activeonly ? " AND promote.active = 1" : '';
     $query = static::query("\n                SELECT\n                    promote.id as id,\n                    promote.project as project,\n                    project.name as name,\n                    project.status as status,\n                    IFNULL(promote_lang.title, promote.title) as title,\n                    IFNULL(promote_lang.description, promote.description) as description,\n                    promote.order as `order`,\n                    promote.active as `active`\n                FROM    promote\n                LEFT JOIN promote_lang\n                    ON promote_lang.id = promote.id\n                    AND promote_lang.lang = :lang\n                INNER JOIN project\n                    ON project.id = promote.project\n                WHERE promote.node = :node\n                {$sqlFilter}\n                ORDER BY `order` ASC, title ASC\n                ", array(':node' => $node, ':lang' => \LANG));
     foreach ($query->fetchAll(\PDO::FETCH_CLASS, __CLASS__) as $promo) {
         $promo->description = Text::recorta($promo->description, 100, false);
         $promo->status = $status[$promo->status];
         $promos[] = $promo;
     }
     return $promos;
 }
示例#3
0
文件: list.html.php 项目: kenjs/Goteo
]</a></td>
                <td><a href="/admin/users/manage/<?php 
        echo $reward->user;
        ?>
" target="_blank" title="<?php 
        echo $reward->name;
        ?>
"><?php 
        echo $reward->email;
        ?>
</a></td>
                <td><a href="/admin/projects/?name=<?php 
        echo $this['projects'][$reward->project];
        ?>
" target="_blank"><?php 
        echo Text::recorta($this['projects'][$reward->project], 20);
        if (!empty($invest->campaign)) {
            echo '<br />(' . $this['calls'][$invest->campaign] . ')';
        }
        ?>
</a></td>
                <td><?php 
        echo $reward->reward_name;
        ?>
</td>
                <?php 
        if (!$reward->fulfilled) {
            ?>
                    <td style="color: red;" ><?php 
            echo Text::_('Pendiente');
            ?>
示例#4
0
                    <li><a href="/glossary"><?php 
echo Text::get('footer-resources-glossary');
?>
</a></li>
                    <li><a href="/press"><?php 
echo Text::get('footer-resources-press');
?>
</a></li>
                    <?php 
foreach ($posts as $id => $title) {
    ?>
                    <li><a href="/blog/<?php 
    echo $id;
    ?>
"><?php 
    echo Text::recorta($title, 50);
    ?>
</a></li>
                    <?php 
}
?>
                    <li><a href="https://github.com/Goteo/Goteo" target="_blank"><?php 
echo Text::get('footer-resources-source_code');
?>
</a></li>
                </ul>
            </div>
			<script type="text/javascript">
				$(function(){
					$('#slides_sponsor').slides({
						container: 'slides_container',
示例#5
0
文件: blog.php 项目: kenjs/Goteo
 public static function process($action = 'list', $id = null, $filters = array())
 {
     $errors = array();
     $node = empty($_SESSION['admin_node']) ? \GOTEO_NODE : $_SESSION['admin_node'];
     $blog = Model\Blog::get($node, 'node');
     if (!$blog instanceof \Goteo\Model\Blog) {
         $blog = new Model\Blog(array('type' => 'node', 'owner' => $node, 'active' => 1));
         if ($blog->save($errors)) {
             Message::Info(Text::get('admin-blog-info-initialize'));
         } else {
             Message::Error(Text::get('admin-blog-error-initialize'));
             throw new Redirection('/admin');
         }
     } elseif (!$blog->active) {
         Message::Error(Text::get('admin-blog-error-no_blog'));
         throw new Redirection('/admin');
     }
     // primero comprobar que tenemos blog
     if (!$blog instanceof Model\Blog) {
         Message::Error(Text::get('admin-blog-error-not_found'));
         throw new Redirection('/admin');
     }
     $url = '/admin/blog';
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         if (empty($_POST['blog'])) {
             Message::Error(Text::get('admin-blog-error_missing_blog'));
             break;
         }
         $editing = false;
         if (!empty($_POST['id'])) {
             $post = Model\Blog\Post::get($_POST['id']);
         } else {
             $post = new Model\Blog\Post();
         }
         // campos que actualizamos
         $fields = array('id', 'blog', 'title', 'text', 'image', 'media', 'legend', 'date', 'publish', 'home', 'footer', 'allow', 'author');
         foreach ($fields as $field) {
             $post->{$field} = $_POST[$field];
         }
         // tratar la imagen y ponerla en la propiedad image
         if (!empty($_FILES['image_upload']['name'])) {
             $post->image = $_FILES['image_upload'];
             $editing = true;
         }
         // tratar las imagenes que quitan
         foreach ($post->gallery as $key => $image) {
             if (!empty($_POST["gallery-{$image->id}-remove"])) {
                 $image->remove('post');
                 unset($post->gallery[$key]);
                 if ($post->image == $image->id) {
                     $post->image = '';
                 }
                 $editing = true;
             }
         }
         if (!empty($post->media)) {
             $post->media = new Model\Project\Media($post->media);
         }
         $post->tags = $_POST['tags'];
         // si tenemos un nuevio tag hay que añadirlo
         if (!empty($_POST['new-tag_save']) && !empty($_POST['new-tag'])) {
             // grabar el tag en la tabla de tag,
             $new_tag = new Model\Blog\Post\Tag(array('id' => '', 'name' => $_POST['new-tag']));
             if ($new_tag->save($errors)) {
                 $post->tags[] = $new_tag->id;
                 // asignar al post
             } else {
                 Message::Error(implode('<br />', $errors));
             }
             $editing = true;
             // seguir editando
         }
         /// este es el único save que se lanza desde un metodo process_
         if ($post->save($errors)) {
             if ($action == 'edit') {
                 Message::Info(Text::get('admin-blog-info-updates-saved'));
             } else {
                 Message::Info(Text::get('admin-blog-info-add_new'));
                 $id = $post->id;
             }
             $action = $editing ? 'edit' : 'list';
             if ((bool) $post->publish) {
                 // Evento Feed
                 $log = new Feed();
                 $log->setTarget('goteo', 'blog');
                 $log->populate('nueva entrada blog Goteo (admin)', '/admin/blog', \vsprintf('El admin %s ha %s en el blog Goteo la entrada "%s"', array(Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id), Feed::item('relevant', 'Publicado'), Feed::item('blog', $post->title, $post->id))));
                 $log->doAdmin('admin');
                 // evento público
                 $log->unique = true;
                 $log->populate($post->title, '/blog/' . $post->id, Text::recorta($post->text, 250), $post->gallery[0]->id);
                 $log->doPublic('goteo');
                 unset($log);
             } else {
                 //sino lo quitamos
                 \Goteo\Core\Model::query("DELETE FROM feed WHERE url = '/blog/{$post->id}' AND scope = 'public' AND type = 'goteo'");
             }
         } else {
             Message::Error(Text::get('admin-blog-error-save-fail') . ':<br />' . \implode('<br />', $errors));
         }
     }
     switch ($action) {
         case 'list':
             // lista de entradas
             // obtenemos los datos
             $filters['node'] = $node;
             $show = array('all' => 'Todas las entradas existentes', 'published' => 'Solamente las publicadas en el blog', 'owned' => 'Solamente las del propio nodo', 'home' => 'Solamente las de portada', 'entries' => 'Solamente las de cierto nodo', 'updates' => 'Solamente las de proyectos');
             // filtro de blogs de proyectos/nodos
             switch ($filters['show']) {
                 case 'updates':
                     $blogs = Model\Blog::getListProj();
                     break;
                 case 'entries':
                     $blogs = Model\Blog::getListNode();
                     break;
             }
             if (!in_array($filters['show'], array('entries', 'updates')) || !isset($blogs[$filters['blog']])) {
                 unset($filters['blog']);
             }
             $posts = Model\Blog\Post::getList($filters, false);
             $homes = Model\Post::getList('home', $node);
             $footers = Model\Post::getList('footer', $node);
             if ($node == \GOTEO_NODE) {
                 $show['footer'] = 'Solamente las del footer';
             }
             return new View('view/admin/index.html.php', array('folder' => 'blog', 'file' => 'list', 'posts' => $posts, 'filters' => $filters, 'show' => $show, 'blogs' => $blogs, 'homes' => $homes, 'footers' => $footers, 'node' => $node));
             break;
         case 'add':
             // nueva entrada con wisiwig
             // obtenemos datos basicos
             $post = new Model\Blog\Post(array('blog' => $blog->id, 'date' => date('Y-m-d'), 'publish' => false, 'allow' => true, 'tags' => array(), 'author' => $_SESSION['user']->id));
             $message = 'Añadiendo una nueva entrada';
             return new View('view/admin/index.html.php', array('folder' => 'blog', 'file' => 'edit', 'action' => 'add', 'post' => $post, 'tags' => Model\Blog\Post\Tag::getAll(), 'message' => $message));
             break;
         case 'edit':
             if (empty($id)) {
                 Message::Error(Text::get('admin-blog-error-nopost'));
                 throw new Redirection('/admin/blog');
                 break;
             } else {
                 $post = Model\Blog\Post::get($id);
                 if (!$post instanceof Model\Blog\Post) {
                     Message::Error(Text::get('admin-blog-error-break_entry'));
                     $action = 'list';
                     break;
                 } elseif ($node != \GOTEO_NODE && $post->owner_type == 'node' && $post->owner_id != $node) {
                     Message::Error(Text::get('admin-blog-error-noedit'));
                     throw new Redirection('/admin/blog/list');
                 }
             }
             $message = 'Editando una entrada existente';
             return new View('view/admin/index.html.php', array('folder' => 'blog', 'file' => 'edit', 'action' => 'edit', 'post' => $post, 'tags' => Model\Blog\Post\Tag::getAll(), 'message' => $message));
             break;
         case 'remove':
             // eliminar una entrada
             $tempData = Model\Blog\Post::get($id);
             if ($node != \GOTEO_NODE && $tempData->owner_type == 'node' && $tempData->owner_id != $node) {
                 Message::Error(Text::get('admin-blog-error-nodelete'));
                 throw new Redirection('/admin/blog');
             }
             if (Model\Blog\Post::delete($id)) {
                 // Evento Feed
                 $log = new Feed();
                 $log->setTarget('goteo', 'blog');
                 $log->populate('Quita entrada de blog (admin)', '/admin/blog', \vsprintf('El admin %s ha %s la entrada "%s" del blog de Goteo', array(Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id), Feed::item('relevant', 'Quitado'), Feed::item('blog', $tempData->title))));
                 $log->doAdmin('admin');
                 unset($log);
                 Message::Info(Text::get('admin-blog-info-deleted_entry'));
             } else {
                 Message::Error(Text::get('admin-blog-error-delete-fail'));
             }
             throw new Redirection('/admin/blog/list');
             break;
             // acciones portada
         // acciones portada
         case 'reorder':
             // lista de entradas en portada
             // obtenemos los datos
             $posts = Model\Post::getAll('home', $node);
             return new View('view/admin/index.html.php', array('folder' => 'blog', 'file' => 'order', 'posts' => $posts));
             break;
         case 'up':
             if ($node != \GOTEO_NODE) {
                 Model\Post::up_node($id, $node);
             } else {
                 Model\Post::up($id, 'home');
             }
             throw new Redirection('/admin/blog/reorder');
             break;
         case 'down':
             if ($node != \GOTEO_NODE) {
                 Model\Post::up_node($id, $node);
             } else {
                 Model\Post::down($id, 'home');
             }
             throw new Redirection('/admin/blog/reorder');
             break;
         case 'add_home':
             // siguiente orden
             if ($node != \GOTEO_NODE) {
                 $next = Model\Post::next_node($node);
                 $data = (object) array('post' => $id, 'node' => $node, 'order' => $next);
                 if (Model\Post::update_node($data, $errors)) {
                     Message::Info(Text::get('admin-blog-info-add-home'));
                 } else {
                     Message::Error(Text::get('admin-blog-error-any-problem') . ':<br />' . \implode('<br />', $errors));
                 }
             } else {
                 $next = Model\Post::next('home');
                 $post = new Model\Post(array('id' => $id, 'order' => $next, 'home' => 1));
                 if ($post->update($errors)) {
                     Message::Info(Text::get('admin-blog-info-add-home'));
                 } else {
                     Message::Error(Text::get('admin-blog-error-any-problem') . ':<br />' . \implode('<br />', $errors));
                 }
             }
             throw new Redirection('/admin/blog/list');
             break;
         case 'remove_home':
             // se quita de la portada solamente
             $ok = false;
             if ($node != \GOTEO_NODE) {
                 $ok = Model\Post::remove_node($id, $node);
             } else {
                 $ok = Model\Post::remove($id, 'home');
             }
             if ($ok) {
                 Message::Info(Text::get('admin-blog-info-removecover'));
             } else {
                 Message::Error(Text::get('admin-blog-error-cover-deletefail'));
             }
             throw new Redirection('/admin/blog/list');
             break;
             // acciones footer (solo para superadmin y admins de goteo
         // acciones footer (solo para superadmin y admins de goteo
         case 'footer':
             if ($node == \GOTEO_NODE) {
                 // lista de entradas en el footer
                 // obtenemos los datos
                 $posts = Model\Post::getAll('footer');
                 return new View('view/admin/index.html.php', array('folder' => 'blog', 'file' => 'footer', 'posts' => $posts));
             } else {
                 throw new Redirection('/admin/blog/list');
             }
             break;
         case 'up_footer':
             if ($node == \GOTEO_NODE) {
                 Model\Post::up($id, 'footer');
                 throw new Redirection('/admin/blog/footer');
             } else {
                 throw new Redirection('/admin/blog');
             }
             break;
         case 'down_footer':
             if ($node == \GOTEO_NODE) {
                 Model\Post::down($id, 'footer');
                 throw new Redirection('/admin/blog/footer');
             } else {
                 throw new Redirection('/admin/blog');
             }
             break;
         case 'add_footer':
             if ($node == \GOTEO_NODE) {
                 // siguiente orden
                 $next = Model\Post::next('footer');
                 $post = new Model\Post(array('id' => $id, 'order' => $next, 'footer' => 1));
                 if ($post->update($errors)) {
                     Message::Info(Text::get('admin-blog-info-footer-complete'));
                 } else {
                     Message::Error(Text::get('admin-blog-error-any-problem') . ':<br />' . \implode('<br />', $errors));
                 }
             }
             throw new Redirection('/admin/blog');
             break;
         case 'remove_footer':
             if ($node == \GOTEO_NODE) {
                 // se quita del footer solamente
                 if (Model\Post::remove($id, 'footer')) {
                     Message::Info(Text::get('admin-blog-info-footer-delete'));
                 } else {
                     Message::Error(Text::get('admin-blog-error-footer-deletefail'));
                 }
             }
             throw new Redirection('/admin/blog/list');
             break;
     }
 }
示例#6
0
文件: list.html.php 项目: kenjs/Goteo
    <table>
        <thead>
            <tr>
                <th></th>
                <th>Texto</th>
                <th>Campo</th>
                <th>Id</th>
                <?php if ($table == 'post') echo '<th></th>'; ?>
            </tr>
        </thead>

        <tbody>
        <?php while ($item = $pagedResults->fetchPagedRow()) : ?>
            <tr>
                <td width="5%"><a title="Registro <?php echo $item->id ?>" href='/translate/<?php echo $table ?>/edit/<?php echo $item->id . $filter . '&page=' . $_GET['page'] ?>'>[Edit]</a></td>
                <td width="75%"><?php if ($item->pendiente == 1) echo '* '; ?><?php echo Text::recorta($item->value, 250) ?></td>
                <td><?php echo $item->fieldName ?></td>
                <td><?php echo $item->id ?></td>
                <?php if ($table == 'post') : ?>
                <td><a href="/blog/<?php echo $item->id; ?>?preview=<?php echo $_SESSION['user']->id ?>" target="_blank">[Ver]</a></td>
                <?php endif; ?>
            </tr>
        <?php endwhile; ?>
        </tbody>
    </table>
</div>
    <ul id="pagination">
        <?php   $pagedResults->setLayout(new DoubleBarLayout());
                echo $pagedResults->fetchPagedNavigation(str_replace('?', '&', $filter)); ?>
    </ul>
<?php else : ?>
示例#7
0
?>
<div class="supporterContainer">
	<?php if ($user->campaign) : ?>
	<a class="expand" href="/call/<?php echo $user->call ?>" target="_blank">&nbsp;</a>
	<?php elseif ($user->user != 'anonymous') : ?>
	<a class="expand" href="/user/<?php echo htmlspecialchars($user->user) ?>">&nbsp;</a>
	<?php endif; ?>
    <?php if ($user->droped || $user->campaign) : ?>
    <div class="droped">&nbsp;</div>
    <?php endif; ?>
	<div class="supporter">
		<span class="avatar"><img src="<?php echo $user->avatar->getLink(43, 43, true); ?>" /></span>
	    <?php if ($user->user == 'anonymous') : ?>
	    <h4><?php echo $user->name; ?></h4>
	    <?php else : ?>
	    <h4 class="aqua"<?php if ($user->campaign) echo 'style="color: #96238F;"'; ?>><?php echo Text::recorta($user->name,40); ?></h4>
	    <?php endif; ?>
	    <dl>
	        
	        <?php  if (isset($user->projects))  : ?>
	        <dt class="projects"><?php echo Text::get('profile-invest_on-title'); ?></dt>
	        <dd class="projects"><strong><?php echo $user->projects ?></strong><?php echo Text::get('regular-projects'); ?></dd>
	        <?php endif; ?>
	<? /*
	        <dt class="worthcracy"><?php echo Text::get('profile-worthcracy-title'); ?></dt>
	        <dd class="worthcracy">
	            <?php if (isset($user->worth)) echo new View('view/worth/base.html.php', array('worthcracy' => $worthcracy, 'level' => $user->worth)) ?>
	        </dd>
	
	        <dt class="amount"><?php echo Text::get('profile-worth-title'); ?></dt>
	        <dd class="amount<?php if ($user->campaign) echo ' campaign'; ?>"><strong><?php echo \amount_format($user->amount) ?></strong> <span>円</span></dd>
示例#8
0
        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(Text::recorta($mate->name, 20));
        ?>
                        </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');
示例#9
0
        ?>
                        <input type="checkbox" id="msg_reward-<?php 
        echo $rewardId;
        ?>
" name="msg_reward-<?php 
        echo $rewardId;
        ?>
" value="1" />
                        <label for="msg_reward-<?php 
        echo $rewardId;
        ?>
"><?php 
        echo $rewardData->amount;
        ?>
 &euro; (<?php 
        echo Text::recorta($rewardData->reward, 40);
        ?>
)</label>
                    <?php 
    }
    ?>

                </p>
    		</div>
		    <div id="comment">
            <script type="text/javascript">
                // Mark DOM as javascript-enabled
                jQuery(document).ready(function ($) {
                    //change div#preview content when textarea lost focus
                    $("#message").blur(function(){
                        $("#preview").html($("#message").val());
示例#10
0
文件: send.php 项目: kenjs/Goteo
 public static function toInvestors($type, $project, $post = null)
 {
     // notificación
     $notif = $type == 'update' ? 'updates' : 'rounds';
     $anyfail = false;
     $tpl = null;
     // para cada inversor que no tenga bloqueado esta notificacion
     $sql = "\n                SELECT\n                    invest.user as id,\n                    user.name as name,\n                    user.email as email,\n                    invest.method as method,\n                    IFNULL(user.lang, 'es') as lang\n                FROM  invest\n                INNER JOIN user\n                    ON user.id = invest.user\n                    AND user.active = 1\n                LEFT JOIN user_prefer\n                    ON user_prefer.user = invest.user\n                WHERE   invest.project = ?\n                AND invest.status IN ('0', '1', '3', '4')\n                AND (user_prefer.{$notif} = 0 OR user_prefer.{$notif} IS NULL)\n                GROUP BY user.id\n                ";
     if ($query = Model\Invest::query($sql, array($project->id))) {
         foreach ($query->fetchAll(\PDO::FETCH_OBJ) as $investor) {
             /// tipo de envio
             switch ($type) {
                 case 'r1_pass':
                     // template 15,
                     $tpl = 15;
                     $search = array('%USERNAME%', '%PROJECTNAME%', '%PROJECTURL%');
                     $replace = array($investor->name, $project->name, SITE_URL . '/project/' . $project->id);
                     break;
                 case 'fail':
                     // template 17 (paypalistas) / 35 (tpvistas) , caduca sin conseguir el mínimo
                     $tpl = $investor->method == 'paypal' ? 17 : 35;
                     $search = array('%USERNAME%', '%PROJECTNAME%', '%DISCOVERURL%');
                     $replace = array($investor->name, $project->name, SITE_URL . '/discover');
                     break;
                 case 'r2_pass':
                     // template 16, finaliza segunda ronda
                     $tpl = 16;
                     $search = array('%USERNAME%', '%PROJECTNAME%', '%PROJECTURL%');
                     $replace = array($investor->name, $project->name, SITE_URL . '/project/' . $project->id);
                     break;
                 case 'update':
                     // template 18, publica novedad
                     $tpl = 18;
                     $search = array('%USERNAME%', '%PROJECTNAME%', '%UPDATEURL%', '%POST%', '%SHAREFACEBOOK%', '%SHARETWITTER%');
                     $post_url = SITE_URL . '/project/' . $project->id . '/updates/' . $post->id;
                     // contenido del post
                     $post_content = "<p><strong>{$post->title}</strong><br />" . nl2br(Text::recorta($post->text, 500)) . "</p>";
                     // y preparar los enlaces para compartir en redes sociales
                     $share_urls = Text::shareLinks($post_url, $post->title);
                     $replace = array($investor->name, $project->name, $post_url, $post_content, $share_urls['facebook'], $share_urls['twitter']);
                     break;
             }
             if (!empty($tpl)) {
                 // Obtenemos la plantilla para asunto y contenido
                 // en el idioma del usuario
                 $template = Template::get($tpl, $investor->lang);
                 // Sustituimos los datos
                 if (!empty($post)) {
                     $subject = str_replace(array('%PROJECTNAME%', '%OWNERNAME%', '%P_TITLE%'), array($project->name, $project->user->name, $post->title), $template->title);
                 } else {
                     $subject = str_replace('%PROJECTNAME%', $project->name, $template->title);
                 }
                 $content = \str_replace($search, $replace, $template->text);
                 // iniciamos mail
                 $mailHandler = new Mail();
                 $mailHandler->to = $investor->email;
                 $mailHandler->toName = $investor->name;
                 $mailHandler->subject = $subject;
                 $mailHandler->content = $content;
                 $mailHandler->html = true;
                 $mailHandler->template = $template->id;
                 if ($mailHandler->send()) {
                 } else {
                     $anyfail = true;
                     @mail(\GOTEO_FAIL_MAIL, 'Fallo al enviar email automaticamente al cofinanciador ' . SITE_URL, 'Fallo al enviar email automaticamente al cofinanciador: <pre>' . print_r($mailHandler, 1) . '</pre>');
                 }
                 unset($mailHandler);
             }
         }
         // fin bucle inversores
     } else {
         echo '<p>' . str_replace('?', $project->id, $sql) . '</p>';
         $anyfail = true;
     }
     if ($anyfail) {
         return false;
     } else {
         return true;
     }
 }
示例#11
0
 *  (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\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;
示例#12
0
?>
: <?php 
$sep = '';
foreach ($categories as $key => $value) {
    echo $sep . htmlspecialchars($value);
    $sep = ', ';
}
?>
</div>
    
    <div style="width:600px;vertical-align:top;border-right:2px solid #f1f1f1;line-height:15px;padding-right:10px;">
        <a style="text-decoration:none;font-size:14px;color: #797979;" href="<?php 
echo $url;
?>
"><?php 
echo Text::recorta($project->description, 500);
?>
</a>
    </div>
    
    <div style="width: 25px;height: 2px;border-bottom: 1px solid #38b5b1;margin-bottom: 10px; margin-top:10px;"></div>
   
    <div style="font-size: 14px;vertical-align: top;text-transform: uppercase; padding-bottom:10px;"><?php 
echo Text::get('project-view-metter-investment');
?>
: <span style="font-size:14px;color:#96238F;font-weight: bold;"><?php 
echo Text::get('project-view-metter-minimum') . ' ' . \amount_format($project->mincost) . ' ' . utf8_encode(html_entity_decode('&euro;'));
?>
</span>  <span style="color:#FFF;">_</span>  <span style="font-size:14px;color:#ba6fb6;font-weight: bold;"><?php 
echo Text::get('project-view-metter-optimum') . ' ' . \amount_format($project->maxcost) . ' ' . utf8_encode(html_entity_decode('&euro;'));
?>
示例#13
0
if ($user->user == 'anonymous') {
    ?>
	    <h4><?php 
    echo $user->name;
    ?>
</h4>
	    <?php 
} else {
    ?>
	    <h4 class="aqua"<?php 
    if ($user->campaign) {
        echo 'style="color: #96238F;"';
    }
    ?>
><?php 
    echo Text::recorta($user->name, 40);
    ?>
</h4>
	    <?php 
}
?>
	    <dl>
	        <?php 
if (isset($user->projects)) {
    ?>
	        <dt class="projects"><?php 
    echo Text::get('profile-invest_on-title');
    ?>
</dt>
	        <dd class="projects"><strong><?php 
    echo $user->projects;
示例#14
0
    case 'tags':
        $title = Text::get('blog-side-tags');
        $items = Post\Tag::getList($blog->id);
        // enlace a la lista de entradas con filtro tag
        foreach ($items as $item) {
            if ($item->used > 0) {
                $list[] = '<a href="/blog/?tag=' . $item->id . '">' . $item->name . '</a>';
            }
        }
        break;
    case 'comments':
        $title = Text::get('blog-side-last_comments');
        $items = Post\Comment::getList($blog->id);
        // enlace a la entrada en la que ha comentado
        foreach ($items as $item) {
            $text = Text::recorta($item->text, 200);
            $list[] = "\n\t\t\t\t<div>\n\t\t\t\t\t<!--span class='avatar'><img src='/image/{$item->user}->avatar->id/50/50/1' alt='' /></span-->\n\t\t\t\t\t<span class='date'>{$item->date}</span>\n\t\t\t\t\t<div class='high-comment'>\n\t\t\t\t\t\t<strong><a href=\"/blog/{$item->post}\">{$item->user->name}</a></strong>\n\t\t\t\t\t\t<p>{$text}</p>\n\t\t\t\t\t</div>\n\t\t\t\t</div>";
        }
        break;
}
if (!empty($list)) {
    ?>
<div class="widget blog-sidebar-module">
    <h3 class="supertitle"><?php 
    echo $title;
    ?>
</h3>
    <ul id="blog-side-<?php 
    echo $this['type'];
    ?>
">
示例#15
0
        ?>
"><?php 
        echo Text::get('regular-by');
        ?>
 <?php 
        echo $post->user->name;
        ?>
</a></div>
                <?php 
    }
    ?>
                <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++;
示例#16
0
            <tr>
                <td width="5%"><a title="Registro <?php 
        echo $item->id;
        ?>
" href='/translate/<?php 
        echo $table;
        ?>
/edit/<?php 
        echo $item->id . $filter . '&page=' . $_GET['page'];
        ?>
'>[Edit]</a></td>
                <td width="75%"><?php 
        if ($item->pendiente == 1) {
            echo '* ';
        }
        echo Text::recorta($item->value, 250);
        ?>
</td>
                <td><?php 
        echo $item->fieldName;
        ?>
</td>
                <td><?php 
        echo $item->id;
        ?>
</td>
                <?php 
        if ($table == 'post') {
            ?>
                <td><a href="/blog/<?php 
            echo $item->id;
示例#17
0
文件: feed.php 项目: isbkch/Goteo
 /**
  *  Metodo para sacar los eventos
  *
  * @param string $type  tipo de evento (public: columnas goteo, proyectos, comunidad;  admin: categorias de filtro)
  * @param string $scope ambito de eventos (public | admin)
  * @param numeric $limit limite de elementos
  * @return array list of items
  */
 public static function getAll($type = 'all', $scope = 'public', $limit = '99', $node = null)
 {
     $list = array();
     try {
         $values = array(':scope' => $scope);
         $sqlType = '';
         if ($type != 'all') {
             $sqlType = " AND feed.type = :type";
             $values[':type'] = $type;
         } else {
             // acciones del web service ultra secreto
             $sqlType = " AND feed.type != 'usws'";
         }
         $sqlNode = '';
         if (!empty($node) && $node != \GOTEO_NODE) {
             /* segun el objetivo del feed sea:
              * proyectos del nodo
              * usuarios del nodo
              * convocatorias destacadas por el nodo (aunque inactivas)
              * el propio nodo
              * el blog
              */
             $sqlNode = " AND (\n                        (feed.target_type = 'project' AND feed.target_id IN (\n                            SELECT id FROM project WHERE node = :node\n                            )\n                        )\n                        OR (feed.target_type = 'user' AND feed.target_id IN (\n                            SELECT id FROM user WHERE node = :node\n                            )\n                        )\n                        OR (feed.target_type = 'call' AND feed.target_id IN (\n                            SELECT `call` FROM campaign WHERE node = :node\n                            )\n                        )\n                        OR (feed.target_type = 'node' AND feed.target_id = :node)\n                        OR (feed.target_type = 'blog')\n                    )";
             $values[':node'] = $node;
         }
         $sql = "SELECT\n                            feed.id as id,\n                            feed.title as title,\n                            feed.url as url,\n                            feed.image as image,\n                            DATE_FORMAT(feed.datetime, '%H:%i %d|%m|%Y') as date,\n                            feed.datetime as timer,\n                            feed.html as html\n                        FROM feed\n                        WHERE feed.scope = :scope \n                        {$sqlType}\n                        {$sqlNode}\n                        ORDER BY datetime DESC\n                        LIMIT {$limit}\n                        ";
         $query = Model::query($sql, $values);
         foreach ($query->fetchAll(\PDO::FETCH_CLASS, __CLASS__) as $item) {
             // si es la columan goteo, vamos a cambiar el html por el del post traducido
             if ($type == 'goteo') {
                 // primero sacamos la id del post de la url
                 $matches = array();
                 \preg_match('(\\d+)', $item->url, $matches);
                 if (!empty($matches[0])) {
                     //  luego hacemos get del post
                     $post = Post::get($matches[0], LANG);
                     if ($post->owner_type == 'node' && $post->owner_id != \GOTEO_NODE) {
                         if (!\Goteo\Core\NodeSys::isActive($post->owner_id)) {
                             continue;
                         }
                     }
                     // y substituimos el $item->html por el $post->html
                     $item->html = Text::recorta($post->text, 250);
                     $item->title = $post->title;
                     $item->image = $post->image->id;
                     // arreglo la fecha de publicación
                     $parts = explode(' ', $item->timer);
                     $item->timer = $post->date . ' ' . $parts[1];
                 }
             }
             //hace tanto
             $item->timeago = self::time_ago($item->timer);
             $list[] = $item;
         }
         return $list;
     } catch (\PDOException $e) {
         throw new Exception(Text::_('No se ha guardado correctamente. ') . $e->getMessage() . "<br />{$sql}<br /><pre>" . print_r($values, 1) . "</pre>");
     }
 }
示例#18
0
 *  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, Goteo\Core\View;
$bodyClass = 'news';
$read_more = Text::get('regular-read_more');
// noticias
$news = $this['news'];
// últimas entradas del blog goteo
$list = array();
$title = Text::get('blog-side-last_posts');
$items = Post::getAll(1, 7);
// enlace a la entrada
foreach ($items as $item) {
    $list[] = '<a href="/blog/' . $item->id . '"> ' . Text::recorta($item->title, 100) . '</a>';
}
// paginacion
require_once 'library/pagination/pagination.php';
$pagedResults = new \Paginated($news, 7, isset($_GET['page']) ? $_GET['page'] : 1);
include 'view/prologue.html.php';
include 'view/header.html.php';
?>
<div id="sub-header-secondary">
    <div class="clearfix">
        <h2>GOTEO<span class="red">NEWS</span></h2>
        <?php 
echo new View('view/header/share.html.php');
?>
    </div>
</div>