Aardvark Topsites PHP V 5.x.x için modül. Bu modülde üye sitelerin eklediği anahtar kelimeler ana sayfada gözüküyor, arama yapılırken kolay bulmada ve arama motorlarında sitelerin önsıralarda yayınlanmasına faydalı oluyor.
Kurulum işlemleri.
1. Mysql üzerindeki toplist veritabanında `ats_sites` tablosunun içine `openid` altına, `tags` alanını ekleyin. "tags" alanının özelliği; VARCHAR( 100 ) ve NOT NULL olacak.
2. index.php dosyasını editörle açın aşağıdaki kodu bulun.
// Check for hits in
require_once("{$CONF['path']}/sources/in.php");
$in = new in;
Bu kodların sonuna şu kodları ekleyin.
//Cloud Tags
$result = $DB->query("SELECT tags FROM {$CONF['sql_prefix']}_sites WHERE active = 1", __FILE__, __LINE__);
while ($row = $DB->fetch_array($result)) {
$temp_tags = explode(',', $row['tags']);
foreach ($temp_tags as $tag) {
if (isset($tags[$tag])) {
$tags[$tag]++;
} else {
$tags[$tag] = 1;
}
}
}
ksort($tags);
// change these font sizes if you will
$max_size = 250; // max font size in %
$min_size = 100; // min font size in %
// get the largest and smallest array values
$max_qty = max(array_values($tags));
$min_qty = min(array_values($tags));
// find the range of values
$spread = $max_qty - $min_qty;
if (0 == $spread) { // we don't want to divide by zero
$spread = 1;
}
// determine the font-size increment
// this is the increase per tag quantity (times used)
$step = ($max_size - $min_size)/($spread);
// loop through our tag array
foreach ($tags as $key => $value) {
// calculate CSS font-size
// find the $value in excess of $min_qty
// multiply by the font-size increment ($size)
// and add the $min_size set above
$size = $min_size + (($value - $min_qty) * $step);
// uncomment if you want sizes in whole %:
// $size = ceil($size);
$TMPL['clouds'] .= '<a href="index.php?a=search&q='.$key.'" style="font-size: '.$size.'%" title="'.$value.' sites tagged with '.$key.'">'.$key.'[/url] ';
}
//End Cloud tag
3. sources/join.php dosyasını editörle açın aşağıdaki kodu bulun.
if (isset($TMPL['email'])) { $TMPL['email'] = stripslashes($TMPL['email']); }
Bu koddan sonra şu kodu ekleyin.
if (isset($TMPL['tags'])) { $TMPL['tags'] = stripslashes($TMPL['tags']); }
Aynı dosya içine bu kodu bulun,
$TMPL['description'] = $this->bad_words($TMPL['description']);
Bu koddan sonra aşağıdaki kodu ekleyin.
$TMPL['tags'] = $DB->escape($FORM['tags'], 1);
$TMPL['tags'] = $this->bad_words($TMPL['tags']);
$TMPL['tags'] = strtolower($TMPL['tags']);
$TMPL['readytag'] = ereg_replace(", ", ",", $TMPL['tags']);
$TMPL['tags'] = $TMPL['readytag'];
Yine bu dosyada aşağıdaki kodları bulun,
$DB->query("INSERT INTO {$CONF['sql_prefix']}_sites (username, password, url, short_url, title, description, category, banner_url, email, join_date, active, openid)
VALUES ('{$TMPL['username']}', '{$password}', '{$TMPL['url']}', '{$short_url}', '{$TMPL['title']}', '{$TMPL['description']}', '{$TMPL['category']}', '{$TMPL['banner_url']}', '{$TMPL['email']}', '{$join_date}', {$CONF['active_default']}, 0)", __FILE__, __LINE__);
Burada bu kodları silip yerine aşağıdaki kodları ekleyin.
$DB->query("INSERT INTO {$CONF['sql_prefix']}_sites (username, password, url, short_url, title, description, category, banner_url, email, join_date, active, openid, tags)
VALUES ('{$TMPL['username']}', '{$password}', '{$TMPL['url']}', '{$short_url}', '{$TMPL['title']}', '{$TMPL['description']}', '{$TMPL['category']}', '{$TMPL['banner_url']}', '{$TMPL['email']}', '{$join_date}', {$CONF['active_default']}, 0, '{$TMPL['tags']}')", __FILE__, __LINE__);
4. /sources/search.php dosyasını editörle açın.
Aşağıdaki kodları bulun,
$TMPL['header'] = $LNG['search_header'];
Bu kodları silip yerine şu kodları ekleyin.
$TMPL['header'] = $FORM['q'];
Aşağıdaki kodları bulun.
$query = "SELECT sites.username, url, title, description, banner_url FROM {$CONF['sql_prefix']}_sites sites, {$CONF['sql_prefix']}_stats stats WHERE active = 1 AND sites.username = stats.username AND (";
$i = 0;
foreach ($words as $word) {
if ($i > 0) {
$query .= " OR ";
}
$query .= "description LIKE '%{$word}%' OR title LIKE '%{$word}%'";
Bu kodları silip yerine aşağıdaki kodları ekleyin.
$query = "SELECT sites.username, url, title, description, banner_url, tags FROM {$CONF['sql_prefix']}_sites sites, {$CONF['sql_prefix']}_stats stats WHERE active = 1 AND sites.username = stats.username AND (";
$i = 0;
foreach ($words as $word) {
if ($i > 0) {
$query .= " OR ";
}
$query .= "description LIKE '%{$word}%' OR title LIKE '%{$word}%' OR tags LIKE '%{$word}%'";
5. join_form.html dosyasını editörle açın.
Aşağıdaki kodları bulun.
<label>{$lng->g_description}
<textarea cols="40" rows="5" name="description">{$description}</textarea>
</label>
Bu kodlardan sonra aşağıdaki kodları ekleyin.
<label>Tags - separate with , (example: dog,cat,house)
<textarea cols="40" rows="1" name="tags">{$tags}</textarea>
</label>
6. wrapper.html dosyasını açın ve enalta {$clouds} kodunu ekleyin.
7. sources/admin/edit.php dosyasını editörle açın
Aşağıdaki kodları bulun.
if (isset($TMPL['email'])) { $TMPL['email'] = stripslashes($TMPL['email']); }
Bu kodlardan sonra şu kodları ekleyin.
if (isset($TMPL['tags'])) { $TMPL['tags'] = stripslashes($TMPL['tags']); }
Aşağıdaki kodları bulun,
<label>{$LNG['g_description']}
<textarea cols="40" rows="5" name="description">{$TMPL['description']}</textarea>
</label>
Bu kodlardan sonra şu kodları ekleyin.
<label>Tags
<textarea cols="40" rows="5" name="tags">{$TMPL['tags']}</textarea>
</label>
Aşağıdaki kodları bulun,
$TMPL['email'] = $DB->escape($FORM['email']);
Bu kodlardan sonra aşağıdaki kodları ekleyin.
$TMPL['tags'] = $DB->escape($FORM['tags']);
$TMPL['tags'] = strtolower($TMPL['tags']);
//remove any spaces after comma
$TMPL['readytag'] = ereg_replace(", ", ",", $TMPL['tags']);
$TMPL['tags'] = $TMPL['readytag'];
Yine aynı dosyada şu kodları bulun.
email = '{$TMPL['email']}',
Bu kodu silip yerine şu kodları ekleyin.
email = '{$TMPL['email']}', tags = '{$TMPL['tags']}',
8. sources/user_cp/edit.php dosyasını editörle açın.
Aşağıdaki kodları bulun
if (isset($TMPL['email'])) { $TMPL['email'] = stripslashes($TMPL['email']); }
Bu kodlardan sonra aşağıdaki kodları ekleyin.
if (isset($TMPL['tags'])) { $TMPL['tags'] = stripslashes($TMPL['tags']); }
Aşağıdaki kodları bulun,
$TMPL['description'] = $DB->escape($FORM['description'], 1);
Bu kodlardan sonra şu kodları ekleyin.
$TMPL['tags'] = $DB->escape($FORM['tags'], 1);
Aşağıdaki kodları bulun,
$TMPL['description'] = $this->bad_words($TMPL['description']);
Bu kodlardan sonra şu kodları ekleyin.
$TMPL['tags'] = $this->bad_words($TMPL['tags']);
$TMPL['tags'] = strtolower($TMPL['tags']);
//remove any spaces after comma
$TMPL['readytag'] = ereg_replace(", ", ",", $TMPL['tags']);
$TMPL['tags'] = $TMPL['readytag'];
Aşağıdaki kodları bulun.
email = '{$TMPL['email']}'
Bu kodların yerine şu kodları ekleyin.
email = '{$TMPL['email']}', tags = '{$TMPL['tags']}'
9. skins/temanız/edit_form.html dosyasını editörle açın.
Aşağıdaki kodları bulun.
<label>{$lng->g_description}
<textarea cols="40" rows="5" name="description">{$description}</textarea>
</label>
Bu kodlardan sonra aşağıdaki kodları ekleyin.
<label>Tags
<textarea cols="40" rows="2" name="tags">{$tags}</textarea>
</label>