getActiveLocale(); $LANG = LocaleSvc::getCommonTranslator($locale,'setup'); switch ($TYPE) { case 'install': switch ($STEP) { case 1: echo '
'; echo $LANG->tr('inst_txt_db_will_create'); echo '
'; require(__DIR__.__DS__.'install-'.$VERSION.'.inc.php'); echo ''; echo $LANG->tr('link_install'); echo ''; break; case 2: $db = System::getInstance()->getDB(); $error = false; $db->isTransactionSupported() && $db->startTransaction(); echo ''; echo $LANG->tr('inst_txt_db_created'); echo '
'; try { require(__DIR__.__DS__.'install-'.$VERSION.'.inc.php'); $db->table('installinfos')->insert(array('type' => 'module', 'key' => $MOD, 'version' => $VERSION, 'attrib' => 0)); } catch (SQLException $sqlEx) { echo 'SQL ERROR: '.$sqlEx->getMessage().'
'; if (defined('DEBUG')) echo '
'.$sqlEx->getQuery().''; $error=true; } $db->isTransactionSupported() && (($error && $db->rollback()) || $db->commit()); echo ''; echo $LANG->tr('link_go_back_module'); echo ''; break; default: throw new BadFunctionCallException('Invalid step'); } break; case 'upgrade': switch ($STEP) { default: throw new BadFunctionCallException('Invalid step'); } break; case 'validate': switch ($STEP) { case 1: echo '
'; echo $LANG->tr('uinst_txt_db_will_remove'); echo '
'; require(__DIR__.__DS__.'remove-'.$VERSION.'.inc.php'); echo ''; echo $LANG->tr('link_uninstall'); echo ''; break; case 2: $db = System::getInstance()->getDB(); $error = false; $db->isTransactionSupported() && $db->startTransaction(); echo ''; echo $LANG->tr('uinst_txt_db_removed'); echo '
'; try { require(__DIR__.__DS__.'remove-'.$VERSION.'.inc.php'); $db->table('installinfos')->delete(array('type' => 'module', 'key' => $MOD)); } catch (SQLException $sqlEx) { echo 'SQL ERROR: '.$sqlEx->getMessage().'
'; if (defined('DEBUG')) echo '
'.$sqlEx->getQuery().''; $error=true; } $db->isTransactionSupported() && (($error && $db->rollback()) || $db->commit()); echo ''; echo $LANG->tr('link_go_back_module'); echo ''; break; default: throw new BadFunctionCallException('Invalid step'); } break; }