Пример #1
0
function keywords($text)
{
    strpos($text, ',') && ($text = explode(',', $text));
    if (is_array($text)) {
        foreach ($text as $value) {
            keywords(trim($value));
        }
        return;
    }
    $cogear = getInstance();
    $cogear->meta->info->title->append($text);
}
Пример #2
0
<?php

if (!path()) {
    draw_page('Поваренная книга программиста', dview('index_content', main_categories()));
} elseif (is_category_path(path()) && is_category_exists(path())) {
    is_need_cache(true);
    $category = new Category(path());
    keywords($category->keywords());
    draw_page($category->getTitle(), dview('one_category', $category));
} elseif (is_example_path(path()) && is_example_exists(path())) {
    is_need_cache(true);
    $example = new Example(path());
    keywords($example->keywords());
    draw_page($example->prop('desc'), view('path_block', ['id' => $example->id()]) . view('one_example', ['data' => $example, 'show_link' => true]));
} else {
    show_404();
}
Пример #3
0
 public function admin_manage_tags($admin)
 {
     if (!Post::any_editable()) {
         show_403(__("Access Denied"), __("You do not have sufficient privileges to manage tags.", "tags"));
     }
     $sql = SQL::current();
     $tags = array();
     $names = array();
     foreach ($sql->select("post_attributes", "*", array("name" => "tags"))->fetchAll() as $tag) {
         $post_tags = YAML::load($tag["value"]);
         $tags = array_merge($tags, $post_tags);
         foreach ($post_tags as $name => $clean) {
             $names[] = $name;
         }
     }
     $popularity = array_count_values($names);
     $cloud = array();
     if (!empty($popularity)) {
         $max_qty = max($popularity);
         $min_qty = min($popularity);
         $spread = $max_qty - $min_qty;
         if ($spread == 0) {
             $spread = 1;
         }
         $step = 75 / $spread;
         foreach ($popularity as $tag => $count) {
             $cloud[] = array("size" => 100 + ($count - $min_qty) * $step, "popularity" => $count, "name" => $tag, "title" => sprintf(_p("%s post tagged with &quot;%s&quot;", "%s posts tagged with &quot;%s&quot;", $count, "tags"), $count, $tag), "clean" => $tags[$tag], "url" => url("tag/" . $tags[$tag], MainController::current()));
         }
     }
     fallback($_GET['query'], "");
     list($where, $params) = keywords($_GET['query'], "post_attributes.value LIKE :query OR url LIKE :query");
     $visitor = Visitor::current();
     if (!$visitor->group->can("view_draft", "edit_draft", "edit_post", "delete_draft", "delete_post")) {
         $where["user_id"] = $visitor->id;
     }
     $results = Post::find(array("placeholders" => true, "where" => $where, "params" => $params));
     $ids = array();
     foreach ($results[0] as $result) {
         $ids[] = $result["id"];
     }
     if (!empty($ids)) {
         $posts = new Paginator(Post::find(array("placeholders" => true, "drafts" => true, "where" => array("id" => $ids))), 25);
     } else {
         $posts = new Paginator(array());
     }
     $admin->display("manage_tags", array("tag_cloud" => $cloud, "posts" => $posts));
 }
Пример #4
0
                                            <div class="media well">
                                                <div class="media-body">
                                                    <div class="col-lg-8">
                                                        <div class="ibox-content">
                                                            <h3 class="media-heading">
                                                                <?php 
        echo $article_data->title;
        ?>
                                                            </h3>

                                                            <span>Sub Authors : <?php 
        echo sub_authors($article_data->sub_authors);
        ?>
 </span><br/>
                                                            <span>Keywords : <?php 
        echo keywords($article_data->keyword);
        ?>
 </span><br/>

                                                        </div>
                                                    </div>
                                                    <div class="col-lg-2 pull-right">
                                                        <a href="<?php 
        echo base_url();
        ?>
./uploads/FreshCopy/<?php 
        echo $article_data->id . '.docx';
        ?>
"
                                                           target="_blank">
                                                            <button type="button" style="margin-bottom: 10px"
Пример #5
0
 /**
  * Set metadata for output later
  *
  * @access    public
  * @param    string
  * @return    void
  */
 public function set_metadata($name, $content, $type = 'meta')
 {
     $name = htmlspecialchars(strip_tags($name));
     $content = htmlspecialchars(strip_tags($content));
     // Keywords with no comments? ARG! comment them
     if ($name == 'keywords' && !strpos($content, ',')) {
         $this->CI->load->helper('inflector');
         $content = keywords($content);
     }
     switch ($type) {
         case 'meta':
             $meta = '<meta name="' . $name . '" content="' . $content . '" />';
             break;
         case 'link':
             $meta = '<link rel="' . $name . '" href="' . $content . '" />';
             break;
     }
     $this->extra_head($meta);
     return $this;
 }
Пример #6
0
 static function admin_manage_comments($admin)
 {
     if (!Comment::any_editable() and !Comment::any_deletable()) {
         show_403(__("Access Denied"), __("You do not have sufficient privileges to manage any comments.", "comments"));
     }
     fallback($_GET['query'], "");
     list($where, $params) = keywords($_GET['query'], "body LIKE :query");
     $where[] = "status != 'spam'";
     $visitor = Visitor::current();
     if (!$visitor->group->can("edit_comment", "delete_comment", true)) {
         $where["user_id"] = $visitor->id;
     }
     $admin->display("manage_comments", array("comments" => new Paginator(Comment::find(array("placeholders" => true, "where" => $where, "params" => $params)), 25)));
 }
Пример #7
0
 function autokeyword($updatedb = 0)
 {
     $this->detail_data();
     $fields = read_cache('fields', $this->archive['chid']);
     if ($fields['keywords']['available'] && $this->channel['autokeyword'] && empty($this->archive['keywords']) && !empty($this->archive[$this->channel['autokeyword']])) {
         $keywords = autokeyword($this->archive[$this->channel['autokeyword']]);
         $this->updatefield('keywords', keywords(addslashes($keywords)), 'main');
     }
     unset($fields, $keywords);
     $updatedb && $this->updatedb();
 }
Пример #8
0
 /**
  * Function: search
  * Grabs the posts for a search query.
  */
 public function search()
 {
     fallback($_GET['query'], "");
     $config = Config::current();
     if ($config->clean_urls and substr_count($_SERVER['REQUEST_URI'], "?") and !substr_count($_SERVER['REQUEST_URI'], "%2F")) {
         # Searches with / and clean URLs = server 404
         redirect("search/" . urlencode($_GET['query']) . "/");
     }
     if (empty($_GET['query'])) {
         return Flash::warning(__("Please enter a search term."));
     }
     list($where, $params) = keywords($_GET['query'], "post_attributes.value LIKE :query OR url LIKE :query", "posts");
     $results = Post::find(array("placeholders" => true, "where" => $where, "params" => $params));
     $ids = array();
     foreach ($results[0] as $result) {
         $ids[] = $result["id"];
     }
     if (!empty($ids)) {
         $posts = new Paginator(Post::find(array("placeholders" => true, "where" => array("id" => $ids))), $this->post_limit);
     } else {
         $posts = new Paginator(array());
     }
     $this->display(array("pages/search", "pages/index"), array("posts" => $posts, "search" => $_GET['query']), fix(_f("Search results for \"%s\"", array($_GET['query']))));
 }
Пример #9
0
                 $a_field->deal('archivenew');
                 if (!empty($a_field->error)) {
                     $c_upload->rollback();
                     amessage($a_field->error, axaction(2, M_REFERER));
                 }
                 $archivenew[$k] = $a_field->newvalue;
             }
         }
     }
 }
 unset($a_field);
 $cu_ret = cu_fields_deal($channel['cuid'], 'archivenew', $aedit->archive);
 !empty($cu_ret) && amessage($cu_ret, axaction(2, M_REFERER));
 $aedit->edit_cudata($archivenew, 1);
 if (isset($archivenew['keywords'])) {
     $archivenew['keywords'] = keywords($archivenew['keywords'], $aedit->archive['keywords']);
 }
 if ($fields['abstract']['available'] && $channel['autoabstract'] && empty($archivenew['abstract']) && isset($archivenew[$channel['autoabstract']])) {
     $archivenew['abstract'] = autoabstract($archivenew[$channel['autoabstract']]);
 }
 if ($fields['thumb']['available'] && $channel['autothumb'] && empty($archivenew['thumb']) && isset($archivenew[$channel['autothumb']])) {
     $archivenew['thumb'] = $c_upload->thumb_pick(stripslashes($archivenew[$channel['autothumb']]), $fields[$channel['autothumb']]['datatype'], $fields['thumb']['rpid']);
 }
 if ($channel['autosize'] && isset($archivenew[$channel['autosize']]) && $archivenew[$channel['autosize']] != addslashes($aedit->archive[$channel['autosize']])) {
     $archivenew['atmsize'] = atm_size(stripslashes($archivenew[$channel['autosize']]), $fields[$channel['autosize']]['datatype'], $channel['autosizemode']);
     $aedit->updatefield('atmsize', $archivenew['atmsize'], 'main');
 }
 if ($channel['autobyte'] && isset($archivenew[$channel['autobyte']])) {
     $archivenew['bytenum'] = atm_byte(stripslashes($archivenew[$channel['autobyte']]), $fields[$channel['autobyte']]['datatype']);
     $aedit->updatefield('bytenum', $archivenew['bytenum'], 'main');
 }
Пример #10
0
<?php
	include_once('ressources/class.templates.inc');
	include_once('ressources/class.ldap.inc');
	include_once('ressources/class.users.menus.inc');
	include_once('ressources/class.artica.inc');
	include_once('ressources/class.ini.inc');
	include_once('ressources/class.spamassassin.inc');
	$user=new usersMenus();
		if($user->AsPostfixAdministrator==false){
		$tpl=new templates();
		echo "alert('". $tpl->javascript_parse_text("{ERROR_NO_PRIVS}")."');";
		die();exit();
	}
	
	if(isset($_GET["tabs"])){tabs();exit;}
	if(isset($_GET["keywords"])){keywords();exit;}
	if(isset($_GET["keywords-popup"])){keywords_add_popup();exit;}
	if(isset($_GET["keywords-list"])){keywords_list();exit;}
	if(isset($_POST["keywords-save"])){keywords_add();exit;}
	if(isset($_GET["keywords-edit"])){keywords_edit();exit;}
	if(isset($_GET["keywords-edit-save"])){keywords_edit_save();exit;}
	if(isset($_GET["SimpleKeywordDisable"])){SimpleKeywordDisable();exit;}
	if(isset($_GET["SimpleWordsDelete"])){SimpleWordsDelete();exit;}
	
js();

function js(){
	$tpl=new templates();
	$page=CurrentPageName();
	$title=$tpl->_ENGINE_parse_body("{APP_SPAMASSASSIN}::{block_keywords}");		
	echo "YahooWin3('700','$page?tabs=yes','$title');";
    echo "</select>";
}
if ($id_politico) {
    $tamanho = 3;
    $numero = 3;
    $consulta = $consulta . " WHERE v2.id_politico = '{$id_politico}'";
}
echo "<br />";
$input1 = '';
$consulta1 = $consulta . " AND v2.id_voto_tipo = 'Sim'";
//$consulta =  $consulta." ORDER BY data DESC LIMIT 0,2000";
$sql_votacao1 = mysql_query($consulta1) or die(mysql_error());
while ($row_votacao1 = mysql_fetch_array($sql_votacao1)) {
    $input1 = $input1 . ' ' . $row_votacao1[0];
}
$input2 = '';
$consulta2 = $consulta . " AND v2.id_voto_tipo = 'Não'";
//$consulta =  $consulta." ORDER BY data DESC LIMIT 0,2000";
$sql_votacao2 = mysql_query($consulta2) or die(mysql_error());
while ($row_votacao2 = mysql_fetch_array($sql_votacao2)) {
    $input2 = $input2 . ' ' . $row_votacao2[0];
}
echo "<div style='width:50%;float:left;'>";
echo "<h1 class='verde'>SIM</h1>";
keywords($input1, 1, 10, 'verde');
echo "</div>";
echo "<div style='width:50%;float:right;text-align:right;'>";
echo "<h1 class='vermelho'>NÃO</h1>";
keywords($input2, 1, 10, 'vermelho');
echo "</div>";
echo "<div style='clear:both;'> &nbsp;</div>";
<?php

echo "<div class='divisao'>Proposições</div>";
$conta_proposicao = 1;
$input = '';
echo "<table border=1 class='tabelas'>\n\t<tr>\n\t\t<td>N<sup>o</sup></td>\n\t\t<td>Título</td>\n\t\t<td>Data</td>\n\t\t<td>Casa</td>\t\n\t\t<td>Número</td>\n\t\t<td>Tipo</td>\t\n\t\t<td>Ementa</td>\t\t\t\t\t\t\n\t</tr>";
foreach ($sparql11 as $row) {
    $data = $row['data'];
    if ($data == '01/01/1970') {
        $data = '-';
    }
    echo "\n\t\t<tr>\n\t\t\t<td>{$conta_proposicao}</td>\n\t\t\t<td>" . $row['titulo'] . "</td>\n\t\t\t<td>" . $data . "</td>\n\t\t\t<td>" . $row['casa'] . "</td>\n\t\t\t<td>" . $row['numero'] . "</td>\n\t\t\t<td>" . $row['tipo'] . " - " . $row['descricao_tipo'] . "</td>\n\t\t\t<td>" . $row['ementa'] . "</td>\n\t\t</tr>";
    $conta_proposicao++;
    $input = $input . ' ' . $row['ementa'];
}
echo "</table>";
echo "<br />";
keywords($input, 3, 5, 'azul');
Пример #13
0
">
    <LINK REL="stylesheet" TYPE="text/css" HREF="<?php 
echo bu::pub('default.css');
?>
">
    <link href='http://fonts.googleapis.com/css?family=Lobster&subset=cyrillic,latin' rel='stylesheet' type='text/css'>
    <LINK REL="SHORTCUT ICON" HREF="<?php 
echo bu::pub('favicon.png');
?>
">
    <title><?php 
echo title();
?>
</title>
    <meta name="keywords" content="<?php 
echo is_array(keywords()) ? implode(', ', keywords()) : keywords();
?>
">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
  <div class="container">

    <div class="col-md-10 col-md-push-1">
      <div id='header'> Большая поваренная книга программиста.  </div>

      <div class="row">
        <div id='sub_header'>
          <?php 
echo view('menu');
?>
Пример #14
0
        echo ' 个';
    } elseif (is_tag()) {
        $description = strip_tags(tag_description());
        echo trim($description);
    } else {
        $description = strip_tags(term_description());
        echo trim($description);
    }
}
?>
    <meta name="description" content="<?php 
description();
?>
">
    <meta name="keywords" content="<?php 
keywords();
?>
">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <?php 
if (is_404()) {
    ?>
        <meta http-equiv='refresh' content=5;URL="<?php 
    bloginfo('url');
    ?>
">
    <?php 
}
?>
	<?php 
wp_head();
Пример #15
0
 public function search()
 {
     if (empty($_GET['query'])) {
         exit;
     }
     # TODO
     $config = Config::current();
     if ($config->clean_urls and substr_count($_SERVER['REQUEST_URI'], "?") and !substr_count($_SERVER['REQUEST_URI'], "%2F")) {
         # Searches with / and clean URLs = server 404
         redirect("search/" . urlencode($_GET['query']) . "/");
     }
     if (empty($_GET['query'])) {
         return Flash::warning(__("Please enter a search term."));
     }
     list($where, $params) = keywords($_GET['query'], "name LIKE :query OR url LIKE :query", "extensions");
     $extensions = Extension::find(array("placeholders" => true, "where" => $where, "params" => $params));
     list($where, $params) = keywords($_GET['query'], "description LIKE :query OR tags LIKE :query", "versions");
     $versions = Version::find(array("placeholders" => true, "where" => $where, "params" => $params));
     list($where, $params) = keywords($_GET['query'], "body LIKE :query", "notes");
     $notes = Note::find(array("placeholders" => true, "where" => $where, "params" => $params));
     $this->display("extend/search", array("extensions" => new Paginator($extensions, 25, "extensions_page"), "versions" => new Paginator($versions, 25, "versions_page"), "notes" => new Paginator($notes, 25, "notes_page"), "search" => $_GET['query']), fix(_f("Search results for \"%s\"", $_GET['query'])));
 }
Пример #16
0
         if ($curuser->pmbypmids('field', $a_field->field['pmid'])) {
             $a_field->deal('archiveadd');
             if (!empty($a_field->error)) {
                 $c_upload->rollback();
                 mcmessage($a_field->error, axaction(2, M_REFERER));
             }
             $archiveadd[$k] = $a_field->newvalue;
         }
     }
 }
 unset($a_field);
 $oldarr = array();
 $cu_ret = cu_fields_deal($channel['cuid'], 'archiveadd', $oldarr);
 $cu_ret && mcmessage($cu_ret, axaction(2, M_REFERER));
 if (isset($archiveadd['keywords'])) {
     $archiveadd['keywords'] = keywords($archiveadd['keywords']);
 }
 $fields['author']['available'] && ($archiveadd['author'] = empty($archiveadd['author']) ? $curuser->info['mname'] : $archiveadd['author']);
 if ($fields['abstract']['available'] && !$fields['abstract']['isadmin'] && $channel['autoabstract'] && empty($archiveadd['abstract']) && isset($archiveadd[$channel['autoabstract']])) {
     $archiveadd['abstract'] = autoabstract($archiveadd[$channel['autoabstract']]);
 }
 if ($fields['thumb']['available'] && !$fields['thumb']['isadmin'] && $channel['autothumb'] && empty($archiveadd['thumb']) && isset($archiveadd[$channel['autothumb']])) {
     $field = read_cache('field', $chid, 'thumb');
     $archiveadd['thumb'] = $c_upload->thumb_pick(stripslashes($archiveadd[$channel['autothumb']]), $fields[$channel['autothumb']]['datatype'], $fields['thumb']['rpid']);
 }
 if ($channel['autosize'] && !empty($archiveadd[$channel['autosize']])) {
     $archiveadd['atmsize'] = atm_size(stripslashes($archiveadd[$channel['autosize']]), $fields[$channel['autosize']]['datatype'], $channel['autosizemode']);
     $sqlmain .= ",atmsize='" . $archiveadd['atmsize'] . "'";
 }
 if ($channel['autobyte'] && isset($archiveadd[$channel['autobyte']])) {
     $archiveadd['bytenum'] = atm_byte(stripslashes($archiveadd[$channel['autobyte']]), $fields[$channel['autobyte']]['datatype']);
Пример #17
0
 public function search()
 {
     fallback($_GET['query'], "");
     $config = Config::current();
     if ($config->clean_urls and substr_count($_SERVER['REQUEST_URI'], "?") and !substr_count($_SERVER['REQUEST_URI'], "%2F")) {
         # Searches with / and clean URLs = server 404
         redirect("search/" . urlencode($_GET['query']) . "/");
     }
     if (empty($_GET['query'])) {
         return Flash::warning(__("Please enter a search term."));
     }
     list($where, $params) = keywords($_GET['query'], "title LIKE :query OR description LIKE :query OR url LIKE :query", "tickets");
     $tickets = Ticket::find(array("placeholders" => true, "where" => $where, "params" => $params, "done" => true));
     list($where, $params) = keywords($_GET['query'], "body LIKE :query", "revisions");
     $revisions = Revision::find(array("placeholders" => true, "where" => $where, "params" => $params));
     list($where, $params) = keywords($_GET['query'], "name LIKE :query", "milestones");
     $milestones = Milestone::find(array("placeholders" => true, "where" => $where, "params" => $params));
     $this->display("progress/search", array("tickets" => new Paginator($tickets, 25, "tickets_page"), "revisions" => new Paginator($revisions, 25, "revisions_page"), "milestones" => new Paginator($milestones, 25, "milestones_page"), "search" => $_GET['query']), fix(_f("Search results for \"%s\"", $_GET['query'])));
 }
Пример #18
0
 /**
  * Function: export
  * Export posts, pages, etc.
  */
 public function export()
 {
     if (!Visitor::current()->group->can("add_post")) {
         show_403(__("Access Denied"), __("You do not have sufficient privileges to export content."));
     }
     if (empty($_POST)) {
         return $this->display("export");
     }
     $config = Config::current();
     $trigger = Trigger::current();
     $route = Route::current();
     $exports = array();
     if (isset($_POST['posts'])) {
         list($where, $params) = keywords($_POST['filter_posts'], "post_attributes.value LIKE :query OR url LIKE :query", "post_attributes");
         if (!empty($_GET['month'])) {
             $where["created_at like"] = $_GET['month'] . "-%";
         }
         $visitor = Visitor::current();
         if (!$visitor->group->can("view_draft", "edit_draft", "edit_post", "delete_draft", "delete_post")) {
             $where["user_id"] = $visitor->id;
         }
         $results = Post::find(array("placeholders" => true, "drafts" => true, "where" => $where, "params" => $params));
         $ids = array();
         foreach ($results[0] as $result) {
             $ids[] = $result["id"];
         }
         if (!empty($ids)) {
             $posts = Post::find(array("drafts" => true, "where" => array("id" => $ids), "order" => "id ASC"), array("filter" => false));
         } else {
             $posts = new Paginator(array());
         }
         $latest_timestamp = 0;
         foreach ($posts as $post) {
             if (strtotime($post->created_at) > $latest_timestamp) {
                 $latest_timestamp = strtotime($post->created_at);
             }
         }
         $id = substr(strstr($config->url, "//"), 2);
         $id = str_replace("#", "/", $id);
         $id = preg_replace("/(" . preg_quote(parse_url($config->url, PHP_URL_HOST)) . ")/", "\\1," . date("Y", $latest_timestamp) . ":", $id, 1);
         $posts_atom = '<?xml version="1.0" encoding="utf-8"?>' . "\r";
         $posts_atom .= '<feed xmlns="http://www.w3.org/2005/Atom" xmlns:chyrp="http://chyrp.net/export/1.0/">' . "\r";
         $posts_atom .= '    <title>' . fix($config->name) . ' Posts</title>' . "\r";
         $posts_atom .= '    <subtitle>' . fix($config->description) . '</subtitle>' . "\r";
         $posts_atom .= '    <id>tag:' . parse_url($config->url, PHP_URL_HOST) . ',' . date("Y", $latest_timestamp) . ':Chyrp</id>' . "\r";
         $posts_atom .= '    <updated>' . date("c", $latest_timestamp) . '</updated>' . "\r";
         $posts_atom .= '    <link href="' . $config->url . '" rel="self" type="application/atom+xml" />' . "\r";
         $posts_atom .= '    <generator uri="http://chyrp.net/" version="' . CHYRP_VERSION . '">Chyrp</generator>' . "\r";
         foreach ($posts as $post) {
             $title = fix($post->title(), false);
             fallback($title, ucfirst($post->feather) . " Post #" . $post->id);
             $updated = $post->updated ? $post->updated_at : $post->created_at;
             $tagged = substr(strstr(url("id/" . $post->id), "//"), 2);
             $tagged = str_replace("#", "/", $tagged);
             $tagged = preg_replace("/(" . preg_quote(parse_url($post->url(), PHP_URL_HOST)) . ")/", "\\1," . when("Y-m-d", $updated) . ":", $tagged, 1);
             $url = $post->url();
             $posts_atom .= '    <entry xml:base="' . fix($url) . '">' . "\r";
             $posts_atom .= '        <title type="html">' . $title . '</title>' . "\r";
             $posts_atom .= '        <id>tag:' . $tagged . '</id>' . "\r";
             $posts_atom .= '        <updated>' . when("c", $updated) . '</updated>' . "\r";
             $posts_atom .= '        <published>' . when("c", $post->created_at) . '</published>' . "\r";
             $posts_atom .= '        <link href="' . fix($trigger->filter($url, "post_export_url", $post)) . '" />' . "\r";
             $posts_atom .= '        <author chyrp:user_id="' . $post->user_id . '">' . "\r";
             $posts_atom .= '            <name>' . fix(oneof($post->user->full_name, $post->user->login)) . '</name>' . "\r";
             if (!empty($post->user->website)) {
                 $posts_atom .= '            <uri>' . fix($post->user->website) . '</uri>' . "\r";
             }
             $posts_atom .= '            <chyrp:login>' . fix($post->user->login) . '</chyrp:login>' . "\r";
             $posts_atom .= '        </author>' . "\r";
             $posts_atom .= '        <content>' . "\r";
             foreach ($post->attributes as $key => $val) {
                 $posts_atom .= '            <' . $key . '>' . fix($val) . '</' . $key . '>' . "\r";
             }
             $posts_atom .= '        </content>' . "\r";
             foreach (array("feather", "clean", "url", "pinned", "status") as $attr) {
                 $posts_atom .= '        <chyrp:' . $attr . '>' . fix($post->{$attr}) . '</chyrp:' . $attr . '>' . "\r";
             }
             $trigger->filter($posts_atom, "posts_export", $post);
             $posts_atom .= '    </entry>' . "\r";
         }
         $posts_atom .= '</feed>' . "\r";
         $exports["posts.atom"] = $posts_atom;
     }
     if (isset($_POST['pages'])) {
         list($where, $params) = keywords($_POST['filter_pages'], "title LIKE :query OR body LIKE :query", "pages");
         $pages = Page::find(array("where" => $where, "params" => $params, "order" => "id ASC"), array("filter" => false));
         $latest_timestamp = 0;
         foreach ($pages as $page) {
             if (strtotime($page->created_at) > $latest_timestamp) {
                 $latest_timestamp = strtotime($page->created_at);
             }
         }
         $pages_atom = '<?xml version="1.0" encoding="utf-8"?>' . "\r";
         $pages_atom .= '<feed xmlns="http://www.w3.org/2005/Atom" xmlns:chyrp="http://chyrp.net/export/1.0/">' . "\r";
         $pages_atom .= '    <title>' . fix($config->name) . ' Pages</title>' . "\r";
         $pages_atom .= '    <subtitle>' . fix($config->description) . '</subtitle>' . "\r";
         $pages_atom .= '    <id>tag:' . parse_url($config->url, PHP_URL_HOST) . ',' . date("Y", $latest_timestamp) . ':Chyrp</id>' . "\r";
         $pages_atom .= '    <updated>' . date("c", $latest_timestamp) . '</updated>' . "\r";
         $pages_atom .= '    <link href="' . $config->url . '" rel="self" type="application/atom+xml" />' . "\r";
         $pages_atom .= '    <generator uri="http://chyrp.net/" version="' . CHYRP_VERSION . '">Chyrp</generator>' . "\r";
         foreach ($pages as $page) {
             $updated = $page->updated ? $page->updated_at : $page->created_at;
             $tagged = substr(strstr($page->url(), "//"), 2);
             $tagged = str_replace("#", "/", $tagged);
             $tagged = preg_replace("/(" . preg_quote(parse_url($page->url(), PHP_URL_HOST)) . ")/", "\\1," . when("Y-m-d", $updated) . ":", $tagged, 1);
             $url = $page->url();
             $pages_atom .= '    <entry xml:base="' . fix($url) . '" chyrp:parent_id="' . $page->parent_id . '">' . "\r";
             $pages_atom .= '        <title type="html">' . fix($page->title) . '</title>' . "\r";
             $pages_atom .= '        <id>tag:' . $tagged . '</id>' . "\r";
             $pages_atom .= '        <updated>' . when("c", $updated) . '</updated>' . "\r";
             $pages_atom .= '        <published>' . when("c", $page->created_at) . '</published>' . "\r";
             $pages_atom .= '        <link href="' . fix($trigger->filter($url, "page_export_url", $page)) . '" />' . "\r";
             $pages_atom .= '        <author chyrp:user_id="' . fix($page->user_id) . '">' . "\r";
             $pages_atom .= '            <name>' . fix(oneof($page->user->full_name, $page->user->login)) . '</name>' . "\r";
             if (!empty($page->user->website)) {
                 $pages_atom .= '            <uri>' . fix($page->user->website) . '</uri>' . "\r";
             }
             $pages_atom .= '            <chyrp:login>' . fix($page->user->login) . '</chyrp:login>' . "\r";
             $pages_atom .= '        </author>' . "\r";
             $pages_atom .= '        <content type="html">' . fix($page->body) . '</content>' . "\r";
             foreach (array("show_in_list", "list_order", "clean", "url") as $attr) {
                 $pages_atom .= '        <chyrp:' . $attr . '>' . fix($page->{$attr}) . '</chyrp:' . $attr . '>' . "\r";
             }
             $trigger->filter($pages_atom, "pages_export", $page);
             $pages_atom .= '    </entry>' . "\r";
         }
         $pages_atom .= '</feed>' . "\r";
         $exports["pages.atom"] = $pages_atom;
     }
     if (isset($_POST['groups'])) {
         list($where, $params) = keywords($_POST['filter_groups'], "name LIKE :query", "groups");
         $groups = Group::find(array("where" => $where, "params" => $params, "order" => "id ASC"));
         $groups_yaml = array("groups" => array(), "permissions" => array());
         foreach (SQL::current()->select("permissions", "*", array("group_id" => 0))->fetchAll() as $permission) {
             $groups_yaml["permissions"][$permission["id"]] = $permission["name"];
         }
         foreach ($groups as $index => $group) {
             $groups_yaml["groups"][$group->name] = $group->permissions;
         }
         $exports["groups.yaml"] = YAML::dump($groups_yaml);
     }
     if (isset($_POST['users'])) {
         list($where, $params) = keywords($_POST['filter_users'], "login LIKE :query OR full_name LIKE :query OR email LIKE :query OR website LIKE :query", "users");
         $users = User::find(array("where" => $where, "params" => $params, "order" => "id ASC"));
         $users_yaml = array();
         foreach ($users as $user) {
             $users_yaml[$user->login] = array();
             foreach ($user as $name => $attr) {
                 if (!in_array($name, array("no_results", "group_id", "group", "id", "login", "belongs_to", "has_many", "has_one", "queryString"))) {
                     $users_yaml[$user->login][$name] = $attr;
                 } elseif ($name == "group_id") {
                     $users_yaml[$user->login]["group"] = $user->group->name;
                 }
             }
         }
         $exports["users.yaml"] = YAML::dump($users_yaml);
     }
     $trigger->filter($exports, "export");
     require INCLUDES_DIR . "/lib/zip.php";
     $zip = new ZipFile();
     foreach ($exports as $filename => $content) {
         $zip->addFile($content, $filename);
     }
     $zip_contents = $zip->file();
     $filename = sanitize(camelize($config->name), false, true) . "_Export_" . date("Y-m-d");
     header("Content-type: application/octet-stream");
     header("Content-Disposition: attachment; filename=\"" . $filename . ".zip\"");
     header("Content-length: " . strlen($zip_contents) . "\n\n");
     echo $zip_contents;
 }
        $id_politico2 = $row3[0];
        $politician = $row3[1];
        $quantidade = '';
        $sql444 = mysql_query("SELECT quantidade FROM eleicao_voto_politico WHERE id_politico = '{$id_politico2}' AND id_cidade = '{$id_cidade}'");
        while ($row444 = mysql_fetch_row($sql444)) {
            $quantidade = '- ' . $row444[0] . ' votos';
        }
        echo "<option value={$id_politico2}";
        if ($id_politico == $id_politico2) {
            echo " SELECTED";
        }
        echo ">{$politician} {$quantidade}</option>";
    }
    echo "</select>";
}
if ($id_politico) {
    $tamanho = 3;
    $numero = 3;
    $consulta = $consulta . " AND pr.id_politico = '{$id_politico}'";
}
echo "<br />";
echo "<br />";
$input = '';
$consulta = $consulta . " ORDER BY data DESC LIMIT 0,2000";
$sql_proposicao = mysql_query($consulta) or die(mysql_error());
while ($row_proposicao = mysql_fetch_array($sql_proposicao)) {
    //echo $row_proposicao['ementa'];
    $input = $input . ' ' . $row_proposicao['ementa'];
}
keywords($input, $numero, $tamanho, 'azul');