76 lines
4.2 KiB
PHP
76 lines
4.2 KiB
PHP
|
|
<?php
|
||
|
|
if( !class_exists('he_contacts') ) {
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Contacts Module
|
||
|
|
*
|
||
|
|
* @author Eldar
|
||
|
|
* @copyright Hire-Experts LLC
|
||
|
|
* @version Contacts Module 1.01
|
||
|
|
*/
|
||
|
|
class he_contacts
|
||
|
|
{
|
||
|
|
function __construct()
|
||
|
|
{
|
||
|
|
$this->check_db_structure();
|
||
|
|
}
|
||
|
|
|
||
|
|
function check_db_structure()
|
||
|
|
{
|
||
|
|
global $setting;
|
||
|
|
|
||
|
|
$file_version = $this->get_version();
|
||
|
|
|
||
|
|
//check if db structure is ready
|
||
|
|
if( !$setting['he_contacts_version'] )
|
||
|
|
{
|
||
|
|
/*if( !he_database::fetch_row("SHOW COLUMNS FROM se_settings LIKE 'he_contacts_version'") )
|
||
|
|
{
|
||
|
|
he_database::query("ALTER TABLE `se_settings` ADD `he_contacts_version` int(10) NOT NULL DEFAULT 101");
|
||
|
|
|
||
|
|
he_database::query("INSERT INTO `se_languagevars` (`languagevar_id`, `languagevar_language_id`, `languagevar_value`, `languagevar_default`) VALUES('690698000', '1', 'Choose contacts.', 'contacts')");
|
||
|
|
he_database::query("INSERT INTO `se_languagevars` (`languagevar_id`, `languagevar_language_id`, `languagevar_value`, `languagevar_default`) VALUES('690698001', '1', 'Add your friends by clicking on their pictures below.', 'contacts')");
|
||
|
|
he_database::query("INSERT INTO `se_languagevars` (`languagevar_id`, `languagevar_language_id`, `languagevar_value`, `languagevar_default`) VALUES('690698002', '1', 'No Friends', 'contacts')");
|
||
|
|
he_database::query("INSERT INTO `se_languagevars` (`languagevar_id`, `languagevar_language_id`, `languagevar_value`, `languagevar_default`) VALUES('690698003', '1', 'more', 'contacts')");
|
||
|
|
he_database::query("INSERT INTO `se_languagevars` (`languagevar_id`, `languagevar_language_id`, `languagevar_value`, `languagevar_default`) VALUES('690698004', '1', 'Invite by E-mail Address:', 'contacts')");
|
||
|
|
he_database::query("INSERT INTO `se_languagevars` (`languagevar_id`, `languagevar_language_id`, `languagevar_value`, `languagevar_default`) VALUES('690698005', '1', 'Use commas to separate e-mails', 'contacts')");
|
||
|
|
he_database::query("INSERT INTO `se_languagevars` (`languagevar_id`, `languagevar_language_id`, `languagevar_value`, `languagevar_default`) VALUES('690698006', '1', 'Send', 'contacts')");
|
||
|
|
he_database::query("INSERT INTO `se_languagevars` (`languagevar_id`, `languagevar_language_id`, `languagevar_value`, `languagevar_default`) VALUES('690698007', '1', 'check all', 'contacts')");
|
||
|
|
$setting['he_contacts_version'] = $file_version;
|
||
|
|
}*/
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
//check db and file version
|
||
|
|
if( $file_version > $setting['he_contacts_version'] )
|
||
|
|
{
|
||
|
|
//db version is older than file so we have to upgrade db version
|
||
|
|
switch( $setting['he_contacts_version'] )
|
||
|
|
{
|
||
|
|
case 101:
|
||
|
|
he_database::query("INSERT INTO `se_languagevars` (`languagevar_id`, `languagevar_language_id`, `languagevar_value`, `languagevar_default`) VALUES('690704200', '1', 'Suggest to friends', 'contacts')");
|
||
|
|
he_database::query("INSERT INTO `se_languagevars` (`languagevar_id`, `languagevar_language_id`, `languagevar_value`, `languagevar_default`) VALUES('690704203', '1', 'Your messages have been successfully sent.', 'contacts')");
|
||
|
|
he_database::query("INSERT INTO `se_languagevars` (`languagevar_id`, `languagevar_language_id`, `languagevar_value`, `languagevar_default`) VALUES('690704204', '1', 'Failed. Please check carefully and try again.', 'contacts')");
|
||
|
|
$setting['he_contacts_version'] = 102;
|
||
|
|
$this->update_version(102);
|
||
|
|
break;
|
||
|
|
case 102:
|
||
|
|
he_database::query("INSERT INTO `se_languagevars` (`languagevar_id`, `languagevar_language_id`, `languagevar_value`, `languagevar_default`) VALUES('690698007', '1', 'check all', 'contacts')");
|
||
|
|
$setting['he_contacts_version'] = 103;
|
||
|
|
$this->update_version(103);
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
function get_version()
|
||
|
|
{
|
||
|
|
return 103;
|
||
|
|
}
|
||
|
|
|
||
|
|
function update_version($new_version) {
|
||
|
|
he_database::query("UPDATE `se_settings` SET `he_contacts_version`=$new_version");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
?>
|