Changeset 2135


Ignore:
Timestamp:
Oct 12, 2007, 5:27:34 AM (17 years ago)
Author:
rvelices
Message:
  • fix plugin menu link broken with xamp (realpath behaves differently)
  • complete quick search rewriting
    • now we can quote phrases as in google "New York" is not the same as New York
    • user comments not searched anymore (faster)
    • the big full text query does not use joins anymore (faster)
    • related tags not shown on the index page, but now you can see the matching tags and matching categories
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions_plugins.inc.php

    r1900 r2135  
    9696  if (false!==$real_file)
    9797  {
    98     $real_plugin_path = realpath(PHPWG_PLUGINS_PATH);
     98    $real_plugin_path = rtrim(realpath(PHPWG_PLUGINS_PATH), '\\/');
    9999    $file = substr($real_file, strlen($real_plugin_path)+1);
    100100    $file = str_replace('\\', '/', $file);//Windows
  • trunk/include/functions_search.inc.php

    r2043 r2135  
    254254/**
    255255 * returns the LIKE sql clause corresponding to the quick search query $q
    256  * and the field $field. example q="john bill", field="file" will return
    257  * file LIKE "%john%" OR file LIKE "%bill%". Special characters for MySql
    258  * full text search (+,<,>) are omitted.
     256 * and the field $field. example q='john bill', field='file' will return
     257 * file LIKE '%john%' OR file LIKE '%bill%'. Special characters for MySql full
     258 * text search (+,<,>,~) are omitted. The query can contain a phrase:
     259 * 'Pierre "New York"' will return LIKE '%Pierre%' OR LIKE '%New York%'.
    259260 * @param string q
    260261 * @param string field
     
    263264function get_qsearch_like_clause($q, $field)
    264265{
    265   $tokens = preg_split('/[\s,.;!\?]+/', $q);
     266  $q = stripslashes($q);
     267  $tokens = array();
     268  $token_modifiers = array();
     269  $crt_token = "";
     270  $crt_token_modifier = "";
     271  $state = 0;
     272
     273  for ($i=0; $i<strlen($q); $i++)
     274  {
     275    $ch = $q[$i];
     276    switch ($state)
     277    {
     278      case 0:
     279        if ($ch=='"')
     280        {
     281          if (strlen($crt_token))
     282          {
     283            $tokens[] = $crt_token;
     284            $token_modifiers[] = $crt_token_modifier;
     285            $crt_token = "";
     286            $crt_token_modifier = "";
     287          }
     288          $state=1;
     289        }
     290        elseif ( $ch=='*' )
     291        { // wild card
     292          $crt_token .= '%';
     293        }
     294        elseif ( strcspn($ch, '+-><~')==0 )
     295        { //special full text modifier
     296          if (strlen($crt_token))
     297          {
     298            $tokens[] = $crt_token;
     299            $token_modifiers[] = $crt_token_modifier;
     300            $crt_token = "";
     301            $crt_token_modifier = "";
     302          }
     303          $crt_token_modifier .= $ch;
     304        }
     305        elseif (preg_match('/[\s,.;!\?]+/', $ch))
     306        { // white space
     307          if (strlen($crt_token))
     308          {
     309            $tokens[] = $crt_token;
     310            $token_modifiers[] = $crt_token_modifier;
     311            $crt_token = "";
     312            $crt_token_modifier = "";
     313          }
     314        }
     315        else
     316        {
     317          $crt_token .= $ch;
     318        }
     319        break;
     320      case 1: // qualified with quotes
     321        switch ($ch)
     322        {
     323          case '"':
     324            $tokens[] = $crt_token;
     325            $token_modifiers[] = $crt_token_modifier;
     326            $crt_token = "";
     327            $crt_token_modifier = "";
     328            $state=0;
     329            break;
     330          default:
     331            $crt_token .= $ch;
     332        }
     333        break;
     334    }
     335  }
     336  if (strlen($crt_token))
     337  {
     338    $tokens[] = $crt_token;
     339    $token_modifiers[] = $crt_token_modifier;
     340  }
     341
     342  $clauses = array();
    266343  for ($i=0; $i<count($tokens); $i++)
    267344  {
    268     $tokens[$i]=str_replace('*','%', $tokens[$i]);
    269     if (preg_match('/^[+<>]/',$tokens[$i]) )
    270       $tokens[$i]=substr($tokens[$i], 1);
    271     else if (substr($tokens[$i], 0, 1)=='-')
    272     {
    273       unset($tokens[$i]);
    274       $i--;
    275     }
    276   }
    277 
    278   if (!empty($tokens))
    279   {
    280     $query = '(';
    281     for ($i=0; $i<count($tokens); $i++)
    282     {
    283       if ($i>0) $query .= 'OR ';
    284       $query .= ' '.$field.' LIKE "%'.$tokens[$i].'%" ';
    285     }
    286     $query .= ')';
    287     return $query;
    288   }
    289   return null;
     345    $tokens[$i] = trim($tokens[$i], '%');
     346    if (strstr($token_modifiers[$i], '-')!==false)
     347      continue;
     348    if ( strlen($tokens[$i])==0)
     349      continue;
     350    $clauses[] = $field.' LIKE "%'.addslashes($tokens[$i]).'%"';
     351  }
     352
     353  return count($clauses) ? '('.implode(' OR ', $clauses).')' : null;
    290354}
    291355
    292356
    293357/**
    294  * returns the search results (array of image ids) corresponding to a
    295  * quick/query search. A quick/query search returns many items (search is
    296  * not strict), but results are sorted by relevance.
     358 * returns the search results corresponding to a quick/query search.
     359 * A quick/query search returns many items (search is not strict), but results
     360 * are sorted by relevance unless $page['super_order_by'] is set. Returns:
     361 * array (
     362 * 'items' => array(85,68,79...)
     363 * 'as_is' => 1 (indicates the caller that items are ordered and permissions checked
     364 * 'qs'    => array(
     365 *    'matching_tags' => array(85,86) - matching tags
     366 *    'matching_cats' => array(1,2,3) - matching categories
     367 *    'matching_cats_no_images' =>array(99) - matching categories without images
     368 *      ))
    297369 *
    298370 * @param string q
     371 * @param string images_where optional aditional restriction on images table
    299372 * @return array
    300373 */
    301 function get_quick_search_results($q)
     374function get_quick_search_results($q, $images_where='')
    302375{
    303376  global $page;
    304   $search_results = array();
     377  $search_results =
     378    array(
     379      'items' => array(),
     380      'as_is' => 1,
     381      'qs' => array('q'=>stripslashes($q)),
     382    );
    305383  $q = trim($q);
    306384  if (empty($q))
    307385  {
    308     $search_results['items'] = array();
    309386    return $search_results;
    310387  }
    311   // prepare the big join on images, comments and categories
     388  $q_like_field = '@@__db_field__@@'; //something never in a search
     389  $q_like_clause = get_qsearch_like_clause($q, $q_like_field );
     390
     391
     392  // Step 1 - first we find matches in #images table ===========================
     393  $where_clauses='MATCH(i.name, i.comment) AGAINST( "'.$q.'" IN BOOLEAN MODE)';
     394  if (!empty($q_like_clause))
     395  {
     396    $where_clauses .= '
     397    OR '. str_replace($q_like_field, 'file', $q_like_clause);
     398    $where_clauses = '('.$where_clauses.')';
     399  }
     400  $where_clauses = array($where_clauses);
     401  if (!empty($images_where))
     402  {
     403    $where_clauses[]='('.$images_where.')';
     404  }
     405  $where_clauses[] .= get_sql_condition_FandF
     406      (
     407        array( 'visible_images' => 'i.id' ), null, true
     408      );
    312409  $query = '
    313 SELECT
    314   i.id, CAST( CONCAT_WS(" ",
    315     IFNULL(i.name,""),
    316     IFNULL(i.comment,""),
    317     IFNULL(GROUP_CONCAT(DISTINCT co.content),""),
    318     IFNULL(GROUP_CONCAT(DISTINCT c.dir),""),
    319     IFNULL(GROUP_CONCAT(DISTINCT c.name),""),
    320     IFNULL(GROUP_CONCAT(DISTINCT c.comment),"") ) AS CHAR) AS ft
    321 FROM (
    322   (
    323     '.IMAGES_TABLE.' i LEFT JOIN '.COMMENTS_TABLE.' co on i.id=co.image_id
    324   )
    325     INNER JOIN
    326   '.IMAGE_CATEGORY_TABLE.' ic on ic.image_id=i.id
    327   )
    328     INNER JOIN
    329   '.CATEGORIES_TABLE.' c on c.id=ic.category_id
    330 '.get_sql_condition_FandF
    331   (
    332     array
    333       (
    334         'forbidden_categories' => 'category_id',
    335         'visible_categories' => 'category_id',
    336         'visible_images' => 'i.id'
    337       ),
    338     'WHERE'
    339   ).'
    340 GROUP BY i.id';
    341 
    342   $query = 'SELECT id, MATCH(ft) AGAINST( "'.$q.'" IN BOOLEAN MODE) AS q FROM ('.$query.') AS Y
    343 WHERE MATCH(ft) AGAINST( "'.$q.'" IN BOOLEAN MODE)';
     410SELECT i.id,
     411    MATCH(i.name, i.comment) AGAINST( "'.$q.'" IN BOOLEAN MODE) AS weight
     412  FROM '.IMAGES_TABLE.' i
     413  WHERE '.implode("\n AND ", $where_clauses);
    344414
    345415  $by_weights=array();
     
    347417  while ($row = mysql_fetch_array($result))
    348418  { // weight is important when sorting images by relevance
    349     if ($row['q'])
    350     {
    351       $by_weights[(int)$row['id']] =  2*$row['q'];
    352     }
    353   }
    354 
    355   $permissions_checked = true;
    356   // now search the file name separately (not done in full text because slower
    357   // and the filename in pwg doesn't have spaces so full text is meaningless )
    358   $q_like_clause = get_qsearch_like_clause($q, 'file' );
     419    if ($row['weight'])
     420    {
     421      $by_weights[(int)$row['id']] =  2*$row['weight'];
     422    }
     423    else
     424    {//full text does not match but file name match
     425      $by_weights[(int)$row['id']] =  2;
     426    }
     427  }
     428
     429
     430  // Step 2 - search tags corresponding to the query $q ========================
    359431  if (!empty($q_like_clause))
    360   {
    361     $query = '
    362 SELECT id
    363   FROM '.IMAGES_TABLE.'
    364   WHERE '.$q_like_clause.
    365       get_sql_condition_FandF
    366       (
    367         array
    368           (
    369             'visible_images' => 'id'
    370           ),
    371         'AND'
    372       );
    373     $result = pwg_query($query);
    374     while ($row = mysql_fetch_assoc($result))
    375     { // weight is important when sorting images by relevance
    376       $id=(int)$row['id'];
    377       @$by_weights[$id] += 2;
    378       $permissions_checked = false;
    379     }
    380   }
    381 
    382   // now search tag names corresponding to the query $q. we could have searched
    383   // tags earlier during the big join, but for the sake of the performance and
    384   // because tags have only a simple name we do it separately
    385   $q_like_clause = get_qsearch_like_clause($q, 'CONVERT(name, CHAR)' );
    386   if (!empty($q_like_clause))
    387   {
    388     // search also by url name (without accents)
    389     $q_like_clause_url = get_qsearch_like_clause($q, 'url_name' );
     432  { // search name and url name (without accents)
    390433    $query = '
    391434SELECT id
    392435  FROM '.TAGS_TABLE.'
    393   WHERE '.$q_like_clause.'
    394   OR '.$q_like_clause_url;
     436  WHERE ('.str_replace($q_like_field, 'CONVERT(name, CHAR)', $q_like_clause).'
     437    OR '.str_replace($q_like_field, 'url_name', $q_like_clause).')';
    395438    $tag_ids = array_from_query( $query, 'id');
    396439    if (!empty($tag_ids))
    397     { // we got some tags
     440    { // we got some tags; get the images
     441      $search_results['qs']['matching_tags']=$tag_ids;
    398442      $query = '
    399 SELECT image_id, COUNT(tag_id) AS q
     443SELECT image_id, COUNT(tag_id) AS weight
    400444  FROM '.IMAGE_TAG_TABLE.'
    401445  WHERE tag_id IN ('.implode(',',$tag_ids).')
     
    405449      { // weight is important when sorting images by relevance
    406450        $image_id=(int)$row['image_id'];
    407         @$by_weights[$image_id] += $row['q'];
    408         $permissions_checked = false;
     451        @$by_weights[$image_id] += $row['weight'];
    409452      }
    410453    }
    411454  }
    412455
    413   //at this point, found images might contain images not allowed for the user
    414   if ( !$permissions_checked
    415        and !empty($by_weights)
    416        and !isset($page['super_order_by']) )
    417   {
    418     // before returning the result "as is", make sure the user has the
    419     // permissions for every item
    420     global $conf;
    421     $query = '
     456
     457  // Step 3 - search categories corresponding to the query $q ==================
     458  global $user;
     459  $query = '
     460SELECT id, nb_images
     461  FROM '.CATEGORIES_TABLE.'
     462    INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' ON id=cat_id
     463  WHERE user_id='.$user['id'].'
     464    AND MATCH(name, comment) AGAINST( "'.$q.'" IN BOOLEAN MODE)'.
     465  get_sql_condition_FandF (
     466      array( 'visible_categories' => 'cat_id' ), "\n    AND"
     467    );
     468  $result = pwg_query($query);
     469  while ($row = mysql_fetch_assoc($result))
     470  { // weight is important when sorting images by relevance
     471    if ($row['nb_images']==0)
     472    {
     473      $search_results['qs']['matching_cats_no_images'][] = $row['id'];
     474    }
     475    else
     476    {
     477      $search_results['qs']['matching_cats'][] = $row['id'];
     478    }
     479  }
     480
     481  if ( empty($by_weights) and empty($search_results['qs']['matching_cats']) )
     482  {
     483    return $search_results;
     484  }
     485
     486  // Step 4 - now we have $by_weights ( array image id => weight ) that need
     487  // permission checks and/or matching categories to get images from
     488  $where_clauses = array();
     489  if ( !empty($by_weights) )
     490  {
     491    $where_clauses[]='i.id IN ('
     492      . implode(',', array_keys($by_weights)) . ')';
     493  }
     494  if ( !empty($search_results['qs']['matching_cats']) )
     495  {
     496    $where_clauses[]='category_id IN ('.
     497      implode(',',$search_results['qs']['matching_cats']).')';
     498  }
     499  $where_clauses = array( '('.implode("\n    OR ",$where_clauses).')' );
     500  if (!empty($images_where))
     501  {
     502    $where_clauses[]='('.$images_where.')';
     503  }
     504  $where_clauses[] = get_sql_condition_FandF(
     505      array
     506        (
     507          'forbidden_categories' => 'category_id',
     508          'visible_categories' => 'category_id',
     509          'visible_images' => 'i.id'
     510        ),
     511      null,true
     512    );
     513
     514  global $conf;
     515  $query = '
    422516SELECT DISTINCT(id)
    423   FROM '.IMAGES_TABLE.'
     517  FROM '.IMAGES_TABLE.' i
    424518    INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
    425   WHERE id IN ('.implode(',', array_keys($by_weights) ).')
    426 '.get_sql_condition_FandF
    427   (
    428     array
    429       (
    430         'forbidden_categories' => 'category_id',
    431         'visible_categories' => 'category_id',
    432         'visible_images' => 'id'
    433       ),
    434     'AND'
    435   ).'
    436   '.$conf['order_by'];
    437     $allowed_images = array_flip( array_from_query( $query, 'id') );
    438     $by_weights = array_intersect_key($by_weights, $allowed_images );
    439     $divisor = 4.0 * count($allowed_images);
    440     // decrease weight from 0 to 0.25 corresponding to the order
    441     foreach ($allowed_images as $id=>$rank )
    442     {
    443       $by_weights[$id] -=  $rank / $divisor;
    444     }
    445     $permissions_checked = true;
    446   }
    447   arsort($by_weights, SORT_NUMERIC);
    448   if ( $permissions_checked )
    449   {
    450     $search_results['as_is']=1;
    451   }
    452  
    453   $search_results['items'] = array_keys($by_weights);
     519  WHERE '.implode("\n AND ", $where_clauses)."\n".
     520  $conf['order_by'];
     521
     522  $allowed_images = array_from_query( $query, 'id');
     523
     524  if ( isset($page['super_order_by']) or empty($by_weights) )
     525  {
     526    $search_results['items'] = $allowed_images;
     527    return $search_results;
     528  }
     529
     530  $allowed_images = array_flip( $allowed_images );
     531  $divisor = 5.0 * count($allowed_images);
     532  foreach ($allowed_images as $id=>$rank )
     533  {
     534    $weight = isset($by_weights[$id]) ? $by_weights[$id] : 1;
     535    $weight -= $rank/$divisor;
     536    $allowed_images[$id] = $weight;
     537  }
     538  arsort($allowed_images, SORT_NUMERIC);
     539  $search_results['items'] = array_keys($allowed_images);
    454540  return $search_results;
    455541}
     
    459545 *
    460546 * @param int search id
     547 * @param string images_where optional aditional restriction on images table
    461548 * @return array
    462549 */
    463 function get_search_results($search_id)
     550function get_search_results($search_id, $images_where='')
    464551{
    465552  $search = get_search_array($search_id);
     
    471558  else
    472559  {
    473     return get_quick_search_results($search['q']);
     560    return get_quick_search_results($search['q'], $images_where);
    474561  }
    475562}
  • trunk/include/section_init.inc.php

    r2117 r2135  
    330330    {
    331331      $page['items'] = $search_result['items'];
     332      if ( isset($search_result['qs']) )
     333      {//save the details of the query search
     334        $page['qsearch_details'] = $search_result['qs'];
     335      }
    332336    }
    333337
     
    520524// add meta robots noindex, nofollow to avoid unnecesary robot crawls
    521525$page['meta_robots']=array();
    522 if ( isset($page['chronology_field']) or isset($page['flat'])
     526if ( isset($page['chronology_field'])
     527      or ( isset($page['flat']) and isset($page['category']) )
    523528      or 'list'==$page['section'] or 'recent_pics'==$page['section'] )
    524529{
  • trunk/include/ws_functions.inc.php

    r2126 r2135  
    760760  include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
    761761
    762   $where_clauses = ws_std_image_sql_filter( $params );
    763   $order_by = ws_std_image_sql_order($params);
    764 
    765   if ( !empty($where_clauses) and !empty($order_by) )
    766   {
     762  $where_clauses = ws_std_image_sql_filter( $params, 'i.' );
     763  $order_by = ws_std_image_sql_order($params, 'i.');
     764
     765  if ( !empty($order_by) )
     766  {
     767    global $conf;
     768    $conf['order_by'] = 'ORDER BY '.$order_by;
    767769    $page['super_order_by']=1; // quick_search_result might be faster
    768770  }
    769   $search_result = get_quick_search_results($params['query']);
    770 
    771   global $image_ids; //needed for sorting by rank (usort)
    772   if ( ( !isset($search_result['as_is'])
    773       or !empty($where_clauses)
    774       or !empty($order_by) )
    775       and !empty($search_result['items']) )
    776   {
    777     $where_clauses[] = 'id IN ('
    778         .wordwrap(implode(', ', $search_result['items']), 80, "\n")
    779         .')';
    780     $where_clauses[] = get_sql_condition_FandF(
    781         array
    782           (
    783             'forbidden_categories' => 'category_id',
    784             'visible_categories' => 'category_id',
    785             'visible_images' => 'id'
    786           ),
    787         '', true
    788       );
    789     $query = '
    790 SELECT DISTINCT id FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id=image_id
    791   WHERE '.implode('
    792     AND ', $where_clauses);
    793     if (!empty($order_by))
    794     {
    795       $query .= '
    796   ORDER BY '.$order_by;
    797     }
    798     $image_ids = array_from_query($query, 'id');
    799     global $ranks;
    800     $ranks = array_flip( $search_result['items'] );
    801     usort(
    802       $image_ids,
    803       create_function('$i1,$i2', 'global $ranks; return $ranks[$i1]-$ranks[$i2];')
    804     );
    805     unset ($ranks);
    806   }
    807   else
    808   {
    809     $image_ids = $search_result['items'];
    810   }
     771
     772  $search_result = get_quick_search_results($params['query'],
     773    implode(',', $where_clauses) );
     774  $image_ids = $search_result['items'];
    811775
    812776  $image_ids = array_slice($image_ids,
  • trunk/index.php

    r2117 r2135  
    104104  $template_title.= ' ['.count($page['items']).']';
    105105}
     106$template->assign_var('TITLE', $template_title);
    106107
    107108if (isset($page['flat']) or isset($page['chronology_field']))
     
    170171include(PHPWG_ROOT_PATH.'include/menubar.inc.php');
    171172
    172 $template->assign_vars(
    173   array(
    174     'TITLE' => $template_title
    175     )
    176   );
    177 
    178173if ('search' == $page['section'])
    179174{
     
    200195if (is_admin() and !empty($page['items']) )
    201196{
    202     $template->assign_block_vars(
    203       'caddie',
    204       array(
    205         'URL' =>
    206           add_url_params(duplicate_index_url(), array('caddie'=>1) )
    207         )
     197  $template->assign_block_vars(
     198    'caddie',
     199    array(
     200      'URL' =>
     201         add_url_params(duplicate_index_url(), array('caddie'=>1) )
     202      )
     203    );
     204}
     205
     206if ( $page['section']=='search' and $page['start']==0 and
     207    !isset($page['chronology_field']) and isset($page['qsearch_details']) )
     208{
     209  $template->assign_var('QUERY_SEARCH',
     210    htmlspecialchars($page['qsearch_details']['q']) );
     211
     212  $found_cat_ids = array_merge(
     213      (array)@$page['qsearch_details']['matching_cats_no_images'],
     214      (array)@$page['qsearch_details']['matching_cats'] );
     215  if (count($found_cat_ids))
     216  {
     217    $hints = array();
     218    $query = '
     219SELECT id, name, permalink FROM '.CATEGORIES_TABLE.'
     220  WHERE id IN ('.implode(',', $found_cat_ids).')
     221  ORDER BY name
     222  LIMIT 10';
     223    $result = pwg_query($query);
     224    while ( $row = mysql_fetch_assoc($result) )
     225    {
     226      $hints[] = get_cat_display_name( array($row) );
     227    }
     228    $template->assign_block_vars( 'category_search_results',
     229        array(
     230            'CONTENT' => implode(' &mdash; ', $hints)
     231          )
    208232      );
    209233  }
    210234
    211 if ( $page['section']=='search' and $page['start']==0 )
    212 {
    213   $tags = get_common_tags($page['items'],
    214       $conf['content_tag_cloud_items_number'], null);
    215   if ( count($tags)>1 )
    216   {
    217     $template->assign_block_vars('related_tags', array() );
    218 
    219     $tags = add_level_to_tags($tags);
    220     foreach ($tags as $tag)
     235  $tags = find_tags( (array)@$page['qsearch_details']['matching_tags'] );
     236  if (count($tags))
     237  {
     238    usort($tags, 'name_compare');
     239    $hints = array();
     240    foreach ( $tags as $tag )
    221241    {
    222       $template->assign_block_vars(
    223       'related_tags.tag', array(
    224         'URL' => make_index_url(
    225           array(
    226             'tags' => array($tag)
    227             )
    228           ),
    229         'NAME' => $tag['name'],
    230         'TITLE' => l10n_dec(
    231             '%d picture are also linked to current tags',
    232             '%d pictures are also linked to current tags',
    233             $tag['counter']),
    234         'CLASS' => 'tagLevel'.$tag['level']
    235         )
     242      $hints[] =
     243        '<a href="' . make_index_url(array('tags'=>array($tag))) . '">'
     244        .$tag['name']
     245        .'</a>';
     246    }
     247    $template->assign_block_vars( 'tag_search_results',
     248        array(
     249            'CONTENT' => implode(' &mdash; ', $hints)
     250          )
    236251      );
    237     }
    238252  }
    239253}
     
    300314      )
    301315    );
    302   $header_infos['COMMENT'] = strip_tags($page['comment']);
    303316}
    304317//------------------------------------------------------------ log informations
  • trunk/language/en_UK/common.lang.php

    r2127 r2135  
    380380$lang['Administrator, webmaster and special user cannot use this method'] = 'Administrator, webmaster and special user cannot use this method';
    381381$lang['reg_err_mail_address_dbl'] = 'a user use already this mail address';
     382$lang['Category results for'] = 'Category results for';
     383$lang['Tag results for'] = 'Tag results for';
    382384?>
  • trunk/language/fr_FR/common.lang.php

    r2130 r2135  
    379379$lang['Administrator, webmaster and special user cannot use this method'] = 'Administrateur, webmestre et utilisateur spécial ne peuvent pas utiliser cette méthode';
    380380$lang['reg_err_mail_address_dbl'] = 'un utilisateur utilise déjà cette adresse e-mail';
     381$lang['Category results for'] = 'Résultats des catégories pour';
     382$lang['Tag results for'] = 'Résultats des tags pour';
    381383?>
  • trunk/qsearch.php

    r2095 r2135  
    4040$search['q']=$_GET['q'];
    4141
    42 $query ='
     42$query = '
     43SElECT id FROM '.SEARCH_TABLE.'
     44  WHERE rules = \''.addslashes(serialize($search)).'\'
     45;';
     46$search_id = array_from_query( $query, 'id');
     47if ( !empty($search_id) )
     48{
     49  $search_id = $search_id[0];
     50  $query = '
     51UPDATE '.SEARCH_TABLE.'
     52  SET last_seen=NOW()
     53  WHERE id='.$search_id;
     54  pwg_query($query);
     55}
     56else
     57{
     58  $query ='
    4359INSERT INTO '.SEARCH_TABLE.'
    4460  (rules, last_seen)
     
    4662  (\''.addslashes(serialize($search)).'\', NOW() )
    4763;';
    48 pwg_query($query);
    49 
    50 $search_id = mysql_insert_id();
     64  pwg_query($query);
     65  $search_id = mysql_insert_id();
     66}
    5167
    5268redirect(
  • trunk/template/yoga/default-layout.css

    r2091 r2135  
    257257  display: inline;
    258258  white-space: nowrap;
     259  margin: 0 2px;
    259260}
    260261
  • trunk/template/yoga/index.tpl

    r1900 r2135  
    2525
    2626      <!-- BEGIN search_rules -->
    27       <li><a href="{search_rules.URL}" style="border:none;" onclick="popuphelp(this.href); return false;" title="{lang:Search rules}"><img src="{pwg_root}{themeconf:icon_dir}/search_rules.png" class="button" alt="(?)"></a></li>
     27      <li><a href="{search_rules.URL}" style="border:none;" onclick="popuphelp(this.href); return false;" title="{lang:Search rules}" rel="nofollow"><img src="{pwg_root}{themeconf:icon_dir}/search_rules.png" class="button" alt="(?)"></a></li>
    2828      <!-- END search_rules -->
    2929
     
    6565
    6666{PLUGIN_INDEX_CONTENT_BEGIN}
     67
     68<!-- BEGIN category_search_results -->
     69<div style="font-size:16px;text-align:left;margin:10px">{lang:Category results for} <strong>{QUERY_SEARCH}</strong> : <em><strong>{category_search_results.CONTENT}</strong></em></div>
     70<!-- END category_search_results -->
     71<!-- BEGIN tag_search_results -->
     72<div style="font-size:16px;text-align:left;margin:10px">{lang:Tag results for} <strong>{QUERY_SEARCH}</strong> : <em><strong>{tag_search_results.CONTENT}</strong></em></div>
     73<!-- END tag_search_results -->
     74
     75
    6776<!-- BEGIN calendar -->
    6877<!-- BEGIN navbar -->
     
    98107<!-- END cat_infos -->
    99108
    100 <!-- BEGIN related_tags -->
    101   <ul id="fullTagCloud">
    102     <li>{lang:Related tags}:</li>
    103     <!-- BEGIN tag -->
    104     <li><a href="{related_tags.tag.URL}" class="{related_tags.tag.CLASS}" title="{related_tags.tag.TITLE}">{related_tags.tag.NAME}</a></li>
    105     <!-- END tag -->
    106   </ul>
    107 <!-- END related_tags -->
    108109
    109110{PLUGIN_INDEX_CONTENT_END}
Note: See TracChangeset for help on using the changeset viewer.