Exemplo n.º 1
0
 /**
  *
  */
 function displayMenu()
 {
     $this->legacy = KunenaMenuFix::getLegacy();
     $this->invalid = KunenaMenuFix::getInvalid();
     $this->setToolBarMenu();
     $this->display();
 }
Exemplo n.º 2
0
function kunena_upgrade_200_menu($parent)
{
    $legacy = KunenaMenuFix::getLegacy();
    $errors = KunenaMenuFix::fixLegacy();
    if (!empty($legacy)) {
        return array('action' => '', 'name' => JText::sprintf('COM_KUNENA_INSTALL_200_MENU', count($legacy)), 'success' => !$errors);
    }
}
function kunena_200_2012_04_13_menu($parent)
{
    $app = JFactory::getApplication();
    $legacy = KunenaMenuFix::getLegacy();
    $errors = KunenaMenuFix::fixLegacy();
    if ($errors) {
        foreach ($errors as $error) {
            $app->enqueueMessage($error, 'error');
        }
    }
    if (!empty($legacy)) {
        return array('action' => '', 'name' => JText::sprintf('COM_KUNENA_INSTALL_200_MENU', count($legacy)), 'success' => !$errors);
    }
    return null;
}
Exemplo n.º 4
0
 /**
  * Uninstall Kunena, run from Joomla installer.
  */
 public function uninstall()
 {
     $this->uninstallPlugin('kunena', 'alphauserpoints');
     $this->uninstallPlugin('kunena', 'community');
     $this->uninstallPlugin('kunena', 'comprofiler');
     $this->uninstallPlugin('kunena', 'gravatar');
     $this->uninstallPlugin('kunena', 'joomla');
     $this->uninstallPlugin('kunena', 'kunena');
     $this->uninstallPlugin('kunena', 'uddeim');
     $this->uninstallPlugin('finder', 'kunena');
     $this->uninstallPlugin('quickicon', 'kunena');
     $this->uninstallPlugin('system', 'kunena');
     $this->uninstallModule('mod_kunenamenu');
     // Remove all Kunena related menu items, including aliases
     if (class_exists('KunenaMenuFix')) {
         $items = KunenaMenuFix::getAll();
         foreach ($items as $item) {
             KunenaMenuFix::delete($item->id);
         }
     }
     $this->deleteMenu();
     return true;
 }
Exemplo n.º 5
0
 public function fixlegacy()
 {
     if (!JSession::checkToken('post')) {
         $this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
         $this->setRedirect(KunenaRoute::_($this->baseurl, false));
         return;
     }
     $legacy = KunenaMenuFix::getLegacy();
     $errors = KunenaMenuFix::fixLegacy();
     if ($errors) {
         $this->app->enqueueMessage(JText::sprintf('COM_KUNENA_MENU_FIXED_LEGACY_FAILED', $errors[0]), 'notice');
     } else {
         $this->app->enqueueMessage(JText::sprintf('COM_KUNENA_MENU_FIXED_LEGACY', count($legacy)));
     }
     $this->setRedirect(KunenaRoute::_($this->baseurl, false));
 }
Exemplo n.º 6
0
 /**
  *
  */
 protected static function build()
 {
     if (!isset(self::$structure)) {
         self::$structure = array();
         foreach (self::$items as $item) {
             if (!is_object($item)) {
                 continue;
             }
             $itemid = null;
             $view = null;
             if ($item->type == 'alias' && !empty($item->query['Itemid'])) {
                 $realitem = empty(self::$items[$item->query['Itemid']]) ? null : self::$items[$item->query['Itemid']];
                 if (is_object($realitem) && $realitem->type == 'component' && $realitem->component == 'com_kunena') {
                     $itemid = $item->query['Itemid'];
                     self::$aliases[$item->id] = $itemid;
                 } elseif (!$realitem) {
                     $itemid = 0;
                     self::$invalid[$item->id] = $itemid;
                 }
                 $view = 'alias';
             } elseif ($item->type == 'component' && $item->component == 'com_kunena') {
                 $itemid = $item->id;
                 $view = empty($item->query['view']) ? 'legacy' : $item->query['view'];
             }
             if ($itemid !== null && $view) {
                 $language = isset($item->language) ? strtolower($item->language) : '*';
                 $home = self::getHome($item);
                 self::$filtered[$item->id] = $itemid;
                 self::$same[$item->route][$item->id] = $item;
                 self::$structure[$language][$home ? $home->id : 0][$view][$item->id] = $itemid;
                 if (KunenaRouteLegacy::isLegacy($view)) {
                     self::$legacy[$item->id] = $item->id;
                 }
             }
         }
     }
 }
Exemplo n.º 7
0
 /**
  * Uninstall Kunena, run from Joomla installer.
  */
 public function uninstall()
 {
     // Put back file that was removed during installation.
     $contents = '';
     JFile::write(KPATH_ADMIN . '/install.php', $contents);
     // Uninstall all plugins.
     $this->uninstallPlugin('kunena', 'alphauserpoints');
     $this->uninstallPlugin('kunena', 'community');
     $this->uninstallPlugin('kunena', 'comprofiler');
     $this->uninstallPlugin('kunena', 'gravatar');
     $this->uninstallPlugin('kunena', 'joomla');
     $this->uninstallPlugin('kunena', 'kunena');
     $this->uninstallPlugin('kunena', 'uddeim');
     $this->uninstallPlugin('finder', 'kunena');
     // Uninstall menu module.
     $this->uninstallModule('mod_kunenamenu');
     // Remove all Kunena related menu items, including aliases
     if (class_exists('KunenaMenuFix')) {
         $items = KunenaMenuFix::getAll();
         foreach ($items as $item) {
             KunenaMenuFix::delete($item->id);
         }
     }
     $this->deleteMenu();
     return true;
 }
Exemplo n.º 8
0
 /**
  * Method to get all joomla menu details about kunena.
  *
  * @return    string
  * @since    1.6
  */
 protected function _getJoomlaMenuDetails()
 {
     $items = KunenaMenuFix::getAll();
     if (!empty($items)) {
         $joomlamenudetails = '[table][tr][td][u] ID [/u][/td][td][u] Name [/u][/td][td][u] Menutype [/u][/td][td][u] Link [/u][/td][td][u] Path [/u][/td][td][u] In trash [/u][/td][/tr] ';
         foreach ($items as $item) {
             $trashed = 'No';
             if ($item->published == '-2') {
                 $trashed = 'Yes';
             }
             $link = preg_replace('/^.*\\?(option=com_kunena&)?/', '', $item->link);
             $joomlamenudetails .= '[tr][td]' . $item->id . ' [/td][td] ' . $item->title . ' [/td][td] ' . $item->menutype . ' [/td][td] ' . $link . ' [/td][td] ' . $item->route . '[/td][td] ' . $trashed . '[/td][/tr] ';
         }
         $joomlamenudetails .= '[/table]';
     } else {
         $joomlamenudetails = "Menu items doesn't exists";
     }
     return $joomlamenudetails;
 }
Exemplo n.º 9
0
 /**
  * Method to get all joomla menu details about kunena.
  *
  * @return	string
  * @since	1.6
  */
 protected function _getJoomlaMenuDetails()
 {
     $items = KunenaMenuFix::getAll();
     $joomlamenudetails = '[table][tr][td][u] ID [/u][/td][td][u] Name [/u][/td][td][u] Menutype [/u][/td][td][u] Link [/u][/td][td][u] Path [/u][/td][/tr] ';
     foreach ($items as $item) {
         $link = preg_replace('/^.*\\?(option=com_kunena&)?/', '', $item->link);
         $joomlamenudetails .= '[tr][td]' . $item->id . ' [/td][td] ' . $item->title . ' [/td][td] ' . $item->menutype . ' [/td][td] ' . $link . ' [/td][td] ' . $item->route . '[/td][/tr] ';
     }
     $joomlamenudetails .= '[/table]';
     return $joomlamenudetails;
 }