<?php 
/*#################################################################*\
|# Licence Number 0DT7-0122-0NW1-0210
|# -------------------------------------------------------------   #|
|# Copyright (c)2010 PHP Link Directory.                           #|
|# http://www.phplinkdirectory.com                                 #|
\*#################################################################*/
	
/**
# ################################################################################
# Project:   PHP Link Directory
#
# **********************************************************************
# Copyright (C) 2004-2009 NetCreated, Inc. (http://www.netcreated.com/)
#
# This software is for use only to those who have purchased a license.
# A license must be purchased for EACH installation of the software.
#
# By using the software you agree to the terms:
#
#    - You may not redistribute, sell or otherwise share this software
#      in whole or in part without the consent of the the ownership
#      of PHP Link Directory. Please contact david@david-duval.com
#      if you need more information.
#
#    - You agree to retain a link back to http://www.phplinkdirectory.com/
#      on all pages of your directory in you purchased the $25 version
#      of the software.
#
# License holders are entitled to upgrades to the 3.4 branch of the software
# as they are made available at http://www.phplinkdirectory.com/
#
# In some cases, license holders may be required to agree to changes
# in the software license before receiving updates to the software.
# **********************************************************************
#
# For questions, help, comments, discussion, etc., please join the
# PHP Link Directory Forum http://www.phplinkdirectory.com/forum/
#
# @link           http://www.phplinkdirectory.com/
# @copyright      2004-2009 NetCreated, Inc. (http://www.netcreated.com/)
# @projectManager David DuVal <david@david-duval.com>
# @package        PHPLinkDirectory
# @version        4.0.0
# ################################################################################
*/

/**
 * Calculate password field length for user table,
 * depending on PHP version for eigther use "sha1" or "md5" hash function
 */
if (version_compare (phpversion(), "4.3.0", ">=") && function_exists ('sha1'))
   $PasswFieldLength = 40 + strlen ("{sha1}"); /* sha1 hash + {sha1} prefix */
else
   $PasswFieldLength = 32 + strlen ("{md5}");  /* md5 hash + {md5} prefix   */
   
 function generatePassword ($length = 12)
{
  // start with a blank password
  $password = "";

  // define possible characters
  $possible = "0123456789bcdfghjkmnpqrstvwxyz"; 
    
  // set up a counter
  $i = 0; 
    
  // add random characters to $password until $length is reached
  while ($i < $length) { 
    // pick a random character from the possible ones
    $char = substr($possible, mt_rand(0, strlen($possible)-1), 1);
        
    // we don't want this character if it's already in the password
    if (!strstr($password, $char)) { 
      $password .= $char;
      $i++;
    }
  }
  // done!
  return $password;
} 
 
 
 $rand_pass = generatePassword(12);

 $tables = array ();

 

 
/**
 * ADOdb Data Dictionary Library for PHP (Full Documentation)
 * http://phplens.com/lens/adodb/docs-datadict.htm
 */
 $tables['link'] = array (
   'name'   => TABLE_PREFIX.'LINK'                  ,
   'fields' => array (
      'ID'                 => 'I KEY AUTO'          ,
      'TITLE'              => 'C(255) NOTNULL'      ,
      'DESCRIPTION'        => 'X2 NULL'             ,
      'URL'                => 'C(255) NOTNULL'      ,
	  'ADDRESS'         => 'C(255) NULL'         ,
      'CITY'        => 'C(255) NULL'         ,
	  'STATE'         => 'C(255) NULL'         ,
      'ZIP'        => 'C(255) NULL'         ,
	  'PHONE_NUMBER'        => 'C(255) NULL'         ,
      'CATEGORY_ID'        => 'I NOTNULL'           ,
      'RECPR_URL'          => 'C(255) NULL'         ,
      'RECPR_REQUIRED'     => 'L NOTNULL DEFAULT 0' ,
      'STATUS'             => 'I NOTNULL DEFAULT 0' ,
      'VALID'              => 'L NOTNULL DEFAULT 0' ,
      'RATING'             => 'C(11) NOTNULL'       ,
      'VOTES'              => 'C(11) NOTNULL'       ,
      'COMMENT_COUNT'      => 'C(11) NOTNULL'       ,
      'RECPR_VALID'        => 'L NOTNULL DEFAULT 0' ,
      'OWNER_ID'           => 'I NULL'              ,
      'OWNER_NAME'         => 'C(255) NULL'         ,
      'OWNER_EMAIL'        => 'C(255) NULL'         ,
      'OWNER_NOTIF'        => 'I NOTNULL DEFAULT 0' ,
      'OWNER_EMAIL_CONFIRMED' => 'I NOTNULL DEFAULT 1',
      'DATE_MODIFIED'      => 'T DEFDATE'           ,
      'DATE_ADDED'         => 'T DEFDATE'           ,
      'HITS'               => 'I NOTNULL DEFAULT 0' ,
      'LAST_CHECKED'       => 'T'                   ,
      'RECPR_LAST_CHECKED' => 'T'                   ,
      'PAGERANK'           => 'I NOTNULL DEFAULT -1',
	  'INLINKS'            => 'I8 NOTNULL DEFAULT -1',
      'RECPR_PAGERANK'     => 'I NOTNULL DEFAULT -1',
      'FEATURED_MAIN'      => 'I NOTNULL DEFAULT 0' ,
      'FEATURED'           => 'I NOTNULL DEFAULT 0' ,
      'EXPIRY_DATE'        => 'T'                   ,
      'NOFOLLOW'           => 'L NOTNULL DEFAULT 0' ,
      'PAYED'              => 'I NOTNULL DEFAULT -1',
      'LINK_TYPE'          => 'I NOTNULL DEFAULT 0' ,
      'IPADDRESS'          => 'C(15) NULL'          ,
      'DOMAIN'             => 'C(250) NULL'         ,
      'OTHER_INFO'         => 'X NULL'              ,
      'META_KEYWORDS'      => 'X NULL'              ,
      'META_DESCRIPTION'   => 'X NULL'              ,
      'RECPR_EXPIRED'      => 'L NOTNULL DEFAULT 0'
   ),
   'indexes' => array (
      'TITLE'              => 'TITLE'                               ,
      'DESCRIPTION'        => array ('DESCRIPTION'     , 'FULLTEXT'),
      'URL'                => 'URL'                                 ,
      'CATEGORY_ID'        => 'CATEGORY_ID'                         ,
      'STATUS_CATEGORY_ID' => 'STATUS, CATEGORY_ID'                 ,
      'HITS'               => 'HITS'                                ,
      'FEATURED'           => 'FEATURED'                            ,
      'EXPIRY_DATE'        => 'EXPIRY_DATE'                         ,
      'META_KEYWORDS'      => array ('META_KEYWORDS'   , 'FULLTEXT'),
      'META_DESCRIPTION'   => array ('META_DESCRIPTION', 'FULLTEXT')
   ),
   'options' => array (
      'mysql'              => "TYPE=MyISAM COMMENT='Stores all the links with informations'"
   )
 );

 

 $tables['link_to_import'] = array (
   'name'   => TABLE_PREFIX.'LINK_TO_IMPORT'        ,
   'fields' => array (
      'ID'                 => 'I KEY AUTO'          ,
      'TITLE'              => 'C(255) NOTNULL'      ,
      'DESCRIPTION'        => 'X2 NULL'             ,
      'URL'                => 'C(255) NOTNULL'      ,
	  'OWNER_NAME'         => 'C(255) NULL'         ,
      'OWNER_EMAIL'        => 'C(255) NULL'         ,
      'DOMAIN_NAME'             => 'C(250) NULL'         
   ),
   'indexes' => array (
      'TITLE'              => 'TITLE'                               ,
      'DESCRIPTION'        => array ('DESCRIPTION'     , 'FULLTEXT'),
      'URL'                => 'URL'                                 
   ),
   'options' => array (
      'mysql'              => "TYPE=MyISAM COMMENT='Stores all the links with informations'"
   )
 );
  
 $tables['link_review'] = array (
   'name'   => TABLE_PREFIX.'LINK_REVIEW'           ,
   'fields' => array (
      'ID'                 => 'I KEY AUTO'          ,
      'LINK_ID'            => 'I'                   ,
      'TITLE'              => 'C(255) NOTNULL'      ,
      'DESCRIPTION'        => 'X2 NULL'             ,
      'URL'                => 'C(255) NOTNULL'      ,
	  'ADDRESS'         => 'C(255) NULL'         	,
      'CITY'        => 'C(255) NULL'         		,
	  'STATE'         => 'C(255) NULL'         		,
      'ZIP'        => 'C(255) NULL'         		,
	  'PHONE_NUMBER'        => 'C(255) NULL'        ,
      'CATEGORY_ID'        => 'I NOTNULL'           ,
      'RECPR_URL'          => 'C(255) NULL'         ,
      'RECPR_REQUIRED'     => 'L NOTNULL DEFAULT 0' ,
      'STATUS'             => 'I NOTNULL DEFAULT 0' ,
      'VALID'              => 'L NOTNULL DEFAULT 0' ,
      'RECPR_VALID'        => 'L NOTNULL DEFAULT 0' ,
      'OWNER_ID'           => 'I NULL'              ,
      'OWNER_NAME'         => 'C(255) NULL'         ,
      'OWNER_EMAIL'        => 'C(255) NULL'         ,
      'OWNER_NOTIF'        => 'I NOTNULL DEFAULT 0' ,
      'OWNER_EMAIL_CONFIRMED' => 'I NOTNULL DEFAULT 1',
      'DATE_MODIFIED'      => 'T DEFDATE'           ,
      'DATE_ADDED'         => 'T DEFDATE'           ,
      'LAST_CHECKED'       => 'T'                   ,
      'RECPR_LAST_CHECKED' => 'T'                   ,
      'PAGERANK'           => 'I NOTNULL DEFAULT -1',
      'RECPR_PAGERANK'     => 'I NOTNULL DEFAULT -1',
      'FEATURED_MAIN'      => 'I NOTNULL DEFAULT 0' ,
      'FEATURED'           => 'I NOTNULL DEFAULT 0' ,
      'EXPIRY_DATE'        => 'T'                   ,
      'NOFOLLOW'           => 'L NOTNULL DEFAULT 0' ,
      'PAYED'              => 'I NOTNULL DEFAULT -1',
      'LINK_TYPE'          => 'I NOTNULL DEFAULT 0' ,
      'MARK_REMOVE'        => 'I NOTNULL DEFAULT 0' ,
      'IPADDRESS'          => 'C(15) NULL'          ,
      'DOMAIN'             => 'C(250) NULL'         ,
      'OTHER_INFO'         => 'X NULL'              ,
      'META_KEYWORDS'      => 'X NULL'              ,
      'META_DESCRIPTION'   => 'X NULL'
   ),
   'indexes' => array (
      'TITLE'              => 'TITLE'                               ,
      'DESCRIPTION'        => array ('DESCRIPTION'     , 'FULLTEXT'),
      'URL'                => 'URL'                                 ,
      'CATEGORY_ID'        => 'CATEGORY_ID'                         ,
      'STATUS_CATEGORY_ID' => 'STATUS, CATEGORY_ID'                 ,
      'FEATURED'           => 'FEATURED'                            ,
      'EXPIRY_DATE'        => 'EXPIRY_DATE'                         ,
      'META_KEYWORDS'      => array ('META_KEYWORDS'   , 'FULLTEXT'),
      'META_DESCRIPTION'   => array ('META_DESCRIPTION', 'FULLTEXT')
   ),
   'options' => array (
      'mysql'              => "TYPE=MyISAM COMMENT='Stores all information of link reviews'"
   )
 );
 $tables['category'] = array (
   'name'   => TABLE_PREFIX.'CATEGORY'              ,
   'fields' => array (
      'ID'                   => 'I KEY AUTO'            ,
      'TITLE'                => 'C(255) NOTNULL'        ,
      'CACHE_TITLE'          => 'X NULL'                ,
      'TITLE_URL'            => 'C(255) NULL'           ,
      'CACHE_URL'            => 'X NULL'                ,
      'DESCRIPTION'          => 'X2 NULL'               ,
	  'TDESCRIPTION'	     => 'X2 NULL'				,
	  'CATCONTENT'		     => 'X2 NULL'				,
      'PARENT_ID'            => 'I NOTNULL'             ,
      'STATUS'               => 'I NOTNULL DEFAULT 1'   ,
      'DATE_ADDED'           => 'T DEFDATE'             ,
      'HITS'                 => 'I NOTNULL DEFAULT 0'   ,
      'SYMBOLIC'             => 'I NOTNULL DEFAULT 0'   ,
      'SYMBOLIC_ID'          => 'I NOTNULL DEFAULT 0'   ,
      'META_KEYWORDS'        => 'X NULL'                ,
      'META_DESCRIPTION'     => 'X NULL'                ,
      'CLOSED_TO_LINKS'      => 'I NOTNULL DEFAULT 0'   ,
      'CLOSED_TO_ARTICLES'   => 'I NOTNULL DEFAULT 0'   ,
      'SORT_ORDER'           => 'I NOTNULL DEFAULT 1000',
      'RSS_URL'				 => 'X NULL'
   ),
   'indexes' => array (
      'TITLE'            => 'TITLE'                               ,
      'TITLE_URL'        => 'TITLE_URL'                           ,
      'DESCRIPTION'      => array ('DESCRIPTION'     , 'FULLTEXT'),
      'PARENT_ID'        => 'PARENT_ID'                           ,
      'STATUS'           => 'STATUS'                              ,
      'HITS'             => 'HITS'                                ,
      'META_KEYWORDS'    => array ('META_KEYWORDS'   , 'FULLTEXT'),
      'META_DESCRIPTION' => array ('META_DESCRIPTION', 'FULLTEXT')
   ),
   'options' => array (
      'mysql'            => "TYPE=MyISAM COMMENT='Stores all the categories with informations'"
   )
 );
 $tables['article'] = array (
   'name'   => TABLE_PREFIX.'ARTICLE'               ,
   'fields' => array (
      'ID'                 => 'I KEY AUTO'          ,
      'TITLE'              => 'C(255) NOTNULL'      ,
      'DESCRIPTION'        => 'X2 NULL'             ,
      'ARTICLE'            => 'X2 NULL'             ,
      'CATEGORY_ID'        => 'I NOTNULL'           ,
      'STATUS'             => 'I NOTNULL DEFAULT 2' ,
      'VALID'              => 'L NOTNULL DEFAULT 0' ,
      'RATING'             => 'C(11) NOTNULL'       ,
      'VOTES'              => 'C(11) NOTNULL'       ,
	  'HITS'               => 'I NOTNULL DEFAULT 0' ,
	  'COMMENT_COUNT'      => 'C(11) NOTNULL DEFAULT 0'       ,
      'OWNER_ID'           => 'I NULL'              ,
      'OWNER_NAME'         => 'C(255) NULL'         ,
      'OWNER_EMAIL'        => 'C(255) NULL'         ,
      'OWNER_NOTIF'        => 'I NOTNULL DEFAULT 0' ,
      'OWNER_EMAIL_CONFIRMED'=>'I NOTNULL DEFAULT 1',
      'DATE_MODIFIED'      => 'T DEFDATE'           ,
      'DATE_ADDED'         => 'T DEFDATE'           ,
      'FEATURED_MAIN'      => 'I NOTNULL DEFAULT 0' ,
      'FEATURED'           => 'I NOTNULL DEFAULT 0' ,
      'EXPIRY_DATE'        => 'T'                   ,
      'PAYED'              => 'I NOTNULL DEFAULT -1',
      'ARTICLE_TYPE'       => 'I NOTNULL DEFAULT 0' ,
      'IPADDRESS'          => 'C(15) NULL'          ,
      'DOMAIN'             => 'C(250) NULL'         ,
      'OTHER_INFO'         => 'X NULL'              ,
      'META_KEYWORDS'      => 'X NULL'              ,
      'META_DESCRIPTION'   => 'X NULL'				,
 	  'RELEASE_DATE'       => 'T DEFDATE'           
   ),
   'indexes' => array (
      'TITLE'              => 'TITLE'                           ,
      'DESCRIPTION'        => array ('DESCRIPTION' , 'FULLTEXT'),
      'ARTICLE'            => array ('ARTICLE'     , 'FULLTEXT'),
      'CATEGORY_ID'        => 'CATEGORY_ID'                     ,
      'STATUS'             => 'STATUS'                          ,
   'META_KEYWORDS'      => array ('META_KEYWORDS'   , 'FULLTEXT'),
      'META_DESCRIPTION'   => array ('META_DESCRIPTION', 'FULLTEXT')
   ),
   'options' => array (
      'mysql'              => "TYPE=MyISAM COMMENT='Stores all the articles with informations'"
   )
 );
  $tables['article_review'] = array (
   'name'   => TABLE_PREFIX.'ARTICLE_REVIEW'               ,
   'fields' => array (
       'ID'                 => 'I KEY AUTO'          ,
	   'ARTICLE_ID'              => 'C(255) NOTNULL'      ,
      'TITLE'              => 'C(255) NOTNULL'      ,
      'DESCRIPTION'        => 'X2 NULL'             ,
      'ARTICLE'            => 'X2 NULL'             ,
      'CATEGORY_ID'        => 'I NOTNULL'           ,
      'STATUS'             => 'I NOTNULL DEFAULT 1' ,
      'VALID'              => 'L NOTNULL DEFAULT 0' ,
      'OWNER_ID'           => 'I NULL'              ,
      'OWNER_NAME'         => 'C(255) NULL'         ,
      'OWNER_EMAIL'        => 'C(255) NULL'         ,
      'OWNER_NOTIF'        => 'I NOTNULL DEFAULT 0' ,
      'OWNER_EMAIL_CONFIRMED' => 'I NOTNULL DEFAULT 1',
      'DATE_MODIFIED'      => 'T DEFDATE'           ,
      'DATE_ADDED'         => 'T DEFDATE'           ,
      'FEATURED_MAIN'      => 'I NOTNULL DEFAULT 0' ,
      'FEATURED'           => 'I NOTNULL DEFAULT 0' ,
      'EXPIRY_DATE'        => 'T'                   ,
      'PAYED'              => 'I NOTNULL DEFAULT -1',
      'ARTICLE_TYPE'       => 'I NOTNULL DEFAULT 0' ,
	  'MARK_REMOVE'        => 'I NOTNULL DEFAULT 0' ,
      'IPADDRESS'          => 'C(15) NULL'          ,
      'DOMAIN'             => 'C(250) NULL'         ,
      'OTHER_INFO'         => 'X NULL'              ,
      'META_KEYWORDS'      => 'X NULL'              ,
      'META_DESCRIPTION'   => 'X NULL'
   ),
   'indexes' => array (
      'TITLE'              => 'TITLE'                           ,
      'DESCRIPTION'        => array ('DESCRIPTION' , 'FULLTEXT'),
      'ARTICLE'            => array ('ARTICLE'     , 'FULLTEXT'),
      'CATEGORY_ID'        => 'CATEGORY_ID'                     ,
      'STATUS'             => 'STATUS'                          ,
	  'META_KEYWORDS'      => array ('META_KEYWORDS'   , 'FULLTEXT'),
      'META_DESCRIPTION'   => array ('META_DESCRIPTION', 'FULLTEXT')
   ),
   'options' => array (
      'mysql'              => "TYPE=MyISAM COMMENT='Stores all the articles with informations'"
   )
 );
$tables['articlecomment'] = array (
   'name'   => TABLE_PREFIX.'ARTICLE_COMMENT'             ,
   'fields' => array (
      'ID'           => 'I KEY AUTO'              ,
      'ARTICLE_ID'   => 'C(11) NOTNULL'           ,
      'USER_ID'      => 'C(11) NOTNULL'           ,
      'USER_NAME'    => 'C(255) NOTNULL'          ,
      'COMMENT'      => 'X2'                      ,
      'DATE_ADDED'   => 'T DEFDATE'               ,
      'IPADDRESS'    => 'C(15) NULL'              ,
      'STATUS'       => 'C(11) NOTNULL'           ,
   ),
 );

$tables['article_subscribe'] = array (
   'name'   => TABLE_PREFIX.'ARTICLE_SUBSCRIBE'   ,
   'fields' => array (
      'ID'           => 'I KEY AUTO'              ,
      'USER_ID'      => 'I NOTNULL'               ,
      'ARTICLE_ID'   => 'I NOTNULL'               ,
      'COMMENT_ID'   => 'I NOTNULL'               ,
      'DATE_ADDED'   => 'T DEFDATE'               ,
   ),
 );
  
$tables['articlerating'] = array (
   'name'   => TABLE_PREFIX.'ARTICLE_RATING'              ,
   'fields' => array (
      'ARTICLE_ID'   => 'C(11) NOTNULL'           ,
      'IPADDRESS'    => 'C(15) NULL'              ,
      'DATE_ADDED'   => 'T DEFDATE'               ,
   ),
 );
 
 $tables['linkcomment'] = array (
   'name'   => TABLE_PREFIX.'LINK_COMMENT'             ,
   'fields' => array (
      'ID'           => 'I KEY AUTO'              ,
      'LINK_ID'   => 'C(11) NOTNULL'           ,
      'USER_ID'      => 'C(11) NOTNULL'           ,
      'USER_NAME'    => 'C(255) NOTNULL'          ,
      'COMMENT'      => 'X2'                      ,
      'DATE_ADDED'   => 'T DEFDATE'               ,
      'IPADDRESS'    => 'C(15) NULL'              ,
      'STATUS'       => 'C(11) NOTNULL'           ,
   ),
 );
$tables['link_subscribe'] = array (
   'name'   => TABLE_PREFIX.'LINK_SUBSCRIBE'   ,
   'fields' => array (
      'ID'           => 'I KEY AUTO'              ,
      'USER_ID'      => 'I NOTNULL'               ,
      'ARTICLE_ID'   => 'I NOTNULL'               ,
      'COMMENT_ID'   => 'I NOTNULL'               ,
      'DATE_ADDED'   => 'T DEFDATE'               ,
   ),
 );
 
$tables['linkrating'] = array (
   'name'   => TABLE_PREFIX.'LINK_RATING'              ,
   'fields' => array (
      'LINK_ID'   => 'C(11) NOTNULL'           ,
      'IPADDRESS'    => 'C(15) NULL'              ,
      'DATE_ADDED'   => 'T DEFDATE'               ,
   ),
 );
 
 $tables['email'] = array (
   'name'   => TABLE_PREFIX.'EMAIL'                 ,
   'fields' => array (
      'ID'        => 'I KEY AUTO'                   ,
      'EMAIL'     => 'C(255) NOTNULL'               ,
      'TITLE'     => 'C(255) NOTNULL'               ,
      'NAME'      => 'C(255)'                       ,
      'URL'       => 'C(255) NOTNULL'               ,
      'DATE_SENT' => 'T DEFDATE'
   ),
   'options' => array (
      "TYPE=MyISAM COMMENT='Stores all emailing informations'"
   )
 );
  $tables['email_tpl'] = array (
   'name'   => TABLE_PREFIX.'EMAIL_TPL'             ,
   'fields' => array (
      'ID'       => 'I KEY AUTO'                    ,
      'TPL_TYPE' => 'I DEFAULT 1'                   ,
      'TITLE'    => 'C(255) NOTNULL'                ,
      'SUBJECT'  => 'C(255) NOTNULL'                ,
      'BODY'     => 'B'
   ),
   'options' => array (
      'mysql'    => "TYPE=MyISAM COMMENT='Stores all email templates'"
   )
 );
 $tables['config'] = array (
   'name'   => TABLE_PREFIX.'CONFIG'                ,
   'fields' => array (
      'ID'    => 'C(255) KEY'                       ,
      'VALUE' => 'X2 NULL'
   ),
   'data' => array (
      array ('ID' => 'SITE_NAME'                , 'VALUE' => 'Site Name'                  ),
      array ('ID' => 'SITE_URL'                 , 'VALUE' => 'http://www.yourdomain.com/' ),
      array ('ID' => 'SITE_DESC'                , 'VALUE' => 'Site description'           ),
      array ('ID' => 'REWRITE_TYPE'             , 'VALUE' => 0                            ),
      array ('ID' => 'REWRITE_EXT'              , 'VALUE' => 0                            ),
      array ('ID' => 'LINKS_PER_PAGE'           , 'VALUE' => '20'                         ),
      array ('ID' => 'MAILS_PER_PAGE'           , 'VALUE' => '20'                         ),
      array ('ID' => 'BOOLEAN_SEARCH_ACTIVE'    , 'VALUE' => '0'                          ),
      array ('ID' => 'VISUAL_CONFIRM'           , 'VALUE' => '1'                          ),
      array ('ID' => 'CAPTCHA_DISTORTION_LEVEL' , 'VALUE' => '4'                          ),
      array ('ID' => 'CAPTCHA_PHRASE_LENGTH'    , 'VALUE' => '5'                          ),
      array ('ID' => 'CAPTCHA_PHRASE_TYPE'      , 'VALUE' => 'alphabetical'               ),
      array ('ID' => 'CAPTCHA_SIMPLE'           , 'VALUE' => '0'                          ),
      array ('ID' => 'REQUIRE_REGISTERED_USER'  , 'VALUE' => '0'                          ),
	  array ('ID' => 'REQUIRE_REGISTERED_USER_ARTICLE' , 'VALUE' => '1'                          ),
      array ('ID' => 'REQUIRE_RECIPROCAL'       , 'VALUE' => '0'                          ),
      array ('ID' => 'SHOW_RECIPROCAL_FIELD'    , 'VALUE' => '0'                          ),
	  array ('ID' => 'REQUIRE_URL'              , 'VALUE' => '1'                          ),
	  array ('ID' => 'SAME_DOMAIN_RECPR'		, 'VALUE' => '0'						  ),
	  array ('ID' => 'CHECK_DOMAIN_ONLY'		, 'VALUE' => '1'						  ),
      array ('ID' => 'ALLOW_MULTIPLE'           , 'VALUE' => '1'                          ),
      array ('ID' => 'CATS_PER_ROW'             , 'VALUE' => '2'                          ),
      array ('ID' => 'ENABLE_REWRITE'           , 'VALUE' => '0'                          ),
      array ('ID' => 'VERSION'                  , 'VALUE' => CURRENT_VERSION              ),
      array ('ID' => 'RECPR_NOFOLLOW'           , 'VALUE' => '1'                          ),
      array ('ID' => 'EMAIL_METHOD'             , 'VALUE' => 'mail'                       ),
      array ('ID' => 'EMAIL_SERVER'             , 'VALUE' => 'localhost'                  ),
      array ('ID' => 'EMAIL_USER'               , 'VALUE' => ''                           ),
      array ('ID' => 'EMAIL_PASS'               , 'VALUE' => ''                           ),
      array ('ID' => 'EMAIL_SENDMAIL'           , 'VALUE' => '/usr/bin/sendmail'          ),
      array ('ID' => 'CATS_PREVIEW'             , 'VALUE' => '3'                          ),
      array ('ID' => 'CATS_COUNT'               , 'VALUE' => '1'                          ),
      array ('ID' => 'DIRECTORY_TITLE'          , 'VALUE' => 'Directory'                  ),
      array ('ID' => 'ENABLE_RSS'               , 'VALUE' => '1'                          ),
	  array ('ID' => 'INTERNAL_RSS'             , 'VALUE' => '0'                          ),
	  array ('ID' => 'LIMIT_PR'                 , 'VALUE' => '0'                          ),
	  array ('ID' => 'PR_MIN'                   , 'VALUE' => '1'                          ),
      array ('ID' => 'ENABLE_PAGERANK'          , 'VALUE' => '1'                          ),
      array ('ID' => 'DEBUG'                    , 'VALUE' => '0'                          ),
      array ('ID' => 'SHOW_PAGERANK'            , 'VALUE' => '0'                          ),
      array ('ID' => 'DEFAULT_SORT'             , 'VALUE' => 'P'                          ),
      array ('ID' => 'ENABLE_NEWS'              , 'VALUE' => '1'                          ),
      array ('ID' => 'ADMIN_LANG'               , 'VALUE' => 'en'                         ),
      array ('ID' => 'FRONTEND_LANG'            , 'VALUE' => 'en'                         ),
      array ('ID' => 'LINKS_TOP'                , 'VALUE' => '20'                         ),
      array ('ID' => 'NTF_SUBMIT_TPL'           , 'VALUE' => ''                           ),
      array ('ID' => 'NTF_APPROVE_TPL'          , 'VALUE' => ''                           ),
      array ('ID' => 'NTF_REJECT_TPL'           , 'VALUE' => ''                           ),
	  array ('ID' => 'NTF_SUBMITA_TPL'           , 'VALUE' => ''                           ),
      array ('ID' => 'NTF_APPROVEA_TPL'          , 'VALUE' => ''                           ),
      array ('ID' => 'NTF_REJECTA_TPL'           , 'VALUE' => ''                           ),
      array ('ID' => 'NTF_PAYMENT_TPL'          , 'VALUE' => ''                           ),
      array ('ID' => 'NTF_REVIEW_SUBMIT_TPL'    , 'VALUE' => ''                           ),
      array ('ID' => 'NTF_REVIEW_APPROVE_TPL'   , 'VALUE' => ''                           ),
      array ('ID' => 'NTF_REVIEW_REJECT_TPL'    , 'VALUE' => ''                           ),
	  array ('ID' => 'NTF_REVIEWA_SUBMIT_TPL'    , 'VALUE' => ''                          ),
      array ('ID' => 'NTF_REVIEWA_APPROVE_TPL'   , 'VALUE' => ''                          ),
      array ('ID' => 'NTF_REVIEWA_REJECT_TPL'    , 'VALUE' => ''                          ),
      array ('ID' => 'NTF_EXPIRED_TPL'          , 'VALUE' => ''                           ),
      array ('ID' => 'NTF_INVOICE_TPL'          , 'VALUE' => ''                           ),
      array ('ID' => 'NTF_INVOICE_ARTICLE_TPL'  , 'VALUE' => ''                           ),
      array ('ID' => 'NTF_USER_DETAILS_TPL'     , 'VALUE' => ''                           ),
      array ('ID' => 'NTF_USER_PASSWORD_TPL'    , 'VALUE' => ''                           ),
      array ('ID' => 'FTR_ENABLE'               , 'VALUE' => '0'                          ),
      array ('ID' => 'FTR_MAX_LINKS'            , 'VALUE' => '5'                          ),
      array ('ID' => 'PAY_ENABLE'               , 'VALUE' => '0'                          ),
      array ('ID' => 'PAY_UM'                   , 'VALUE' => '0'                          ),
	  array ('ID' => 'PAY_UMF'                  , 'VALUE' => '0'                          ),
	  array ('ID' => 'PAY_UMN'                  , 'VALUE' => '0'                          ),
	  array ('ID' => 'PAY_UMR'                  , 'VALUE' => '0'                          ),
      array ('ID' => 'PAY_NORMAL'               , 'VALUE' => '0'                          ),
      array ('ID' => 'PAY_FEATURED'             , 'VALUE' => '0'                          ),
      array ('ID' => 'PAY_RECPR'                , 'VALUE' => '0'                          ),
      array ('ID' => 'PAY_AUTO_ACCEPT'          , 'VALUE' => ''                           ),
      array ('ID' => 'PAY_ENABLE_FREE'          , 'VALUE' => '0'                          ),
      array ('ID' => 'PAY_ENABLE_SUBSCRIPTION'  , 'VALUE' => '0'                          ),
      array ('ID' => 'PAY_CURRENCY_CODE'        , 'VALUE' => 'USD'                        ),
      array ('ID' => 'PAYPAL_ENABLE'            , 'VALUE' => '0'                          ),
      array ('ID' => 'PAYPAL_ACCOUNT'           , 'VALUE' => ''                           ),
      # Three way linking
      array ('ID' => 'ENABLE_THREE_WAY'         , 'VALUE' => '0'                          ),
      array ('ID' => 'THREE_WAY_LINK_URL'       , 'VALUE' => 'http://www.third-site.com/' ),
      array ('ID' => 'THREE_WAY_LINK_TITLE'     , 'VALUE' => 'Third-Site'                 ),
      # Pager Mod
      array ('ID' => 'PAGER_LPP'                , 'VALUE' => '20'                         ),
      array ('ID' => 'PAGER_GROUPINGS'          , 'VALUE' => '20'                         ),
      # Links open in blank window
      array ('ID' => 'ENABLE_BLANK'             , 'VALUE' => '0'                          ),
      # Hit limiter
      array ('ID' => 'LIMIT_HITS_TIME'          , 'VALUE' => '24'                         ),
      # Output Compression
      array ('ID' => 'COMPRESS_OUTPUT'          , 'VALUE' => '0'                          ),
      array ('ID' => 'COMPRESSION_LEVEL'        , 'VALUE' => '6'                          ),
      # Caching
      array ('ID' => 'CACHING'                  , 'VALUE' => '0'                          ),
      array ('ID' => 'DB_CACHING'               , 'VALUE' => '0'                          ),
      array ('ID' => 'DB_CACHE_TIMEOUT'         , 'VALUE' => '3600'                       ),
      array ('ID' => 'CRON_ADOCACHEFLUSH_HOUR'  , 'VALUE' => '0'                          ),
      array ('ID' => 'CRON_ADOCLEARCACHE_LASTRUN', 'VALUE' => '0'                          ),
      # META Tags
      array ('ID' => 'ENABLE_META_TAGS'         , 'VALUE' => '0'                          ),
	  array ('ID' => 'ENABLE_USER_META_TAGS_ARTICLE'   , 'VALUE' => '0'                          ),
      array ('ID' => 'ENABLE_USER_META_TAGS'    , 'VALUE' => '0'                          ),
      array ('ID' => 'DEFAULT_META_KEYWORDS'    , 'VALUE' => 'PHP Link Directory,submit link,payment,categories'),
      array ('ID' => 'DEFAULT_META_DESCRIPTION' , 'VALUE' => 'This is the link directory where you can submit the URL to your homepage. Powered by PHP Link Directory.'),
      array ('ID' => 'DEFAULT_META_AUTHOR'      , 'VALUE' => 'Your name / Company name'   ),
      array ('ID' => 'DEFAULT_META_COPYRIGHT'   , 'VALUE' => 'Copyright (c) 2009 by YOUR NAME. All rights reserved!'),
      array ('ID' => 'DEFAULT_META_ROBOTS'      , 'VALUE' => ''                           ),
      # Form Field Lengths
      array ('ID' => 'USER_LOGIN_MIN_LENGTH'    , 'VALUE' => '4'                          ),
      array ('ID' => 'USER_LOGIN_MAX_LENGTH'    , 'VALUE' => '25'                         ),
      array ('ID' => 'USER_NAME_MIN_LENGTH'     , 'VALUE' => '4'                          ),
      array ('ID' => 'USER_NAME_MAX_LENGTH'     , 'VALUE' => '50'                         ),
      array ('ID' => 'USER_PASSWORD_MIN_LENGTH' , 'VALUE' => '5'                          ),
      array ('ID' => 'USER_PASSWORD_MAX_LENGTH' , 'VALUE' => '25'                         ),
      array ('ID' => 'TITLE_MIN_LENGTH'         , 'VALUE' => '3'                          ),
      array ('ID' => 'TITLE_MAX_LENGTH'         , 'VALUE' => '100'                        ),
      array ('ID' => 'DESCRIPTION_MIN_LENGTH'   , 'VALUE' => '0'                          ),
      array ('ID' => 'DESCRIPTION_MAX_LENGTH'   , 'VALUE' => '500'                        ),
      array ('ID' => 'CAT_TITLE_MIN_LENGTH'     , 'VALUE' => '3'                          ),
      array ('ID' => 'CAT_TITLE_MAX_LENGTH'     , 'VALUE' => '100'                        ),
      array ('ID' => 'CAT_DESCRIPTION_MIN_LENGTH', 'VALUE' => '0'                         ),
      array ('ID' => 'CAT_DESCRIPTION_MAX_LENGTH', 'VALUE' => '500'                       ),
	  array ('ID' => 'ARTICLE_TITLE_MIN_LENGTH'        , 'VALUE' => '3'                   ),
      array ('ID' => 'ARTICLE_TITLE_MAX_LENGTH'        , 'VALUE' => '100'                 ),
      array ('ID' => 'ARTICLE_DESCRIPTION_MIN_LENGTH'  , 'VALUE' => '0'                   ),
      array ('ID' => 'ARTICLE_DESCRIPTION_MAX_LENGTH'  , 'VALUE' => '250'                 ),
      array ('ID' => 'ARTICLE_MIN_LENGTH'              , 'VALUE' => '0'                   ),
      array ('ID' => 'ARTICLE_MAX_LENGTH'              , 'VALUE' => '5000'                ),
      array ('ID' => 'META_DESCRIPTION_MIN_LENGTH', 'VALUE' => '0'                        ),
      array ('ID' => 'META_DESCRIPTION_MAX_LENGTH', 'VALUE' => '250'                      ),
      array ('ID' => 'META_KEYWORDS_MIN_LENGTH'   , 'VALUE' => '0'                        ),
      array ('ID' => 'META_KEYWORDS_MAX_LENGTH'   , 'VALUE' => '250'                      ),
      # Category order
      array ('ID' => 'CATEG_FIELD_SORT'         , 'VALUE' => 'TITLE'                      ),
      array ('ID' => 'CATEG_FIELD_SORT_ORDER'   , 'VALUE' => 'ASC'                        ),
      array ('ID' => 'SUBCATEG_FIELD_SORT'      , 'VALUE' => 'HITS'                       ),
      array ('ID' => 'SUBCATEG_FIELD_SORT_ORDER', 'VALUE' => 'ASC'                        ),
      # Force HTTP status 200 (OK)
      array ('ID' => 'FORCE_HTTP_STATUS_OK'     , 'VALUE' => '0'                          ),
      array ('ID' => 'FORCE_INVALID_HTTP_STATUS_OK', 'VALUE' => '0'                       ),
      # Template
      array ('ID' => 'TEMPLATE'                 , 'VALUE' => 'Professional'               ),
      array ('ID' => 'ADMIN_TEMPLATE'           , 'VALUE' => 'DefaultAdmin'               ),
      array ('ID' => 'CORE_TEMPLATES'           , 'VALUE' => 'Core'                       ),
      # Automatic redirects
      array ('ID' => 'ADMIN_REDIRECT_TIMEOUT'   , 'VALUE' => 3                            ),
      # Category selection method
      array ('ID' => 'CAT_SELECTION_METHOD'     , 'VALUE' => 0                            ),
      array ('ID' => 'ADMIN_CAT_SELECTION_METHOD','VALUE' => 0                            ),
      # A basic option to bypass security warning for those uninterested
      array ('ID' => 'BYPASS_SECURITY_WARNINGS' , 'VALUE' => 0                            ),
      # Request variables cleanup (XSS protection)
      array ('ID' => 'ALLOW_HTML'               , 'VALUE' => 0                            ),
      array ('ID' => 'ALLOWED_HTML_TAGS'        , 'VALUE' => 'b,strong,i,u,strike,span'   ),
	  # Request variables cleanup (XSS protection)
      array ('ID' => 'ALLOW_ATTR'               , 'VALUE' => 0                            ),
      array ('ID' => 'ALLOWED_ATTR_TAGS'        , 'VALUE' => ''   ),
      # Reciprocal link options
      array ('ID' => 'RECPR_NEED_200_OK'        , 'VALUE' => 0                            ),
      array ('ID' => 'RECPR_CHECK_NOFOLLOW'     , 'VALUE' => 1                            ),
      array ('ID' => 'RECPR_CHECK_DOMAIN'       , 'VALUE' => 1                            ),
      # Spam protection
      array ('ID' => 'ALLOW_EMPTY_USERAGENT'    , 'VALUE' => 0                            ),
      array ('ID' => 'ALLOW_FOREIGN_REFERER'    , 'VALUE' => 0                            ),
      array ('ID' => 'FORCE_SUBMIT_SESSION'     , 'VALUE' => 1                            ),
      array ('ID' => 'SECRET_SESSION_PASSWORD'  , 'VALUE' => $rand_pass			  ),
      # Contact email
      array ('ID' => 'SITE_CONTACT_EMAIL'       , 'VALUE' => ''                           ),
      # Rich Text Editor
      array ('ID' => 'ADMIN_USE_RTE'            , 'VALUE' => 1                            ),
	  array ('ID' => 'ARTICLE_SUBMIT_USE_RTE'          , 'VALUE' => '0'                          ),
	  array ('ID' => 'LINK_SUBMIT_USE_RTE'          , 'VALUE' => '0'                          ),
	  # Date and Time
      array ('ID' => 'SERVER_OFFSET_TIME'       , 'VALUE' => 0                            ),
      #array ('ID' => 'DATE_FORMAT'              , 'VALUE' => 'F j, Y - G:i:s'             ),
      # Charset
      array ('ID' => 'CHARSET'                  , 'VALUE' => 'utf-8'                      ),
	  # Main Page Text
	  array ('ID' => 'MAINCONTENT'				, 'VALUE' => '<b><i>MAIN CONTENT</i></b>.' ),
	  # Submit Terms Page Text
	  array ('ID' => 'SUBMIT_TERMS'				, 'VALUE' => "<p>We make an effort to review as many submissions as possible, but we cannot always accept every submission. When submitting, please provide an accurate and grammatically correct title and description for your link. The title and description should reflect the content that a user would find on your site. Your site should not display popups, or attempt to install any software on the user\'s computer. Your site should be complete with all links working, and with a generous amount of content. If your site is new, please consider making sure it is both complete and worthwhile to a potential user before submitting to the directory. Finally, sites containing content that is not legal in all parts of the World, or is not legally viewed by children may not be accepted. Thanks for doing your part to submit a quality site that users of this directory will love, as this will be good for your site, and our directory. Thanks so much for your quality submission!</p>" ),
	  #Control Submission On or Off
	  array ('ID' => 'DISABLE_SUBMIT'			, 'VALUE' => 0						      ),
	  #Submission Disable Reason
	  array ('ID' => 'DISABLE_REASON'		    , 'VALUE' => 'We will be back in 24 hours.' ),
	  #Control Article Submission On or Off
	  array ('ID' => 'DISABLE_ARTICLE_SUBMIT'	, 'VALUE' => 0						      ),
	  #Submission Disable Reason
	  array ('ID' => 'DISABLE_ARTICLE_REASON'	, 'VALUE' => 'We will be back in 24 hours.' ),
	  #Control Google Maps On or Off
	  array ('ID' => 'GMAP_ENABLE'			    , 'VALUE' => 0						      ),
	  #Google Map Key
	  array ('ID' => 'GMAP_KEY'		            , 'VALUE' => 'You must obtain a key from google. http://code.google.com/apis/maps/signup.html' ),
      # Article Comments
      array ('ID' => 'ARTICLE_COMMENT'                 , 'VALUE' => '1'                          ),
      array ('ID' => 'REQUIRE_REGISTERED_USER_ARTICLE_COMMENT' , 'VALUE' => '1'                          ),
      array ('ID' => 'AUTO_APPROVE_COMMENTS_ONOFF'     , 'VALUE' => '0'                          ),
      array ('ID' => 'VISUAL_CONFIRM_COMMENTS'         , 'VALUE' => '1'                          ),
      array ('ID' => 'AUTO_APPROVE_COMMENTS'           , 'VALUE' => '2'                          ),
      # Article Ratings
      array ('ID' => 'REQUIRE_REGISTERED_USER_ARTICLE_RATING'  , 'VALUE' => '1'                          ),
      array ('ID' => 'ARTICLE_RATING_DISPLAY'          , 'VALUE' => 'numeric'                    ),
      array ('ID' => 'ARTICLE_RATING_TIME'             , 'VALUE' => '86400'                      ),
      array ('ID' => 'ARTICLE_RATING'                  , 'VALUE' => '1'                          ),
      array ('ID' => 'MIN_RATING'                      , 'VALUE' => '1'                          ),
      array ('ID' => 'MIN_VOTES'                       , 'VALUE' => '10'                         ),
      # LINK Comments
      array ('ID' => 'LINK_COMMENT'                 , 'VALUE' => '1'                          ),
      array ('ID' => 'REQUIRE_REGISTERED_USER_LINK_COMMENT' , 'VALUE' => '1'                          ),
      array ('ID' => 'AUTO_APPROVE_LINK_COMMENTS_ONOFF'     , 'VALUE' => '0'                          ),
      array ('ID' => 'VISUAL_CONFIRM_LINK_COMMENTS'         , 'VALUE' => '1'                          ),
      array ('ID' => 'AUTO_APPROVE_LINK_COMMENTS'           , 'VALUE' => '2'                          ),
      # LINK Ratings
      array ('ID' => 'REQUIRE_REGISTERED_USER_LINK_RATING'  , 'VALUE' => '1'                          ),
      array ('ID' => 'LINK_RATING_DISPLAY'          , 'VALUE' => 'numeric'                    ),
      array ('ID' => 'LINK_RATING_TIME'             , 'VALUE' => '86400'                      ),
      array ('ID' => 'LINK_RATING'                  , 'VALUE' => '1'                          ),
      array ('ID' => 'LINK_MIN_RATING'                      , 'VALUE' => '1'                          ),
      array ('ID' => 'LINK_MIN_VOTES'                       , 'VALUE' => '10'                         ),
      # Author extra info
      array ('ID' => 'ALLOW_AUTHOR_INFO'               , 'VALUE' => '1'                          ),
      array ('ID' => 'ALLOW_ANONYMOUS'                 , 'VALUE' => '1'                          ),
      # Article Payment
      array ('ID' => 'ARTICLE_PAY_ENABLE'              , 'VALUE' => '0'                          ),
      array ('ID' => 'ARTICLE_PAY_ENABLE_FREE'         , 'VALUE' => '0'                          ),
      array ('ID' => 'ARTICLE_PAY_NORMAL'              , 'VALUE' => '0'                          ),
      array ('ID' => 'ARTICLE_PAY_FEATURED'            , 'VALUE' => '0'                          ),
      array ('ID' => 'ALLOW_AVATARS'                   , 'VALUE' => '1'                          ),
      # Email confirmation
      array ('ID' => 'EMAIL_CONFIRMATION'               , 'VALUE' => '1'                          ),
	  array ('ID' => 'SHOW_CONFIRMED_ONLY'              , 'VALUE' => '0'                          ),
      array ('ID' => 'WAIT_FOR_EMAIL_CONF'              , 'VALUE' => '5'                          ),
   ),
   'options' => array (
      'mysql' => "TYPE=MyISAM COMMENT='Stores configuration options of the directory'"
   )
 );
 
 $tables['user_default_actions'] = array (
   'name'   => TABLE_PREFIX.'USER_DEFAULT_ACTIONS'                ,
   'fields' => array (
      'ID'    => 'I KEY'                       ,
      'LEVEL_ID' => 'I NOTNULL'						,
      'NAME'	=>'C(250) NOTNULL'					,
      'INFO'	=> 'X'						,
      'VALUE' => 'I NOTNULL DEFAULT 0'
   ),
   'data' => array (
       #regular user
      array ('ID' => '1'                , 'LEVEL_ID'=>'0',		'NAME'=>'Add Link',		'INFO'=>'',		'VALUE' => '1'),
      array ('ID' => '2'                , 'LEVEL_ID'=>'0',		'NAME'=>'Edit Link',	'INFO'=>'',		'VALUE' => '1'),
      array ('ID' => '3'                , 'LEVEL_ID'=>'0',		'NAME'=>'Delete Link',	'INFO'=>'',		'VALUE' => '1'),
      #editor user
      array ('ID' => '4'                , 'LEVEL_ID'=>'2',		'NAME'=>'Add Link',		'INFO'=>'',		'VALUE' => '1'),
      array ('ID' => '5'                , 'LEVEL_ID'=>'2',		'NAME'=>'Edit Link',	'INFO'=>'',		'VALUE' => '1'),
      array ('ID' => '6'                , 'LEVEL_ID'=>'2',		'NAME'=>'Delete Link',	'INFO'=>'',		'VALUE' => '1'),
      #regular user category
      array ('ID' => '7'                , 'LEVEL_ID'=>'0',		'NAME'=>'Add Category',	'INFO'=>'',		'VALUE' => '0'),
      array ('ID' => '8'                , 'LEVEL_ID'=>'0',		'NAME'=>'Edit Category','INFO'=>'',		'VALUE' => '0'),
      array ('ID' => '9'                , 'LEVEL_ID'=>'0',		'NAME'=>'Delete Category', 'INFO'=>'',		'VALUE' => '0'),
      #editor user
      array ('ID' => '10'               , 'LEVEL_ID'=>'2',		'NAME'=>'Add Category',		'INFO'=>'',		'VALUE' => '0'),
      array ('ID' => '11'               , 'LEVEL_ID'=>'2',		'NAME'=>'Edit Category',	'INFO'=>'',		'VALUE' => '1'),
      array ('ID' => '12'               , 'LEVEL_ID'=>'2',		'NAME'=>'Delete Category',	'INFO'=>'',		'VALUE' => '0'),

      array ('ID' => '13'               , 'LEVEL_ID'=>'0',      'NAME'=>'Add Article',     'INFO'=>'',     'VALUE' => '1'),
      array ('ID' => '14'               , 'LEVEL_ID'=>'0',      'NAME'=>'Edit Article',    'INFO'=>'',     'VALUE' => '1'),
      array ('ID' => '15'               , 'LEVEL_ID'=>'0',      'NAME'=>'Delete Article',  'INFO'=>'',     'VALUE' => '1'),
      
      array ('ID' => '16'               , 'LEVEL_ID'=>'2',      'NAME'=>'Add Article',     'INFO'=>'',     'VALUE' => '1'),
      array ('ID' => '17'               , 'LEVEL_ID'=>'2',      'NAME'=>'Edit Article',    'INFO'=>'',     'VALUE' => '1'),
      array ('ID' => '18'               , 'LEVEL_ID'=>'2',      'NAME'=>'Delete Article',  'INFO'=>'',     'VALUE' => '1'),
      
      array ('ID' => '19'               , 'LEVEL_ID'=>'3',      'NAME'=>'Add Link',     'INFO'=>'',     'VALUE' => '1'),
      array ('ID' => '20'               , 'LEVEL_ID'=>'3',      'NAME'=>'Edit Link',    'INFO'=>'',     'VALUE' => '1'),
      array ('ID' => '21'               , 'LEVEL_ID'=>'3',      'NAME'=>'Delete Link',  'INFO'=>'',     'VALUE' => '1'),
      
      array ('ID' => '22'               , 'LEVEL_ID'=>'3',      'NAME'=>'Add Category',     'INFO'=>'',     'VALUE' => '1'),
      array ('ID' => '23'               , 'LEVEL_ID'=>'3',      'NAME'=>'Edit Category',    'INFO'=>'',     'VALUE' => '1'),
      array ('ID' => '24'               , 'LEVEL_ID'=>'3',      'NAME'=>'Delete Category',  'INFO'=>'',     'VALUE' => '1'),
      
      array ('ID' => '25'               , 'LEVEL_ID'=>'3',      'NAME'=>'Add Article',     'INFO'=>'',     'VALUE' => '1'),
      array ('ID' => '26'               , 'LEVEL_ID'=>'3',      'NAME'=>'Edit Article',    'INFO'=>'',     'VALUE' => '1'),
      array ('ID' => '27'               , 'LEVEL_ID'=>'3',      'NAME'=>'Delete Article',  'INFO'=>'',     'VALUE' => '1'),
      
      array ('ID' => '28'               , 'LEVEL_ID'=>'3',      'NAME'=>'Add Page',     'INFO'=>'',     'VALUE' => '1'),
      array ('ID' => '29'               , 'LEVEL_ID'=>'3',      'NAME'=>'Edit Page',    'INFO'=>'',     'VALUE' => '1'),
      array ('ID' => '30'               , 'LEVEL_ID'=>'3',      'NAME'=>'Delete Page',  'INFO'=>'',     'VALUE' => '1'),
      
      array ('ID' => '31'               , 'LEVEL_ID'=>'0',      'NAME'=>'Add Page',     'INFO'=>'',     'VALUE' => '0'),
      array ('ID' => '32'               , 'LEVEL_ID'=>'0',      'NAME'=>'Edit Page',    'INFO'=>'',     'VALUE' => '0'),
      array ('ID' => '33'               , 'LEVEL_ID'=>'0',      'NAME'=>'Delete Page',  'INFO'=>'',     'VALUE' => '0'),
      
      array ('ID' => '34'               , 'LEVEL_ID'=>'2',      'NAME'=>'Add Page',     'INFO'=>'',     'VALUE' => '0'),
      array ('ID' => '35'               , 'LEVEL_ID'=>'2',      'NAME'=>'Edit Page',    'INFO'=>'',     'VALUE' => '0'),
      array ('ID' => '36'               , 'LEVEL_ID'=>'2',      'NAME'=>'Delete Page',  'INFO'=>'',     'VALUE' => '0'),
      
      array ('ID' => '37'               , 'LEVEL_ID'=>'1',      'NAME'=>'Add Link',     'INFO'=>'',     'VALUE' => '1'),
      array ('ID' => '38'               , 'LEVEL_ID'=>'1',      'NAME'=>'Edit Link',    'INFO'=>'',     'VALUE' => '1'),
      array ('ID' => '39'               , 'LEVEL_ID'=>'1',      'NAME'=>'Delete Link',  'INFO'=>'',     'VALUE' => '1'),
      
      array ('ID' => '40'               , 'LEVEL_ID'=>'1',      'NAME'=>'Add Category',     'INFO'=>'',     'VALUE' => '1'),
      array ('ID' => '41'               , 'LEVEL_ID'=>'1',      'NAME'=>'Edit Category',    'INFO'=>'',     'VALUE' => '1'),
      array ('ID' => '42'               , 'LEVEL_ID'=>'1',      'NAME'=>'Delete Category',  'INFO'=>'',     'VALUE' => '1'),
      
      array ('ID' => '43'               , 'LEVEL_ID'=>'1',      'NAME'=>'Add Article',     'INFO'=>'',     'VALUE' => '1'),
      array ('ID' => '44'               , 'LEVEL_ID'=>'1',      'NAME'=>'Edit Article',    'INFO'=>'',     'VALUE' => '1'),
      array ('ID' => '45'               , 'LEVEL_ID'=>'1',      'NAME'=>'Delete Article',  'INFO'=>'',     'VALUE' => '1'),
      
      array ('ID' => '46'               , 'LEVEL_ID'=>'1',      'NAME'=>'Add Page',     'INFO'=>'',     'VALUE' => '1'),
      array ('ID' => '47'               , 'LEVEL_ID'=>'1',      'NAME'=>'Edit Page',    'INFO'=>'',     'VALUE' => '1'),
      array ('ID' => '48'               , 'LEVEL_ID'=>'1',      'NAME'=>'Delete Page',  'INFO'=>'',     'VALUE' => '1'),
      
   ),
   'options' => array (
      'mysql' => "TYPE=MyISAM COMMENT=''"
   )
 );
 
  $tables['user_actions'] = array (
   'name'   => TABLE_PREFIX.'USER_ACTIONS'          ,
   'fields' => array (
      'ID'    => 'I KEY AUTO'                       ,
      'USER_ID' => 'I NOTNULL'						,
      'ACTION_ID' => 'I NOTNULL'					,
      'VALUE' => 'I NOTNULL DEFAULT 0'
   ),
   'options' => array (
      'mysql' => "TYPE=MyISAM COMMENT=''"
   )
 );
  
 $tables['payment'] = array (
   'name'   => TABLE_PREFIX.'PAYMENT'               ,
   'fields' => array (
      'ID'                => 'I KEY AUTO'             ,
      'LINK_ID'           => 'C(15) NOTNULL'          ,
      'ARTICLE_ID'        => 'C(15) NOTNULL'          ,
      'NAME'              => 'C(255)'                 ,
      'EMAIL'             => 'C(255)'                 ,
      'IPADDRESS'         => 'C(15) NOTNULL'          ,
      'AMOUNT'            => 'N(8.2) NOTNULL'         ,
      'QUANTITY'          => 'I NOTNULL'              ,
      'TOTAL'             => 'N(8.2) NOTNULL'         ,
      'PAYED_TOTAL'       => 'N(8.2) NOTNULL'         ,
      'PAYED_QUANTITY'    => 'I NOTNULL'              ,
      'UM'                => 'I NOTNULL'              ,
      'CONFIRMED'         => 'I NOTNULL DEFAULT 0'    ,
      'SUBSCRIBED'        => 'I NOTNULL DEFAULT 0'    ,
	  'PAYMENT_TYPE'      => 'C(255)'                 ,
	  'PAYMENT_STATUS'    => 'C(255)'                 ,
      'PAY_DATE'          => 'T NOTNULL DEFDATE'      ,
      'CONFIRM_DATE'      => 'T'                      ,
      'RAW_LOG'           => 'X2'
   ),
   'options' => array (
      'mysql'             => "TYPE=MyISAM COMMENT='Stores all payments with informations'"
   )
 );
  $tables['page'] = array (
   'name'   => TABLE_PREFIX.'PAGE'                 ,
   'fields' => array (
      'ID'                => 'I KEY AUTO'          ,
      'NAME'              => 'C(255) NOTNULL'      ,
      'SEO_NAME'          => 'C(255) NOTNULL'      ,
      'CONTENT'           => 'X2'                  ,
      'STATUS'            => 'I NOTNULL DEFAULT 0' ,
      'PRIVACY'           => 'I NOTNULL DEFAULT 0' ,
	  'PLACEMENT'            => 'I NOTNULL DEFAULT 0' ,
	  'SHOW_IN_MENU'            => 'I NOTNULL DEFAULT 1' ,
      'DATE_ADDED'        => 'T DEFDATE'           ,
      'DATE_MODIFIED'     => 'T DEFDATE'		   ,
	  'META_KEYWORDS'      => 'X NULL'              ,
      'META_DESCRIPTION'   => 'X NULL'
   ),
   'indexes' => array (
      'NAME'              => 'NAME'                           ,
      'CONTENT'            => array ('CONTENT'     , 'FULLTEXT'),
      'STATUS'             => 'STATUS'                          ,
	  'PRIVACY'             => 'PRIVACY'                          ,
	  'PLACEMENT'             => 'PLACEMENT'                          ,
      'META_KEYWORDS'      => array ('META_KEYWORDS'   , 'FULLTEXT'),
      'META_DESCRIPTION'   => array ('META_DESCRIPTION', 'FULLTEXT')
   ),
   'options' => array (
      'mysql'             => "TYPE=MyISAM COMMENT='Stores extra pages information'"
   )
 );
 $tables['user'] = array (
   'name'   => TABLE_PREFIX.'USER'                  ,
   'fields' => array (
      'ID'                 => 'I KEY AUTO'          ,
      'LOGIN'              => 'C(100) NOTNULL'       ,
      'NAME'               => 'C(255) NOTNULL'       ,
      'PASSWORD'           => 'C('.$PasswFieldLength.') NOTNULL',
      'LEVEL'              => 'L NOTNULL DEFAULT 0' ,
      'RANK'               => 'L NOTNULL DEFAULT 0' ,
      'ACTIVE'             => 'L NOTNULL DEFAULT 0' ,
	  'LAST_LOGIN'         => 'T DEFDATE'           ,
	  'REGISTRATION_DATE'  => 'T DEFDATE'           ,
      'AUTH_IMG' => 'C(255)NULL' ,
      'AUTH_IMGTN' => 'C(255)NULL' ,
      'SUBMIT_NOTIF'       => 'L NOTNULL DEFAULT 1' ,
      'PAYMENT_NOTIF'      => 'L NOTNULL DEFAULT 1' ,
      'ADDRESS'            => 'C(255) NULL'         ,
      'EMAIL'              => 'C(255) NOTNULL'      ,
      'WEBSITE'            => 'C(255) NULL'         ,
	  'WEBSITE_NAME'       => 'C(255) NULL'         ,
      'INFO'               => 'C(255) NULL'                     ,
      'ANONYMOUS'          => 'L NOTNULL DEFAULT 0'             ,
      'LANGUAGE'           => 'C(2) NULL'           ,
      'AVATAR'             => 'C(100) NULL'         ,
      'ICQ'                => 'C(15) NULL'          ,
      'AIM'                => 'C(255) NULL'         ,
      'YIM'                => 'C(255) NULL'         ,
      'MSN'                => 'C(255) NULL'         ,
      'CONFIRM'            => 'C(10) NULL'          ,
      'NEW_PASSWORD'       => 'C('.$PasswFieldLength.') NULL',
      'EMAIL_CONFIRMED'    => 'I NOTNULL DEFAULT 1' ,
   ),
   'options' => array (
      'mysql'              => "TYPE=MyISAM COMMENT='Stores all the users with informations'"
   )
 );
 $tables['user_permission'] = array (
   'name'   => TABLE_PREFIX.'USER_PERMISSION'       ,
   'fields' => array (
      'ID'          => 'I KEY AUTO'                 ,
      'USER_ID'     => 'I NOTNULL'                  ,
      'CATEGORY_ID' => 'I NOTNULL'
   ),
   'options' => array (
      'mysql'       => "TYPE=MyISAM COMMENT='Stores user permissions'"
   )
 );
 $tables['banlist'] = array (
   'name' => TABLE_PREFIX.'BANLIST'                 ,
   'fields' => array (
      'ID'         => 'I KEY AUTO'                  ,
      'BAN_IP'     => 'C(15) NULL'                  ,
      'BAN_DOMAIN' => 'C(64) NULL'                  ,
      'BAN_EMAIL'  => 'C(255) NULL'                 ,
      'BAN_WORD'   => 'C(255) NULL'
   ),
   'options' => array (
      'mysql'      => "TYPE=MyISAM COMMENT='Stores banning informations'"
   )
 );
 $tables['hitcount'] = array (
   'name' => TABLE_PREFIX.'HITS'                    ,
   'fields' => array (
      'ID'          => 'I KEY AUTO'                 ,
      'LINK_ID'     => 'C(64) NULL'                 ,
	   'ARTICLE_ID'     => 'C(64) NULL'                 ,
      'CATEGORY_ID' => 'C(250) NULL'                ,
      'IP'          => 'C(15) NULL'                 ,
      'LAST_HIT'    => 'T DEFDATE'
   ),
   'options' => array (
      'mysql'       => "TYPE=MyISAM COMMENT='Counts hits of categories and links'"
   )
 );

 $tables['img_verification'] = array (
   'name' => TABLE_PREFIX.'IMG_VERIFICATION'        ,
   'fields' => array (
      'IMGHASH'      => 'C(32) NULL'                ,
      'IMGPHRASE'    => 'C(10) NULL'                ,
      'CREATED'      => 'I(20) NOTNULL DEFAULT 0'   ,
      'VIEWED'       => 'L NOTNULL DEFAULT 0'
   ),
   'options' => array (
      'mysql'        => "TYPE=MyISAM COMMENT='Stores captcha informations for an improved validation'"
   )
 );

 $tables['submit_verification'] = array (
   'name' => TABLE_PREFIX.'SUBMIT_VERIFICATION'     ,
   'fields' => array (
      'SESSION'      => 'C(32) NULL'                ,
      'SUBMITHASH'   => 'C(32) NULL'                ,
      'CREATED'      => 'I(20) NOTNULL DEFAULT 0'
   ),
   'options' => array (
      'mysql'        => "TYPE=MyISAM COMMENT='Stores submit sessions for an improved validation of submitions'"
   )
 );
 $tables['search'] = array (
   'name' => TABLE_PREFIX.'SEARCH'                 ,
   'fields' => array (
      'SEARCHID'     => 'I KEY AUTO'               ,
      'USERID'       => 'I(10) DEFAULT 0'          ,
      'IPADDRESS'    => 'C(15) NULL'               ,
      'QUERY'        => 'C(250) NOTNULL'           ,
      'SORTBY'       => 'C(200) NULL'              ,
      'SORTORDER'    => "C(4) DEFAULT 'DESC'"      ,
      'SEARCHTIME'   => 'T DEFDATE'                ,
      'SEARCHTERMS'  => 'X DEFAULT NULL'           ,
      'DISPLAYTERMS' => 'X DEFAULT NULL'           ,
      'COMPLETED'    => "I(2) DEFAULT '0'"
   )
 );
 
  $tables['widget_zone_types'] = array (
   'name' => TABLE_PREFIX.'WIDGET_ZONE_TYPES'                 ,
   'fields' => array (
      'NAME'     => 'C(255) KEY '               
   ),
   'data' => array (
      array ('NAME' => 'VERTICAL'),
      array ('NAME' => 'CENTRAL')
   ),
   'options' => array (
      'mysql' => "TYPE=MyISAM COMMENT='Stores zone types for widget applications'"
   )  
 );
 
 $tables['widget_zones'] = array (
   'name' => TABLE_PREFIX.'WIDGET_ZONES'                 ,
   'fields' => array (
      'NAME'     => 'C(255) KEY ' ,
 	  'TYPE'	=> 'C(255) NOTNULL'              
   ),
   'data' => array (
      array ('NAME' => 'LEFT_COLUMN', 'TYPE' => 'VERTICAL'),
      array ('NAME' => 'RIGHT_COLUMN', 'TYPE' => 'VERTICAL'),
      array ('NAME' => 'MAIN_ON_HOMEPAGE', 'TYPE' => 'CENTRAL'),
      array ('NAME' => 'MAIN_NOT_ON_HOMEPAGE', 'TYPE' => 'CENTRAL'),
      array ('NAME' => 'LINK_DETAIL', 'TYPE' => 'CENTRAL')
   ),
   'options' => array (
      'mysql' => "TYPE=MyISAM COMMENT='Stores zones for widget applications'"
   )  
 );
 
 
  $tables['widget'] = array (
   'name' => TABLE_PREFIX.'WIDGET',
   'fields' => array (
      'NAME'     => 'C(255) KEY ' ,
 	  'TYPE'	=> 'C(255) NOTNULL',
  	  'DESCRIPTION' => 'X NULL'		       
   ),
   'data' => array(
   		array('NAME' => 'MainContent', 'TYPE' => 'CENTRAL', 'DESCRIPTION' => 'This is the main content of the site, it is not editable and cannot be deleted.')
   ),
   'options' => array (
      'mysql' => "TYPE=MyISAM COMMENT='Stores installed widgets'"
   )  
 );
 
 
   $tables['widget_activated'] = array (
   'name' => TABLE_PREFIX.'WIDGET_ACTIVATED',
   'fields' => array (
      'NAME'     => 'C(255) NOTNULL' ,
 	  'ZONE'	 => 'C(255) NOTNULL',
   	  'ORDER_ID' => 'I NULL',	       
   ),
   'data' => array(
   		array('NAME' => 'MainContent', 'ZONE' => 'MAIN_ON_HOMEPAGE', 'ORDER_ID' => 0),
   		array('NAME' => 'MainContent', 'ZONE' => 'MAIN_NOT_ON_HOMEPAGE', 'ORDER_ID' => 0),
   		array('NAME' => 'MainContent', 'ZONE' => 'LINK_DETAIL', 'ORDER_ID' => 0)
   ),
   'options' => array (
      'mysql' => "TYPE=MyISAM COMMENT='Stores installed & activated widgets and their active zones'"
   )  
 );
 
   $tables['widget_settings'] = array (
   'name' => TABLE_PREFIX.'WIDGET_SETTINGS',
   'fields' => array (
   	  'IDENTIFIER'     	=> 'C(255) NOTNULL',	
      'WIDGET_NAME'     => 'C(255) NOTNULL' ,
 	  'SETTING_NAME'	=> 'C(255) NOTNULL'	,
      'SETTING_VALUE'	=> 'X NULL'        	,
   	  'SETTING_INFO'	=> 'X NULL'         ,
   	  'SETTING_ALLOWED' => 'X NULL'         
   ),
   'options' => array (
      'mysql' => "TYPE=MyISAM COMMENT='Stores installed widgets settings'"
   )  
 );
 
 
 $tables['news'] = array (
   'name'   => TABLE_PREFIX.'NEWS'                  ,
   'fields' => array (
      'ID'                 => 'I KEY AUTO'          ,
      'TITLE'              => 'C(255) NOTNULL'      ,
      'DESCRIPTION'        => 'X2 NULL'             ,
      'URL'                => 'C(255) NOTNULL'      ,
      'CATEGORY_ID'        => 'I NOTNULL'           ,
      'RATING'             => 'C(11) NOTNULL'       ,
      'VOTES'              => 'C(11) NOTNULL'       ,
      'COMMENT_COUNT'      => 'C(11) NOTNULL'       ,
      'OWNER_ID'           => 'I NULL'              ,
      'OWNER_NAME'         => 'C(255) NULL'         ,
      'OWNER_EMAIL'        => 'C(255) NULL'         ,
      'OWNER_NOTIF'        => 'I NOTNULL DEFAULT 0' ,
      'DATE_MODIFIED'      => 'T DEFDATE'           ,
      'DATE_ADDED'         => 'T DEFDATE'           ,
      'LAST_CHECKED'       => 'T'                   ,
      'RECPR_LAST_CHECKED' => 'T'                   ,
      'PAGERANK'           => 'I NOTNULL DEFAULT -1',
      'RECPR_PAGERANK'     => 'I NOTNULL DEFAULT -1',
      'FEATURED_MAIN'      => 'I NOTNULL DEFAULT 0' ,
      'FEATURED'           => 'I NOTNULL DEFAULT 0' ,
      'EXPIRY_DATE'        => 'T'                   ,
      'NOFOLLOW'           => 'L NOTNULL DEFAULT 0' ,
      'DOMAIN'             => 'C(250) NULL'         ,
      'OTHER_INFO'         => 'X NULL'              ,
      'META_KEYWORDS'      => 'X NULL'              ,
      'META_DESCRIPTION'   => 'X NULL'              ,
      'RECPR_EXPIRED'      => 'L NOTNULL DEFAULT 0'
   ),
   'indexes' => array (
      'TITLE'              => 'TITLE'                               ,
      'DESCRIPTION'        => array ('DESCRIPTION'     , 'FULLTEXT'),
      'URL'                => 'URL'                                 ,
      'CATEGORY_ID'        => 'CATEGORY_ID'                         ,
      'FEATURED'           => 'FEATURED'                            ,
      'EXPIRY_DATE'        => 'EXPIRY_DATE'                         ,
      'META_KEYWORDS'      => array ('META_KEYWORDS'   , 'FULLTEXT'),
      'META_DESCRIPTION'   => array ('META_DESCRIPTION', 'FULLTEXT')
   ),
   'options' => array (
      'mysql'              => "TYPE=MyISAM COMMENT='Stores all the links with informations'"
   )
 );

?>
