Ejemplo n.º 1
0
function phpwcms_revision_r414()
{
    $status = true;
    // Test against new shopping module fields
    $result = _dbQuery("SHOW TABLES LIKE '" . DB_PREPEND . "phpwcms_shop_products'");
    if (!empty($result)) {
        $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_shop_products LIKE 'shopprod_special_price'");
        if (empty($result)) {
            $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_shop_products ADD shopprod_special_price TEXT NOT NULL", 'ALTER');
        }
        $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_shop_products LIKE 'shopprod_track_view'");
        if (empty($result)) {
            $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_shop_products ADD shopprod_track_view INT(11) NOT NULL DEFAULT '0'", 'ALTER');
            $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_shop_products ADD INDEX (shopprod_track_view)", 'ALTER');
        }
        $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_shop_products LIKE 'shopprod_lang'");
        if (empty($result)) {
            $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_shop_products ADD shopprod_lang VARCHAR(255) NOT NULL DEFAULT ''", 'ALTER');
            $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_shop_products ADD INDEX (shopprod_lang)", 'ALTER');
        }
    }
    // do former revision check
    // r407 - 413 required no action, so fallback to r406
    $r406 = '406';
    if (phpwcms_revision_check_temp($r406) !== true) {
        $status = phpwcms_revision_check($r406);
    }
    return $status;
}
Ejemplo n.º 2
0
function phpwcms_revision_r502()
{
    $status = true;
    // do former revision check – fallback to r497
    if (phpwcms_revision_check_temp('497') !== true) {
        $status = phpwcms_revision_check('497');
    }
    // add field for default language type and target ID to article, category
    $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_articlecat LIKE 'acat_lang_type'", 'COUNT_SHOW');
    if (empty($result)) {
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_articlecat ADD acat_lang_type VARCHAR(255) NOT NULL DEFAULT ''", 'ALTER');
        _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_articlecat ADD INDEX (acat_lang_type)", 'ALTER');
    }
    $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_articlecat LIKE 'acat_lang_id'", 'COUNT_SHOW');
    if (empty($result)) {
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_articlecat ADD acat_lang_id INT(11) unsigned NOT NULL DEFAULT '0'", 'ALTER');
        _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_articlecat ADD INDEX (acat_lang_id)", 'ALTER');
    }
    $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_article LIKE 'article_lang_type'", 'COUNT_SHOW');
    if (empty($result)) {
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_article ADD article_lang_type VARCHAR(255) NOT NULL DEFAULT ''", 'ALTER');
        _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_article ADD INDEX (article_lang_type)", 'ALTER');
    }
    $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_article LIKE 'article_lang_id'", 'COUNT_SHOW');
    if (empty($result)) {
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_article ADD article_lang_id INT(11) unsigned NOT NULL DEFAULT '0'", 'ALTER');
        _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_article ADD INDEX (article_lang_id)", 'ALTER');
    }
    return $status;
}
Ejemplo n.º 3
0
function phpwcms_revision_r540()
{
    $status = true;
    // do former revision check – fallback to r539
    if (phpwcms_revision_check_temp('539') !== true) {
        $status = phpwcms_revision_check('539');
    }
    $result = _dbQuery("SHOW COLUMNS FROM `" . DB_PREPEND . "phpwcms_article` WHERE Field='article_canonical'");
    if (!isset($result[0])) {
        $insert = _dbQuery("ALTER TABLE `" . DB_PREPEND . "phpwcms_article` ADD `article_canonical` VARCHAR(2000) NOT NULL DEFAULT ''", 'ALTER');
        if (!$insert) {
            $status = false;
        }
    }
    $result = _dbQuery("SHOW COLUMNS FROM `" . DB_PREPEND . "phpwcms_articlecat` WHERE Field='acat_canonical'");
    if (!isset($result[0])) {
        $insert = _dbQuery("ALTER TABLE `" . DB_PREPEND . "phpwcms_articlecat` ADD `acat_canonical` VARCHAR(2000) NOT NULL DEFAULT ''", 'ALTER');
        if (!$insert) {
            $status = false;
        }
        // Reset cache values
        _setConfig('structure_array_vmode_all', false, 'frontend_render', 1);
        _setConfig('structure_array_vmode_editor', false, 'frontend_render', 1);
        _setConfig('structure_array_vmode_admin', false, 'frontend_render', 1);
    }
    return $status;
}
Ejemplo n.º 4
0
function phpwcms_revision_r534()
{
    $status = true;
    // do former revision check – fallback to r533
    if (phpwcms_revision_check_temp('533') !== true) {
        $status = phpwcms_revision_check('533');
    }
    // change type of some content related fields from TEXT to MEDIUMTEXT
    // Retrieve Types of article content table
    $result = _dbQuery("SHOW COLUMNS FROM `" . DB_PREPEND . "phpwcms_articlecontent` WHERE Field IN ('acontent_text', 'acontent_html', 'acontent_media')");
    if (isset($result[0]['Type'])) {
        foreach ($result as $column) {
            $update = _dbQuery("ALTER TABLE `" . DB_PREPEND . "phpwcms_articlecontent` CHANGE `" . $column['Field'] . '` `' . $column['Field'] . "` MEDIUMTEXT NOT NULL", 'ALTER');
            if (!$update) {
                $status = false;
            }
        }
    }
    // Retrieve Types of article table
    $result = _dbQuery("SHOW COLUMNS FROM `" . DB_PREPEND . "phpwcms_article` WHERE Field='article_summary'");
    if (isset($result[0]['Type'])) {
        $update = _dbQuery("ALTER TABLE `" . DB_PREPEND . "phpwcms_article` CHANGE `article_summary` `article_summary` MEDIUMTEXT NOT NULL", 'ALTER');
        if (!$update) {
            $status = false;
        }
    }
    return $status;
}
Ejemplo n.º 5
0
function phpwcms_revision_r541()
{
    $status = true;
    // do former revision check – fallback to r540
    if (phpwcms_revision_check_temp('540') !== true) {
        $status = phpwcms_revision_check('540');
    }
    $result = _dbQuery("SHOW COLUMNS FROM `" . DB_PREPEND . "phpwcms_articlecat` WHERE Field='acat_breadcrumb'");
    if (!isset($result[0])) {
        $insert = _dbQuery("ALTER TABLE `" . DB_PREPEND . "phpwcms_articlecat` ADD `acat_breadcrumb` INT(1) NOT NULL DEFAULT '0'", 'ALTER');
        if (!$insert) {
            $status = false;
        }
        // Reset cache values
        _setConfig('structure_array_vmode_all', false, 'frontend_render', 1);
        _setConfig('structure_array_vmode_editor', false, 'frontend_render', 1);
        _setConfig('structure_array_vmode_admin', false, 'frontend_render', 1);
    }
    $result = _dbQuery("SHOW COLUMNS FROM `" . DB_PREPEND . "phpwcms_shop_products` WHERE Field='shopprod_unit'");
    if (!isset($result[0])) {
        if (!($insert = _dbQuery("ALTER TABLE `" . DB_PREPEND . "phpwcms_shop_products` ADD `shopprod_unit` VARCHAR(100) NOT NULL DEFAULT ''", 'ALTER'))) {
            $status = false;
        }
    }
    return $status;
}
Ejemplo n.º 6
0
function phpwcms_revision_r538()
{
    $status = true;
    // do former revision check – fallback to r537
    if (phpwcms_revision_check_temp('537') !== true) {
        $status = phpwcms_revision_check('537');
    }
    $result = _dbQuery("SHOW COLUMNS FROM `" . DB_PREPEND . "phpwcms_articlecat` WHERE Field='acat_public'");
    if (isset($result[0]['Default']) && $result[0]['Default'] == 0) {
        $update = _dbQuery("ALTER TABLE `" . DB_PREPEND . "phpwcms_articlecat` CHANGE `acat_public` `acat_public` INT(1) NOT NULL DEFAULT '1'", 'ALTER');
        if (!$update) {
            $status = false;
        }
    }
    $result = _dbQuery("SHOW COLUMNS FROM `" . DB_PREPEND . "phpwcms_articlecat` WHERE Field='acat_alias'");
    if (isset($result[0]['Type']) && strpos($result[0]['Type'], '255') === false) {
        $update = _dbQuery("ALTER TABLE `" . DB_PREPEND . "phpwcms_articlecat` CHANGE `acat_alias` `acat_alias` VARCHAR(255) NOT NULL DEFAULT ''", 'ALTER');
        if (!$update) {
            $status = false;
        }
    }
    // Reset cache values
    _setConfig('structure_array_vmode_all', false, 'frontend_render', 1);
    _setConfig('structure_array_vmode_editor', false, 'frontend_render', 1);
    _setConfig('structure_array_vmode_admin', false, 'frontend_render', 1);
    return $status;
}
Ejemplo n.º 7
0
function phpwcms_revision_r535()
{
    $status = true;
    // do former revision check – fallback to r534
    if (phpwcms_revision_check_temp('534') !== true) {
        $status = phpwcms_revision_check('534');
    }
    // change type of some content related fields from TEXT to MEDIUMTEXT
    // Retrieve Type of profession name
    $result = _dbQuery("SHOW COLUMNS FROM `" . DB_PREPEND . "phpwcms_profession` WHERE Field='prof_name'");
    if (isset($result[0]['Type']) && strpos($result[0]['Type'], '100')) {
        $update = _dbQuery("ALTER TABLE `" . DB_PREPEND . "phpwcms_profession` CHANGE `prof_name` `prof_name` VARCHAR(255) NOT NULL DEFAULT ''", 'ALTER');
        if (!$update) {
            $status = false;
        }
    }
    // Change profession ' n/a'
    _dbUpdate('phpwcms_profession', array('prof_name' => 'n/a'), "prof_name=' n/a'");
    // Import new professions
    $result = _dbCount("SELECT COUNT(*) FROM `" . DB_PREPEND . "phpwcms_profession`");
    if ($result < 25) {
        $jobs = array('academic', 'accountant', 'actor', 'administrative services department manager', 'administrator', 'administrator, IT', 'agricultural advisor', 'air steward', 'air-conditioning installer or mechanic', 'aircraft service technician', 'ambulance driver (non paramedic)', 'animal carer (not in farms)', 'animator', 'arable farm manager, field crop or vegetable', 'arable farmer, field crop or vegetable', 'architect', 'architect, landscape', 'artist', 'asbestos removal worker', 'assembler', 'assembly team leader', 'assistant', 'author', 'baker', 'bank clerk (back-office)', 'beauty therapist', 'beverage production process controller', 'biologist', 'blogger', 'boring machine operator', 'bricklayer', 'builder', 'butcher', 'car mechanic', 'career counsellor', 'caretaker', 'carpenter', 'charge nurse', 'check-out operator', 'chef', 'child-carer', 'civil engineering technician', 'civil servant', 'cleaning supervisor', 'clerk', 'climatologist', 'cloak room attendant', 'cnc operator', 'comic book writer', 'community health worker', 'company director', 'computer programmer', 'confectionery maker', 'construction operative', 'cook', 'cooling or freezing installer or mechanic', 'critic', 'database designer', 'decorator', 'dental hygienist', 'dental prosthesis technician', 'dentist', 'department store manager', 'designer', 'designer, graphic', 'designer, industrial', 'designer, interface', 'designer, interior', 'designer, screen', 'designer, web', 'dietician', 'diplomat', 'director', 'display designer', 'doctor', 'domestic housekeeper', 'economist', 'editor', 'education advisor', 'electrical engineer', 'electrical mechanic or fitter', 'electrician', 'engineer', 'engineering maintenance supervisor', 'estate agent', 'executive', 'executive secretary', 'farmer', 'felt roofer', 'filing clerk', 'film director', 'financial clerk', 'financial services manager', 'fire fighter', 'first line supervisor beverages workers', 'first line supervisor of cleaning workers', 'fisherman', 'fishmonger', 'flight attendant', 'floral arranger', 'food scientist', 'garage supervisor', 'garbage man', 'gardener, all other', 'general practitioner', 'geographer', 'geologist', 'hairdresser', 'head groundsman', 'head teacher', 'horse riding instructor', 'hospital nurse', 'hotel manager', 'house painter', 'hr manager', 'it applications programmer', 'it systems administrator', 'jeweller', 'journalist', 'judge', 'juggler', 'kitchen assistant', 'lathe setter-operator', 'lawyer', 'lecturer', 'legal secretary', 'lexicographer', 'library assistant', 'local police officer', 'logistics manager', 'machine tool operator', 'magician', 'makeup artist', 'manager', 'manager, all other health services', 'marketing manager', 'meat processing operator', 'mechanical engineering technician', 'medical laboratory technician', 'medical radiography equipment operator', 'metal moulder', 'metal production process operator', 'meteorologist', 'midwifery professional', 'miner', 'mortgage clerk', 'musical instrument maker', 'musician', 'non-commissioned officer armed forces', 'nurse', 'nursery school teacher', 'nursing aid', 'ophthalmic optician', 'optician', 'painter', 'payroll clerk', 'personal assistant', 'personal carer in an institution for the elderly', 'personal carer in an institution for the handicapped', 'personal carer in private homes', 'personnel clerk', 'pest controller', 'photographer', 'physician assistant', 'pilot', 'pipe fitter', 'plant maintenance mechanic', 'plumber', 'police inspector', 'police officer', 'policy advisor', 'politician', 'porter', 'post secondary education teacher', 'post sorting or distributing clerk', 'power plant operator', 'primary school head', 'primary school teacher', 'printer', 'printing machine operator', 'prison officer / warder', 'product manager', 'professional gambler', 'project manager', 'programmer', 'psychologist', 'puppeteer', 'quality inspector, all other products', 'receptionist', 'restaurant cook', 'road paviour', 'roofer', 'sailor', 'sales assistant, all other', 'sales or marketing manager', 'sales representative', 'sales support clerk', 'salesperson', 'scientist', 'seaman (armed forces)', 'secondary school manager', 'secondary school teacher', 'secretary', 'security guard', 'sheet metal worker', 'ship mechanic', 'shoe repairer, leather repairer', 'shop assistant', 'sign language Interpreter', 'singer', 'social media manager', 'social photographer', 'software analyst', 'software developer', 'software engineer', 'soldier', 'solicitor', 'speech therapist', 'steel fixer', 'stockman', 'structural engineer', 'student', 'surgeon', 'surgical footwear maker', 'swimming instructor', 'system operator', 'tailor', 'tailor, seamstress', 'tax inspector', 'taxi driver', 'teacher', 'telephone operator', 'telephonist', 'theorist', 'tile layer', 'translator', 'transport clerk', 'travel agency clerk', 'travel agent', 'truck driver long distances', 'trucker', 'TV cameraman', 'TV presenter', 'university professor', 'university researcher', 'vet', 'veterinary practitioner', 'vocational education teacher', 'waiter', 'waiting staff', 'web designer', 'web developer', 'webmaster', 'welder, all other', 'wood processing plant operator', 'writer', 'other', 'n/a');
        foreach ($jobs as $job) {
            $sql = 'INSERT IGNORE INTO `' . DB_PREPEND . 'phpwcms_profession` (prof_name) VALUES(' . _dbEscape($job) . ')';
            _dbQuery($sql, 'INSERT');
        }
    }
    return $status;
}
Ejemplo n.º 8
0
function phpwcms_revision_r403()
{
    $status = true;
    // do former revision check
    // r402 required no action, so fallback to r401
    $r401 = '401';
    if (phpwcms_revision_check_temp($r401) !== true) {
        $status = phpwcms_revision_check($r401);
    }
    // check if article content tab field exists
    $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_articlecontent LIKE 'acontent_tab'", 'COUNT_SHOW');
    if (empty($result)) {
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_articlecontent ADD acontent_tab VARCHAR(255) NOT NULL DEFAULT ''", 'ALTER');
    }
    // check if new structure level class field exists
    $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_articlecat LIKE 'acat_class'", 'COUNT_SHOW');
    if (empty($result)) {
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_articlecat ADD acat_class VARCHAR(255) NOT NULL DEFAULT ''", 'ALTER');
    }
    // check if new structure level keywords field exists
    $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_articlecat LIKE 'acat_keywords'", 'COUNT_SHOW');
    if (empty($result)) {
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_articlecat ADD acat_keywords VARCHAR(255) NOT NULL DEFAULT ''", 'ALTER');
    }
    // upgrade sysvalue fields
    $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_sysvalue LIKE 'sysvalue_vartype'");
    if (isset($result[0]['Type']) && $result[0]['Type'] == 'varchar(100)') {
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_sysvalue CHANGE sysvalue_vartype sysvalue_vartype VARCHAR(255) NOT NULL DEFAULT ''", 'ALTER');
    }
    $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_sysvalue LIKE 'sysvalue_value'");
    if (isset($result[0]['Type']) && $result[0]['Type'] == 'text') {
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_sysvalue CHANGE sysvalue_value sysvalue_value MEDIUMTEXT NOT NULL", 'ALTER');
    }
    return $status;
}
Ejemplo n.º 9
0
function phpwcms_revision_r402()
{
    // do former revision check
    $r401 = '401';
    if (phpwcms_revision_check_temp($r401) !== true) {
        phpwcms_revision_check($r401);
    }
    return true;
}
Ejemplo n.º 10
0
function phpwcms_revision_r529()
{
    $status = true;
    // do former revision check – fallback to r528
    if (phpwcms_revision_check_temp('528') !== true) {
        $status = phpwcms_revision_check('528');
    }
    // reset article and file manager status (open/close)
    _dbUpdate('phpwcms_user', array('usr_var_structure' => '', 'usr_var_publicfile' => '', 'usr_var_privatefile' => ''));
    return $status;
}
Ejemplo n.º 11
0
function phpwcms_revision_r438()
{
    $status = true;
    // do former revision check – fallback to r427
    if (phpwcms_revision_check_temp('427') !== true) {
        $status = phpwcms_revision_check('427');
    }
    // Fix possible problem
    _dbQuery('UPDATE ' . DB_PREPEND . "phpwcms_article SET article_subtitle = '' WHERE article_subtitle = '0'", 'UPDATE');
    _dbQuery('UPDATE ' . DB_PREPEND . "phpwcms_article SET article_menutitle = '' WHERE article_menutitle = '0'", 'UPDATE');
    _dbQuery('UPDATE ' . DB_PREPEND . "phpwcms_article SET article_description = '' WHERE article_description = '0'", 'UPDATE');
    return $status;
}
Ejemplo n.º 12
0
function phpwcms_revision_r427()
{
    $status = true;
    // do former revision check – fallback to r427
    $r421 = '421';
    if (phpwcms_revision_check_temp($r421) !== true) {
        $status = phpwcms_revision_check($r421);
    }
    // Change some missing default values for older releases
    $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_article CHANGE article_menutitle article_menutitle VARCHAR(255) NOT NULL DEFAULT  ''", 'ALTER');
    $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_article CHANGE article_description article_description VARCHAR(255) NOT NULL DEFAULT  ''", 'ALTER');
    return $status;
}
Ejemplo n.º 13
0
function phpwcms_revision_r528()
{
    $status = true;
    // do former revision check – fallback to r514
    if (phpwcms_revision_check_temp('514') !== true) {
        $status = phpwcms_revision_check('514');
    }
    // add field to disable forced 302 redirect for article to structure level
    $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_articlecat LIKE 'acat_disable301'", 'COUNT_SHOW');
    if (empty($result)) {
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_articlecat ADD acat_disable301 INT(1) unsigned NOT NULL DEFAULT '0'", 'ALTER');
    }
    return $status;
}
Ejemplo n.º 14
0
function phpwcms_revision_r509()
{
    $status = true;
    // do former revision check – fallback to r502
    if (phpwcms_revision_check_temp('502') !== true) {
        $status = phpwcms_revision_check('502');
    }
    // Hide article from teaser list
    $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_article LIKE 'article_noteaser'", 'COUNT_SHOW');
    if (empty($result)) {
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_article ADD article_noteaser INT(1) UNSIGNED NOT NULL DEFAULT '0' AFTER article_morelink", 'ALTER');
        _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_article ADD INDEX (article_noteaser)", 'ALTER');
    }
    return $status;
}
Ejemplo n.º 15
0
function phpwcms_revision_r537()
{
    $status = true;
    // do former revision check – fallback to r536
    if (phpwcms_revision_check_temp('536') !== true) {
        $status = phpwcms_revision_check('536');
    }
    $result = _dbQuery("SHOW COLUMNS FROM `" . DB_PREPEND . "phpwcms_articlecat` WHERE Field='acat_public'");
    if (isset($result[0]['Default']) && $result[0]['Default'] == 0) {
        $update = _dbQuery("ALTER TABLE `" . DB_PREPEND . "phpwcms_articlecat` CHANGE `acat_public` `acat_public` INT(1) NOT NULL DEFAULT '1'", 'ALTER');
        if (!$update) {
            $status = false;
        }
    }
    $result = _dbQuery("SHOW COLUMNS FROM `" . DB_PREPEND . "phpwcms_articlecat` WHERE Field='acat_opengraph'");
    if (!isset($result[0])) {
        $insert = _dbQuery("ALTER TABLE `" . DB_PREPEND . "phpwcms_articlecat` ADD `acat_opengraph` INT(1) UNSIGNED NOT NULL DEFAULT '1', ADD INDEX (`acat_opengraph`)", 'ALTER');
        if (!$insert) {
            $status = false;
        }
        // Reset cache values
        _setConfig('structure_array_vmode_all', false, 'frontend_render', 1);
        _setConfig('structure_array_vmode_editor', false, 'frontend_render', 1);
        _setConfig('structure_array_vmode_admin', false, 'frontend_render', 1);
    }
    $result = _dbQuery("SHOW COLUMNS FROM `" . DB_PREPEND . "phpwcms_content` WHERE Field='cnt_opengraph'");
    if (!isset($result[0])) {
        $insert = _dbQuery("ALTER TABLE `" . DB_PREPEND . "phpwcms_content` ADD `cnt_opengraph` INT(1) UNSIGNED NOT NULL DEFAULT '1', ADD INDEX (`cnt_opengraph`)", 'ALTER');
        if (!$insert) {
            $status = false;
        }
    }
    $result = _dbQuery("SHOW COLUMNS FROM `" . DB_PREPEND . "phpwcms_categories` WHERE Field='cat_opengraph'");
    if (!isset($result[0])) {
        $insert = _dbQuery("ALTER TABLE `" . DB_PREPEND . "phpwcms_categories` ADD `cat_opengraph` INT(1) UNSIGNED NOT NULL DEFAULT '1', ADD INDEX (`cat_opengraph`)", 'ALTER');
        if (!$insert) {
            $status = false;
        }
    }
    $result = _dbQuery("SHOW COLUMNS FROM `" . DB_PREPEND . "phpwcms_shop_products` WHERE Field='shopprod_opengraph'");
    if (!isset($result[0])) {
        $insert = _dbQuery("ALTER TABLE `" . DB_PREPEND . "phpwcms_shop_products` ADD `shopprod_opengraph` INT(1) UNSIGNED NOT NULL DEFAULT '1', ADD INDEX (`shopprod_opengraph`)", 'ALTER');
        if (!$insert) {
            $status = false;
        }
    }
    return $status;
}
Ejemplo n.º 16
0
function phpwcms_revision_r421()
{
    $status = true;
    // Add column for default content part
    $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_categories LIKE 'cat_sort'");
    if (empty($result)) {
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_categories ADD cat_sort INT(11) NOT NULL DEFAULT '0'", 'ALTER');
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_categories ADD INDEX (cat_sort)", 'ALTER');
    }
    // do former revision check – fallback to r416
    $r416 = '416';
    if (phpwcms_revision_check_temp($r416) !== true) {
        $status = phpwcms_revision_check($r416);
    }
    return $status;
}
Ejemplo n.º 17
0
function phpwcms_revision_r416()
{
    $status = true;
    // Add column for default content part
    $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_articlecat LIKE 'acat_cpdefault'");
    if (empty($result)) {
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_articlecat ADD acat_cpdefault INT(10) UNSIGNED NOT NULL DEFAULT '0'", 'ALTER');
    }
    // do former revision check
    // r415 requires no action, so fallback to r414
    $r414 = '414';
    if (phpwcms_revision_check_temp($r414) !== true) {
        $status = phpwcms_revision_check($r414);
    }
    return $status;
}
Ejemplo n.º 18
0
function phpwcms_revision_r539()
{
    $status = true;
    // do former revision check – fallback to r538
    if (phpwcms_revision_check_temp('538') !== true) {
        $status = phpwcms_revision_check('538');
    }
    $result = _dbQuery("SHOW COLUMNS FROM `" . DB_PREPEND . "phpwcms_article` WHERE Field='article_description'");
    if (isset($result[0]['Type']) && substr(strtolower($result[0]['Type']), 0, 7) == 'varchar') {
        $update = _dbQuery("ALTER TABLE `" . DB_PREPEND . "phpwcms_article` CHANGE `article_description` `article_description` text NOT NULL", 'ALTER');
        if (!$update) {
            $status = false;
        }
    }
    return $status;
}
Ejemplo n.º 19
0
function phpwcms_revision_r533()
{
    $status = true;
    // do former revision check – fallback to r532
    if (phpwcms_revision_check_temp('532') !== true) {
        $status = phpwcms_revision_check('532');
    }
    $result = _dbQuery("SHOW TABLES LIKE '" . DB_PREPEND . "phpwcms_shop_products'");
    if (!empty($result)) {
        $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_shop_products LIKE 'shopprod_overwrite_meta'");
        if (empty($result)) {
            $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_shop_products ADD shopprod_overwrite_meta INT(1) NOT NULL DEFAULT '1'", 'ALTER');
        }
    }
    return $status;
}
Ejemplo n.º 20
0
function phpwcms_revision_r406()
{
    $status = true;
    // upgrade sysvalue fields +KH:24.11.2011 if no field exists
    $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_sysvalue LIKE 'sysvalue_vartype'");
    // sysvalue_vartype
    if (empty($result)) {
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_sysvalue ADD sysvalue_vartype VARCHAR(255) NOT NULL DEFAULT ''", 'ALTER');
    } elseif (isset($result[0]['Type']) && $result[0]['Type'] == 'varchar(100)') {
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_sysvalue CHANGE sysvalue_vartype sysvalue_vartype VARCHAR(255) NOT NULL DEFAULT ''", 'ALTER');
    }
    // sysvalue_value
    $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_sysvalue LIKE 'sysvalue_value'");
    if (empty($result)) {
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_sysvalue ADD sysvalue_value MEDIUMTEXT NOT NULL DEFAULT ''", 'ALTER');
    } elseif (isset($result[0]['Type']) && ($result[0]['Type'] == 'text' or $result[0]['Type'] == 'mediumblob')) {
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_sysvalue CHANGE sysvalue_value sysvalue_value MEDIUMTEXT NOT NULL", 'ALTER');
    }
    // sysvalue_lastchange
    $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_sysvalue LIKE 'sysvalue_lastchange'");
    if (empty($result)) {
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_sysvalue ADD sysvalue_lastchange INT(11) NOT NULL DEFAULT 0", 'ALTER');
    }
    // sysvalue_group
    $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_sysvalue LIKE 'sysvalue_group'");
    if (empty($result)) {
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_sysvalue ADD sysvalue_group VARCHAR(255) NOT NULL DEFAULT ''", 'ALTER');
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_sysvalue ADD INDEX (sysvalue_group)", 'ALTER');
    }
    // sysvalue_status
    $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_sysvalue LIKE 'sysvalue_status'");
    if (empty($result)) {
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_sysvalue ADD sysvalue_status INT(1) NOT NULL DEFAULT 0", 'ALTER');
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_sysvalue ADD INDEX (sysvalue_status)", 'ALTER');
    }
    // do former revision check
    // r404/405 required no action, so fallback to r403
    $r403 = '403';
    if (phpwcms_revision_check_temp($r403) !== true) {
        $status = phpwcms_revision_check($r403);
    }
    return $status;
}
Ejemplo n.º 21
0
function phpwcms_revision_r497()
{
    $status = true;
    // do former revision check – fallback to r438
    if (phpwcms_revision_check_temp('438') !== true) {
        $status = phpwcms_revision_check('438');
    }
    // Check if seo log hash (for filter unique items) field exists
    $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_log_seo LIKE 'hash'", 'COUNT_SHOW');
    if (empty($result)) {
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_log_seo ADD hash CHAR(32) NOT NULL DEFAULT ''", 'ALTER');
        if ($result) {
            _dbQuery('UPDATE ' . DB_PREPEND . 'phpwcms_log_seo SET hash=MD5(LOWER(CONCAT(domain,query)))', 'UPDATE');
            _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_log_seo ADD INDEX (hash)", 'ALTER');
        }
    }
    // switch crossreference field type from INT to VARCHAR
    $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_crossreference LIKE 'cref_type'");
    if (isset($result[0]['Type']) && substr(strtolower($result[0]['Type']), 0, 3) == 'int') {
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_crossreference CHANGE cref_type cref_type VARCHAR(255) NOT NULL DEFAULT ''", 'ALTER');
        // Update feedimport References
        _dbUpdate('phpwcms_crossreference', array('cref_type' => 'feed_to_article_import'), "cref_str LIKE 'feedimport_%'");
    }
    // add language to article category, article and content part
    $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_articlecat LIKE 'acat_lang'", 'COUNT_SHOW');
    if (empty($result)) {
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_articlecat ADD acat_lang VARCHAR(255) NOT NULL DEFAULT ''", 'ALTER');
        _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_articlecat ADD INDEX (acat_lang)", 'ALTER');
    }
    $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_article LIKE 'article_lang'", 'COUNT_SHOW');
    if (empty($result)) {
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_article ADD article_lang VARCHAR(255) NOT NULL DEFAULT ''", 'ALTER');
        _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_article ADD INDEX (article_lang)", 'ALTER');
    }
    $result = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_articlecontent LIKE 'acontent_lang'", 'COUNT_SHOW');
    if (empty($result)) {
        $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_articlecontent ADD acontent_lang VARCHAR(255) NOT NULL DEFAULT ''", 'ALTER');
        _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_articlecontent ADD INDEX (acontent_lang)", 'ALTER');
    }
    return $status;
}
Ejemplo n.º 22
0
function phpwcms_revision_r532()
{
    $status = true;
    // do former revision check – fallback to r529
    if (phpwcms_revision_check_temp('529') !== true) {
        $status = phpwcms_revision_check('529');
    }
    $result = _dbQuery('SHOW TABLES LIKE ' . _dbEscape(DB_PREPEND . 'phpwcms_redirect'));
    if (!isset($result[0])) {
        $sql = "CREATE TABLE IF NOT EXISTS `" . DB_PREPEND . "phpwcms_redirect` (\n\t\t\t\t\t`rid` int(11) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t`changed` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\t\t\t\t\t`id` bigint(20) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t`aid` bigint(20) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t`alias` varchar(255) NOT NULL DEFAULT '',\n\t\t\t\t\t`link` varchar(255) NOT NULL DEFAULT '',\n\t\t\t\t\t`views` bigint(20) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t`active` int(1) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t`shortcut` int(1) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t`type` varchar(255) NOT NULL DEFAULT '',\n\t\t\t\t\t`code` varchar(255) NOT NULL DEFAULT '',\n\t\t\t\t\t`target` varchar(255) NOT NULL DEFAULT '',\n\t\t\t\t\tPRIMARY KEY (`rid`),\n\t\t\t\t\tKEY `id` (`id`,`aid`,`alias`),\n\t\t\t\t\tKEY `active` (`active`),\n\t\t\t\t\tKEY `link` (`link`)\n\t\t\t\t) ENGINE=MyISAM";
        if (!empty($GLOBALS['phpwcms']['db_charset'])) {
            $sql .= ' DEFAULT CHARSET=' . $GLOBALS['phpwcms']['db_charset'];
        }
        if (!empty($GLOBALS['phpwcms']['db_collation'])) {
            $sql .= ' COLLATE=' . $GLOBALS['phpwcms']['db_collation'];
        }
        $result = _dbQuery($sql, 'CREATE');
        if (!$result) {
            $status = false;
        }
    }
    return $status;
}
Ejemplo n.º 23
0
function phpwcms_revision_r536()
{
    $status = true;
    // do former revision check – fallback to r535
    if (phpwcms_revision_check_temp('535') !== true) {
        $status = phpwcms_revision_check('535');
    }
    $result = _dbQuery("SHOW COLUMNS FROM `" . DB_PREPEND . "phpwcms_article` WHERE Field='article_public'");
    if (isset($result[0]['Default']) && $result[0]['Default'] == 0) {
        $update = _dbQuery("ALTER TABLE `" . DB_PREPEND . "phpwcms_article` CHANGE `article_public` `article_public` INT(1) NOT NULL DEFAULT '1'", 'ALTER');
        if (!$update) {
            $status = false;
        }
    }
    $result = _dbQuery("SHOW COLUMNS FROM `" . DB_PREPEND . "phpwcms_article` WHERE Field='article_opengraph'");
    if (!isset($result[0])) {
        $insert = _dbQuery("ALTER TABLE `" . DB_PREPEND . "phpwcms_article` ADD `article_opengraph` INT(1) UNSIGNED NOT NULL DEFAULT '1', ADD INDEX (`article_opengraph`)", 'ALTER');
        if (!$insert) {
            $status = false;
        }
    }
    return $status;
}
Ejemplo n.º 24
0
function phpwcms_revision_r514()
{
    $status = true;
    // do former revision check – fallback to r509
    if (phpwcms_revision_check_temp('509') !== true) {
        $status = phpwcms_revision_check('509');
    }
    // Delete
    // empty temp images table
    _dbQuery('DROP TABLE IF EXISTS ' . DB_PREPEND . 'phpwcms_imgcache', 'DROP');
    // empty temp images directory
    $thumbnails = returnFileListAsArray(PHPWCMS_THUMB, 'jpg,jpeg,gif,png');
    if (is_array($thumbnails) && count($thumbnails)) {
        foreach ($thumbnails as $thumbnail) {
            @unlink(PHPWCMS_THUMB . $thumbnail['filename']);
        }
    }
    // Set file hash
    $result = _dbQuery("SHOW FIELDS FROM " . DB_PREPEND . "phpwcms_file WHERE Field='f_hash'");
    if ($status && !empty($result[0])) {
        // Remove unused fields but only when file storage upgrade from earlier update is done
        $count = _dbQuery("SHOW COLUMNS FROM " . DB_PREPEND . "phpwcms_file LIKE 'f_thumb_%'", 'COUNT_SHOW');
        if ($count === 2) {
            $count = _dbCount("SELECT * FROM " . DB_PREPEND . "phpwcms_file WHERE f_thumb_list != '' OR f_thumb_preview != ''");
            if ($count === 0) {
                _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_file DROP f_thumb_list", 'ALTER');
                _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_file DROP f_thumb_preview", 'ALTER');
                $status = true;
            } else {
                $status = false;
            }
        }
        $result = array_change_key_case($result[0], CASE_LOWER);
        if ($status && $result['type'] == 'varchar(50)') {
            $status = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_file CHANGE f_hash f_hash VARCHAR(255) NOT NULL DEFAULT ''", 'ALTER');
            // ensure all went well
            if ($status) {
                $result = _dbQuery("SHOW FIELDS FROM " . DB_PREPEND . "phpwcms_file WHERE Field='f_hash'");
                $status = false;
                if (!empty($result[0])) {
                    $result = array_change_key_case($result[0], CASE_LOWER);
                    if ($result['type'] == 'varchar(255)') {
                        $status = true;
                    }
                }
            }
        }
        // Rename Hash and files
        if ($status) {
            // Cleanup first — Check all files trashed or deleted and not yet physical accessible anymore
            $files = _dbGet('phpwcms_file', '*', 'f_trash IN (8,9) AND f_kid=1');
            if (isset($files[0]['f_id'])) {
                write_textfile(PHPWCMS_STORAGE . 'phpwcms-filestorage.log', date('Y-m-d H:i:s') . ': Prepare removing non-existing, trashed or deleted files from phpwcms_file database table' . LF, 'a');
                $file_id = array();
                foreach ($files as $file) {
                    $file['storage_name'] = $file['f_hash'];
                    if ($file['f_ext']) {
                        $file['storage_name'] .= '.' . $file['f_ext'];
                    }
                    if (!is_file(PHPWCMS_STORAGE . $file['storage_name'])) {
                        write_textfile(PHPWCMS_STORAGE . 'phpwcms-filestorage.log', date('Y-m-d H:i:s') . ': ' . json_encode($file) . LF, 'a');
                        $file_id[] = $file['f_id'];
                    }
                }
                $file_id = implode(',', $file_id);
                write_textfile(PHPWCMS_STORAGE . 'phpwcms-filestorage.log', date('Y-m-d H:i:s') . ': File IDs to be deleted (' . $file_id . ')', 'a');
                if ($file_id) {
                    $result = _dbQuery('DELETE FROM ' . DB_PREPEND . 'phpwcms_file WHERE f_trash IN (8,9) AND f_kid=1 AND f_id IN (' . $file_id . ')', 'DELETE');
                    if (!empty($result['AFFECTED_ROWS'])) {
                        write_textfile(PHPWCMS_STORAGE . 'phpwcms-filestorage.log', ' // DONE: ' . $result['AFFECTED_ROWS'] . ' deleted', 'a');
                    } else {
                        write_textfile(PHPWCMS_STORAGE . 'phpwcms-filestorage.log', ' // DONE: None deleted', 'a');
                    }
                }
                write_textfile(PHPWCMS_STORAGE . 'phpwcms-filestorage.log', LF . LF . '---' . LF . LF, 'a');
            }
            // ToDo: implement new naming
        }
    } else {
        $status = false;
    }
    return $status;
}
Ejemplo n.º 25
0
<?php 
        die;
    }
}
require_once $basepath . '/include/config/conf.inc.php';
require_once $basepath . '/include/inc_lib/default.inc.php';
require_once PHPWCMS_ROOT . '/include/inc_lib/helper.session.php';
require_once PHPWCMS_ROOT . '/include/inc_lib/dbcon.inc.php';
require_once PHPWCMS_ROOT . '/include/inc_lib/general.inc.php';
require_once PHPWCMS_ROOT . '/include/inc_lib/backend.functions.inc.php';
require_once PHPWCMS_ROOT . '/include/inc_lang/code.lang.inc.php';
$_SESSION['REFERER_URL'] = PHPWCMS_URL . get_login_file();
// make compatibility check
if (phpwcms_revision_check_temp($phpwcms["revision"]) !== true) {
    _dbQuery('SET storage_engine=MYISAM', 'SET');
    $revision_status = phpwcms_revision_check($phpwcms["revision"]);
}
// define vars
$err = 0;
$wcs_user = '';
// where user should be redirected too after login
if (!empty($_POST['ref_url'])) {
    $ref_url = xss_clean($_POST['ref_url']);
} elseif (!empty($_GET['ref'])) {
    $ref_url = xss_clean(rawurldecode($_GET['ref']));
} else {
    $ref_url = '';
}
if ($_SERVER['REQUEST_METHOD'] === 'POST' && count($_POST) && $_POST['logintoken'] !== get_token_get_value('csrftoken')) {
    $csrf_error = true;
} else {