You are here

private function nexcloud::get_tagids in filedepot 6

Same name and namespace in other branches
  1. 7 nexcloud.class.php \nexcloud::get_tagids()

File

./nexcloud.class.php, line 97
nexcloud.class.php Tag Cloud class for the fildepot module

Class

nexcloud
@file nexcloud.class.php Tag Cloud class for the fildepot module

Code

private function get_tagids($tagwords) {
  if (!empty($tagwords)) {
    $tagwords = explode(',', $tagwords);

    // Build a comma separated list of tagwords that we can use in a SQL statements below
    $allTagWords = array();
    foreach ($tagwords as $word) {
      $tag = "'" . addslashes($word) . "'";
      $allTagWords[] = $tag;
    }
    $tagwords = implode(',', $allTagWords);

    // build a comma separated list of words
    if (!empty($tagwords)) {
      $query = db_query("SELECT id FROM {nextag_words} where tagword in ({$tagwords})");
      $tagids = array();
      while ($A = db_fetch_array($query)) {
        $tagids[] = $A['id'];
      }
      return $tagids;
    }
    else {
      return FALSE;
    }
  }
  else {
    return FALSE;
  }
}