| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
function interwiki_install() {
|
| 5 |
switch ($GLOBALS['db_type']) {
|
| 6 |
case 'mysqli':
|
| 7 |
case 'mysql':
|
| 8 |
$result = db_query("
|
| 9 |
CREATE TABLE {interwiki} (
|
| 10 |
iw_prefix char(32) NOT NULL default '',
|
| 11 |
iw_url char(127) NOT NULL default '',
|
| 12 |
iw_local tinyint(1) NOT NULL default '0',
|
| 13 |
iw_rel char(32) NOT NULL default '',
|
| 14 |
UNIQUE KEY iw_prefix (iw_prefix)
|
| 15 |
) /*!40100 DEFAULT CHARACTER SET utf8 */;");
|
| 16 |
$result = _interwiki_insert('kos', 'http://www.dkosopedia.com/index.php/$1', 0);
|
| 17 |
$result = _interwiki_insert('w', 'http://en.wikipedia.org/wiki/$1', 0);
|
| 18 |
$result = _interwiki_insert('dis', 'http://www.sourcewatch.org/index.php?title=$1', 0);
|
| 19 |
$result = _interwiki_insert('http', 'http:$1', 0);
|
| 20 |
$result = _interwiki_insert('', '$1', 1);
|
| 21 |
$result = _interwiki_insert('ebay', 'http://search.ebay.com/$4', 0);
|
| 22 |
$result = _interwiki_insert('googledef', 'http://www.google.com/search?&q=define%3A$2', 0);
|
| 23 |
$result = _interwiki_insert('google', 'http://www.google.com/search?q=%22$2%22', 0);
|
| 24 |
$result = _interwiki_insert('sw', 'http://www.sourcewatch.org/index.php?title=$1', 0);
|
| 25 |
$result = _interwiki_insert('th', 'http://thesaurus.reference.com/search?q=$3', 0);
|
| 26 |
$result = _interwiki_insert('archive', 'http://web.archive.org/web/*/http://$1', 0);
|
| 27 |
$result = _interwiki_insert('whois', 'http://reports.internic.net/cgi/whois?whois_nic=$1&type=domain', 0);
|
| 28 |
$result = _interwiki_insert('opendir', 'http://search.dmoz.org/cgi-bin/search?search=$2', 0);
|
| 29 |
$result = _interwiki_insert('technorati', 'http://technorati.com/tag/$2', 0, 'tag');
|
| 30 |
break;
|
| 31 |
}
|
| 32 |
}
|
| 33 |
|
| 34 |
function _interwiki_insert($prefix,$url,$local,$rel='') {
|
| 35 |
return db_query("INSERT INTO {interwiki} VALUES ('$prefix', '$url', $local, '$rel')");
|
| 36 |
}
|
| 37 |
|
| 38 |
function interwiki_uninstall() {
|
| 39 |
db_query('DROP TABLE {interwiki}');
|
| 40 |
}
|
| 41 |
|
| 42 |
function interwiki_update_1() {
|
| 43 |
$ret = array();
|
| 44 |
$ret[] = update_sql("ALTER TABLE {interwiki} ADD iw_rel char(32) NOT NULL default ''");
|
| 45 |
return $ret;
|
| 46 |
}
|