本文整理汇总了PHP中F0FController::onBeforeBrowse方法的典型用法代码示例。如果您正苦于以下问题:PHP F0FController::onBeforeBrowse方法的具体用法?PHP F0FController::onBeforeBrowse怎么用?PHP F0FController::onBeforeBrowse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类F0FController
的用法示例。
在下文中一共展示了F0FController::onBeforeBrowse方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onBeforeBrowse
protected function onBeforeBrowse()
{
$db = JFactory::getDbo();
$config = J2Store::config();
$installation_complete = $config->get('installation_complete', 0);
if (!$installation_complete) {
//installation not completed
JFactory::getApplication()->redirect('index.php?option=com_j2store&view=postconfig');
}
//first check if the currency table has a default records at least.
$rows = F0FModel::getTmpInstance('Currencies', 'J2StoreModel')->enabled(1)->getList();
if (count($rows) < 1) {
//no records found. Dumb default data
F0FModel::getTmpInstance('Currencies', 'J2StoreModel')->create_currency_by_code('USD', 'USD');
}
//update schema
$dbInstaller = new F0FDatabaseInstaller(array('dbinstaller_directory' => JPATH_ADMINISTRATOR . '/components/com_j2store/sql/xml'));
$dbInstaller->updateSchema();
//update cart table
$cols = $db->getTableColumns('#__j2store_carts');
$cols_to_delete = array('product_id', 'vendor_id', 'variant_id', 'product_type', 'product_options', 'product_qty');
foreach ($cols_to_delete as $key) {
if (array_key_exists($key, $cols)) {
$db->setQuery('ALTER TABLE #__j2store_carts DROP COLUMN ' . $key);
try {
$db->execute();
} catch (Exception $e) {
echo $e->getMessage();
}
}
}
return parent::onBeforeBrowse();
}
示例2: onBeforeBrowse
public function onBeforeBrowse()
{
$result = parent::onBeforeBrowse();
if ($result) {
$params = JComponentHelper::getParams('com_akeeba');
$model = $this->getThisModel();
$view = $this->getThisView();
/** @var AkeebaModelCpanels $model */
$view->setModel($model);
$aeconfig = Factory::getConfiguration();
// Invalidate stale backups
Factory::resetState(array('global' => true, 'log' => false, 'maxrun' => $params->get('failure_timeout', 180)));
// Just in case the reset() loaded a stale configuration...
Platform::getInstance()->load_configuration();
// Let's make sure the temporary and output directories are set correctly and writable...
$wizmodel = F0FModel::getAnInstance('Confwiz', 'AkeebaModel');
$wizmodel->autofixDirectories();
// Check if we need to toggle the settings encryption feature
$model->checkSettingsEncryption();
// Update the magic component parameters
$model->updateMagicParameters();
// Run the automatic database check
$model->checkAndFixDatabase();
// Run the automatic update site refresh
/** @var AkeebaModelUpdates $updateModel */
$updateModel = F0FModel::getTmpInstance('Updates', 'AkeebaModel');
$updateModel->refreshUpdateSite();
}
return $result;
}
示例3: onBeforeBrowse
protected function onBeforeBrowse()
{
$result = parent::onBeforeBrowse();
if ($result) {
F0FModel::getTmpInstance('Cpanels', 'AkeebasubsModel')->checkAndFixDatabase()->saveMagicVariables();
// Run the automatic update site refresh
/** @var AkeebasubsModelUpdates $updateModel */
$updateModel = F0FModel::getTmpInstance('Updates', 'AkeebasubsModel');
$updateModel->refreshUpdateSite();
}
return $result;
}
示例4: onBeforeBrowse
public function onBeforeBrowse()
{
$result = parent::onBeforeBrowse();
if ($result) {
$params = JComponentHelper::getParams('com_akeeba');
$model = $this->getThisModel();
$view = $this->getThisView();
/** @var AkeebaModelCpanels $model */
$view->setModel($model);
$aeconfig = AEFactory::getConfiguration();
// Invalidate stale backups
AECoreKettenrad::reset(array('global' => true, 'log' => false, 'maxrun' => $params->get('failure_timeout', 180)));
// Just in case the reset() loaded a stale configuration...
AEPlatform::getInstance()->load_configuration();
// Let's make sure the temporary and output directories are set correctly and writable...
$wizmodel = F0FModel::getAnInstance('Confwiz', 'AkeebaModel');
$wizmodel->autofixDirectories();
// Check if we need to toggle the settings encryption feature
$model->checkSettingsEncryption();
// Update the magic component parameters
$model->updateMagicParameters();
// Run the automatic database check
$model->checkAndFixDatabase();
// Run the automatic update site refresh
/** @var AkeebaModelUpdates $updateModel */
$updateModel = F0FModel::getTmpInstance('Updates', 'AkeebaModel');
$updateModel->refreshUpdateSite();
// Check the last installed version and show the post-setup page on Joomla! 3.1 or earlier
if (!version_compare(JVERSION, '3.2.0', 'ge')) {
$versionLast = null;
if (file_exists(JPATH_COMPONENT_ADMINISTRATOR . '/akeeba.lastversion.php')) {
include_once JPATH_COMPONENT_ADMINISTRATOR . '/akeeba.lastversion.php';
if (defined('AKEEBA_LASTVERSIONCHECK')) {
$versionLast = AKEEBA_LASTVERSIONCHECK;
}
}
if (is_null($versionLast)) {
$component = JComponentHelper::getComponent('com_akeeba');
if (is_object($component->params) && $component->params instanceof JRegistry) {
$params = $component->params;
} else {
$params = new JParameter($component->params);
}
$versionLast = $params->get('lastversion', '');
}
if (version_compare(AKEEBA_VERSION, $versionLast, 'ne') || empty($versionLast)) {
$this->setRedirect('index.php?option=com_akeeba&view=postsetup');
return true;
}
}
}
return $result;
}
示例5: onBeforeBrowse
public function onBeforeBrowse()
{
// Do we have an affiliate code?
$affid = $this->input->getInt('affid', 0);
if ($affid) {
$session = JFactory::getSession();
$session->set('affid', $affid, 'com_akeebasubs');
}
$params = JFactory::getApplication()->getPageParameters();
$ids = $params->get('ids', '');
if (is_array($ids) && !empty($ids)) {
$ids = implode(',', $ids);
if ($ids === '0') {
$ids = '';
}
} else {
$ids = '';
}
// Working around Progressive Caching
$appInput = JFactory::getApplication()->input;
if (!empty($ids)) {
$appInput->set('ids', $ids);
$appInput->set('_x_userid', JFactory::getUser()->id);
}
/** @var AkeebasubsModelTaxhelper $taxHelper */
$taxHelper = F0FModel::getTmpInstance('Taxhelper', 'AkeebasubsModel');
$taxParameters = $taxHelper->getTaxDefiningParameters();
$appInput->set('_akeebasubs_taxParameters', $taxParameters);
$this->registerUrlParams(array('ids' => 'ARRAY', '_akeebasubs_taxParameters' => 'ARRAY', 'no_clear' => 'BOOL', '_x_userid' => 'INT', 'coupon' => 'STRING'));
// Save a possible coupon code in the session
$coupon = $this->input->getString('coupon');
if (!empty($coupon)) {
$session = JFactory::getSession();
$session->set('coupon', $coupon, 'com_akeebasubs');
}
// Continue parsing page options
if (parent::onBeforeBrowse()) {
$noClear = $this->input->getBool('no_clear', false);
if (!$noClear) {
$model = $this->getThisModel()->clearState()->clearInput()->savestate(0)->limit(0)->limitstart(0)->enabled(1)->only_once(1)->filter_order('ordering')->filter_order_Dir('ASC');
if (!empty($ids)) {
$model->id($ids);
}
}
$this->getThisModel()->access_user_id(JFactory::getUser()->id);
return true;
} else {
return false;
}
}
示例6: onBeforeBrowse
public function onBeforeBrowse()
{
$result = parent::onBeforeBrowse();
if ($result) {
$view = $this->getThisView();
$view->setModel($this->getThisModel(), true);
// Upgrade the database schema if necessary
$this->getThisModel()->checkAndFixDatabase();
// Migrate user data if necessary
$this->getThisModel()->autoMigrate();
// Refresh the update site definitions if required. Also takes into account any change of the Download ID
// in the Options.
/** @var AdmintoolsModelUpdates $updateModel */
$updateModel = F0FModel::getTmpInstance('Updates', 'AdmintoolsModel');
$updateModel->refreshUpdateSite();
// Is a Download ID needed but missing?
$needDLID = $this->getThisModel()->needsDownloadID();
$view->needsdlid = $needDLID;
// Check the last installed version and show the post-setup page on Joomla! 3.1 or earlier
if (!version_compare(JVERSION, '3.2.0', 'ge')) {
$versionLast = null;
if (file_exists(JPATH_COMPONENT_ADMINISTRATOR . '/admintools.lastversion.php')) {
include_once JPATH_COMPONENT_ADMINISTRATOR . '/admintools.lastversion.php';
if (defined('ADMINTOOLS_LASTVERSIONCHECK')) {
$versionLast = ADMINTOOLS_LASTVERSIONCHECK;
}
}
if (is_null($versionLast)) {
// FIX 2.1.13: Load the component parameters WITHOUT using JComponentHelper
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(array($db->quoteName('params')))->from($db->quoteName('#__extensions'))->where($db->quoteName('type') . ' = ' . $db->Quote('component'))->where($db->quoteName('element') . ' = ' . $db->Quote('com_admintools'));
$db->setQuery($query);
$rawparams = $db->loadResult();
$params = new JRegistry();
if (version_compare(JVERSION, '3.0', 'ge')) {
$params->loadString($rawparams, 'JSON');
} else {
$params->loadJSON($rawparams);
}
$versionLast = $params->get('lastversion', '');
}
if (version_compare(ADMINTOOLS_VERSION, $versionLast, 'ne') || empty($versionLast)) {
$this->setRedirect('index.php?option=com_admintools&view=postsetup');
return true;
}
}
}
return $result;
}
示例7: onBeforeBrowse
/**
* This runs before the browse() method. Return false to prevent executing
* the method.
*
* @return bool
*/
public function onBeforeBrowse()
{
$result = parent::onBeforeBrowse();
if ($result) {
// Get the current order by column
$orderby = $this->getThisModel()->getState('filter_order', '');
// If it's not one of the allowed columns, force it to be the "ordering" column
if (!in_array($orderby, array('todo_item_id', 'ordering', 'title', 'due'))) {
$orderby = 'ordering';
}
// Apply ordering and filter only the enabled items
$this->getThisModel()->filter_order($orderby)->enabled(1);
}
return $result;
}
示例8: onBeforeBrowse
/**
* ACL check before allowing someone to browse
*
* @return boolean True to allow the method to run
*/
protected function onBeforeBrowse()
{
if (parent::onBeforeBrowse()) {
jimport('joomla.filesystem.file');
//make sure we have a default.php template
$filename = 'default.php';
$tplpath = JPATH_ADMINISTRATOR . '/components/com_j2store/views/emailtemplate/tpls';
$defaultphp = $tplpath . '/default.php';
$defaulttpl = $tplpath . '/default.tpl';
if (!JFile::exists(JPath::clean($defaultphp))) {
//file does not exist. so we need to rename
JFile::copy($defaulttpl, $defaultphp);
}
return true;
}
return false;
}
示例9: onBeforeBrowse
public function onBeforeBrowse()
{
$result = parent::onBeforeBrowse();
if ($result) {
$view = $this->getThisView();
$view->setModel($this->getThisModel(), true);
// Upgrade the database schema if necessary
$this->getThisModel()->checkAndFixDatabase();
// Refresh the update site definitions if required. Also takes into account any change of the Download ID
// in the Options.
/** @var AdmintoolsModelUpdates $updateModel */
$updateModel = F0FModel::getTmpInstance('Updates', 'AdmintoolsModel');
$updateModel->refreshUpdateSite();
// Is a Download ID needed but missing?
$needDLID = $this->getThisModel()->needsDownloadID();
$view->needsdlid = $needDLID;
}
return $result;
}
示例10: onBeforeBrowse
public function onBeforeBrowse()
{
// Do we have an affiliate code?
$affid = $this->input->getInt('affid', 0);
if ($affid) {
$session = JFactory::getSession();
$session->set('affid', $affid, 'com_akeebasubs');
}
$params = JFactory::getApplication()->getPageParameters();
$ids = $params->get('ids', '');
if (is_array($ids) && !empty($ids)) {
$ids = implode(',', $ids);
if ($ids === '0') {
$ids = '';
}
} else {
$ids = '';
}
// Working around Progressive Caching
if (!empty($ids)) {
JFactory::getApplication()->input->set('ids', $ids);
JFactory::getApplication()->input->set('_x_userid', JFactory::getUser()->id);
$this->registerUrlParams(array('ids' => 'ARRAY', 'no_clear' => 'BOOL', '_x_userid' => 'INT'));
}
if (parent::onBeforeBrowse()) {
$noClear = $this->input->getBool('no_clear', false);
if (!$noClear) {
$model = $this->getThisModel()->clearState()->clearInput()->savestate(0)->limit(0)->limitstart(0)->enabled(1)->only_once(1)->filter_order('ordering')->filter_order_Dir('ASC');
if (!empty($ids)) {
$model->id($ids);
}
}
$this->getThisModel()->access_user_id(JFactory::getUser()->id);
return true;
} else {
return false;
}
}
示例11: onBeforeBrowse
protected function onBeforeBrowse()
{
return parent::onBeforeBrowse();
}