$edited_by = '<br /><br /><br /><span style="font-weight: bold; font-size: x-small;">' . $lang['vmp_last_edit_by_anony'] . ' [<a class="altlink" href="userdetails.php?id=' . (int) $arr['edited_by'] . '">' . htmlsafechars($arr_edited['username']) . '</a>]
				 at ' . get_date($arr['edit_date'], '') . ' GMT ' . ($arr['edit_reason'] !== '' ? ' </span>[ ' . $lang['fe_reason'] . ': ' . htmlsafechars($arr['edit_reason']) . ' ] <span style="font-weight: bold; font-size: x-small;">' : '') . '
				 ' . ($CURUSER['class'] >= UC_STAFF && $arr['post_history'] !== '' ? ' <a class="altlink" href="' . $INSTALLER09['baseurl'] . '/forums.php?action=view_post_history&amp;post_id=' . (int) $arr['post_id'] . '&amp;forum_id=' . $forum_id . '&amp;topic_id=' . $topic_id . '">' . $lang['fe_read_post_history'] . '</a></span><br />' : '</span>');
            }
        } else {
            $edited_by = '<br /><br /><br /><span style="font-weight: bold; font-size: x-small;">' . $lang['fe_last_edited_by'] . ' <a class="altlink" href="userdetails.php?id=' . (int) $arr['edited_by'] . '">' . htmlsafechars($arr_edited['username']) . '</a>
				 at ' . get_date($arr['edit_date'], '') . ' GMT ' . ($arr['edit_reason'] !== '' ? ' </span>[ ' . $lang['fe_reason'] . ': ' . htmlsafechars($arr['edit_reason']) . ' ] <span style="font-weight: bold; font-size: x-small;">' : '') . '
				 ' . ($CURUSER['class'] >= UC_STAFF && $arr['post_history'] !== '' ? ' <a class="altlink" href="' . $INSTALLER09['baseurl'] . '/forums.php?action=view_post_history&amp;post_id=' . (int) $arr['post_id'] . '&amp;forum_id=' . $forum_id . '&amp;topic_id=' . $topic_id . '">' . $lang['fe_read_post_history'] . '</a></span><br />' : '</span>');
        }
        //==
    }
    //==== highlight for search
    $body = $arr['bbcode'] == 'yes' ? format_comment($arr['body']) : format_comment_no_bbcode($arr['body']);
    if (isset($_GET['search'])) {
        $body = highlightWords($body, $search);
        $post_title = highlightWords($post_title, $search);
    }
    $post_id = (int) $arr['post_id'];
    //=== if there are attachments, let's get them!
    $attachments_res = sql_query('SELECT id, file_name, extension, size FROM attachments WHERE post_id =' . sqlesc($post_id) . ' AND user_id = ' . sqlesc($arr['id']));
    if (mysqli_num_rows($attachments_res) > 0) {
        $attachments = '<table align="center" width="100%" border="0" cellspacing="0" cellpadding="5"><tr><td class="' . $class . '" align="left"><span style="font-weight: bold;">' . $lang['fe_attachments'] . ':</span><hr />';
        while ($attachments_arr = mysqli_fetch_assoc($attachments_res)) {
            $attachments .= '<span style="white-space:nowrap;">' . ($attachments_arr['extension'] === 'zip' ? ' <img src="' . $INSTALLER09['pic_base_url'] . 'forums/zip.gif" alt="' . $lang['fe_zip'] . '" title="' . $lang['fe_zip'] . '" width="18" style="vertical-align: middle;" /> ' : ' <img src="' . $INSTALLER09['pic_base_url'] . 'forums/rar.gif" alt="' . $lang['fe_rar'] . '" title="' . $lang['fe_rar'] . '" width="18" /> ') . ' 
					<a class="altlink" href="' . $INSTALLER09['baseurl'] . '/forums.php?action=download_attachment&amp;id=' . (int) $attachments_arr['id'] . '" title="' . $lang['fe_download_attachment'] . '" target="_blank">
					' . htmlsafechars($attachments_arr['file_name']) . '</a> <span style="font-weight: bold; font-size: xx-small;">[' . mksize($attachments_arr['size']) . ']</span>&nbsp;&nbsp;</span>';
        }
        $attachments .= '</td></tr></table>';
    }
    $width = 300;
    $height = 100;
示例#2
0
    echo highlightWords($obj->getPartido(), $q);
    ?>
)<?php 
}
?>
    <?php 
if (count($obj->getPoliticoInstitucions()) > 0) {
    ?>
, 
      <?php 
    foreach ($obj->getPoliticoInstitucions() as $idx => $politicoInstitucion) {
        if ($idx > 0) {
            ?>
, <?php 
        }
        echo highlightWords($politicoInstitucion->getInstitucion()->getNombre(), $q);
    }
    ?>
    <?php 
}
?>
    <?php 
if ($counts) {
    ?>
      <?php 
    echo $q;
    ?>
 (<?php 
    echo $counts[$obj->getId()];
    ?>
)
示例#3
0
<?php

use_helper('VoFormat');
use_helper('VoUser');
?>

<tr>
	<td class="photo">
		<?php 
echo link_to(image_tag(S3Voota::getImagesUrl() . '/usuarios/cc_s_' . ($obj->getProfile()->getImagen() != '' ? $obj->getProfile()->getImagen() : 'p_unknown.png'), 'alt="' . __('Foto de %1%', array('%1%' => $obj)) . '"'), '@usuario?username='******'@usuario?username='******'[0]%1% votos|[1]%1% voto|(1,+Inf]%1% votos', array('%1%' => $numReviews), $numReviews);
?>
    <br />
  	<?php 
echo $quote;
?>
  </td>
</tr>
            $topic_desc = highlightWords(htmlsafechars($arr['topic_desc'], ENT_QUOTES), $search);
            $post_title = highlightWords($post_title, $search);
        } else {
            $topic_title = htmlsafechars($arr['topic_title'], ENT_QUOTES);
            $topic_desc = htmlsafechars($arr['topic_desc'], ENT_QUOTES);
        }
        $post_id = (int) $arr['post_id'];
        $posts = (int) $arr['post_count'];
        $post_icon = $arr['icon'] != '' ? '<img src="pic/smilies/' . htmlsafechars($arr['icon']) . '.gif" alt="icon" title="icon" /> ' : '<img src="pic/forums/topic_normal.gif" alt="Normal Topic" /> ';
        $edited_by = '';
        if ($arr['edit_date'] > 0) {
            $res_edited = sql_query('SELECT username FROM users WHERE id=' . sqlesc($arr['edited_by']));
            $arr_edited = mysqli_fetch_assoc($res_edited);
            $edited_by = '<br /><br /><br /><span style="font-weight: bold; font-size: x-small;">Last edited by <a class="altlink" href="member_details.php?id=' . (int) $arr['edited_by'] . '">' . htmlsafechars($arr_edited['username']) . '</a> at ' . get_date($arr['edit_date'], '') . ' GMT ' . ($arr['edit_reason'] != '' ? ' </span>[ Reason: ' . htmlsafechars($arr['edit_reason']) . ' ] <span style="font-weight: bold; font-size: x-small;">' : '');
        }
        $body = $arr['bbcode'] == 'yes' ? highlightWords(format_comment($arr['body']), $search) : highlightWords(format_comment_no_bbcode($arr['body']), $search);
        $search_post = str_replace(' ', '+', $search);
        $content .= '<tr><td class="forum_head_dark" colspan="3" align="left">in: 
	<a class="altlink" href="forums.php?action=view_forum&amp;forum_id=' . (int) $arr['forum_id'] . '" title="' . sprintf($lang['sea_link_to_x'], "Forum") . '">
	<span style="color: white;font-weight: bold;">' . htmlsafechars($arr['forum_name'], ENT_QUOTES) . '</span></a> in: 
	<a class="altlink" href="forums.php?action=view_topic&amp;topic_id=' . (int) $arr['topic_id'] . '" title="' . sprintf($lang['sea_link_to_x'], "topic") . '"><span style="color: white;font-weight: bold;">
	' . $topic_title . '</span></a></td></tr>
	<tr><td class="forum_head" align="left" width="100" valign="middle"><a name="' . $post_id . '"></a>
	<span style="font-weight: bold;">' . $lang['sea_relevance'] . ': ' . ROUND($arr['relevance'], 3) . '</span></td>
	<td class="forum_head" align="left" valign="middle">
	<span style="white-space:nowrap;">' . $post_icon . '<a class="altlink" href="forums.php?action=view_topic&amp;topic_id=' . $arr['topic_id'] . '&amp;page=' . $page . '#' . (int) $arr['post_id'] . '" title="Link to Post">' . $post_title . '</a>&nbsp;&nbsp;&nbsp;&nbsp; ' . $lang['fe_posted_on'] . ': ' . get_date($arr['added'], '') . ' [' . get_date($arr['added'], '', 0, 1) . ']</span></td>
	<td class="forum_head" align="right" valign="middle"><span style="white-space:nowrap;"> 
	<a href="forums.php?action=view_my_posts&amp;page=' . $page . '#top"><img src="pic/forums/up.gif" alt="' . $lang['fe_top'] . '" title="' . $lang['fe_top'] . '"/></a> 
	<a href="forums.php?action=view_my_posts&amp;page=' . $page . '#bottom"><img src="pic/forums/down.gif" alt="' . $lang['fe_bottom'] . '" title="' . $lang['fe_bottom'] . '" /></a> 
	</span></td>
	</tr>		
示例#5
0
     $sql .= ' ORDER BY cmtval';
     if ($res = $db->query($sql)) {
         while ($row = $res->fetch_row()) {
             $json['hint'][] = $row[0];
         }
         $res->close();
     }
     $db->close();
     function highlightWords($text, array $words)
     {
         $words = array_map(preg_quote, $words);
         return preg_replace('/(' . implode('|', $words) . ')/isu', '<b>$1</b>', $text);
     }
     if ($html) {
         for ($i = 0; $i < count($json['hint']); $i++) {
             $json['hint'][$i] = highlightWords(htmlspecialchars($json['hint'][$i]), $comm);
         }
     }
     break;
     // Общая статистика
 // Общая статистика
 case 'stat':
     set_time_limit(30);
     $json['result'] = true;
     date_default_timezone_set('UTC');
     $json['stat']['date'] = date('Y.m.d H:i:s');
     $mode = isset($_GET['mode']) ? (int) $_GET['mode'] : 0;
     if (!db_connect()) {
         $json['result'] = false;
         $json['error'] = 'database';
         break;
示例#6
0
        $pageControls .= '<a href="' . $_SERVER['PHP_SELF'] . '?suscrp_input=' . $searchKeyword . '&pn=' . $i . '">' . $i . '</a> &nbsp; ';
        if ($i >= $currentPageNo + 4) {
            break;
        }
    }
    if ($currentPageNo != $lastPageNo) {
        $next = $currentPageNo + 1;
        $pageControls .= ' &nbsp;   &nbsp;  &nbsp;  &nbsp;  <a href="' . $_SERVER['PHP_SELF'] . '?suscrp_input=' . $searchKeyword . '&pn=' . $next . '">Next <img src="images/common_arrow.png" align="absmiddle" width="15px" height="15px"/></a> ';
    }
}
while ($row = mysqli_fetch_array($query, MYSQLI_ASSOC)) {
    $id = $row['job_id'];
    $name = $row['job_title'];
    //$desc = substr($row['job_description'],0,200);
    $desc = $row['job_description'];
    $highlighted_desc = highlightWords($desc, $searchKeyword);
    $list .= '<p class="highlight"><a href="job_description.php?job_id=\'' . $id . '\'">' . $name . ' ></a></p>';
    //$list .= '<p class="search_result_desc">'.str_ireplace($keywords, "<span class='highlight'>\"".$keywords."\"</span>", $desc).'</p>';
    //$list .= '<p class="search_result_desc">'.substr($highlighted_desc,0,200).'</p>';
    $list .= '<p class="search_result_desc">' . $highlighted_desc . '</p>';
}
function highlightWords($desc, $searchKeyword)
{
    $searchKeyword = preg_replace('/\\s+/', ' ', trim($searchKeyword));
    $words = explode(' ', $searchKeyword);
    $highlighted = array();
    foreach ($words as $word) {
        $highlighted[] = "<span class='highlight'>" . $word . "</span>";
    }
    return str_ireplace($words, $highlighted, $desc);
}
function niceQuestionFormat($text, $searchWords = '')
{
    $result = insertLinks($text);
    $result = highlightWords($result, $searchWords);
    return $result;
}
示例#8
0
<?php

use_helper('VoFormat');
?>
<tr>
	<td class="photo">
		<?php 
echo image_tag(S3Voota::getImagesUrl() . '/instituciones/cc_s_' . ($obj->getImagen() != '' ? $obj->getImagen() : 'p_unknown.png'), 'alt="' . __('Foto de %1%', array('%1%' => $obj)) . '"');
?>
    </td>
    <td class="name">
		<?php 
echo link_to(highlightWords($obj->getNombre(), $q), 'politico/ranking?partido=all&institucion=' . $obj->getVanity());
?>
      
    </td>
</tr>
	        
	        
	        
示例#9
0
function getCollegeSearch($query)
{
    $ignore_words = array("str", "strada", "ale", "aleea", "din", "bld", "bulevardul", "nr", "numarul", "piata", "pta", "orasul", "comuna", "satul", "sat");
    $query = getStringWithoutDiacritics($query);
    $query = mysql_real_escape_string($query);
    $words = explode(" ", $query);
    $likes = array();
    foreach ($words as $word) {
        // Ignore one and two letter words, stopwords, and numbers;
        if (strlen($word) > 2 && !in_array(strtolower($word), $ignore_words) && (int) $word == 0) {
            $likes[] = "description LIKE '%{$word}%'";
            $likes[] = "description LIKE '{$word}%'";
            $likes[] = "description LIKE '%{$word}'";
        }
    }
    if (count($likes) == 0) {
        return array();
    }
    $where = implode(" OR ", $likes);
    $s = mysql_query("\n      SELECT *\n      FROM electoral_colleges\n      WHERE {$where}");
    $result = array();
    while ($r = mysql_fetch_array($s)) {
        // We drop the descriptions where the match is not a full word, but instead
        // only a subset of a word. So for example... if the search was "ion" and
        // the description was "ionescu", we drop it.
        //
        // We have to do it this way because MYSQL native regexp matching does not
        // handle diacritics well, whereas LIKE works perfectly.
        $clean_description = strtolower(getStringWithoutDiacritics($r['description']));
        if (countMatches($words, $clean_description, $ignore_words) == 0) {
            continue;
        }
        $key = $r['name_cdep'];
        $description = highlightWords(correctDiacritics($r['description']), $words);
        if (!array_key_exists($key, $result)) {
            $result[$key] = array();
            $result[$key]['score'] = 0;
            $result[$key]['description'] = array();
            $result[$key]['matched_words'] = array();
            $result[$key]['name_cdep'] = $r['name_cdep'];
            $result[$key]['name_senat'] = $r['name_senat'];
            $result[$key]['id'] = $r['id'];
        }
        $result[$key]['description'][] = $description;
        $result[$key]['matched_words'] = setMatchedWords($result[$key]['matched_words'], $r['description'], $words);
        if (startsWith($description, "Municipiul")) {
            $result[$key]['score'] += 2;
        }
        if (startsWith($description, "Localitate componentă") || startsWith($description, "Orașul")) {
            $result[$key]['score'] += 1;
        }
        $result[$key]['score'] += (countMatches($words, $clean_description, $ignore_words) - 1) * 2;
    }
    foreach ($result as $key => $value) {
        foreach ($words as $word) {
            $pos = strpos(strtolower($key), strtolower($word));
            if ($pos === false) {
                // string needle NOT found in haystack
            } else {
                // string needle found in haystack
                $result[$key]['score'] += 2;
            }
        }
        $result[$key]['score'] += count($result[$key]['matched_words']);
    }
    usort($result, "collegeResultCompare");
    return array_slice($result, 0, 25);
}
示例#10
0
<?php

use_helper('VoFormat');
?>
<tr>
	<td class="photo">
    <?php 
echo link_to(image_tag(S3Voota::getImagesUrl() . '/' . $obj->getImagePath() . '/cc_s_' . $obj->getImagen(), 'alt="' . __('Foto de %1%', array('%1%' => $obj)) . '"'), 'propuesta/show?id=' . $obj->getVanity());
?>
  </td>
  <td class="name">
		<?php 
echo link_to(highlightWords($obj, $q), 'propuesta/show?id=' . $obj->getVanity());
?>
 <?php 
echo __('(propuesta)');
?>
    <?php 
if ($counts) {
    ?>
	    <?php 
    echo $q;
    ?>
 (<?php 
    echo $counts[$obj->getId()];
    ?>
)
    <?php 
}
?>
    <br />
示例#11
0
<?php

use_helper('VoFormat');
?>
<tr>
	<td class="photo">
		<?php 
echo link_to(image_tag(S3Voota::getImagesUrl() . '/partidos/cc_s_' . ($obj->getImagen() != '' ? $obj->getImagen() : 'p_unknown.png'), 'alt="' . __('Foto de %1%', array('%1%' => $obj)) . '"'), 'partido/show?id=' . $obj->getAbreviatura());
?>
    </td>
    <td class="name">
      <?php 
echo link_to(highlightWords($obj, $q), 'partido/show?id=' . $obj->getAbreviatura());
?>
, <?php 
echo highlightWords($obj->getNombre(), $q);
?>
        <?php 
if ($counts) {
    ?>
	        <?php 
    echo $q;
    ?>
 (<?php 
    echo $counts[$obj->getId()];
    ?>
)
        <?php 
}
?>
      <br />