示例#1
0
 public function createdb()
 {
     if (!$this->dropdb()) {
         return false;
     }
     if (!$this->db->query(repository::sql())) {
         return false;
     }
     if (!$this->db->query(package::sql())) {
         return false;
     }
     if (!$this->db->query(filelist::sql())) {
         return false;
     }
     if (!$this->db->query(guestbook::sql())) {
         return false;
     }
     if (!$this->db->query("\n\t\t  CREATE TABLE IF NOT EXISTS #__mixed (\n\t\t    field VARCHAR( 255 ) NOT NULL ,\n                    value VARCHAR( 255 ) NULL ,\n                    PRIMARY KEY ( field )\n\t\t  ) ENGINE = MyISAM;\n\t\t")) {
         return false;
     }
     if (!$this->db->query("\n\t\t  CREATE TABLE IF NOT EXISTS #__searches (\n\t\t    dt    DATETIME,\n\t\t    sname VARCHAR(50),\n\t\t    sdesc VARCHAR(50),\n\t\t    sfile VARCHAR(50),\n\t\t    ip    VARCHAR(15),\n\t\t    srepo INT,\n\t\t    results INT,\n\t\t    duration INT\n\t\t  ) ENGINE = MyISAM;\n\t        ")) {
         return false;
     }
     $this->db->query("INSERT INTO #__mixed (field,value) value ('count_visits','1');");
     $this->db->query("INSERT INTO #__mixed (field,value) value ('count_searches','1');");
     $this->db->query("INSERT INTO #__mixed (field,value) value ('count_srctxt','1');");
     $this->db->query("INSERT INTO #__mixed (field,value) value ('count_srcxml','1');");
     return true;
 }
示例#2
0
        $reqs = explode(",", $pk->required);
        foreach ($reqs as $key => $req) {
            $areq = explode("|", $req);
            foreach ($areq as $akey => $rr) {
                $rm = preg_replace("/ .*/", "", $rr);
                $areq[$akey] = "<a href='index.php?name={$rm}#results'>" . htmlentities($rr) . "</a>";
            }
            $reqs[$key] = implode("|", $areq);
        }
        $r = implode("<br>", $reqs);
        echo tables(array("<nobr>Package required</nobr>:", $r));
        echo tables(array("Package location:", "<a href={$repo->url}{$pk->location}>{$pk->location}</a>"));
        echo tables(array("Package filename:", "<a href={$repo->url}{$pk->location}/{$pk->filename}>{$pk->filename}</a>"));
        echo tables();
        if ($pk->description) {
            echo "Description:\n";
            echo str_replace("\n", "\n| ", "\n" . $pk->description);
        }
        if ($repo->manifest) {
            $list = new filelist();
            $nrow = $list->find('', $pkg);
            echo "\n\nThis package contain {$nrow} files:\n\n";
            while ($line = $list->get()) {
                echo $line['fullpath'] . $line['filename'] . "\n";
            }
        }
    }
}
echo "</pre>";
echo "To report a bug, send a mail to <a href='mailto:zerouno@slacky.it'>zerouno@slacky.it</a>. Thanks.";
echo "</body></html>";
示例#3
0
         $ord = 'fullpath desc';
         break;
     case "repou":
         $ord = 'repobrief';
         break;
     case "repod":
         $ord = 'repobrief desc';
         break;
     case "locu":
         $ord = 'pkgloc';
         break;
     case "locd":
         $ord = 'pkgloc desc';
         break;
 }
 $fl = new filelist();
 $nres = $fl->find($file, $name, $desc, $repo, $ord);
 if (isset($_GET['debug'])) {
     var_dump($fl, $nres);
 }
 $to = $start + $maxresult;
 if ($to > $nres) {
     $to = $nres;
 }
 if ($start > 0) {
     $from = $start - $maxresult;
     if ($from < 0) {
         $from = 0;
     }
 }
 if ($to < $nres) {
示例#4
0
 public function popolate($more = array())
 {
     $allpackage = array();
     $pack = new package();
     if (!$this->pkgsfile) {
         $this->pkgsfile = new internet(((substr($this->packages, 0, 7) == "http://" or substr($this->packages, 0, 6) == "ftp://") ? "" : $this->url) . $this->packages);
     }
     if (!$this->pkgsfile->exists()) {
         return false;
     }
     $i = 0;
     while (!is_null($pkg = $pack->fetch($this->pkgsfile))) {
         if ($pkg) {
             $id = $pack->add($pkg, array('repository' => $this->id), $more);
             if (!$id) {
                 return false;
             }
             if (isset($_SERVER['DEBUG'])) {
                 echo $id . " -> " . $pack->filename . "               \n";
             }
             if (isset($_SERVER["_"])) {
                 echo "\r(packages {$i}: " . $pkg['name'] . "               ";
             } else {
                 echo ".";
             }
             $allpackage[$pack->filename] = $id;
             $i++;
         }
     }
     $this->pkgsfile->close();
     if (!$this->db->query("update #__repository set npkgs='{$i}' where id='{$this->id}'")) {
         var_dump($this->db);
     }
     if (isset($_SERVER["_"])) {
         echo "\r(packages: {$i}                                            \n";
     } else {
         echo "\n [{$i} packages] \n";
     }
     $list = new filelist();
     if ($this->manifest) {
         $this->manifile = new internet($this->url . $this->manifest);
         if (!($i = $list->addall($allpackage, $this))) {
             var_dump($i);
             return false;
         }
         if (!$this->db->query("update #__repository set nfiles='{$i}' where id='{$this->id}'")) {
             var_dump($this->db);
         }
     }
     if (!$this->pkgsfile->exists()) {
         return false;
     }
     $this->mtime = $this->pkgsfile->head['Last-Modified'];
     $repo['mtime'] = $this->mtime;
     if (!$this->db->query("update #__repository set mtime='" . $this->mtime . "' where id=" . $this->id)) {
         return false;
     }
     return true;
 }