Changeset 220

Show
Ignore:
Timestamp:
05/10/07 21:27:25 (15 years ago)
Author:
ralle030583
Message:

- autoupgrade if somebody hasnt or has an old kb3_navigation table

Location:
dev/common/includes
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • dev/common/includes/autoupgrade.php

    r216 r220  
    55    $qry = new DBQuery(); 
    66    $query = 'select count(*) from kb3_comments'; 
    7     $result = mysql_query($query); 
     7    $result = $qry->execute($query); 
    88    if ($result) 
    99    { 
     
    2828        if ($result) 
    2929        { 
    30             return; 
     30                $query = "select count(KBSITE) from kb3_navigation WHERE KBSITE = '".KB_SITE."'"; 
     31                $result = @mysql_query($query); 
     32                if ($result) 
     33                { 
     34                        return; 
     35                } 
     36                $query = 'ALTER TABLE `kb3_navigation` ADD `KBSITE` VARCHAR( 16 ) NOT NULL'; 
     37        $qry->execute($query); 
     38                $query = 'UPDATE `kb3_navigation` SET KBSITE = "'.KB_SITE.'" WHERE KBSITE LIKE "";'; 
     39        $qry->execute($query); 
     40                return; 
    3141        } 
    3242        $query = 'CREATE TABLE `kb3_navigation` ( 
     
    3949        `posnr` INT NOT NULL, 
    4050        `page` TINYTEXT NOT NULL, 
     51        `KBSITE` VARCHAR ( 16 ) NOT NULL, 
    4152        PRIMARY KEY ( `ID` ) 
    4253        ) TYPE = MYISAM'; 
     
    5061            $statlink = '?a=alliance_detail&all_id='.ALLIANCE_ID; 
    5162        } 
    52         $queries = "INSERT IGNORE INTO `kb3_navigation` VALUES (1,'top',1,'Home','?a=home','_self',1,'ALL_PAGES'); 
    53                 INSERT IGNORE INTO `kb3_navigation` VALUES (2,'top',1,'Campaings','?a=campaigns','_self',2,'ALL_PAGES'); 
    54                 INSERT IGNORE INTO `kb3_navigation` VALUES (3,'top',1,'Contracts','?a=contracts','_self',3,'ALL_PAGES'); 
    55                 INSERT IGNORE INTO `kb3_navigation` VALUES (4,'top',1,'Kills','?a=home','_self',4,'ALL_PAGES'); 
    56                 INSERT IGNORE INTO `kb3_navigation` VALUES (5,'top',1,'Losses','?a=losses','_self',5,'ALL_PAGES'); 
    57                 INSERT IGNORE INTO `kb3_navigation` VALUES (6,'top',1,'Post Mail','?a=post','_self',6,'ALL_PAGES'); 
    58                 INSERT IGNORE INTO `kb3_navigation` VALUES (7,'top',1,'Stats','$statlink','_self',7,'ALL_PAGES'); 
    59                 INSERT IGNORE INTO `kb3_navigation` VALUES (8,'top',1,'Awards','?a=awards','_self',8,'ALL_PAGES'); 
    60                 INSERT IGNORE INTO `kb3_navigation` VALUES (9,'top',1,'Standings','?a=standings','_self',9,'ALL_PAGES'); 
    61                 INSERT IGNORE INTO `kb3_navigation` VALUES (10,'top',1,'Search','?a=search','_self',10,'ALL_PAGES'); 
    62                 INSERT IGNORE INTO `kb3_navigation` VALUES (11,'top',1,'Admin','?a=admin','_self',11,'ALL_PAGES'); 
    63                 INSERT IGNORE INTO `kb3_navigation` VALUES (12,'top',1,'About','?a=about','_self',12,'ALL_PAGES');"; 
     63        $queries = "INSERT IGNORE INTO `kb3_navigation` VALUES (1,'top',1,'Home','?a=home','_self',1,'ALL_PAGES','".KB_SITE."'); 
     64                INSERT IGNORE INTO `kb3_navigation` VALUES (2,'top',1,'Campaings','?a=campaigns','_self',2,'ALL_PAGES','".KB_SITE."'); 
     65                INSERT IGNORE INTO `kb3_navigation` VALUES (3,'top',1,'Contracts','?a=contracts','_self',3,'ALL_PAGES','".KB_SITE."'); 
     66                INSERT IGNORE INTO `kb3_navigation` VALUES (4,'top',1,'Kills','?a=home','_self',4,'ALL_PAGES','".KB_SITE."'); 
     67                INSERT IGNORE INTO `kb3_navigation` VALUES (5,'top',1,'Losses','?a=losses','_self',5,'ALL_PAGES','".KB_SITE."'); 
     68                INSERT IGNORE INTO `kb3_navigation` VALUES (6,'top',1,'Post Mail','?a=post','_self',6,'ALL_PAGES','".KB_SITE."'); 
     69                INSERT IGNORE INTO `kb3_navigation` VALUES (7,'top',1,'Stats','$statlink','_self',7,'ALL_PAGES','".KB_SITE."'); 
     70                INSERT IGNORE INTO `kb3_navigation` VALUES (8,'top',1,'Awards','?a=awards','_self',8,'ALL_PAGES','".KB_SITE."'); 
     71                INSERT IGNORE INTO `kb3_navigation` VALUES (9,'top',1,'Standings','?a=standings','_self',9,'ALL_PAGES','".KB_SITE."'); 
     72                INSERT IGNORE INTO `kb3_navigation` VALUES (10,'top',1,'Search','?a=search','_self',10,'ALL_PAGES','".KB_SITE."'); 
     73                INSERT IGNORE INTO `kb3_navigation` VALUES (11,'top',1,'Admin','?a=admin','_self',11,'ALL_PAGES','".KB_SITE."'); 
     74                INSERT IGNORE INTO `kb3_navigation` VALUES (12,'top',1,'About','?a=about','_self',12,'ALL_PAGES','".KB_SITE."');"; 
    6475        $query = explode("\n", $queries); 
    6576        foreach ($query as $querystring) 
  • dev/common/includes/class.navigation.php

    r219 r220  
    11<?php 
     2//for easier patching 
     3 
    24 
    35class Navigation{ 
     
    57        function Navigation() 
    68        { 
     9                require_once('common/includes/autoupgrade.php'); 
     10                check_navigationtable(); 
    711                $this->contracts_ = killboard::hasContracts(); 
    812        $this->campaigns_ = killboard::hasCampaigns();