本文整理汇总了PHP中JError::legacy方法的典型用法代码示例。如果您正苦于以下问题:PHP JError::legacy方法的具体用法?PHP JError::legacy怎么用?PHP JError::legacy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JError
的用法示例。
在下文中一共展示了JError::legacy方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateSQL
public function updateSQL()
{
if (isset(JError::$legacy) && JError::$legacy == true) {
JError::$legacy = false;
}
$structs = array('order' => array('order_serial_params' => 'TEXT NOT NULL DEFAULT \'\''));
foreach ($structs as $table => &$v) {
$sql = array();
$current = array();
if (!HIKASHOP_J25) {
$tmp = $this->db->getTableFields(hikaserial::table('shop.' . $table));
$current = reset($tmp);
unset($tmp);
} else {
$current = $this->db->getTableColumns(hikaserial::table('shop.' . $table));
}
foreach ($v as $col => $colSql) {
if (!isset($current[$col])) {
$sql[] = 'ADD COLUMN `' . $col . '` ' . $colSql;
}
}
if (!empty($sql)) {
$query = 'ALTER IGNORE TABLE `' . hikaserial::table('shop.' . $table) . '` ' . implode(',', $sql);
$this->db->setQuery($query);
$this->db->query();
unset($query);
}
unset($sql);
}
if (!$this->update) {
return true;
}
if (version_compare($this->fromVersion, '1.2.0', '<')) {
$query = "CREATE TABLE IF NOT EXISTS `#__hikaserial_consumer` (" . "\t`consumer_id` INT(10) NOT NULL AUTO_INCREMENT," . "\t`consumer_type` VARCHAR(255) NOT NULL," . "\t`consumer_published` INT(4) NOT NULL DEFAULT 0," . "\t`consumer_name` VARCHAR(255) NOT NULL," . "\t`consumer_ordering` INT(10) NOT NULL DEFAULT 0," . "\t`consumer_description` TEXT NOT NULL DEFAULT ''," . "\t`consumer_params` TEXT NOT NULL DEFAULT ''," . "\t`consumer_access` VARCHAR(255) NOT NULL DEFAULT 'all'," . "\tPRIMARY KEY (`consumer_id`)" . ") ENGINE=MyISAM;";
$this->db->setQuery($query);
$this->db->query();
}
if (version_compare($this->fromVersion, '1.3.0', '<')) {
$query = "ALTER TABLE `#__hikaserial_serial` ADD `serial_extradata` TEXT NULL DEFAULT NULL;";
$this->db->setQuery($query);
$this->db->query();
}
if (version_compare($this->fromVersion, '1.4.0', '<')) {
$query = "CREATE TABLE IF NOT EXISTS `#__hikaserial_history` (" . "\t`history_id` INT(10) NOT NULL AUTO_INCREMENT," . "\t`history_serial_id` INT(10) unsigned NOT NULL DEFAULT '0'," . "\t`history_created` INT(10) unsigned NOT NULL DEFAULT '0'," . "\t`history_ip` VARCHAR(255) NOT NULL DEFAULT ''," . "\t`history_new_status` VARCHAR(255) NOT NULL DEFAULT ''," . "\t`history_type` VARCHAR(255) NOT NULL DEFAULT ''," . "\t`history_data` TEXT NOT NULL DEFAULT ''," . "\t`history_user_id` INT(10) unsigned DEFAULT '0'," . "\tPRIMARY KEY (`history_id`)" . ") ENGINE=MyISAM;";
$this->db->setQuery($query);
$this->db->query();
}
if (version_compare($this->fromVersion, '1.5.0', '<')) {
$file = HIKASERIAL_BACK . 'admin.hikaserial.php';
if (file_exists($file)) {
JFile::delete($file);
}
}
if (version_compare($this->fromVersion, '1.5.1', '<')) {
$query = "CREATE TABLE IF NOT EXISTS `#__hikaserial_plugin` (" . "\t`plugin_id` INT(10) NOT NULL AUTO_INCREMENT," . "\t`plugin_type` VARCHAR(255) NOT NULL," . "\t`plugin_published` INT(4) NOT NULL DEFAULT 0," . "\t`plugin_name` VARCHAR(255) NOT NULL," . "\t`plugin_ordering` INT(10) NOT NULL DEFAULT 0," . "\t`plugin_description` TEXT NOT NULL DEFAULT ''," . "\t`plugin_params` TEXT NOT NULL DEFAULT ''," . "\t`plugin_access` VARCHAR(255) NOT NULL DEFAULT 'all'," . "\tPRIMARY KEY (`plugin_id`)" . ") ENGINE=MyISAM;";
$this->db->setQuery($query);
$this->db->query();
}
}
示例2: __construct
/**
* Database object constructor
*
* @param object|\JDatabase|\JDatabaseDriver $cmsDatabase
* @param string $prefix
* @param string $cmsRelease
*/
public function __construct($cmsDatabase, $prefix, $cmsRelease)
{
$this->_db = $cmsDatabase;
$this->_table_prefix = $prefix;
$this->cmsRelease = $cmsRelease;
if (version_compare($this->cmsRelease, '3.0', '<') && class_exists('\\JError')) {
// Make Joomla 2.5 use RunTimeExceptions
\JError::$legacy = false;
}
}
示例3: array
define('JPATH_SITE', JPATH_ROOT);
define('JPATH_CONFIGURATION', JPATH_ROOT);
define('JPATH_ADMINISTRATOR', JPATH_ROOT . '/administrator');
define('JPATH_LIBRARIES', JPATH_ROOT . '/libraries');
define('JPATH_PLUGINS', JPATH_ROOT . '/plugins');
define('JPATH_INSTALLATION', JPATH_ROOT . '/installation');
define('JPATH_THEMES', JPATH_ADMINISTRATOR . '/templates');
define('JPATH_CACHE', JPATH_ROOT . '/cache');
define('JPATH_MANIFESTS', JPATH_ADMINISTRATOR . '/manifests');
define('JPATH_MYWEBAPP', JPATH_BASE);
// Usually this will be in the framework.php file in the
// includes folder.
require_once JPATH_PLATFORM . '/import.php';
require_once JPATH_LIBRARIES . '/import.legacy.php';
// Force library to be in JError legacy mode
JError::$legacy = true;
JError::setErrorHandling(E_NOTICE, 'message');
JError::setErrorHandling(E_WARNING, 'message');
JError::setErrorHandling(E_ERROR, 'message', array('JError', 'customErrorPage'));
// Botstrap the CMS libraries.
require_once JPATH_LIBRARIES . '/cms.php';
// Pre-Load configuration.
ob_start();
require_once JPATH_CONFIGURATION . '/configuration.php';
ob_end_clean();
// System configuration.
$config = new JConfig();
// Set the error_reporting
switch ($config->error_reporting) {
case 'default':
case '-1':
示例4: doExecute
*/
'cli' == PHP_SAPI || die('This script must be executed from the command line.');
version_compare(PHP_VERSION, '5.3', '>=') || die('This script requires PHP >= 5.3');
define('_JEXEC', 1);
define('ECR_DEBUG', 0);
ini_set('error_reporting', -1);
$options = getopt('', array('basedir:'));
count($options) || die('Please specify a build path with the --basedir option');
define('THE_BUILD_PATH', $options['basedir']);
require THE_BUILD_PATH . '/libraries/import.php';
//-- @todo deprecated JRequest..
jimport('joomla.environment.request');
jimport('joomla.application.component.helper');
jimport('joomla.environment.uri');
//-- @todo deprecated JError..
JError::$legacy = false;
/**
* EasyCreator client builder.
*/
class EcrCliBuilder extends JApplicationCli
{
/**
* DoIt
*
* @throws Exception
* @return void
*/
public function doExecute()
{
define('JPATH_BASE', THE_BUILD_PATH);
define('JPATH_SITE', JPATH_BASE);
示例5: jimport
function _updateDatabase()
{
if (version_compare(JVERSION, '2.5', '>=') && version_compare(JVERSION, '3.0', '<')) {
if (JError::$legacy) {
$tmp_legacy = true;
} else {
$tmp_legacy = false;
}
JError::$legacy = false;
}
jimport('joomla.filesystem.file');
if (!file_exists(JPATH_ROOT . "/images/com_adsmanager/")) {
JFolder::create(JPATH_ROOT . "/images/com_adsmanager/");
}
if (!file_exists(JPATH_ROOT . "/images/com_adsmanager/categories/")) {
JFolder::create(JPATH_ROOT . "/images/com_adsmanager/categories/");
}
if (!file_exists(JPATH_ROOT . "/images/com_adsmanager/ads/")) {
JFolder::create(JPATH_ROOT . "/images/com_adsmanager/ads/");
}
if (file_exists(JPATH_ROOT . "/images/com_adsmanager/ads/tmp")) {
JFolder::move(JPATH_ROOT . "/images/com_adsmanager/ads/tmp", JPATH_ROOT . "/images/com_adsmanager/ads/waiting");
}
if (!file_exists(JPATH_ROOT . "/images/com_adsmanager/ads/waiting")) {
JFolder::create(JPATH_ROOT . "/images/com_adsmanager/ads/waiting");
}
if (!file_exists(JPATH_ROOT . "/images/com_adsmanager/ads/uploaded")) {
JFolder::create(JPATH_ROOT . "/images/com_adsmanager/ads/uploaded");
}
if (!file_exists(JPATH_ROOT . "/images/com_adsmanager/ads/tmp")) {
JFolder::create(JPATH_ROOT . "/images/com_adsmanager/ads/tmp");
}
if (!file_exists(JPATH_ROOT . "/images/com_adsmanager/email/")) {
JFolder::create(JPATH_ROOT . "/images/com_adsmanager/email/");
}
if (!file_exists(JPATH_ROOT . "/images/com_adsmanager/files/")) {
JFolder::create(JPATH_ROOT . "/images/com_adsmanager/files/");
}
if (!file_exists(JPATH_ROOT . "/images/com_adsmanager/files/.htaccess")) {
$content = "ForceType application/octet-stream";
$content .= "\nHeader set Content-Disposition attachment";
JFile::write(JPATH_ROOT . "/images/com_adsmanager/files/.htaccess", $content);
}
if (!file_exists(JPATH_ROOT . "/images/com_adsmanager/fields/")) {
JFolder::create(JPATH_ROOT . "/images/com_adsmanager/fields/");
}
if (!file_exists(JPATH_ROOT . "/images/com_adsmanager/plugins/")) {
JFolder::create(JPATH_ROOT . "/images/com_adsmanager/plugins/");
}
if (!file_exists(JPATH_ROOT . "/images/com_adsmanager/index.html")) {
JFile::copy(JPATH_ROOT . "/components/com_adsmanager/index.html", JPATH_ROOT . "/images/com_adsmanager/index.html");
}
if (!file_exists(JPATH_ROOT . "/images/com_adsmanager/categories/index.html")) {
JFile::copy(JPATH_ROOT . "/components/com_adsmanager/index.html", JPATH_ROOT . "/images/com_adsmanager/categories/index.html");
}
if (!file_exists(JPATH_ROOT . "/images/com_adsmanager/ads/index.html")) {
JFile::copy(JPATH_ROOT . "/components/com_adsmanager/index.html", JPATH_ROOT . "/images/com_adsmanager/ads/index.html");
}
if (!file_exists(JPATH_ROOT . "/images/com_adsmanager/ads/waiting/index.html")) {
JFile::copy(JPATH_ROOT . "/components/com_adsmanager/index.html", JPATH_ROOT . "/images/com_adsmanager/ads/waiting/index.html");
}
if (!file_exists(JPATH_ROOT . "/images/com_adsmanager/ads/uploaded/index.html")) {
JFile::copy(JPATH_ROOT . "/components/com_adsmanager/index.html", JPATH_ROOT . "/images/com_adsmanager/ads/uploaded/index.html");
}
if (!file_exists(JPATH_ROOT . "/images/com_adsmanager/email/index.html")) {
JFile::copy(JPATH_ROOT . "/components/com_adsmanager/index.html", JPATH_ROOT . "/images/com_adsmanager/email/index.html");
}
if (!file_exists(JPATH_ROOT . "/images/com_adsmanager/files/index.html")) {
JFile::copy(JPATH_ROOT . "/components/com_adsmanager/index.html", JPATH_ROOT . "/images/com_adsmanager/files/index.html");
}
if (!file_exists(JPATH_ROOT . "/images/com_adsmanager/fields/index.html")) {
JFile::copy(JPATH_ROOT . "/components/com_adsmanager/index.html", JPATH_ROOT . "/images/com_adsmanager/fields/index.html");
}
if (!file_exists(JPATH_ROOT . "/images/com_adsmanager/plugins/index.html")) {
JFile::copy(JPATH_ROOT . "/components/com_adsmanager/index.html", JPATH_ROOT . "/images/com_adsmanager/plugins/index.html");
}
$lang = JFactory::getLanguage();
$lang->load("com_adsmanager");
// Schema modification -- BEGIN
$db = JFactory::getDBO();
$db->setQuery("CREATE TABLE IF NOT EXISTS `#__adsmanager_searchmodule_config` (\n\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t`params` text NOT NULL,\n\t\t\tPRIMARY KEY (`id`)\n\t);");
try {
$result = $db->query();
} catch (Exception $e) {
}
$db->setQuery("INSERT IGNORE INTO `#__adsmanager_searchmodule_config` (`params`) VALUES ('')");
try {
$result = $db->query();
} catch (Exception $e) {
}
$db->setQuery("SELECT count(*) FROM `#__adsmanager_fields` WHERE 1");
$total = $db->loadResult();
if ($total == 0) {
$queries = array();
$queries[] = " INSERT IGNORE INTO `#__adsmanager_columns` (`id`,`name`,`ordering`,`catsid`,`published`) VALUES " . " (2, 'ADSMANAGER_PRICE', 1, 1,1), " . " (3, 'ADSMANAGER_CITY', 2, 1,1), " . " (5, 'ADSMANAGER_STATE', 1, 0,1);";
$queries[] = " UPDATE #__adsmanager_columns SET catsid = ',-1,'";
$queries[] = " INSERT IGNORE INTO `#__adsmanager_field_values` (`fieldvalueid`,`fieldid`,`fieldtitle`,`fieldvalue`,`ordering`,`sys`) VALUES " . " (1, 8, 'ADSMANAGER_KINDOF2', 1, 1, 0), " . " (2, 8, 'ADSMANAGER_KINDOF1', 2, 2, 0), " . " (3, 9, 'ADSMANAGER_STATE_0', 4, 4, 0)," . " (4, 8, 'ADSMANAGER_KINDOFALL', 0, 0, 0)," . " (5, 9, 'ADSMANAGER_STATE_1', 3, 3, 0)," . " (6, 9, 'ADSMANAGER_STATE_3', 1, 1, 0)," . " (7, 9, 'ADSMANAGER_STATE_2', 2, 2, 0)," . " (8, 9, 'ADSMANAGER_STATE_4', 0, 0, 0);";
$queries[] = " INSERT IGNORE INTO `#__adsmanager_fields` (`fieldid`, `name`, `title`, `description`, `type`, `maxlength`, `size`, `required`, `ordering`, `cols`, `rows`, `columnid`, `columnorder`, `pos`, `posorder`, `profile`, `cb_field`, `sort`, `sort_direction`, `published`, `options`) VALUES " . "(1, 'name', 'ADSMANAGER_FORM_NAME', '', 'text', 50, 35, 1, 0, 0, 0, -1, 5, 5, 1, 1, 41, 0, 'DESC', 1, '')," . "(2, 'email', 'ADSMANAGER_FORM_EMAIL', '', 'emailaddress', 50, 35, 1, 1, 0, 0, -1, 10, 5, 4, 1, 50, 0, 'DESC', 1, '')," . "(3, 'ad_city', 'ADSMANAGER_FORM_CITY', '', 'text', 50, 35, 0, 4, 0, 0, 3, 1, 5, 3, 1, 59, 1, 'ASC', 1, '')," . "(4, 'ad_zip', 'ADSMANAGER_FORM_ZIP', '', 'text', 6, 7, 0, 3, 0, 0, -1, 0, 5, 2, 1, -1, 0, 'ASC', 1, '')," . "(5, 'ad_headline', 'ADSMANAGER_FORM_AD_HEADLINE', '', 'text', 60, 35, 1, 5, 0, 0, -1, 0, 1, 1, 0, -1, 0, 'DESC', 1, '')," . "(6, 'ad_text', 'ADSMANAGER_FORM_AD_TEXT', '', 'textarea', 500, 0, 1, 6, 40, 20, -1, 0, 3, 1, 0, -1, 0, 'DESC', 1, '')," . "(7, 'ad_phone', 'ADSMANAGER_FORM_PHONE1', '', 'number', 50, 35, 0, 2, 0, 0, -1, 0, 5, 1, 1, -1, 0, 'DESC', 1, '')," . "(8, 'ad_kindof', 'ADSMANAGER_FORM_KINDOF', '', 'select', 0, 0, 1, 7, 0, 0, 5, 0, 2, 1, 0, -1, 0, 'DESC', 1, '')," . "(9, 'ad_state', 'ADSMANAGER_FORM_STATE', '', 'select', 0, 0, 1, 8, 0, 0, 5, 0, 2, 1, 0, -1, 0, 'DESC', 1, '')," . "(10, 'ad_price', 'ADSMANAGER_FORM_AD_PRICE', '', 'price', 10, 7, 1, 9, 0, 0, 2, 0, 4, 1, 0, -1, 1, 'DESC', 1, '{\"currency_symbol\":\"\\\\u20ac\",\"currency_position\":\"after\",\"currency_number_decimals\":\"2\",\"currency_decimal_separator\":\".\",\"currency_thousands_separator\":\" \"}');";
$queries[] = " UPDATE #__adsmanager_fields SET catsid = ',-1,'";
$queries[] = " INSERT IGNORE INTO `#__adsmanager_positions` (`id`,`name`,`title`) VALUES " . " (1, 'top', 'ADSMANAGER_POSITION_TOP')," . " (2, 'subtitle', 'ADSMANAGER_POSITION_SUBTITLE')," . " (3, 'description', 'ADSMANAGER_POSITION_DESCRIPTION')," . " (4, 'description2', 'ADSMANAGER_POSITION_DESCRIPTION2')," . " (5, 'contact', 'ADSMANAGER_POSITION_CONTACT');";
//.........这里部分代码省略.........
示例6: getTablesCount
/**
* Returns a list of tables and the number of rows or null if the
* table does not exist
* @param $tables An array of table names without prefix
* @param $prefix The table prefix (JEM and EL tables can have a different prefix!)
* @return array The list of tables
*/
public function getTablesCount($tables, $prefix)
{
$db = $this->_db;
foreach ($tables as $table => $value) {
$query = $db->getQuery('true');
$query->select('COUNT(*)')
->from($db->quoteName($prefix.$table));
$db->setQuery($query);
// Set legacy to false to be able to catch DB errors.
$legacyValue = JError::$legacy;
JError::$legacy = false;
try {
$tables[$table] = $db->loadResult();
// Don't count the root category
if (strcasecmp($table, 'jem_categories') == 0) {
$tables[$table]--;
}
} catch (Exception $e) {
$tables[$table] = null;
}
JError::$legacy = $legacyValue;
}
return $tables;
}
示例7: saveContent
function saveContent($post, $plugins)
{
if (version_compare(JVERSION, '2.5', '>=') && version_compare(JVERSION, '3.0', '<')) {
if (JError::$legacy) {
$tmp_legacy = true;
} else {
$tmp_legacy = false;
}
JError::$legacy = false;
}
$fieldNames = @$post['vNames'];
$fieldValues = @$post['vValues'];
$fieldImagesSelect = @$post['vSelectImages'];
$fieldImagesValues = @$post['vImagesValues'];
$j = 1;
if ($this->fieldid > 0) {
/*$this->_db->setQuery( "DELETE FROM #__adsmanager_field_values"
. " WHERE fieldid='".(int)$this->fieldid."'" );*/
$this->_db->setQuery("SELECT * FROM #__adsmanager_field_values" . " WHERE fieldid='" . (int) $this->fieldid . "'");
$existingvalues = $this->_db->loadObjectList('fieldvalue');
} else {
$this->_db->setQuery("SELECT MAX(fieldid) FROM #__adsmanager_fields");
$maxID = $this->_db->loadResult();
$this->fieldid = $maxID;
$existingvalues = array();
}
$options_tag = $this->type;
//To erase previous values in case of update
$listnewvalues = array();
switch ($this->type) {
case "select":
case "multiselect":
case "radio":
case "multicheckbox":
case "price":
case "number":
$options_tag = "multiple";
$j = 0;
$i = 0;
while (isset($fieldNames[$i])) {
$fieldName = trim($fieldNames[$i]);
$fieldValue = trim($fieldValues[$i]);
$i++;
if ($fieldName != null) {
$obj = new stdClass();
$obj->fieldtitle = $fieldName;
$obj->fieldvalue = $fieldValue;
$obj->ordering = $j;
$obj->fieldid = $this->fieldid;
$listnewvalues[] = $this->_db->Quote($fieldValue);
if (isset($existingvalues[$fieldValue])) {
$obj->fieldvalueid = $existingvalues[$fieldValue]->fieldvalueid;
$this->_db->updateObject('#__adsmanager_field_values', $obj, 'fieldvalueid');
} else {
$this->_db->insertObject('#__adsmanager_field_values', $obj);
}
$j++;
}
}
break;
case 'radioimage':
case 'multicheckboximage':
$j = 0;
$i = 0;
while (isset($fieldImagesSelect[$i])) {
$fieldName = trim($fieldImagesSelect[$i]);
$fieldValue = trim($fieldImagesValues[$i]);
$i++;
if ($fieldName != null) {
$obj = new stdClass();
$obj->fieldtitle = $fieldName;
$obj->fieldvalue = $fieldValue;
$obj->ordering = $j;
$obj->fieldid = $this->fieldid;
$listnewvalues[] = $this->_db->Quote($fieldValue);
if (isset($existingvalues[$fieldValue])) {
$obj->fieldvalueid = $existingvalues[$fieldValue]->fieldvalueid;
$this->_db->updateObject('#__adsmanager_field_values', $obj, 'fieldvalueid');
} else {
$this->_db->insertObject('#__adsmanager_field_values', $obj);
}
$j++;
}
}
break;
}
//If they was previous values then erase old values no more present
if (count($listnewvalues) > 0 && count($existingvalues) > 0) {
$this->_db->setQuery("DELETE FROM #__adsmanager_field_values \n\t\t\t\t\t\t\t WHERE fieldid = " . $this->fieldid . " \n\t\t\t\t\t AND fieldvalue NOT IN (" . implode(',', $listnewvalues) . ")");
$this->_db->query();
}
$field_catsid = $post['field_catsid'];
if (!is_array($field_catsid)) {
$field_catsid = array();
}
$field_catsid = "," . implode(',', $field_catsid) . ",";
if ($field_catsid != "") {
$query = "UPDATE #__adsmanager_fields SET catsid =" . $this->_db->Quote($field_catsid) . " WHERE fieldid=" . (int) $this->fieldid;
$this->_db->setQuery($query);
$this->_db->query();
//.........这里部分代码省略.........
示例8: getTablesCount
/**
* Returns a list of tables and the number of rows or null if the
* table does not exist
* @param $tables An array of table names without prefix
* @return array The list of tables
*/
public function getTablesCount($tables, $prefix)
{
$db = JFactory::getDbo();
$dbPrefix = $db->getPrefix();
foreach ($tables as $table => $value) {
$query = $db->getQuery('true');
if ($prefix) {
$query->select("COUNT(*)")->from($this->prefix . $table);
} else {
$query->select("COUNT(*)")->from($dbPrefix . $table);
}
$db->setQuery($query);
// Set legacy to false to be able to catch DB errors.
$legacyValue = JError::$legacy;
JError::$legacy = false;
try {
$tables[$table] = $db->loadResult();
// Don't count the root category
if ($table == "jem_categories") {
$tables[$table]--;
}
JError::$legacy = $legacyValue;
} catch (Exception $e) {
$tables[$table] = null;
JError::$legacy = $legacyValue;
}
}
return $tables;
}