Exemplo n.º 1
0
function setAdminInfo($login, $password, $email)
{
    // security issue: removes apostrophe from the string parameter (prevents sql injection)
    $magicGpc = get_magic_quotes_gpc();
    if (!$magicGpc) {
        $login = addslashes($login);
    }
    if (!$magicGpc) {
        $password = addslashes($password);
    }
    if (!$magicGpc) {
        $email = addslashes($email);
    }
    $sql = "INSERT INTO `users` (`login`, `password`, `email`, `role`)\n                   VALUES ('{$login}', MD5('{$password}'), '{$email}', 'administrator')";
    executeQueryWithPrefix($sql, $_SESSION['mysqlTablesPrefix']);
}
Exemplo n.º 2
0
/**
 * Arfooo
 * 
 * @package    Arfooo
 * @copyright  Copyright (c) Arfooo Annuaire (fr) and Arfooo Directory (en)
 *             by Guillaume Hocine (c) 2007 - 2010
 *             http://www.arfooo.com/ (fr) and http://www.arfooo.net/ (en)
 * @author     Guillaume Hocine & Adrian Galewski
 * @license    http://creativecommons.org/licenses/by/2.0/fr/ Creative Commons
 */
function createDbTables($tablesPrefix, $siteRootUrl, $language, $urlRewriting)
{
    $directoryOpeningDate = date("Y-m-d");
    $createTablesSql = "\n\nCREATE TABLE `adcriterias` (\n  `adCriterionId` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,\n  `name` text NOT NULL,\n  `htmlContent` text NOT NULL,\n  PRIMARY KEY (`adCriterionId`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `ads` (\n  `adId` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,\n  `adCriterionId` mediumint(8) unsigned NOT NULL,\n  `page` varchar(64) NOT NULL,\n  `place` varchar(64) NOT NULL,\n  PRIMARY KEY (`adId`),\n  KEY `adCriterionId` (`adCriterionId`),\n  KEY `page` (`page`,`place`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `allopasscodes` (\n  `code` char(8) NOT NULL,\n  `ip` char(15) NOT NULL,\n  `useDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n  KEY `code` (`code`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `bannedemails` (\n  `banId` mediumint(8) NOT NULL AUTO_INCREMENT,\n  `email` varchar(64) NOT NULL,\n  `dateBanned` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n  PRIMARY KEY (`banId`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `bannedips` (\n  `banId` mediumint(8) NOT NULL AUTO_INCREMENT,\n  `remoteIp` varchar(15) NOT NULL,\n  `dateBanned` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n  PRIMARY KEY (`banId`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `bannedsites` (\n  `banId` mediumint(8) NOT NULL AUTO_INCREMENT,\n  `site` varchar(255) NOT NULL,\n  `dateBanned` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n  PRIMARY KEY (`banId`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `bannedtags` (\n  `banId` mediumint(8) NOT NULL AUTO_INCREMENT,\n  `tag` varchar(255) NOT NULL,\n  `dateBanned` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n  PRIMARY KEY (`banId`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `cachegoogledetails` (\n  `cachePageRankID` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,\n  `url` varchar(64) NOT NULL,\n  `pageRank` tinyint(2) unsigned NOT NULL,\n  `backlinksCount` int(11) unsigned NOT NULL,\n  `indexedPagesCount` int(11) unsigned NOT NULL,\n  `generationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n  PRIMARY KEY (`cachePageRankID`),\n  KEY `url` (`url`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `captchacodes` (\n  `publicCode` varchar(32) NOT NULL,\n  `privateCode` varchar(4) NOT NULL,\n  `generationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n  PRIMARY KEY (`publicCode`),\n  KEY `generationDate` (`generationDate`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `categories` (\n  `categoryId` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,\n  `parentCategoryId` mediumint(8) NOT NULL,\n  `name` varchar(64) NOT NULL,\n  `title` varchar(255) NOT NULL,\n  `description` text NOT NULL,\n  `imageSrc` varchar(255) DEFAULT NULL,\n  `possibleTender` enum('0','1') NOT NULL,\n  `validatedSitesCount` mediumint(8) unsigned NOT NULL DEFAULT '0',\n  `forbidden` enum('0','1') NOT NULL DEFAULT '0',\n  `urlName` varchar(128) NOT NULL,\n  `navigationName` varchar(128) NOT NULL,\n  `headerDescription` varchar(255) NOT NULL,\n  `metaDescription` text NOT NULL,\n  `position` smallint(5) unsigned NOT NULL,\n  `searchEngineSettings` text,\n  PRIMARY KEY (`categoryId`),\n  KEY `name` (`name`),\n  KEY `parentCategoryId` (`parentCategoryId`,`position`),\n  KEY `urlName` (`urlName`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `categoryparents` (\n  `parentId` mediumint(8) unsigned NOT NULL,\n  `childId` mediumint(8) unsigned NOT NULL,\n  `depth` tinyint(2) unsigned NOT NULL,\n  KEY `childId` (`childId`,`depth`),\n  KEY `parentId` (`parentId`,`depth`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `comments` (\n  `commentId` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,\n  `remoteIp` varchar(15) NOT NULL,\n  `siteId` mediumint(8) unsigned NOT NULL,\n  `text` text NOT NULL,\n  `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n  `pseudo` varchar(255) NOT NULL,\n  `validated` enum('0','1') NOT NULL DEFAULT '0',\n  `rating` tinyint(3) unsigned DEFAULT NULL,\n  PRIMARY KEY (`commentId`),\n  KEY `siteId` (`siteId`,`remoteIp`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `custommessages` (\n  `messageId` varchar(20) NOT NULL,\n  `title` text NOT NULL,\n  `description` text NOT NULL,\n  `userText` text NOT NULL,\n  `userDefined` enum('0','1') NOT NULL DEFAULT '1',\n  `type` enum('email','custom') NOT NULL DEFAULT 'email',\n  PRIMARY KEY (`messageId`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `extrafieldcategories` (\n  `categoryId` mediumint(8) unsigned NOT NULL,\n  `fieldId` mediumint(8) unsigned NOT NULL,\n  KEY `categoryId` (`categoryId`),\n  KEY `fieldId` (`fieldId`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `extrafieldoptions` (\n  `fieldId` mediumint(8) unsigned NOT NULL,\n  `value` smallint(5) unsigned NOT NULL,\n  `label` varchar(128) NOT NULL,\n  `position` tinyint(3) unsigned NOT NULL DEFAULT '0',\n  PRIMARY KEY (`fieldId`,`value`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `extrafields` (\n  `fieldId` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,\n  `name` varchar(128) NOT NULL,\n  `type` enum('text','textarea','select','radio','checkbox','range','url','file') NOT NULL,\n  `required` enum('0','1') NOT NULL,\n  `description` text,\n  `inSearchEngine` enum('0','1') NOT NULL DEFAULT '0',\n  `position` tinyint(3) unsigned NOT NULL DEFAULT '0',\n  `suffix` varchar(128) DEFAULT NULL,\n  `config` text,\n  PRIMARY KEY (`fieldId`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `extrafieldvalues` (\n  `itemId` mediumint(8) unsigned NOT NULL,\n  `fieldId` mediumint(8) unsigned NOT NULL,\n  `value` smallint(5) unsigned DEFAULT NULL,\n  `text` text,\n  KEY `itemId` (`itemId`,`fieldId`),\n  KEY `value` (`value`),\n  FULLTEXT KEY `text` (`text`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `hits` (\n  `hitId` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,\n  `remoteIp` char(15) NOT NULL,\n  `siteId` mediumint(8) unsigned NOT NULL,\n  `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n  PRIMARY KEY (`hitId`),\n  KEY `siteId` (`siteId`,`remoteIp`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `keywords` (\n  `keywordId` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,\n  `keyword` varchar(64) NOT NULL,\n  `description` text NOT NULL,\n  PRIMARY KEY (`keywordId`),\n  KEY `keyword` (`keyword`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `keywordsofsites` (\n  `keywordId` mediumint(8) unsigned NOT NULL,\n  `siteId` mediumint(8) unsigned NOT NULL,\n  KEY `siteId` (`siteId`),\n  KEY `keywordId` (`keywordId`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `newsletteremails` (\n  `emailId` mediumint(9) NOT NULL AUTO_INCREMENT,\n  `email` varchar(128) NOT NULL,\n  `active` enum('0','1') NOT NULL DEFAULT '0',\n  PRIMARY KEY (`emailId`),\n  KEY `email` (`email`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `otherreferrersites` (\n  `referrerSiteId` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,\n  `url` varchar(255) NOT NULL,\n  `referrerTimes` mediumint(8) NOT NULL,\n  PRIMARY KEY (`referrerSiteId`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `packages` (\n  `packageId` mediumint(9) unsigned NOT NULL AUTO_INCREMENT,\n  `name` varchar(64) NOT NULL,\n  `amount` float(10,2) NOT NULL,\n  `allopassId` varchar(32) DEFAULT NULL,\n  `allopassNumber` tinyint(4) DEFAULT NULL,\n  `priority` tinyint(4) NOT NULL,\n  `description` text NOT NULL,\n  `imageSrc` varchar(64) DEFAULT NULL,\n  `siteDescriptionMaxLength` int(11) NOT NULL DEFAULT '500',\n  `maxKeywordsCountPerSite` tinyint(4) NOT NULL DEFAULT '5',\n  `backLinkMandatory` enum('0','1') NOT NULL,\n  `siteDescriptionHtmlEnabled` enum('0','1') NOT NULL,\n  `siteDescriptionHtmlAllowedTags` text NOT NULL,\n  `siteDescriptionHtmlAllowedCssProperties` text NOT NULL,\n  `siteDescriptionMinLength` int(11) NOT NULL DEFAULT '0',\n  PRIMARY KEY (`packageId`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `paymentprocessors` (\n  `processorId` varchar(32) NOT NULL,\n  `displayName` varchar(64) NOT NULL,\n  `active` enum('0','1') NOT NULL,\n  `currency` char(3) NOT NULL,\n  `testMode` enum('0','1') NOT NULL,\n  `email` varchar(64) DEFAULT NULL,\n  PRIMARY KEY (`processorId`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `payments` (\n  `paymentId` int(11) NOT NULL AUTO_INCREMENT,\n  `processorId` varchar(64) NOT NULL,\n  `packageId` mediumint(9) NOT NULL,\n  `amount` float(10,2) NOT NULL,\n  `description` text NOT NULL,\n  `ip` char(15) NOT NULL,\n  `userId` mediumint(9) unsigned DEFAULT NULL,\n  `createDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n  `status` enum('unpaid','pending','paid','denied') NOT NULL DEFAULT 'unpaid',\n  `used` enum('0','1') NOT NULL DEFAULT '0',\n  `currency` char(3) NOT NULL,\n  `siteId` mediumint(8) unsigned DEFAULT NULL,\n  PRIMARY KEY (`paymentId`),\n  KEY `userId` (`userId`),\n  KEY `createDate` (`createDate`),\n  KEY `ip` (`ip`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `photos` (\n  `photoId` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `itemId` mediumint(8) unsigned NOT NULL,\n  `src` varchar(32) NOT NULL,\n  `addDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n  `tempId` varchar(32) DEFAULT NULL,\n  `altText` varchar(255) DEFAULT NULL,\n  PRIMARY KEY (`photoId`),\n  KEY `tempId` (`tempId`),\n  KEY `itemId` (`itemId`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `refusals` (\n  `moderatorId` mediumint(8) unsigned NOT NULL,\n  `refusedSitesCount` mediumint(8) unsigned NOT NULL DEFAULT '0',\n  KEY `moderatorId` (`moderatorId`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `rewrites` (\n  `originalUrl` varchar(128) NOT NULL,\n  `rewrittedUrl` varchar(128) NOT NULL,\n  PRIMARY KEY (`originalUrl`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `searchtags` (\n  `tagId` int(11) NOT NULL AUTO_INCREMENT,\n  `tag` varchar(128) NOT NULL,\n  `searchTimes` int(11) NOT NULL DEFAULT '1',\n  `banned` enum('0','1') NOT NULL DEFAULT '0',\n  PRIMARY KEY (`tagId`),\n  KEY `tag` (`tag`),\n  KEY `searchTimes` (`searchTimes`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `settings` (\n  `key` varchar(64) NOT NULL,\n  `value` text NOT NULL,\n  PRIMARY KEY (`key`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `siteadditionalcategories` (\n  `categoryId` mediumint(8) unsigned NOT NULL,\n  `siteId` mediumint(8) unsigned NOT NULL,\n  PRIMARY KEY (`categoryId`,`siteId`),\n  KEY `siteId` (`siteId`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `siteproblems` (\n  `problemId` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,\n  `siteId` mediumint(8) unsigned NOT NULL,\n  `type` enum('spam','badCategory','other') NOT NULL,\n  `description` text NOT NULL,\n  PRIMARY KEY (`problemId`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `sites` (\n  `siteId` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,\n  `siteTitle` varchar(255) NOT NULL,\n  `url` varchar(255) NOT NULL,\n  `description` text NOT NULL,\n  `visitsCount` int(11) NOT NULL DEFAULT '0',\n  `votesAverage` float(10,1) NOT NULL DEFAULT '0.0',\n  `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n  `imageSrc` varchar(100) DEFAULT NULL,\n  `problemExists` smallint(6) NOT NULL DEFAULT '0',\n  `webmasterId` mediumint(8) NOT NULL DEFAULT '0',\n  `status` enum('waiting','validated','banned') NOT NULL,\n  `categoryId` mediumint(8) NOT NULL,\n  `referrerTimes` int(11) NOT NULL DEFAULT '0',\n  `proposalForKeywords` text,\n  `proposalForCategory` text,\n  `rssTitle` text NOT NULL,\n  `returnBond` text NOT NULL,\n  `priority` tinyint(2) unsigned NOT NULL DEFAULT '0',\n  `reversePriority` tinyint(4) NOT NULL DEFAULT '0',\n  `webmasterEmail` text,\n  `webmasterName` text,\n  `moderatorId` mediumint(8) NOT NULL DEFAULT '0',\n  `rssFeedOfSite` text NOT NULL,\n  `votesCount` mediumint(8) unsigned NOT NULL DEFAULT '0',\n  `commentsCount` mediumint(8) NOT NULL DEFAULT '0',\n  `name` text,\n  `httpCode` mediumint(3) unsigned DEFAULT NULL,\n  `backlinkExists` enum('0','1') DEFAULT NULL,\n  `countryCode` char(2) DEFAULT NULL,\n  `address` varchar(255) DEFAULT NULL,\n  `zipCode` varchar(255) DEFAULT NULL,\n  `city` varchar(255) DEFAULT NULL,\n  `country` varchar(255) DEFAULT NULL,\n  `phoneNumber` varchar(255) DEFAULT NULL,\n  `faxNumber` varchar(255) DEFAULT NULL,\n  `packageId` mediumint(9) unsigned DEFAULT NULL,\n  `siteType` enum('basic','premium') NOT NULL DEFAULT 'basic',\n  `paymentProcessorName` varchar(64) DEFAULT NULL,\n  `paymentStatus` enum('pending','paid','denied') DEFAULT NULL,\n  `newsletterActive` enum('0','1') NOT NULL DEFAULT '0',\n  `emailConfirmed` enum('0','1') NOT NULL DEFAULT '0',\n  `lng` float DEFAULT NULL,\n  `lat` float DEFAULT NULL,\n  `ascreen` enum('0','1') NOT NULL DEFAULT '0',\n  `searchPartnership` enum('0','1') NOT NULL DEFAULT '0',\n  `ip` varchar(15) DEFAULT NULL,\n  `firstGalleryImageSrc` varchar(100) DEFAULT NULL,\n  `photosCount` tinyint(3) unsigned NOT NULL DEFAULT '0',\n  `haveExtraFields` enum('0','1') NOT NULL DEFAULT '0',\n  `haveKeywords` enum('0','1') NOT NULL DEFAULT '0',\n  `pageRank` tinyint(3) unsigned NOT NULL DEFAULT '0',\n  `descriptionDisplayMethod` enum('text','html','htmlAdmin') NOT NULL DEFAULT 'text',\n  `isDuplicateContent` enum('0','1') NOT NULL DEFAULT '0',\n  PRIMARY KEY (`siteId`),\n  KEY `visitsCount` (`visitsCount`),\n  KEY `votesAverage` (`votesAverage`,`votesCount`),\n  KEY `pageRank` (`pageRank`),\n  KEY `referrerTimes` (`referrerTimes`),\n  KEY `webmasterId` (`webmasterId`),\n  KEY `url` (`url`),\n  KEY `categoryId` (`categoryId`,`status`,`reversePriority`,`creationDate`),\n  KEY `status` (`status`,`creationDate`),\n  FULLTEXT KEY `description` (`description`),\n  FULLTEXT KEY `siteTitle` (`siteTitle`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `tasks` (\n  `taskId` varchar(32) NOT NULL,\n  `status` enum('init','active','pause','stop','finish','next') NOT NULL DEFAULT 'active',\n  `livePingTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n  `parsedItems` mediumint(8) NOT NULL DEFAULT '0',\n  `totalItems` mediumint(8) NOT NULL DEFAULT '0',\n  `data` longtext NOT NULL,\n  PRIMARY KEY (`taskId`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `users` (\n  `userId` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,\n  `login` varchar(64) NOT NULL DEFAULT '',\n  `password` varchar(64) NOT NULL,\n  `email` varchar(64) NOT NULL,\n  `role` varchar(32) NOT NULL,\n  `active` enum('0','1') NOT NULL DEFAULT '1',\n  PRIMARY KEY (`userId`),\n  UNIQUE KEY `email` (`email`),\n  KEY `role` (`role`),\n  KEY `login` (`login`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `verifications` (\n  `code` varchar(32) NOT NULL,\n  `itemId` varchar(32) NOT NULL,\n  `type` enum('newsletterEmailAdd','newsletterEmailDel','userEmail','siteEmail') NOT NULL,\n  `data` text NOT NULL,\n  `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n  PRIMARY KEY (`code`),\n  KEY `itemId` (`itemId`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\nCREATE TABLE `visits` (\n  `ip` char(15) NOT NULL,\n  `type` enum('ref','vis','tag') NOT NULL,\n  `id` int(11) DEFAULT NULL,\n  `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n  KEY `ts` (`ts`),\n  KEY `ip` (`ip`,`id`,`type`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n";
    $dataSql = <<<SQL
INSERT INTO `custommessages` (`messageId`, `title`, `description`, `userText`, `userDefined`, `type`) VALUES
('validateSite', 'Your site is validated', 'Your site [site name] is validated in the category [name of the category].<br /><br />

You can see your site at this address <a href="[url site details]">See your site</a>.<br /><br />

Thank you for subbmited your site in our directory <a href="[url of your directory]">[name of directory]</a>', 'When you validate a site', '0', 'email'),
('refuseSite', 'Your site is rejected', 'Your site [site name] is rejected in the category [name of the category].<br />
It does not correspond to the criteria for listing in our directory.<br /><br />

After modifying your site, do not hesitate to come to resubmit in our directory <a href="[url of your directory]">[name of directory]</a>.', 'For mail received by the webmaster if the site is refused', '0', 'email'),
('banSite', 'Your site is banned ', 'Your site [site name] is banned in our directory.<br /><br />

Thank you for subbmited your site in our directory <a href="[url of your directory]">[name of directory]</a>', 'For mail received by the webmaster if the site is banned', '0', 'email'),
('submitSite', 'A new website has just been submitted ', 'Information to the new site:<br />
Name: [site name]<br />
URL: [url site]<br />
Description: [description of the site]<br />
Category: [name of the category]

', 'Received by administrator the directory when a site is submitted', '0', 'email'),
('directoryDescription', 'Title description 1 for a better ranking in search engines if you want', 'description 1 for a better ranking in search engines if you want.', '', '0', 'custom'),
('directoryCondition', '', 'Regulation and condition of submission of websites. <br />
<br />
<br />
dddd
<br />
<br />', '', '0', 'custom'),
('webmasterSubmitSite', 'Your site has been successfully submitted ', 'Information on your site:<br />
Name: [site name]<br />
URL: [url site]<br />
Description: [description of the site]<br />
Your site has been submitted in the category [name of the category]<br /><br />

Thank you for submitting your site in our directory <a href="[url of your directory]">[name of directory]</a>
', 'Email received by the webmaster when he submitt a site', '0', 'email'),
('newsletterEmailAdd', 'Confirm your newsletter registration', 'Confirm your registration by clicking on the link below.<br /><br />

<a href="[confirm link]">Confirm</a><br /><br />

<a href="[url of your directory]">[name of directory]</a>
', 'Email received by the user who add his email to newsletter', '0', 'email'),
('newsletterEmailDel', 'Confirm your newsletter unsubscribe', 'Confirm your unsubscribe by clicking on the link below.<br /><br />

<a href="[confirm link]">Confirm your unsubscribe</a><br /><br />


<a href="[url of your directory]">[name of directory]</a>
', 'Email received by the user who delete his email from newsletter', '0', 'email'),
('siteEmail', 'Confirm submission of your site', 'To confirm the submission of your site, thank you to click on the link below.<br /><br />


<a href="[confirm link]">Confirm your site submission</a><br /><br />


<a href="[url of your directory]">[name of directory]</a>', 'Email received by the user who submit site and confirm email is ON.', '0', 'email'),
('userEmail', 'Confirm your registration', 'To confirm your registration, thank you to click on the link below<br /><br />

<a href="[confirm link]">Confirm your registration</a><br /><br />

<a href="[url of your directory]">[name of directory]</a>', 'Email received by the user who register to confirm his email.', '0', 'email'),
('newsletterFooter', '', '<br /><br />
<a href="[unsubscribe link]">
Click here to unsubscribe me
</a>', 'Newsletter footer', '0', 'email'),
('newComment', 'New commment was posted in your directory', 'New commment was posted in your directory.<br /><br />

<a href="[url of your directory]">[url of your directory]</a>', 'Emails recived when new comment was posted', '0', 'email'),
('newSiteProblem', 'New site problem was posted in your directory', 'New site problem was posted in your directory.<br /><br />

<a href="[url of your directory]">[url of your directory]</a>', 'Emails recived when new site problem was posted', '0', 'email'),
('webmasterContact', 'Webmaster contact', 'A user want contact you<br /><br />

His message : [message]<br /><br />

His email <b>[sender email]<b/><br /><br />
Thank you, <a href="[url of your directory]">[name of directory]</a>

', 'Webmaster contact', '0', 'email');


INSERT INTO `refusals` (`moderatorId`, `refusedSitesCount`) VALUES
(0, 0);

INSERT INTO `paymentprocessors` (`processorId`, `displayName`, `active`, `currency`, `testMode`, `email`) VALUES
('Allopass', 'Allopass', '0', 'EUR', '1', ''),
('PayPal', 'PayPal', '0', 'EUR', '1', '');


INSERT INTO `settings` (`key`, `value`) VALUES
('selectionPeriod', '1'),
('selectionSitesCount', '4'),
('selectionSiteIds', ''),
('selectionGenerationDate', ''),
('siteNoveltyPeriod', '30'),
('maxTopNotesCount', '20'),
('maxTopHitsCount', '20'),
('maxTopRankCount', '20'),
('maxTopReferrersCount', '20'),
('topReferrersLastResetDate', ''),
('sitesPerPageInCategory', '20'),
('sitesPerPageInKeywords', '20'),
('sitesPerPageInSearch', '20'),
('commentsEnabled', '0'),
('urlRewriting', '1'),
('notationsEnabled', '1'),
('hitsEnabled', '1'),
('topRankEnabled', '1'),
('topReferrersEnabled', '1'),
('categoriesImages', '1'),
('sitesImages', '1'),
('rssNewsEnabled', '0'),
('rssCategoriesEnabled', '0'),
('siteTitle', 'Arfooo directory title'),
('language', '{$language}'),
('countOfSubcategoriesUnderCategory', '2'),
('maxCategoriesCountPerSite', '1'),
('maxKeywordsCountPerSite', '5'),
('categoriesInLeftMenuEnabled', '1'),
('keywordsEnabled', '0'),
('cacheSiteImagesEnabled', '1'),
('deletionPeriodOfTopReferrers', '30'),
('registrationOfWebmastersEnabled', '0'),
('inscriptionsOfSitesEnabled', '1'),
('automaticSiteValidation', '0'),
('inscriptionCheckHttpResponseCode', '0'),
('sendEmailsOnInscriptionAndApproval', '1'),
('siteDescriptionMaxLength', '400'),
('metaTagScannerEnabled', '1'),
('informWebmastersForAdminDecisions', '1'),
('showingPagerankEnabled', '1'),
('showingBacklinksCountEnabled', '1'),
('showingIndexedPagesCountEnabled', '1'),
('wayForPagerankExtraction', '1'),
('pageRankCachingEnabled', '1'),
('pageRankCacheExpiration', '90'),
('statisticsEnabled', '1'),
('displayValidatedSitesCount', '1'),
('displayWaitingSitesCount', '1'),
('displayRefusedSitesCount', '1'),
('displayAllCategoriesCount', '1'),
('displayKeywordsCount', '1'),
('displayWebmastersCount', '1'),
('captchaEnabledOnWebmasterRegistration', '1'),
('captchaEnabledOnSiteInscription', '1'),
('captchaEnabledOnComments', '1'),
('captchaEnabledOnContactForm', '1'),
('additionalServerUrl', ''),
('siteRootUrl', '{$siteRootUrl}'),
('siteDescription', 'Arfooo directory description'),
('thumbsGeneratorUrl', ''),
('templateName', 'arfooo'),
('directoryOpeningDate', '{$directoryOpeningDate}'),
('dateFormat', 'd-m-Y'),
('automaticCommentValidation', '0'),
('backLinkMandatory', '0'),
('showRandomSitesInDetails', '1'),
('randomSitesInDetailsCount', '5'),
('randomSitesInDetailsDescriptionLength', '100'),
('minSiteDescriptionLength', '100'),
('rssSitesEnabled', '0'),
('countryFlagsEnabled', '0'),
('similarSiteKeywordMatch', '0'),
('googleMapEnabled', '0'),
('googleMapZoom', '3'),
('remoteRssParsingEnabled', '0'),
('companyInfoEnabled', '0'),
('sitesSortyBy', 'creationDate'),
('numberOfItemsForRssParsing', '5'),
('numberOfCharactersForRssParsing', '150'),
('numberOfCharactersForItemDescription', '120'),
('magpieRssCacheMaxAgeDays', '1'),
('availableSiteTypes', 'basic'),
('numberOfTagInTagCloud', '10'),
('minNumberOfTagInTagCloud', '2'),
('tagCloudEnabled', '0'),
('backLinkHtmlCode1Enabled', '1'),
('backLinkHtmlCode2Enabled', '1'),
('backLinkHtmlCode1Text', ''),
('backLinkHtmlCode1Url', ''),
('backLinkHtmlCode2Text', ''),
('firstGalleryImageForThumbEnabled', '1'),
('maxNewsCount', '20'),
('displayBannedSitesCount', '1'),
('newsletterEnabled', '1'),
('emailConfirmationEnabled', '0'),
('allCategoriesPageEnabled', '1'),
('contactPageEnabled', '1'),
('ascreenEnabled', '0'),
('informWebmastersForAdminValidateDecision', '1'),
('informWebmastersForAdminRefuseDecision', '1'),
('informWebmastersForAdminBanDecision', '1'),
('sendEmailsOnComment', '1'),
('sendEmailsOnSiteProblem', '1'),
('advancedSearchEnabled', '1'),
('searchEngineLikeMethodEnabled', '1'),
('searchEngineWordDefaultOperator', 'AND'),
('urlMandatory', '0'),
('itemGalleryImagesMaxCount', '10'),
('itemGalleryImageMaxWeight', '1000'),
('mediumThumbWidth', '220'),
('mediumThumbHeight', '165'),
('smallThumbWidth', '120'),
('smallThumbHeight', '90'),
('microThumbWidth', '60'),
('microThumbHeight', '45'),
('imageWatermarkEnabled', '0'),
('searchEngineSearchIn', 'siteTitle|description|url'),
('supportedUrlSchemes', 'http'),
('searchEngineLikeMethodWordMinLength', '2'),
('searchEngineLikeMethodWordMaxLength', '3'),
('partnershipSearchingEnabled', '1'),
('itemGalleryImagesEnabled', '0'),
('advancedUrlRewritingEnabled', '1'),
('httpGzipCompressionEnabled', '0'),
('maxSubpagesCountPerSite', '1'),
('templateCompileCheckEnabled', '1'),
('templateWhiteSpaceFilterEnabled', '1'),
('referrersSavingEnabled', '1'),
('siteDetailsCacheEnabled', '0'),
('watermarkImageSrc', ''),
('imageWatermarkPosition', 'b,l'),
('siteDetailsCacheLifeTime', '3600'),
('advancedUrlRewritingParentsEnabled', '1'),
('errorHandlerSaveToFileEnabled', '1'),
('errorHandlerDisplayErrorEnabled', '1'),
('newsEnabled', '1'),
('sitesInParentCategoriesEnabled', '0'),
('siteDescriptionHtmlEnabled', '0'),
('siteDescriptionHtmlAllowedTags', 'a[href|title|target], br, b, p, ul, ol, li, table[cellspacing|cellpadding|border], tbody, tr, td[colspan|rowspan], strong, span, em, *[style], *[class], img[src]'),
('siteDescriptionHtmlAllowedCssProperties', 'text-align, color, background-color, font-family, font-size, border, text-decoration, padding-left, height, width, font-weight'),
('campaignFilters', ''),
('siteDescriptionHtmlEnabledAdmin', '0'),
('siteDescriptionHtmlAllowedTagsAdmin', 'a[href|title|target], br, b, p, ul, ol, li, table[cellspacing|cellpadding|border], tbody, tr, td[colspan|rowspan], strong, span, em, *[style], *[class], img[src]'),
('siteDescriptionHtmlAllowedCssPropertiesAdmin', 'text-align, color, background-color, font-family, font-size, border, text-decoration, padding-left, height, width, font-weight'),
('duplicateContentCheckerEnabled', '0'),
('duplicateContentCheckerPhrasesToCheckCount', '3'),
('duplicateContentCheckerWordsInPhraseCount', '6'),
('duplicateContentCheckerAllowableDuplicatedPhrasesCount', '0');

SQL;
    $tableStats = array();
    foreach (explode(";", $createTablesSql) as $sql) {
        $sql = trim($sql);
        if (empty($sql)) {
            continue;
        }
        preg_match("#CREATE TABLE `(.*?)`#", $sql, $match);
        $tableName = $match[1];
        if (executeQueryWithPrefix($sql, $tablesPrefix)) {
            $message = "";
            $created = true;
        } else {
            $message = mysql_error();
            $created = false;
        }
        $tableStats[$tableName]['message'] = $message;
        $tableStats[$tableName]['created'] = $created;
    }
    foreach (explode(";", $dataSql) as $sql) {
        executeQueryWithPrefix($sql, $tablesPrefix);
    }
    return $tableStats;
}