Example #1
0
/****** create_tables.php/Include_stuff
 * FUNCTION
 *		Include classes and the config file.
 ****/
include 'config.php';
require 'class_command.php';
Database::connect();
//Connect to the database
/****** create_tables.php/Create_tables_in_db
 * FUNCTION
 *		Creates the tables in our database.
 ****/
//Create content_description table
$query = "CREATE TABLE content_description (\n  externalpage text NOT NULL,\n  title text NOT NULL,\n  description text NOT NULL,\n  ages varchar(100) NOT NULL default '',\n  mediadate date NOT NULL default '0000-00-00',\n  priority tinyint(2) NOT NULL default 0\n);\n";
Database::sqlWithoutAnswer($query);
//Create :)
//Create content_links table
$query = "CREATE TABLE content_links (\n  catid bigint(8) NOT NULL default '0',\n  topic text NOT NULL,\n  type varchar(20) NOT NULL default '',\n  resource text NOT NULL,\n  KEY catid (catid)\n);\n";
Database::sqlWithoutAnswer($query);
//Create :)
//Create structure table
$query = "CREATE TABLE structure (\n  catid bigint(8) NOT NULL default '0',\n  name text NOT NULL,\n  title varchar(255) NOT NULL default '',\n  description text NOT NULL default '',\n  lastupdate datetime NOT NULL default '0000-00-00 00:00:00',\n  KEY catid (catid)\n);\n";
Database::sqlWithoutAnswer($query);
//Create :)
//Create datatypes table
$query = "CREATE TABLE datatypes (\n  catid bigint(8) NOT NULL default '0',\n  type varchar(20) NOT NULL default '',\n  resource text NOT NULL,\n  KEY catid (catid)\n);\n";
Database::sqlWithoutAnswer($query);
//Create :)
Basic::printToConsole("\nTables in the database (" . DB_DATABASE . ") are successfully created!\n");
Database::close();
//Close connection
Example #2
0
 function _endTagProcessor($__parser, $__tag_name)
 {
     //Check if the end tag is external_page
     if (strtolower($__tag_name) == 'externalpage') {
         $query = 'INSERT INTO content_description';
         $query .= '(externalpage, title, description, ages, mediadate, priority)';
         $query .= ' VALUES("' . addslashes($this->external_page) . '", "' . addslashes(trim($this->title)) . '", "' . addslashes(trim($this->description)) . '", "' . addslashes(trim($this->ages)) . '", "' . addslashes($this->mediadate) . '", "' . addslashes($this->priority) . '")';
         Database::sqlWithoutAnswer($query);
         $this->count_rows++;
         //Count rows
         $this->count_rows_temp++;
         //Temporary count rows - used to make a milestone
         $query = '';
         $this->external_page = '';
         $this->title = '';
         $this->description = '';
         $this->ages = '';
         $this->mediadate = '';
         $this->priority = '';
         $this->current_tag = '';
     }
     //Check if the end tag is in the range of permitted tags
     if (in_array(strtolower($__tag_name), $this->permitted_tags)) {
         $query = 'INSERT INTO content_links';
         $query .= '(catid, topic, type, resource)';
         $query .= ' VALUES("' . addslashes($this->catid) . '", "' . addslashes($this->topic) . '", "' . addslashes($this->type) . '", "' . addslashes($this->resource) . '")';
         Database::sqlWithoutAnswer($query);
         $this->count_rows++;
         //Count rows
         $this->count_rows_temp++;
         //Temporary count rows - used to make a milestone
         $query = '';
         $this->type = '';
         $this->resource = '';
         $this->current_tag = '';
     }
     //Check if the stats are set
     if (ECHO_STATS) {
         //Check if ECHO_STATS_FREQUNCY is reached
         if ($this->count_rows_temp == ECHO_STATS_FREQUNCY) {
             $this->count_rows_temp = 0;
             $this->_echoStatus($this->start_time, $this->count_rows, 'Yet another ' . ECHO_STATS_FREQUNCY . ' rows reached! - content RDF document');
         }
     }
 }