Exemplo n.º 1
0
function showArticleResults($mysqli)
{
    if (isset($_POST['search'])) {
        $keywords = trim(htmlentities($_POST['search'], ENT_QUOTES, "UTF-8"));
        $keywords = $mysqli->real_escape_string($keywords);
        $errors = array();
        if (empty($keywords)) {
            $errors[] = "Bitte geben Sie einen Suchbegriff ein";
        } elseif (searchResults($mysqli, $keywords) === false && searchUser($mysqli, $keywords) === false) {
            $errors[] = "Für ihre Suchanfrage wurden keine Ergebnisse gefunden.";
        }
        if (empty($errors) && searchResults($mysqli, $keywords) !== false) {
            $results = searchResults($mysqli, $keywords);
            // Ausgabe der einzelnen Suchergebnisse
            foreach ($results as $key => $result) {
                // Leerzeichen durch - für die Sucher ersetzen für Title Link außer wenn - schon drin sonst Problem, dann Nr.
                if (strstr($result['title'], '-') || strstr($result['title'], ',')) {
                    $artLink = $result['id'];
                } else {
                    $artLink = str_replace(" ", "-", $result['title']);
                }
                ?>
        <div class="row">
          <div class="col-md-12">    
            <div class="panel-body">
              <div class="row note-content">
                <div class="col-md-8 col-sm-8 col-xs-8 col-lg-8 panel-note">
                  <div class="panel panel-info">
                      <div class="panel-heading">
                        <h3 class="panel-title"><a href="<?php 
                echo PROJECT_HTTP_ROOT . '/' . $artLink;
                ?>
"><?php 
                echo substr($result['title'], 0, 45) . " ...";
                ?>
</a></h3>
                        <ul class="panel-note-control">
                          <li><?php 
                echo $result['points'] . " Punkte";
                ?>
</li>
                          <li>
                            <?php 
                $commments = $mysqli->query("SELECT * FROM comments WHERE articleId = '" . $result['id'] . "' ");
                if ($commments->num_rows > 0) {
                    echo $commments->num_rows;
                    if ($commments->num_rows == 1) {
                        echo " Kommentar";
                    } else {
                        echo " Kommentare";
                    }
                } else {
                    echo "noch keine Kommentare";
                }
                ?>
                          </li>
                          <li><?php 
                echo "  " . date("j.n.y H:i", $result['created']);
                ?>
</li>
                        </ul>
                      </div>
                      <div class="panel-body">                           
                        <div class="myEditor">
                          <p>
                            <?php 
                if ($result['img'] != "") {
                    echo "<a href='" . PROJECT_HTTP_ROOT . "/" . $artLink . "'><img class='chartPic' src='" . PROJECT_HTTP_ROOT . "/sites/Article/" . $result['img'] . "'></a>";
                }
                echo strip_tags(html_entity_decode(substr($result['article'], 0, 250))) . " ... ";
                echo "<a href='" . PROJECT_HTTP_ROOT . "/" . $artLink . "'>Weiter</a>";
                ?>
                          </p>
                        </div>
                      </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      <?php 
            }
        } else {
            foreach ($errors as $error) {
                echo $error . "<br>";
            }
        }
    }
}
Exemplo n.º 2
0
***********************************************************************/
if (!defined('CPG_NUKE')) {
    exit;
}
$pagetitle .= _FAQ2;
if (isset($_POST['query']) || isset($_GET['query']) || isset($_GET['cat'])) {
    $search_terms = isset($_POST['query']) ? Fix_Quotes($_POST['query'], 1) : Fix_Quotes($_GET['query'], 1);
    $search_cat = isset($_POST['cat']) ? intval($_POST['cat']) : intval($_GET['cat']);
    if ($search_terms == '' && $search_cat == 0) {
        $search_cat = 1;
    }
    if (strlen($search_terms) < 3 && !isset($_GET['cat'])) {
        cpg_error(sprintf(_ERROR_NOT_SET, _KEYWORDS));
    }
    searchResults($search_cat, $search_terms);
} else {
    die('You do not have permission to access this file');
}
function searchResults($category = '', $terms = '')
{
    global $db, $prefix, $bgcolor2, $bgcolor3, $multilingual, $currentlang;
    $search_cat = $category == 0 ? '' : "categories='{$category}' AND";
    $search_id = $category == 0 ? '' : "id_cat='{$category}' AND";
    require 'header.php';
    OpenTable();
    if ($category == 0) {
        $category_name = _ALLCATS;
    } else {
        list($category_name) = $db->sql_ufetchrow("SELECT categories FROM " . $prefix . "_faqcategories WHERE id_cat='{$category}'");
    }
Exemplo n.º 3
0
						</li><li><a href="reader.php">E-Music Book</a></li>
					</ul>
				</div>
				<form class="searchWrapper" name="search" action="functions/searchQuery.php" method="post">
     				<input type="text" name="query" placeholder="Search Music...">
     				<button type="submit">Search</button>
 				</form>	
			</div>	
		</div>
		<div id="content">
			<div id="breadcrumbs">
				<a href="index.php">
					<p id="houseWrap">
						<img alt="Home Icon" id="house" src="images/Icons/home.png">
					</p>
				</a> > 
				<a href="#">Search Results</a>
			</div>
			<p class="pageTitleBig">Search Results:</p>
			<div id="searchResultsWrap">
				<?php 
searchResults();
?>
			</div>
		</div>
		<div id="footer">
			<p id="footLinks"><a href="about.php">About</a> | <a href="about.php">Contact</a> | <a href="about.php">Privacy Policy</a> | <a href="about.php">Terms &amp; Conditions</a> | <a href="register.php">Register</a> </p>
			<p id="cpy">&copy; 2013 Simon Barton</p>
		</div>
	</body>
</html>
Exemplo n.º 4
0
//includes other necesary functions
//assignSentiment(), binData, usort() {for sorting by time},
//get_data_from_file(), write_to_file()
$hash = array("#familyguy", "#SouthPark");
foreach ($hash as $item) {
    $count = 0;
    $query = $item;
    $date = strftime("%F");
    $date = strftime("%F", strtotime("-1 day", strtotime($date)));
    $tweets = 1;
    $data_file = $query . ".txt";
    $json_file = $query . ".json";
    var_dump($date);
    echo "<br><br>";
    while (!empty($tweets) && $count < 10) {
        $tweets = searchResults($query, $date);
        echo count($tweets);
        echo "<br><br>";
        if (!empty($tweets)) {
            $sentimentized = assignSentiment($tweets);
            echo count($sentimentized);
            echo "<br><br>";
            write_to_file($data_file, $sentimentized);
            //break;
        }
        sleep(0.5);
        $date = strftime("%F", strtotime("-1 day", strtotime($date)));
        echo $date;
        echo "<br><br>";
        $count++;
    }