Exemplo n.º 1
0
 /**
  * @param string $type
  * @param JInstallerComponent $adapter
  */
 function preflight($type, $adapter)
 {
     $path = $adapter->getParent()->getPath('source');
     $xmldest = $path . '/mobilejoomla.xml';
     $xmlsrc = $path . '/mobilejoomla.j2x.xml';
     if (JFile::exists($xmlsrc)) {
         if (JFile::exists($xmldest)) {
             JFile::delete($xmldest);
         }
         JFile::move($xmlsrc, $xmldest);
     }
     $adapter->getParent()->setPath('manifest', $xmldest);
 }
Exemplo n.º 2
0
 public function update()
 {
     $this->installtype = 'update';
     return parent::update();
 }
Exemplo n.º 3
0
 protected function save_category($data)
 {
     // Initialise variables;
     $dispatcher = JDispatcher::getInstance();
     $table = JTable::getInstance('category');
     $pk = !empty($data['id']) ? $data['id'] : 0;
     $isNew = true;
     // Include the content plugins for the on save events.
     JPluginHelper::importPlugin('content');
     // Load the row if saving an existing category.
     if ($pk > 0) {
         $table->load($pk);
         $isNew = false;
     }
     $data['parent_id'] = "";
     // This is a new category
     if ($isNew) {
         $table->setLocation($data['parent_id'], 'last-child');
     } elseif (!$isNew && $table->parent_id != $data['parent_id']) {
         $table->setLocation($data['parent_id'], 'last-child');
     }
     // Alter the title for save as copy
     if (!$isNew && $data['id'] == 0 && $table->parent_id == $data['parent_id']) {
         $m = null;
         $data['alias'] = '';
         if (preg_match('#\\((\\d+)\\)$#', $table->title, $m)) {
             $data['title'] = preg_replace('#\\(\\d+\\)$#', '(' . ($m[1] + 1) . ')', $table->title);
         } else {
             $data['title'] .= ' (2)';
         }
     }
     // Bind the data.
     if (!$table->bind($data)) {
         $this->parent->setError($table->getError());
         return false;
     }
     // Bind the rules.
     if (isset($data['rules'])) {
         $rules = new JAccessRules($data['rules']);
         $table->setRules($rules);
     }
     // Check the data.
     if (!$table->check()) {
         $this->parent->setError($table->getError());
         return false;
     }
     // Trigger the onContentBeforeSave event.
     $result = $dispatcher->trigger('onContentBeforeSave', array('com_category.category', &$table, $isNew));
     if (in_array(false, $result, true)) {
         $this->parent->setError($table->getError());
         return false;
     }
     // Store the data.
     if (!$table->store()) {
         $this->parent->setError($table->getError());
         return false;
     }
     // Trigger the onContentAfterSave event.
     $dispatcher->trigger('onContentAfterSave', array('com_category.category', &$table, $isNew));
     // Rebuild the tree path.
     if (!$table->rebuildPath($table->id)) {
         $this->parent->setError($table->getError());
         return false;
     }
     return true;
 }
Exemplo n.º 4
0
 public function install()
 {
     $result = parent::install();
     if ($result !== false) {
         $this->postInstall($result);
     }
     return $result;
 }
Exemplo n.º 5
0
 /**
  * Install the Editor Component
  * @return boolean
  */
 function installComponent()
 {
     $mainframe = JFactory::getApplication();
     $db = JFactory::getDBO();
     jimport('joomla.installer.installer');
     require_once JPATH_LIBRARIES . DS . 'joomla' . DS . 'installer' . DS . 'adapters' . DS . 'component.php';
     $installer = JInstaller::getInstance();
     $installer->setPath('source', dirname(dirname(__FILE__)));
     $component = new JInstallerComponent($installer, $db);
     $component->install();
     return $this->checkComponent();
 }