• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP setUpdateMsg函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中setUpdateMsg函数的典型用法代码示例。如果您正苦于以下问题:PHP setUpdateMsg函数的具体用法?PHP setUpdateMsg怎么用?PHP setUpdateMsg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setUpdateMsg函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: _podcastUpdate

function _podcastUpdate()
{
    global $objDatabase, $_ARRAYLANG, $objUpdate, $_CONFIG;
    //move podcast images directory
    $path = ASCMS_DOCUMENT_ROOT . '/images';
    $oldImagesPath = '/content/podcast';
    $newImagesPath = '/podcast';
    if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '1.2.1')) {
        if (!file_exists($path . $newImagesPath) && file_exists($path . $oldImagesPath)) {
            \Cx\Lib\FileSystem\FileSystem::makeWritable($path . $oldImagesPath);
            if (!\Cx\Lib\FileSystem\FileSystem::copy_folder($path . $oldImagesPath, $path . $newImagesPath)) {
                setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_TO_MOVE_DIRECTORY'], $path . $oldImagesPath, $path . $newImagesPath));
                return false;
            }
        }
        \Cx\Lib\FileSystem\FileSystem::makeWritable($path . $newImagesPath);
        \Cx\Lib\FileSystem\FileSystem::makeWritable($path . $newImagesPath . '/youtube_thumbnails');
        //change thumbnail paths
        $query = "UPDATE `" . DBPREFIX . "module_podcast_medium` SET `thumbnail` = REPLACE(`thumbnail`, '/images/content/podcast/', '/images/podcast/')";
        if ($objDatabase->Execute($query) === false) {
            return _databaseError($query, $objDatabase->ErrorMsg());
        }
    }
    //set new default settings
    $query = "UPDATE `" . DBPREFIX . "module_podcast_settings` SET `setvalue` = '50' WHERE `setname` = 'thumb_max_size' AND `setvalue` = ''";
    if ($objDatabase->Execute($query) === false) {
        return _databaseError($query, $objDatabase->ErrorMsg());
    }
    $query = "UPDATE `" . DBPREFIX . "module_podcast_settings` SET `setvalue` = '85' WHERE `setname` = 'thumb_max_size_homecontent' AND `setvalue` = ''";
    if ($objDatabase->Execute($query) === false) {
        return _databaseError($query, $objDatabase->ErrorMsg());
    }
    // only update if installed version is at least a version 2.0.0
    // older versions < 2.0 have a complete other structure of the content page and must therefore completely be reinstalled
    if (!$objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '2.0.0')) {
        try {
            // migrate content page to version 3.0.1
            $search = array('/(.*)/ms');
            $callback = function ($matches) {
                $content = $matches[1];
                if (empty($content)) {
                    return $content;
                }
                // add missing placeholder {PODCAST_JAVASCRIPT}
                if (strpos($content, '{PODCAST_JAVASCRIPT}') === false) {
                    $content .= "\n{PODCAST_JAVASCRIPT}";
                }
                // add missing placeholder {PODCAST_PAGING}
                if (strpos($content, '{PODCAST_PAGING}') === false) {
                    $content = preg_replace('/(\\s+)(<!--\\s+END\\s+podcast_media\\s+-->)/ms', '$1$2$1<div class="noMedium">$1    {PODCAST_PAGING}$1</div>', $content);
                }
                return $content;
            };
            \Cx\Lib\UpdateUtil::migrateContentPageUsingRegexCallback(array('module' => 'podcast'), $search, $callback, array('content'), '3.0.1');
        } catch (\Cx\Lib\UpdateException $e) {
            return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
        }
    }
    return true;
}
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:60,代码来源:podcast.php


示例2: _marketUpdate

/**
 * Cloudrexx
 *
 * @link      http://www.cloudrexx.com
 * @copyright Cloudrexx AG 2007-2015
 *
 * According to our dual licensing model, this program can be used either
 * under the terms of the GNU Affero General Public License, version 3,
 * or under a proprietary license.
 *
 * The texts of the GNU Affero General Public License with an additional
 * permission and of our proprietary license can be found at and
 * in the LICENSE file you have received along with this program.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * "Cloudrexx" is a registered trademark of Cloudrexx AG.
 * The licensing of the program under the AGPLv3 does not imply a
 * trademark license. Therefore any rights, title and interest in
 * our trademarks remain entirely with us.
 */
function _marketUpdate()
{
    global $objDatabase, $_ARRAYLANG;
    $query = "SELECT id FROM " . DBPREFIX . "module_market_settings WHERE name='codeMode'";
    $objCheck = $objDatabase->SelectLimit($query, 1);
    if ($objCheck !== false) {
        if ($objCheck->RecordCount() == 0) {
            $query = "INSERT INTO `" . DBPREFIX . "module_market_settings` ( `id` , `name` , `value` , `description` , `type` )\n                        VALUES ( NULL , 'codeMode', '1', 'TXT_MARKET_SET_CODE_MODE', '2')";
            if ($objDatabase->Execute($query) === false) {
                return _databaseError($query, $objDatabase->ErrorMsg());
            }
        }
    } else {
        return _databaseError($query, $objDatabase->ErrorMsg());
    }
    $arrColumns = $objDatabase->MetaColumns(DBPREFIX . 'module_market_mail');
    if ($arrColumns === false) {
        setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_GETTING_DATABASE_TABLE_STRUCTURE'], DBPREFIX . 'module_market_mail'));
        return false;
    }
    if (!isset($arrColumns['MAILTO'])) {
        $query = "ALTER TABLE `" . DBPREFIX . "module_market_mail` ADD `mailto` VARCHAR( 10 ) NOT NULL AFTER `content`";
        if ($objDatabase->Execute($query) === false) {
            return _databaseError($query, $objDatabase->ErrorMsg());
        }
    }
    /*****************************************************************
     * EXTENSION:    New attributes 'color' and 'sort_id' for entries *
     * ADDED:        Contrexx v2.1.0                                  *
     *****************************************************************/
    $arrColumns = $objDatabase->MetaColumns(DBPREFIX . 'module_market');
    if ($arrColumns === false) {
        setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_GETTING_DATABASE_TABLE_STRUCTURE'], DBPREFIX . 'module_market'));
        return false;
    }
    if (!isset($arrColumns['SORT_ID'])) {
        $query = "ALTER TABLE `" . DBPREFIX . "module_market` ADD `sort_id` INT( 4 ) NOT NULL DEFAULT '0' AFTER `paypal`";
        if ($objDatabase->Execute($query) === false) {
            return _databaseError($query, $objDatabase->ErrorMsg());
        }
    }
    if (!isset($arrColumns['COLOR'])) {
        $query = "ALTER TABLE `" . DBPREFIX . "module_market` ADD `color` VARCHAR(50) NOT NULL DEFAULT '' AFTER `description`";
        if ($objDatabase->Execute($query) === false) {
            return _databaseError($query, $objDatabase->ErrorMsg());
        }
    }
    try {
        // delete obsolete table  contrexx_module_market_access
        \Cx\Lib\UpdateUtil::drop_table(DBPREFIX . 'module_market_access');
        \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_market_spez_fields', array('id' => array('type' => 'INT(5)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'name' => array('type' => 'VARCHAR(100)'), 'value' => array('type' => 'VARCHAR(100)'), 'type' => array('type' => 'INT(1)', 'notnull' => true, 'default' => '1'), 'lang_id' => array('type' => 'INT(2)', 'notnull' => true, 'default' => '0'), 'active' => array('type' => 'INT(1)', 'notnull' => true, 'default' => '0')));
    } catch (\Cx\Lib\UpdateException $e) {
        DBG::trace();
        return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
    }
    return true;
}
开发者ID:Niggu,项目名称:cloudrexx,代码行数:81,代码来源:market.php


示例3: _ecardUpdate

function _ecardUpdate()
{
    global $objDatabase, $_ARRAYLANG, $_CORELANG;
    try {
        \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_ecard_ecards', array('code' => array('type' => 'VARCHAR(35)', 'notnull' => true, 'default' => '', 'primary' => true), 'date' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'TTL' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'salutation' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => ''), 'senderName' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => ''), 'senderEmail' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => ''), 'recipientName' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => ''), 'recipientEmail' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => ''), 'message' => array('type' => 'TEXT', 'notnull' => true)));
        \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_ecard_settings', array('setting_name' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => '', 'primary' => true), 'setting_value' => array('type' => 'TEXT', 'notnull' => true, 'default' => 0)));
    } catch (\Cx\Lib\UpdateException $e) {
        return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
    }
    $ins_tpl = "\n        INSERT INTO " . DBPREFIX . "module_ecard_settings (setting_name, setting_value)\n        VALUES ('%s', '%s')\n        ON DUPLICATE KEY UPDATE `setting_name` = `setting_name`\n    ";
    $insert_values = array(array('maxCharacters', '100'), array('maxLines', '50'), array('motive_0', 'Bild_001.jpg'), array('motive_1', 'Bild_002.jpg'), array('motive_2', ''), array('motive_3', ''), array('motive_4', ''), array('motive_5', ''), array('motive_6', ''), array('motive_7', ''), array('motive_8', ''), array('maxHeight', '300'), array('validdays', '30'), array('maxWidth', '300'), array('maxHeightThumb', '80'), array('maxWidthThumb', '80'), array('subject', 'Sie haben eine E-Card erhalten!'), array('emailText', "[[ECARD_SENDER_NAME]] hat Ihnen eine E-Card geschickt.<br />\n Sie können diese während den nächsten [[ECARD_VALID_DAYS]] Tagen unter [[ECARD_URL]] abrufen."));
    foreach ($insert_values as $setting) {
        $query = sprintf($ins_tpl, addslashes($setting[0]), addslashes($setting[1]));
        if (!$objDatabase->Execute($query)) {
            return _databaseError($query, $objDatabase->ErrorMsg());
        }
    }
    /*     * **********************************************
     * BUGFIX:	Set write access to the image dir   *
     * ********************************************** */
    $arrImagePaths = array(array(ASCMS_DOCUMENT_ROOT . '/images/modules/ecard', ASCMS_PATH_OFFSET . '/images/modules/ecard'), array(ASCMS_ECARD_OPTIMIZED_PATH, ASCMS_ECARD_OPTIMIZED_WEB_PATH), array(ASCMS_ECARD_SEND_ECARDS_PATH, ASCMS_ECARD_SEND_ECARDS_WEB_PATH), array(ASCMS_ECARD_THUMBNAIL_PATH, ASCMS_ECARD_THUMBNAIL_WEB_PATH));
    foreach ($arrImagePaths as $arrImagePath) {
        if (\Cx\Lib\FileSystem\FileSystem::makeWritable($arrImagePath[0])) {
            if ($mediaDir = @opendir($arrImagePath[0])) {
                while ($file = readdir($mediaDir)) {
                    if ($file != '.' && $file != '..') {
                        if (!\Cx\Lib\FileSystem\FileSystem::makeWritable($arrImagePath[0] . '/' . $file)) {
                            setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_FILE'], $arrImagePath[0] . '/' . $file, $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg');
                            return false;
                        }
                    }
                }
            } else {
                setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_DIR_AND_CONTENT'], $arrImagePath[0] . '/', $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg');
                return false;
            }
        } else {
            setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_DIR_AND_CONTENT'], $arrImagePath[0] . '/', $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg');
            return false;
        }
    }
    return true;
}
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:43,代码来源:ecard.php


示例4: _feedUpdate

/**
 * Cloudrexx
 *
 * @link      http://www.cloudrexx.com
 * @copyright Cloudrexx AG 2007-2015
 *
 * According to our dual licensing model, this program can be used either
 * under the terms of the GNU Affero General Public License, version 3,
 * or under a proprietary license.
 *
 * The texts of the GNU Affero General Public License with an additional
 * permission and of our proprietary license can be found at and
 * in the LICENSE file you have received along with this program.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * "Cloudrexx" is a registered trademark of Cloudrexx AG.
 * The licensing of the program under the AGPLv3 does not imply a
 * trademark license. Therefore any rights, title and interest in
 * our trademarks remain entirely with us.
 */
function _feedUpdate()
{
    global $objDatabase, $_ARRAYLANG;
    $query = "ALTER TABLE `" . DBPREFIX . "module_feed_newsml_documents` CHANGE `publicIdentifier` `publicIdentifier` VARCHAR( 255 ) NOT NULL DEFAULT ''";
    if (!$objDatabase->Execute($query)) {
        return _databaseError($query, $objDatabase->ErrorMsg());
    }
    $arrIndexes = $objDatabase->MetaIndexes(DBPREFIX . 'module_feed_newsml_documents');
    if ($arrIndexes !== false) {
        if (!isset($arrIndexes['unique'])) {
            $query = "ALTER TABLE `" . DBPREFIX . "module_feed_newsml_documents` ADD UNIQUE `unique` (`publicIdentifier`)";
            if (!$objDatabase->Execute($query)) {
                return _databaseError($query, $objDatabase->ErrorMsg());
            }
        }
    } else {
        setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_GETTING_DATABASE_TABLE_STRUCTURE'], DBPREFIX . 'module_feed_newsml_documents'));
        return false;
    }
    return true;
}
开发者ID:Niggu,项目名称:cloudrexx,代码行数:45,代码来源:feed.php


示例5: _memberdirUpdate

function _memberdirUpdate()
{
    global $objDatabase, $_ARRAYLANG, $_CORELANG;
    try {
        \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_memberdir_directories', array('dirid' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'parentdir' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'active' => array('type' => 'SET(\'1\',\'0\')', 'notnull' => true, 'default' => '1'), 'name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'description' => array('type' => 'TEXT'), 'displaymode' => array('type' => 'SET(\'0\',\'1\',\'2\')', 'notnull' => true, 'default' => '0'), 'sort' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '1'), 'pic1' => array('type' => 'SET(\'1\',\'0\')', 'notnull' => true, 'default' => '0'), 'pic2' => array('type' => 'SET(\'1\',\'0\')', 'notnull' => true, 'default' => '0'), 'lang_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '1')), array('memberdir_dir' => array('fields' => array('name', 'description'), 'type' => 'FULLTEXT')));
        \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_memberdir_name', array('field' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'dirid' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'active' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => ''), 'lang_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '1')));
        \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_memberdir_settings', array('setid' => array('type' => 'INT(4)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'setname' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'setvalue' => array('type' => 'TEXT'), 'lang_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '1')));
        \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_memberdir_values', array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'dirid' => array('type' => 'INT(14)', 'notnull' => true, 'default' => '0'), 'pic1' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'pic2' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), '0' => array('type' => 'SMALLINT(5)', 'notnull' => true, 'unsigned' => true, 'default' => '0'), '1' => array('type' => 'TEXT'), '2' => array('type' => 'TEXT'), '3' => array('type' => 'TEXT'), '4' => array('type' => 'TEXT'), '5' => array('type' => 'TEXT'), '6' => array('type' => 'TEXT'), '7' => array('type' => 'TEXT'), '8' => array('type' => 'TEXT'), '9' => array('type' => 'TEXT'), '10' => array('type' => 'TEXT'), '11' => array('type' => 'TEXT'), '12' => array('type' => 'TEXT'), '13' => array('type' => 'TEXT'), '14' => array('type' => 'TEXT'), '15' => array('type' => 'TEXT'), '16' => array('type' => 'TEXT'), '17' => array('type' => 'TEXT'), '18' => array('type' => 'TEXT'), 'lang_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '1')));
        $arrSettings = array('default_listing' => array('1', '1'), 'max_height' => array('400', '1'), 'max_width' => array('500', '1'));
        foreach ($arrSettings as $key => $arrSetting) {
            if (!\Cx\Lib\UpdateUtil::sql("SELECT 1 FROM `" . DBPREFIX . "module_memberdir_settings` WHERE `setname` = '" . $key . "'")->RecordCount()) {
                \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "module_memberdir_settings`\n                    SET `setname`    = '" . $key . "',\n                        `setvalue`   = '" . $arrSetting[0] . "',\n                        `lang_id`    = '" . $arrSetting[1] . "'\n                ");
            }
        }
    } catch (\Cx\Lib\UpdateException $e) {
        // we COULD do something else here..
        return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
    }
    if (!\Cx\Lib\FileSystem\FileSystem::makeWritable(ASCMS_MEDIA_PATH . '/memberdir')) {
        setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_DIR_AND_CONTENT'], ASCMS_MEDIA_PATH . '/memberdir/', $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg');
        return false;
    }
    return true;
}
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:24,代码来源:memberdir.php


示例6: _egovUpdate

function _egovUpdate()
{
    global $objDatabase, $_ARRAYLANG;
    // Check required tables..
    $arrTables = $objDatabase->MetaTables('TABLES');
    if (!$arrTables) {
        setUpdateMsg($_ARRAYLANG['TXT_UNABLE_DETERMINE_DATABASE_STRUCTURE']);
        return false;
    }
    // Create new configuration table if missing
    if (!in_array(DBPREFIX . "module_egov_configuration", $arrTables)) {
        $query = "\n            CREATE TABLE " . DBPREFIX . "module_egov_configuration (\n              `name` varchar(255) NOT NULL default '',\n              `value` text NOT NULL,\n              UNIQUE KEY `name` (`name`)\n            ) ENGINE=MyISAM;\n        ";
        if ($objDatabase->Execute($query) === false) {
            return _databaseError($query, $objDatabase->ErrorMsg());
        }
    }
    // Copy original values
    $arrField = array('set_sender_name', 'set_sender_email', 'set_recipient_email', 'set_state_subject', 'set_state_email', 'set_calendar_color_1', 'set_calendar_color_2', 'set_calendar_color_3', 'set_calendar_legende_1', 'set_calendar_legende_2', 'set_calendar_legende_3', 'set_calendar_background', 'set_calendar_border', 'set_calendar_date_label', 'set_calendar_date_desc', 'set_orderentry_subject', 'set_orderentry_email', 'set_orderentry_name', 'set_orderentry_sender', 'set_orderentry_recipient', 'set_paypal_email', 'set_paypal_currency', 'set_paypal_ipn');
    foreach ($arrField as $fieldname) {
        $query = "\n            SELECT 1 FROM " . DBPREFIX . "module_egov_configuration\n            WHERE name='{$fieldname}'\n        ";
        $objResult = $objDatabase->Execute($query);
        if (!$objResult) {
            return _databaseError($query, $objDatabase->ErrorMsg());
        }
        if ($objResult->RecordCount() == 1) {
            // The value is already there
            continue;
        }
        // Copy the original value
        $query = "\n            INSERT INTO " . DBPREFIX . "module_egov_configuration (name, value)\n            SELECT '{$fieldname}', `{$fieldname}`\n              FROM " . DBPREFIX . "module_egov_settings\n        ";
        $objResult = $objDatabase->Execute($query);
        if (!$objResult) {
            return _databaseError($query, $objDatabase->ErrorMsg());
        }
    }
    // Add new settings for Yellowpay
    $arrField = array('yellowpay_accepted_payment_methods' => '', 'yellowpay_authorization' => 'immediate', 'yellowpay_uid' => 'demo', 'yellowpay_hashseed' => 'demo', 'yellowpay_shopid' => '', 'yellowpay_use_testserver' => '1');
    foreach ($arrField as $fieldname => $defaultvalue) {
        $query = "\n            SELECT 1 FROM " . DBPREFIX . "module_egov_configuration\n            WHERE name='{$fieldname}'\n        ";
        $objResult = $objDatabase->Execute($query);
        if (!$objResult) {
            return _databaseError($query, $objDatabase->ErrorMsg());
        }
        if ($objResult->RecordCount() == 1) {
            // The value is already there
            continue;
        }
        // Add the new setting with its default value
        $query = "\n            INSERT INTO " . DBPREFIX . "module_egov_configuration (\n                name, value\n            ) VALUES (\n                '{$fieldname}', '{$defaultvalue}'\n            )\n        ";
        $objResult = $objDatabase->Execute($query);
        if (!$objResult) {
            return _databaseError($query, $objDatabase->ErrorMsg());
        }
    }
    // products table
    if (!in_array(DBPREFIX . "module_egov_products", $arrTables)) {
        $query = "\n            CREATE TABLE `" . DBPREFIX . "module_egov_products` (\n              `product_id` int(11) NOT NULL auto_increment,\n              `product_autostatus` tinyint(1) NOT NULL default '0',\n              `product_name` varchar(255) NOT NULL default '',\n              `product_desc` text NOT NULL,\n              `product_price` decimal(11,2) NOT NULL default '0.00',\n              `product_per_day` enum('yes','no') NOT NULL default 'no',\n              `product_quantity` tinyint(2) NOT NULL default '0',\n              `product_target_email` varchar(255) NOT NULL default '',\n              `product_target_url` varchar(255) NOT NULL default '',\n              `product_message` text NOT NULL,\n              `product_status` tinyint(1) NOT NULL default '1',\n              `product_electro` tinyint(1) NOT NULL default '0',\n              `product_file` varchar(255) NOT NULL default '',\n              `product_sender_name` varchar(255) NOT NULL default '',\n              `product_sender_email` varchar(255) NOT NULL default '',\n              `product_target_subject` varchar(255) NOT NULL,\n              `product_target_body` text NOT NULL,\n              `product_paypal` tinyint(1) NOT NULL default '0',\n              `product_paypal_sandbox` varchar(255) NOT NULL default '',\n              `product_paypal_currency` varchar(255) NOT NULL default '',\n              `product_orderby` int(11) NOT NULL default '0',\n              PRIMARY KEY  (`product_id`)\n            ) TYPE=MyISAM;\n        ";
        if ($objDatabase->Execute($query) === false) {
            return _databaseError($query, $objDatabase->ErrorMsg());
        }
    }
    // Add Yellowpay field to Product table
    $arrProductColumns = $objDatabase->MetaColumns(DBPREFIX . 'module_egov_products');
    if ($arrProductColumns === false) {
        setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_GETTING_DATABASE_TABLE_STRUCTURE'], DBPREFIX . 'module_egov_products'));
        return false;
    }
    if (!isset($arrProductColumns['YELLOWPAY'])) {
        $query = "\n            ALTER TABLE " . DBPREFIX . "module_egov_products\n            ADD `yellowpay` TINYINT(1) unsigned NOT NULL default '0'\n        ";
        $objResult = $objDatabase->Execute($query);
        if (!$objResult) {
            return _databaseError($query, $objDatabase->ErrorMsg());
        }
    }
    // Add quantity limit field to Product table
    if (!isset($arrProductColumns['PRODUCT_QUANTITY_LIMIT'])) {
        $query = "\n            ALTER TABLE " . DBPREFIX . "module_egov_products\n            ADD `product_quantity_limit` TINYINT(2) unsigned NOT NULL default '1'\n            AFTER `product_quantity`;\n        ";
        $objResult = $objDatabase->Execute($query);
        if (!$objResult) {
            return _databaseError($query, $objDatabase->ErrorMsg());
        }
    }
    // Add alternative payment method name field to Product table
    if (!isset($arrProductColumns['ALTERNATIVE_NAMES'])) {
        $query = "\n            ALTER TABLE " . DBPREFIX . "module_egov_products\n            ADD `alternative_names` TEXT NOT NULL;\n        ";
        $objResult = $objDatabase->Execute($query);
        if (!$objResult) {
            return _databaseError($query, $objDatabase->ErrorMsg());
        }
    }
    /********************************
     * EXTENSION:   Timezone        *
     * ADDED:       Contrexx v3.0.0 *
     ********************************/
    try {
        \Cx\Lib\UpdateUtil::sql('ALTER TABLE `' . DBPREFIX . 'module_egov_orders` CHANGE `order_date` `order_date` TIMESTAMP NOT NULL DEFAULT "0000-00-00 00:00:00"');
    } catch (\Cx\Lib\UpdateException $e) {
        return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
    }
    return true;
//.........这里部分代码省略.........
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:101,代码来源:egov.php


示例7: DefaultActionHandler

 public static function DefaultActionHandler($e)
 {
     if ($e instanceof Update_DatabaseException) {
         return _databaseError($e->sql, $e->getMessage());
     }
     setUpdateMsg($e->getMessage());
     return false;
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:8,代码来源:UpdateUtil.class.php


示例8: _writeNewConfigurationFile

function _writeNewConfigurationFile()
{
    global $_CORELANG, $_ARRAYLANG, $_DBCONFIG, $_PATHCONFIG, $_FTPCONFIG, $_CONFIGURATION, $_CONFIG;
    $ftpStatus = $_FTPCONFIG['is_activated'] ? 'true' : 'false';
    $charset = 'UTF-8';
    $dbCharset = 'utf8';
    $_FTPCONFIG['port'] = intval($_FTPCONFIG['port']);
    $configurationTpl = <<<CONFIG_TPL
<?php
global \$_DBCONFIG, \$_PATHCONFIG, \$_FTPCONFIG, \$_CONFIG;
/**
* @exclude
*
* Cloudrexx CMS Web Installer
* Please use the Cloudrexx CMS installer to configure this file
* or edit this file and configure the parameters for your site and
* database manually.
*/

/**
* -------------------------------------------------------------------------
* Set installation status
* -------------------------------------------------------------------------
*/
define('CONTREXX_INSTALLED', true);

/**
* -------------------------------------------------------------------------
* Database configuration section
* -------------------------------------------------------------------------
*/
\$_DBCONFIG['host'] = '{$_DBCONFIG['host']}'; // This is normally set to localhost
\$_DBCONFIG['database'] = '{$_DBCONFIG['database']}'; // Database name
\$_DBCONFIG['tablePrefix'] = '{$_DBCONFIG['tablePrefix']}'; // Database table prefix
\$_DBCONFIG['user'] = '{$_DBCONFIG['user']}'; // Database username
\$_DBCONFIG['password'] = '{$_DBCONFIG['password']}'; // Database password
\$_DBCONFIG['dbType'] = '{$_DBCONFIG['dbType']}';    // Database type (e.g. mysql,postgres ..)
\$_DBCONFIG['charset'] = '{$dbCharset}'; // Charset (default, latin1, utf8, ..)
\$_DBCONFIG['timezone'] = '{$_CONFIG['timezone']}'; // Controller's timezone for model
\$_DBCONFIG['collation'] = '{$_DBCONFIG['collation']}';

/**
* -------------------------------------------------------------------------
* Site path specific configuration
* -------------------------------------------------------------------------
*/
\$_PATHCONFIG['ascms_root'] = '';
\$_PATHCONFIG['ascms_root_offset'] = ''; // example: '/cms';
\$_PATHCONFIG['ascms_installation_root'] = \$_PATHCONFIG['ascms_root'];
\$_PATHCONFIG['ascms_installation_offset'] = \$_PATHCONFIG['ascms_root_offset']; // example: '/cms';

/**
* -------------------------------------------------------------------------
* Ftp specific configuration
* -------------------------------------------------------------------------
*/
\$_FTPCONFIG['is_activated'] = {$ftpStatus}; // Ftp support true or false
\$_FTPCONFIG['host']    = '{$_FTPCONFIG['host']}';// This is normally set to localhost
\$_FTPCONFIG['port'] = {$_FTPCONFIG['port']}; // Ftp remote port
\$_FTPCONFIG['username'] = '{$_FTPCONFIG['username']}'; // Ftp login username
\$_FTPCONFIG['password']    = '{$_FTPCONFIG['password']}'; // Ftp login password
\$_FTPCONFIG['path']    = '{$_FTPCONFIG['path']}'; // Ftp path to cms (must not include ascms_root_offset)

/**
* -------------------------------------------------------------------------
* Base setup (altering might break the system!)
* -------------------------------------------------------------------------
*/
// Set character encoding
\$_CONFIG['coreCharacterEncoding'] = 'UTF-8'; // example 'UTF-8'

CONFIG_TPL;
    // write settings
    try {
        $objFile = new \Cx\Lib\FileSystem\File(ASCMS_DOCUMENT_ROOT . '/config/configuration.php');
        $objFile->makeWritable();
        $objFile->write($configurationTpl);
    } catch (\Cx\Lib\FileSystem\FileSystemException $e) {
        \DBG::msg($e->getMessage());
        setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_WRITE_SETTINGS_FILE'], ASCMS_DOCUMENT_ROOT . '/config/configuration.php'));
        setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_FILE'], ASCMS_DOCUMENT_ROOT . '/config/configuration.php', $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg');
        return false;
    }
    return true;
}
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:85,代码来源:core.php


示例9: _accessUpdate

/**
 * Cloudrexx
 *
 * @link      http://www.cloudrexx.com
 * @copyright Cloudrexx AG 2007-2015
 *
 * According to our dual licensing model, this program can be used either
 * under the terms of the GNU Affero General Public License, version 3,
 * or under a proprietary license.
 *
 * The texts of the GNU Affero General Public License with an additional
 * permission and of our proprietary license can be found at and
 * in the LICENSE file you have received along with this program.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * "Cloudrexx" is a registered trademark of Cloudrexx AG.
 * The licensing of the program under the AGPLv3 does not imply a
 * trademark license. Therefore any rights, title and interest in
 * our trademarks remain entirely with us.
 */
function _accessUpdate()
{
    global $objDatabase, $objUpdate, $_CONFIG, $_ARRAYLANG, $_CORELANG;
    $arrTables = $objDatabase->MetaTables('TABLES');
    if (!$arrTables) {
        setUpdateMsg($_ARRAYLANG['TXT_UNABLE_DETERMINE_DATABASE_STRUCTURE']);
        return false;
    }
    /****************************
     *
     * ADD NOTIFICATION E-MAILS
     *
     ***************************/
    try {
        \Cx\Lib\UpdateUtil::table(DBPREFIX . 'access_user_mail', array('type' => array('type' => 'ENUM(\'reg_confirm\',\'reset_pw\',\'user_activated\',\'user_deactivated\',\'new_user\')', 'notnull' => true, 'default' => 'reg_confirm'), 'lang_id' => array('type' => 'TINYINT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'sender_mail' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'sender_name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'subject' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'format' => array('type' => 'ENUM(\'text\',\'html\',\'multipart\')', 'notnull' => true, 'default' => 'text'), 'body_text' => array('type' => 'TEXT'), 'body_html' => array('type' => 'TEXT')), array('mail' => array('fields' => array('type', 'lang_id'), 'type' => 'UNIQUE')), 'InnoDB');
        $result = \Cx\Lib\UpdateUtil::sql('SHOW KEYS FROM `' . DBPREFIX . 'access_group_dynamic_ids`');
        if ($result->EOF) {
            \Cx\Lib\UpdateUtil::sql('ALTER IGNORE TABLE `' . DBPREFIX . 'access_group_dynamic_ids` ADD PRIMARY KEY ( `access_id` , `group_id` )');
        }
        $result = \Cx\Lib\UpdateUtil::sql('SHOW KEYS FROM `' . DBPREFIX . 'access_group_static_ids`');
        if ($result->EOF) {
            \Cx\Lib\UpdateUtil::sql('ALTER IGNORE TABLE `' . DBPREFIX . 'access_group_static_ids` ADD PRIMARY KEY ( `access_id` , `group_id` )');
        }
    } catch (\Cx\Lib\UpdateException $e) {
        // we COULD do something else here..
        return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
    }
    \DBG::msg('001');
    $arrMails = array(array('type' => 'reg_confirm', 'subject' => 'Benutzerregistrierung bestätigen', 'body_text' => 'Hallo [[USERNAME]],\\r\\n\\r\\nVielen Dank für Ihre Anmeldung bei [[HOST]].\\r\\nBitte klicken Sie auf den folgenden Link, um Ihre E-Mail-Adresse zu bestätigen:\\r\\n[[ACTIVATION_LINK]]\\r\\n\\r\\nUm sich später einzuloggen, geben Sie bitte Ihren Benutzernamen \\"[[USERNAME]]\\" und das Passwort ein, das Sie bei der Registrierung festgelegt haben.\\r\\n\\r\\n\\r\\n--\\r\\nIhr [[SENDER]]'), array('type' => 'reset_pw', 'subject' => 'Kennwort zurücksetzen', 'body_text' => 'Hallo [[USERNAME]],\\r\\n\\r\\nUm ein neues Passwort zu wählen, müssen Sie auf die unten aufgeführte URL gehen und dort Ihr neues Passwort eingeben.\\r\\n\\r\\nWICHTIG: Die Gültigkeit der URL wird nach 60 Minuten verfallen, nachdem diese E-Mail abgeschickt wurde.\\r\\nFalls Sie mehr Zeit benötigen, geben Sie Ihre E-Mail Adresse einfach ein weiteres Mal ein.\\r\\n\\r\\nIhre URL:\\r\\n[[URL]]\\r\\n\\r\\n\\r\\n--\\r\\n[[SENDER]]'), array('type' => 'user_activated', 'subject' => 'Ihr Benutzerkonto wurde aktiviert', 'body_text' => 'Hallo [[USERNAME]],\\r\\n\\r\\nIhr Benutzerkonto auf [[HOST]] wurde soeben aktiviert und kann von nun an verwendet werden.\\r\\n\\r\\n\\r\\n--\\r\\n[[SENDER]]'), array('type' => 'user_deactivated', 'subject' => 'Ihr Benutzerkonto wurde deaktiviert', 'body_text' => 'Hallo [[USERNAME]],\\r\\n\\r\\nIhr Benutzerkonto auf [[HOST]] wurde soeben deaktiviert.\\r\\n\\r\\n\\r\\n--\\r\\n[[SENDER]]'), array('type' => 'new_user', 'subject' => 'Ein neuer Benutzer hat sich registriert', 'body_text' => 'Der Benutzer [[USERNAME]] hat sich soeben registriert und muss nun frei geschaltet werden.\\r\\n\\r\\nÜber die folgende Adresse kann das Benutzerkonto von [[USERNAME]] verwaltet werden:\\r\\n[[LINK]]\\r\\n\\r\\n\\r\\n--\\r\\n[[SENDER]]'));
    foreach ($arrMails as $arrMail) {
        $query = "SELECT 1 FROM `" . DBPREFIX . "access_user_mail` WHERE `type` = '" . $arrMail['type'] . "'";
        $objMail = $objDatabase->SelectLimit($query, 1);
        if ($objMail !== false) {
            if ($objMail->RecordCount() == 0) {
                $query = "INSERT INTO `" . DBPREFIX . "access_user_mail` (\n                    `type`,\n                    `lang_id`,\n                    `sender_mail`,\n                    `sender_name`,\n                    `subject`,\n                    `body_text`,\n                    `body_html`\n                ) VALUES (\n                    '" . $arrMail['type'] . "',\n                    0,\n                    '" . addslashes($_CONFIG['coreAdminEmail']) . "',\n                    '" . addslashes($_CONFIG['coreAdminName']) . "',\n                    '" . $arrMail['subject'] . "',\n                    '" . $arrMail['body_text'] . "',\n                    ''\n                )";
                if ($objDatabase->Execute($query) === false) {
                    return _databaseError($query, $objDatabase->ErrorMsg());
                }
            }
        } else {
            return _databaseError($query, $objDatabase->ErrorMsg());
        }
    }
    /****************
     *
     * ADD SETTINGS
     *
     ***************/
    try {
        \Cx\Lib\UpdateUtil::table(DBPREFIX . 'access_settings', array('key' => array('type' => 'VARCHAR(32)', 'notnull' => true, 'default' => ''), 'value' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'key'), 'status' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'value')), array('key' => array('fields' => array('key'), 'type' => 'UNIQUE')), 'InnoDB');
        if (in_array(DBPREFIX . "communit_config", $arrTables)) {
            $objResult = \Cx\Lib\UpdateUtil::sql('SELECT `name`, `value`, `status` FROM `' . DBPREFIX . 'community_config`');
            while (!$objResult->EOF) {
                $arrCommunityConfig[$objResult->fields['name']] = array('value' => $objResult->fields['value'], 'status' => $objResult->fields['status']);
                $objResult->MoveNext();
            }
        }
        $arrSettings = array('user_activation' => array('value' => '', 'status' => isset($arrCommunityConfig['user_activation']['status']) ? $arrCommunityConfig['user_activation']['status'] : 0), 'user_activation_timeout' => array('value' => isset($arrCommunityConfig['user_activation_timeout']['value']) ? $arrCommunityConfig['user_activation_timeout']['value'] : 0, 'status' => isset($arrCommunityConfig['user_activation_timeout']['status']) ? $arrCommunityConfig['user_activation_timeout']['status'] : 0), 'assigne_to_groups' => array('value' => isset($arrCommunityConfig['community_groups']['value']) ? $arrCommunityConfig['community_groups']['value'] : '', 'status' => 1), 'max_profile_pic_width' => array('value' => '160', 'status' => 1), 'max_profile_pic_height' => array('value' => '160', 'status' => 1), 'profile_thumbnail_pic_width' => array('value' => '50', 'status' => 1), 'profile_thumbnail_pic_height' => array('value' => '50', 'status' => 1), 'max_profile_pic_size' => array('value' => '30000', 'status' => 1), 'max_pic_width' => array('value' => '600', 'status' => 1), 'max_pic_height' => array('value' => '600', 'status' => 1), 'max_thumbnail_pic_width' => array('value' => '130', 'status' => 1), 'max_thumbnail_pic_height' => array('value' => '130', 'status' => 1), 'max_pic_size' => array('value' => '200000', 'status' => 1), 'notification_address' => array('value' => addslashes($_CONFIG['coreAdminEmail']), 'status' => 1), 'user_config_email_access' => array('value' => '', 'status' => 1), 'user_config_profile_access' => array('value' => '', 'status' => 1), 'default_email_access' => array('value' => 'members_only', 'status' => 1), 'default_profile_access' => array('value' => 'members_only', 'status' => 1), 'user_delete_account' => array('value' => '', 'status' => 1), 'block_currently_online_users' => array('value' => '10', 'status' => 0), 'block_currently_online_users_pic' => array('value' => '', 'status' => 0), 'block_last_active_users' => array('value' => '10', 'status' => 0), 'block_last_active_users_pic' => array('value' => '', 'status' => 0), 'block_latest_reg_users' => array('value' => '10', 'status' => 0), 'block_latest_reg_users_pic' => array('value' => '', 'status' => 0), 'block_birthday_users' => array('value' => '10', 'status' => 0), 'block_birthday_users_pic' => array('value' => '', 'status' => 0), 'session_user_interval' => array('value' => '0', 'status' => 1), 'user_accept_tos_on_signup' => array('value' => '', 'status' => 0), 'user_captcha' => array('value' => '', 'status' => 0), 'profile_thumbnail_method' => array('value' => 'crop', 'status' => 1), 'profile_thumbnail_scale_color' => array('value' => '#FFFFFF', 'status' => 1));
        foreach ($arrSettings as $key => $arrSetting) {
            if (!\Cx\Lib\UpdateUtil::sql("SELECT 1 FROM `" . DBPREFIX . "access_settings` WHERE `key` = '" . $key . "'")->RecordCount()) {
                \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "access_settings`\n                    SET `key`       = '" . $key . "',\n                        `value`     = '" . $arrSetting['value'] . "',\n                        `status`    = '" . $arrSetting['status'] . "'\n                ");
            }
        }
        // delete obsolete table community_config
        \Cx\Lib\UpdateUtil::drop_table(DBPREFIX . 'community_config');
        // delete obsolete table user_validity
        \Cx\Lib\UpdateUtil::drop_table(DBPREFIX . 'user_validity');
    } catch (\Cx\Lib\UpdateException $e) {
        // we COULD do something else here..
        return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
    }
    /********************
     *
     * ADD USER PROFILE
     *
     *******************/
//.........这里部分代码省略.........
开发者ID:Niggu,项目名称:cloudrexx,代码行数:101,代码来源:access.php


示例10: _newsUpdate

function _newsUpdate()
{
    global $objDatabase, $_CONFIG, $objUpdate, $_ARRAYLANG;
    /************************************************
     * EXTENSION:    Placeholder NEWS_LINK replaced    *
     *                by NEWS_LINK_TITLE                *
     * ADDED:        Contrexx v2.1.0                    *
     ************************************************/
    if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '2.1.0')) {
        try {
            \Cx\Lib\UpdateUtil::migrateContentPage('news', null, '{NEWS_LINK}', '{NEWS_LINK_TITLE}', '2.1.0');
        } catch (\Cx\Lib\UpdateException $e) {
            return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
        }
    }
    /************************************************
     * EXTENSION:    Front- and backend permissions  *
     * ADDED:        Contrexx v2.1.0                    *
     ************************************************/
    $query = "SELECT 1 FROM `" . DBPREFIX . "module_news_settings` WHERE `name` = 'news_message_protection'";
    $objResult = $objDatabase->SelectLimit($query, 1);
    if ($objResult) {
        if ($objResult->RecordCount() == 0) {
            $query = "INSERT INTO `" . DBPREFIX . "module_news_settings` (`name`, `value`) VALUES ('news_message_protection', '1'),\n                                                                                              ('recent_news_message_limit', '5')\n            ";
            if ($objDatabase->Execute($query) === false) {
                return _databaseError($query, $objDatabase->ErrorMsg());
            }
        }
    } else {
        return _databaseError($query, $objDatabase->ErrorMsg());
    }
    $query = "SELECT 1 FROM `" . DBPREFIX . "module_news_settings` WHERE `name` = 'news_message_protection_restricted'";
    $objResult = $objDatabase->SelectLimit($query, 1);
    if ($objResult) {
        if ($objResult->RecordCount() == 0) {
            $query = "INSERT INTO `" . DBPREFIX . "module_news_settings` (`name`, `value`) VALUES ('news_message_protection_restricted', '1')";
            if ($objDatabase->Execute($query) === false) {
                return _databaseError($query, $objDatabase->ErrorMsg());
            }
        }
    } else {
        return _databaseError($query, $objDatabase->ErrorMsg());
    }
    $arrColumns = $objDatabase->MetaColumnNames(DBPREFIX . 'module_news');
    if ($arrColumns === false) {
        setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_GETTING_DATABASE_TABLE_STRUCTURE'], DBPREFIX . 'module_news'));
        return false;
    }
    if (!in_array('frontend_access_id', $arrColumns)) {
        $query = "ALTER TABLE `" . DBPREFIX . "module_news` ADD `frontend_access_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `validated`";
        if ($objDatabase->Execute($query) === false) {
            return _databaseError($query, $objDatabase->ErrorMsg());
        }
    }
    if (!in_array('backend_access_id', $arrColumns)) {
        $query = "ALTER TABLE `" . DBPREFIX . "module_news` ADD `backend_access_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `frontend_access_id`";
        if ($objDatabase->Execute($query) === false) {
            return _databaseError($query, $objDatabase->ErrorMsg());
        }
    }
    /************************************************
     * EXTENSION:    Thunbmail Image                 *
     * ADDED:        Contrexx v2.1.0                    *
     ************************************************/
    $arrColumns = $objDatabase->MetaColumnNames(DBPREFIX . 'module_news');
    if ($arrColumns === false) {
        setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_GETTING_DATABASE_TABLE_STRUCTURE'], DBPREFIX . 'module_news'));
        return false;
    }
    if (!in_array('teaser_image_thumbnail_path', $arrColumns)) {
        $query = "ALTER TABLE `" . DBPREFIX . "module_news` ADD `teaser_image_thumbnail_path` TEXT NOT NULL AFTER `teaser_image_path`";
        if ($objDatabase->Execute($query) === false) {
            return _databaseError($query, $objDatabase->ErrorMsg());
        }
    }
    try {
        // delete obsolete table  contrexx_module_news_access
        \Cx\Lib\UpdateUtil::drop_table(DBPREFIX . 'module_news_access');
        # fix some ugly NOT NULL without defaults
        \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_news', array('id' => array('type' => 'INT(6) UNSIGNED', 'notnull' => true, 'primary' => true, 'auto_increment' => true), 'date' => array('type' => 'INT(14)', 'notnull' => false, 'default_expr' => 'NULL'), 'title' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => ''), 'text' => array('type' => 'MEDIUMTEXT', 'notnull' => true), 'redirect' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => ''), 'source' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => ''), 'url1' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => ''), 'url2' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => ''), 'catid' => array('type' => 'INT(2) UNSIGNED', 'notnull' => true, 'default' => 0), 'lang' => array('type' => 'INT(2) UNSIGNED', 'notnull' => true, 'default' => 0), 'userid' => array('type' => 'INT(6) UNSIGNED', 'notnull' => true, 'default' => 0), 'startdate' => array('type' => 'DATETIME', 'notnull' => true, 'default' => '0000-00-00 00:00:00'), 'enddate' => array('type' => 'DATETIME', 'notnull' => true, 'default' => '0000-00-00 00:00:00'), 'status' => array('type' => 'TINYINT(4)', 'notnull' => true, 'default' => 1), 'validated' => array('type' => "ENUM('0','1')", 'notnull' => true, 'default' => 0), 'frontend_access_id' => array('type' => 'INT(10) UNSIGNED', 'notnull' => true, 'default' => 0), 'backend_access_id' => array('type' => 'INT(10) UNSIGNED', 'notnull' => true, 'default' => 0), 'teaser_only' => array('type' => "ENUM('0','1')", 'notnull' => true, 'default' => 0), 'teaser_frames' => array('type' => 'TEXT', 'notnull' => true), 'teaser_text' => array('type' => 'TEXT', 'notnull' => true), 'teaser_show_link' => array('type' => 'TINYINT(1) UNSIGNED', 'notnull' => true, 'default' => 1), 'teaser_image_path' => array('type' => 'TEXT', 'notnull' => true), 'teaser_image_thumbnail_path' => array('type' => 'TEXT', 'notnull' => true), 'changelog' => array('type' => 'INT(14)', 'notnull' => true, 'default' => 0)), array('newsindex' => array('type' => 'FULLTEXT', 'fields' => array('text', 'title', 'teaser_text'))));
    } catch (\Cx\Lib\UpdateException $e) {
        // we COULD do something else here..
        DBG::trace();
        return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
    }
    //encoding was a little messy in 2.1.4. convert titles and teasers to their raw representation
    if ($_CONFIG['coreCmsVersion'] == "2.1.4") {
        try {
            $res = \Cx\Lib\UpdateUtil::sql('SELECT `id`, `title`, `teaser_text` FROM `' . DBPREFIX . 'module_news` WHERE `changelog` > ' . mktime(0, 0, 0, 12, 15, 2010));
            while ($res->MoveNext()) {
                $title = $res->fields['title'];
                $teaserText = $res->fields['teaser_text'];
        

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP setUpdatedLatLng函数代码示例发布时间:2022-05-15
下一篇:
PHP setToken函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap