diff --git a/README b/README deleted file mode 100644 index e69de29..0000000 diff --git a/README.md b/README.md new file mode 100644 index 0000000..ec70e27 --- /dev/null +++ b/README.md @@ -0,0 +1,145 @@ +[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/2.0.0/active.svg)](https://github.com/xoopscube/xcl) +![License GPL](https://img.shields.io/badge/License-GPL-green) +![X-Updare Store](https://img.shields.io/badge/X--Update%20Store-Pending-red) + +## ///// — MultiMenu :: Custom Navigation Blocks + +![alt text](https://repository-images.githubusercontent.com/461634439/038a5641-d653-4d78-ba55-898667ae7d) + + +MODULE | MultiMenu +------------ | ------------- +Description | MultiMenu module allows you to display customized menus. +Render Engine| Smarty v2 and XCube Layout +Version | 2.3.1 +Author | Tom Hayakawa +Author | Update by @gigamaster Nuno Luciano (XCL7) +Copyright | 2005-2022 Authors +License | GPL + + +##### :computer: The Minimum Requirements + + + + Apache, Nginx, etc. PHP 7.2.x + MySQL 5.6, MariaDB InnoDB utf8 / utf8mb4 + XCL version 2.3.+ + + + +----- + +## Module MultiMenu v.2.3.+ + +Refactor code to XCL - PHP7 and MySQL ENGINE=InnoDB + +### Description + +multiMenu module allows you to display customized menus. +Original module by Solo, luinithil, Wolf and contributions by Domifara, Naoki Sawada, Naoki Okino, Nobunobu, Yoshi Sakai, Toshihiro Takehara (aka nouphet). + +### Setting matching methods + +The following methods describe the logic of MultiMenu links management on the UI screen. + +#### Specify URL with full path as usual + +**Example**: https://github.com/xoopscube/xcl + +#### Specification by module name +[Module_name] +[Module_name]xxxx.php?xxxx=xxxx + +**Example:** + +Link ==>[news] +Title ==> News +↓ +Display: News + +**Example:** + +Link ==> [news]article.php?storyid=11 +Title ==> Important news +↓ +Display: Important news + + +#### Always show submenu + ++[module_name] ++[module_name]xxxx.php?xxxx=xxxx + +**Example:** + +Link ==> +[news] +Title ==> News +↓ +Display: (Always displayed) + News + News post + Archive + +**Example:** +Link ==> @[news]article.php?storyid=11 +Title ==> Important news +↓ +Display: (Always displayed) +Important news +News post +Archive + +#### Display the submenu only with module +when the corresponding module is displayed (same operation as the main menu) + +@[Module_name] +@[Module_name]xxxx.php?xxxx=xxxx + +**Example:** +Link ==> @[news] +Title ==> News +↓ +Display: (Normal) +News +↓ +Display: (when the corresponding module is displayed) +News +News post +Archive + +**Example:** +Link ==> @[news]article.php?storyid=11 +Title ==> Important news +↓ +Display: (Normal) +Important news +↓ +Display: (when the corresponding module is displayed) +Important news +News post +Archive + +#### Show as custom submenu +-[Module_name] +-[Module_name]xxxx.php?xxxx=xxxx +-https://github.com/xoopscube/xcl + +Links that start with a sign are added to submenus of menus that have links that do not start with a-sign. +The way the sub menu is displayed changes depending on the attributes of the parent menu, as shown in the examples. +If displayed at the same time as the submenu, a custom submenu will be added to the bottom of the module submenu. + +### Changelog + +[refactor code] +v.2.30 PHP7 and MySQL ENGINE=InnoDB for XCL + +[Update] +v1.20 + * Rewritten exclusively for XOOPS Cube Legacy 2.1.x + * Improvement of security (POST foreach deployment is abolished) + * Supports PHP5 only + * Fixed to work without system module + * HTTP_POST_VARS deprecated + * Change block template file name + * Fixed block management not working diff --git a/html/modules/multiMenu/admin/admin_action.php b/html/modules/multiMenu/admin/admin_action.php index 75f9908..9813c88 100644 --- a/html/modules/multiMenu/admin/admin_action.php +++ b/html/modules/multiMenu/admin/admin_action.php @@ -1,30 +1,40 @@ mContext->mRequest->getRequest('op') ; -$op = empty($op) ? '' : $op; -$class = new multimenu($menu_num); +if ( ! defined( 'XOOPS_ROOT_PATH' ) ) { + exit(); +} + +$root = XCube_Root::getSingleton(); +$op = $root->mContext->mRequest->getRequest( 'op' ); +$op = empty( $op ) ? '' : $op; +$class = new multimenu( $menu_num ); -switch($op) { - case "new": - $class->im_admin_new(); - break; - case "edit": - $class->im_admin_edit(); - break; - case "update": - $class->im_admin_update(); - break; - case "del": - $class->im_admin_del(); - break; - case "move": - $class->im_admin_move(); - $class->im_admin_list(); - break; - default: - $class->im_admin_list(); - break; +switch ( $op ) { + case "new": + $class->im_admin_new(); + break; + case "edit": + $class->im_admin_edit(); + break; + case "update": + $class->im_admin_update(); + break; + case "del": + $class->im_admin_del(); + break; + case "move": + $class->im_admin_move(); + $class->im_admin_list(); + break; + default: + $class->im_admin_list(); + break; } -?> \ No newline at end of file diff --git a/html/modules/multiMenu/admin/admin_function.php b/html/modules/multiMenu/admin/admin_function.php index 8371b0d..6346377 100644 --- a/html/modules/multiMenu/admin/admin_function.php +++ b/html/modules/multiMenu/admin/admin_function.php @@ -1,322 +1,345 @@ root = XCube_Root::getSingleton(); - $this->mnum = $menu_num; - $this->db = XoopsDatabaseFactory::getDatabaseConnection(); - } - public function mm_admin_menu($currentoption=0, $breadcrumb=""){ - $tblColors=Array(); - $tblColors[0] = $tblColors[1] = $tblColors[2] = $tblColors[3] = $tblColors[4] = $tblColors[5] = $tblColors[6] = $tblColors[7] = $tblColors[8] = $tblColors[99] = '#DDE'; - $tblColors[$currentoption] = 'white'; - echo '
- '.$this->root->mContext->mModule->mXoopsModule->getShow('name').' : '.$breadcrumb.' -

'; -/* - echo ''; -*/ - echo ''; - - echo '
'; - } - private function im_admin_clean(){ - global $xoopsDB; - $i=0; - $db = $xoopsDB->prefix( "multimenu".$this->menu_num ); - $result = $xoopsDB->query("SELECT id FROM ".$db." ORDER BY weight ASC"); - while (list($id) = $xoopsDB->fetchrow($result)) { - $xoopsDB->queryF("UPDATE ".$db." SET weight='$i' WHERE id=$id"); - $i++; - } - } - public function im_admin_list(){ - xoops_cp_header(); - $this->mm_admin_menu(intval($this->mnum), _AD_MULTIMENU_ADMIN.$this->mnum ); - - echo '
'. _AD_MULTIMENU_ADMIN . $this->mnum . ''; - echo '
- - - - - '; - - $modhand = xoops_getmodulehandler('menu'); - $modhand->setTable($this->mnum); - $mCriteria = new CriteriaCompo(); - $mCriteria->addSort('weight'); - $modhand->im_admin_clean(); - $objcts = $modhand->getObjects($mCriteria); - $class = 'even'; - foreach ( $objcts as $obj ) { - if ($obj->get('weight') != 0) { - $moveup = "["._AD_MULTIMENU_UP."]"; - } else { - $moveup = "["._AD_MULTIMENU_UP."]"; - } - if ($obj->get('weight') != (count($objcts) - 1)) { - $movedown = "["._AD_MULTIMENU_DOWN."]"; - } else { - $movedown = "["._AD_MULTIMENU_DOWN."]"; - } -//fix by domifara Notice [PHP]: Undefined variable: status - $status = $obj->get('hide')? _YES :_NO ; - echo " - +/** + * @package Multimenu + * @version 2.3.1 + * @author Gigamaster, 2020 XCL PHP7 + * @author Domifara + * @author Tom Hayakawa + * @copyright Copyright 2005-2021 XOOPSCube Project + * @license https://github.com/xoopscube/xcl/blob/master/docs/GPL_V2.txt + */ + +if ( ! defined( 'XOOPS_ROOT_PATH' ) ) { + exit(); +} + +class multimenu { + + private $mnum; + + private $db; + + private $root; + + public $menu_num; + + public function __construct( $menu_num = '01' ) { + + $this->root = XCube_Root::getSingleton(); + $this->mnum = $menu_num; + $this->db = XoopsDatabaseFactory::getDatabaseConnection(); + } + + public function mm_admin_menu( $currentoption = 0, $breadcrumb = "" ) { + $tblColors = array(); + $tblColors[0] = $tblColors[1] = $tblColors[2] = $tblColors[3] = $tblColors[4] = $tblColors[5] = $tblColors[6] = $tblColors[7] = $tblColors[8] = $tblColors[99] = 'unselected'; + $tblColors[ $currentoption ] = 'selected'; + + echo '
'._AD_MULTIMENU_TITLE.''._AD_MULTIMENU_HIDE.''._AD_MULTIMENU_LINK.''._AD_MULTIMENU_OPERATION.'
".$obj->get('title')."
+
+ ' . $this->root->mContext->mModule->mXoopsModule->getShow( 'name' ) . ' : ' . $breadcrumb . ' +

'; + + echo ''; + } + + private function im_admin_clean() { + global $xoopsDB; + $i = 0; + $db = $xoopsDB->prefix( "multimenu" . $this->menu_num ); + $result = $xoopsDB->query( "SELECT id FROM " . $db . " ORDER BY weight ASC" ); + while ( list( $id ) = $xoopsDB->fetchrow( $result ) ) { + $xoopsDB->queryF( "UPDATE " . $db . " SET weight='$i' WHERE id=$id" ); + $i ++; + } + } + + public function im_admin_list() { + xoops_cp_header(); + $this->mm_admin_menu( (int) $this->mnum, _AD_MULTIMENU_ADMIN . $this->mnum ); + + echo '

' . _AD_MULTIMENU_ADMIN . $this->mnum . '

'; + echo ' + + + + + + + '; + + $modhand = xoops_getmodulehandler( 'menu' ); + $modhand->setTable( $this->mnum ); + $mCriteria = new CriteriaCompo(); + $mCriteria->addSort( 'weight' ); + $modhand->im_admin_clean(); + $objcts = $modhand->getObjects( $mCriteria ); + $class = 'even'; + +// XCL admin action icons by gigamaster + $mIconView = ''. _NO.''; + $mIconViewNo = ''. _YES.''; + + $mIconEdit = '' . _EDIT . ''; + $mIconDown = '' . _AD_MULTIMENU_DOWN . ''; + $mIconUp = '' . _AD_MULTIMENU_UP . ''; + $mIconDelete = '' . _DELETE . ''; + + + foreach ( $objcts as $obj ) { + if ( $obj->get( 'weight' ) != 0 ) { + $moveup = "$mIconUp"; + } else { + $moveup = "$mIconUp"; + } + if ( $obj->get( 'weight' ) != ( count( $objcts ) - 1 ) ) { + $movedown = "$mIconDown"; + } else { + $movedown = "$mIconDown"; + } + // fix by domifara Notice [PHP]: Undefined variable: status + // XCL admin action icons by gigamaster + // $status = $obj->get( 'hide' ) ? _YES : _NO; + $status = $obj->get( 'hide' ) ? $mIconViewNo : $mIconView; + + echo " + - - "; - $class = ($class == 'odd') ? 'even' : 'odd'; - } - echo " + "; + $class = ( $class == 'odd' ) ? 'even' : 'odd'; + } + + echo "
' . _AD_MULTIMENU_TITLE . '' . _AD_MULTIMENU_HIDE . '' . _AD_MULTIMENU_LINK . '' . _AD_MULTIMENU_OPERATION . '
" . $obj->get( 'title' ) . " $status".$obj->get('link')."["._DELETE."] - ["._EDIT."]".$moveup.$movedown."
"; -// echo $GLOBALS['xoopsSecurity']->getTokenHTML(); - echo $GLOBALS['xoopsGTicket']->getTicketHtml( __LINE__ ); - echo " + " . $obj->get( 'link' ) . " + $mIconEdit + " . $moveup . $movedown . " + $mIconDelete + +
"; + + echo $GLOBALS['xoopsGTicket']->getTicketHtml( __LINE__ ); + //echo " + echo "
"; - echo "

"; - xoops_cp_footer(); - } - public function im_admin_new() { - if ( ! $GLOBALS['xoopsGTicket']->check() ) { - redirect_header('index.php',3,$GLOBALS['xoopsGTicket']->getErrors()); + + xoops_cp_footer(); } - global $xoopsDB; - xoops_cp_header(); - $this->mm_admin_menu(intval($this->mnum), _AD_MULTIMENU_ADMIN.$this->mnum ); - echo "
". _AD_MULTIMENU_ADMIN . $this->mnum . ""; - - $id = 0; - $title = ''; - $link = ''; - $hide = ''; - $weight = 255; - $target = "_self"; - $member_handler = xoops_gethandler('member'); - $xoopsgroups = $member_handler->getGroups(); - $count = count($xoopsgroups); - $groups = array(); - for ($i = 0; $i < $count; $i++) $groups[] = $xoopsgroups[$i]->getVar('groupid'); - include XOOPS_ROOT_PATH."/class/xoopsformloader.php"; - $form = new XoopsThemeForm(_AD_MULTIMENU_NEWIMENU, "newform", "index.php?mnum=".$this->mnum); - - $formtitle = new XoopsFormText(_AD_MULTIMENU_TITLE, "title", 50, 150, ""); - $formlink = new XoopsFormText(_AD_MULTIMENU_LINK, "link", 50, 255, ""); - $formhide = new XoopsFormSelect(_AD_MULTIMENU_HIDE, "hide", ""); - $formhide->addOption("0", _NO); - $formhide->addOption("1", _YES); - $formtarget = new XoopsFormSelect(_AD_MULTIMENU_TARGET, "target", "_self"); - $formtarget->addOption("_self", _AD_MULTIMENU_TARG_SELF); - $formtarget->addOption("_blank", _AD_MULTIMENU_TARG_BLANK); - $formtarget->addOption("_parent", _AD_MULTIMENU_TARG_PARENT); - $formtarget->addOption("_top", _AD_MULTIMENU_TARG_TOP); - $formgroups = new XoopsFormSelectGroup(_AD_MULTIMENU_GROUPS, "groups", true, $groups, 5, true); - $submit_button = new XoopsFormButton("", "submit", _AD_MULTIMENU_SUBMIT, "submit"); - - $form->addElement($formtitle, true); - $form->addElement($formlink, false); - $form->addElement($formhide); - $form->addElement($formtarget); - $form->addElement($formgroups); - $form->addElement(new XoopsFormHidden("id", 0)); - $form->addElement(new XoopsFormHidden("op", "update")); - $form->addElement($submit_button); + + public function im_admin_new() { + if ( ! $GLOBALS['xoopsGTicket']->check() ) { + redirect_header( 'index.php', 3, $GLOBALS['xoopsGTicket']->getErrors() ); + } + global $xoopsDB; + xoops_cp_header(); + $this->mm_admin_menu( (int) $this->mnum, _AD_MULTIMENU_ADMIN . $this->mnum ); + echo "

" . _AD_MULTIMENU_ADMIN . $this->mnum . "

"; + + $id = 0; + $title = ''; + $link = ''; + $hide = ''; + $weight = 191; + $target = "_self"; + $member_handler = xoops_gethandler( 'member' ); + $xoopsgroups = $member_handler->getGroups(); + $count = count( $xoopsgroups ); + $groups = array(); + for ( $i = 0; $i < $count; $i ++ ) { + $groups[] = $xoopsgroups[ $i ]->getVar( 'groupid' ); + } + include XOOPS_ROOT_PATH . "/class/xoopsformloader.php"; + $form = new XoopsThemeForm( _AD_MULTIMENU_NEWIMENU, "newform", "index.php?mnum=" . $this->mnum ); + + $formtitle = new XoopsFormText( _AD_MULTIMENU_TITLE, "title", 50, 150, "" ); + $formlink = new XoopsFormText( _AD_MULTIMENU_LINK, "link", 50, 191, "" ); + $formhide = new XoopsFormSelect( _AD_MULTIMENU_HIDE, "hide", "" ); + $formhide->addOption( "0", _NO ); + $formhide->addOption( "1", _YES ); + $formtarget = new XoopsFormSelect( _AD_MULTIMENU_TARGET, "target", "_self" ); + $formtarget->addOption( "_self", _AD_MULTIMENU_TARG_SELF ); + $formtarget->addOption( "_blank", _AD_MULTIMENU_TARG_BLANK ); + $formtarget->addOption( "_parent", _AD_MULTIMENU_TARG_PARENT ); + $formtarget->addOption( "_top", _AD_MULTIMENU_TARG_TOP ); + $formgroups = new XoopsFormSelectGroup( _AD_MULTIMENU_GROUPS, "groups", true, $groups, 5, true ); + $submit_button = new XoopsFormButton( "", "submit", _AD_MULTIMENU_SUBMIT, "submit" ); + + $form->addElement( $formtitle, true ); + $form->addElement( $formlink, false ); + $form->addElement( $formhide ); + $form->addElement( $formtarget ); + $form->addElement( $formgroups ); + + $formHiddenID = new XoopsFormHidden( "id", 0 ); + $form->addElement( $formHiddenID ); + + $formHiddenOP = new XoopsFormHidden( "op", "update" ); + $form->addElement( $formHiddenOP ); + + $form->addElement( $submit_button ); //for gticket by domifara - $GLOBALS['xoopsGTicket']->addTicketXoopsFormElement( $form , __LINE__ ) ; - - $form->display(); - echo "

"; - xoops_cp_footer(); - } -/* - private function im_admin_update_flow(&$obj){ - $block_id = isset($_POST['block_id']) ? intval($_POST['block_id']) : 0; - $parent_id = isset($_POST['parent_id']) ? intval($_POST['parent_id']) : 0; - $title = isset($_POST['title']) ? $_POST['title'] : 'NoTitle'; - $link = isset($_POST['link']) ? $_POST['link'] : 'http://www.google.co.jp/'; - $hide = empty($_POST['hide']) ? 0 : 1; - $groups = isset($_POST['groups']) ? $_POST['groups'] : ''; - $groups = (is_array($groups)) ? implode(" ", $groups) : ''; - $target = isset($_POST['target']) ? $_POST['target'] : '_self'; - - $obj->set('block_id', $block_id); - $obj->set('parent_id', $parent_id); - $obj->set('title', $title); - $obj->set('hide', $hide); - $obj->set('link', $link); - $obj->set('weight', 255); - $obj->set('target', $target); - $obj->set('groups', $groups); - } -*/ - private function im_admin_update_menu(&$obj){ - $title = isset($_POST['title']) ? $this->root->mContext->mRequest->getRequest('title') : 'NoTitle'; - $link = isset($_POST['link']) ? $this->root->mContext->mRequest->getRequest('link') : 'http://www.google.co.jp/'; - $hide = empty($_POST['hide']) ? 0 : 1; - $groups = isset($_POST['groups']) ? $this->root->mContext->mRequest->getRequest('groups') : ''; - $groups = (is_array($groups)) ? implode(" ", array_map( 'intval' , $groups ) ) : ''; - $target = isset($_POST['target']) ? $this->root->mContext->mRequest->getRequest('target') : '_self'; - //$obj->set('id', $id); - $obj->set('title', $title); - $obj->set('hide', $hide); - $obj->set('link', $link); - $obj->set('target', $target); - $obj->set('groups', $groups); - } - public function im_admin_update(){ - if ( ! $GLOBALS['xoopsGTicket']->check() ) { - redirect_header('index.php',3,$GLOBALS['xoopsGTicket']->getErrors()); + $GLOBALS['xoopsGTicket']->addTicketXoopsFormElement( $form, __LINE__ ); + + $form->display(); + + xoops_cp_footer(); + } + + private function im_admin_update_menu( &$obj ) { + $title = isset( $_POST['title'] ) ? $this->root->mContext->mRequest->getRequest( 'title' ) : 'NoTitle'; + $link = isset( $_POST['link'] ) ? $this->root->mContext->mRequest->getRequest( 'link' ) : 'https://github.com/xoopscube/xcl'; + $hide = empty( $_POST['hide'] ) ? 0 : 1; + $groups = isset( $_POST['groups'] ) ? $this->root->mContext->mRequest->getRequest( 'groups' ) : ''; + $groups = ( is_array( $groups ) ) ? implode( " ", array_map( 'intval', $groups ) ) : ''; + $target = isset( $_POST['target'] ) ? $this->root->mContext->mRequest->getRequest( 'target' ) : '_self'; + //$obj->set('id', $id); + $obj->set( 'title', $title ); + $obj->set( 'hide', $hide ); + $obj->set( 'link', $link ); + $obj->set( 'target', $target ); + $obj->set( 'groups', $groups ); + } + + public function im_admin_update() { + if ( ! $GLOBALS['xoopsGTicket']->check() ) { + redirect_header( 'index.php', 3, $GLOBALS['xoopsGTicket']->getErrors() ); + } + $modhand = xoops_getmodulehandler( 'menu' ); + $modhand->setTable( $this->mnum ); + $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; + if ( $id == 0 ) { + $obj = $modhand->create(); + } else { + $obj = $modhand->get( $id ); + } + $this->im_admin_update_menu( $obj ); + $success = $modhand->insert( $obj ); + if ( ! $success ) { + redirect_header( "index.php?mnum=" . $this->mnum, 2, _AD_MULTIMENU_UPDATED ); + } else { + $modhand->im_admin_clean(); + redirect_header( "index.php?mnum=" . $this->mnum, 2, _AD_MULTIMENU_UPDATED ); + } + exit(); } - $modhand = xoops_getmodulehandler('menu'); - $modhand->setTable($this->mnum); - $id = isset($_POST['id']) ? intval($_POST['id']) : 0; - if ( $id == 0 ) { - $obj = $modhand->create(); - } else { - $obj = $modhand->get($id); - } - $this->im_admin_update_menu($obj); - $success = $modhand->insert($obj); - if ( !$success ) { - redirect_header("index.php?mnum=".$this->mnum,2,_AD_MULTIMENU_UPDATED); - }else { - $modhand->im_admin_clean(); - redirect_header("index.php?mnum=".$this->mnum,2,_AD_MULTIMENU_UPDATED); - } - exit(); - } - public function im_admin_edit () { - xoops_cp_header(); - $this->mm_admin_menu(intval($this->mnum), _AD_MULTIMENU_ADMIN.$this->mnum ); - echo "
". _AD_MULTIMENU_ADMIN . $this->mnum . ""; - - $id = isset($_GET['id']) ? intval($_GET['id']) : 0; - $modhand = xoops_getmodulehandler('menu'); - $modhand->setTable($this->mnum); - $obj = $modhand->get($id); - - $groups = explode(" ", $obj->get('groups')); - include XOOPS_ROOT_PATH."/class/xoopsformloader.php"; - $form = new XoopsThemeForm(_AD_MULTIMENU_EDITIMENU, "editform", "index.php?mnum=".$this->mnum); - $formtitle = new XoopsFormText(_AD_MULTIMENU_TITLE, "title", 50, 150, $obj->get('title')); - $formlink = new XoopsFormText(_AD_MULTIMENU_LINK, "link", 50, 255, $obj->get('link')); - /* - * for future reqest - if ($this->mnum=="99"){ - $block_id = new XoopsFormText(_AD_MULTIMENU_BLOCKID , "block_id" , 5, 5, $obj->get('block_id')); - $parent_id = new XoopsFormText(_AD_MULTIMENU_PARENTID, "parent_id", 5, 5, $obj->get('parent_id')); - } - */ - $formhide = new XoopsFormSelect(_AD_MULTIMENU_HIDE, "hide", $obj->get('hide')); - $formhide->addOption("0", _NO); - $formhide->addOption("1", _YES); - $formtarget = new XoopsFormSelect(_AD_MULTIMENU_TARGET, "target", $obj->get('target')); - $formtarget->addOption("_self", _AD_MULTIMENU_TARG_SELF); - $formtarget->addOption("_blank", _AD_MULTIMENU_TARG_BLANK); - $formtarget->addOption("_parent", _AD_MULTIMENU_TARG_PARENT); - $formtarget->addOption("_top", _AD_MULTIMENU_TARG_TOP); - $formgroups = new XoopsFormSelectGroup(_AD_MULTIMENU_GROUPS, "groups", true, $groups, 5, true); - $submit_button = new XoopsFormButton("", "submit", _AD_MULTIMENU_SUBMIT, "submit"); - - $form->addElement($formtitle, true); - $form->addElement($formlink, false); - $form->addElement($block_id, false); - $form->addElement($parent_id, false); - $form->addElement($formhide); - $form->addElement($formtarget); - $form->addElement($formgroups); - $form->addElement(new XoopsFormHidden("id", $id)); - $form->addElement(new XoopsFormHidden("op", "update")); - $form->addElement($submit_button); + + public function im_admin_edit() { + xoops_cp_header(); + $this->mm_admin_menu( (int) $this->mnum, _AD_MULTIMENU_ADMIN . $this->mnum ); + echo "

" . _AD_MULTIMENU_ADMIN . $this->mnum . "

"; + + $id = isset( $_GET['id'] ) ? (int) $_GET['id'] : 0; + $modhand = xoops_getmodulehandler( 'menu' ); + $modhand->setTable( $this->mnum ); + $obj = $modhand->get( $id ); + + $groups = explode( " ", $obj->get( 'groups' ) ); + include XOOPS_ROOT_PATH . "/class/xoopsformloader.php"; + $form = new XoopsThemeForm( _AD_MULTIMENU_EDITIMENU, "editform", "index.php?mnum=" . $this->mnum ); + $formtitle = new XoopsFormText( _AD_MULTIMENU_TITLE, "title", 50, 150, $obj->get( 'title' ) ); + $formlink = new XoopsFormText( _AD_MULTIMENU_LINK, "link", 50, 191, $obj->get( 'link' ) ); + /* + * for future request + if ($this->mnum=="99"){ + $block_id = new XoopsFormText(_AD_MULTIMENU_BLOCKID , "block_id" , 5, 5, $obj->get('block_id')); + $parent_id = new XoopsFormText(_AD_MULTIMENU_PARENTID, "parent_id", 5, 5, $obj->get('parent_id')); + } + */ + $formhide = new XoopsFormSelect( _AD_MULTIMENU_HIDE, "hide", $obj->get( 'hide' ) ); + $formhide->addOption( "0", _NO ); + $formhide->addOption( "1", _YES ); + $formtarget = new XoopsFormSelect( _AD_MULTIMENU_TARGET, "target", $obj->get( 'target' ) ); + $formtarget->addOption( "_self", _AD_MULTIMENU_TARG_SELF ); + $formtarget->addOption( "_blank", _AD_MULTIMENU_TARG_BLANK ); + $formtarget->addOption( "_parent", _AD_MULTIMENU_TARG_PARENT ); + $formtarget->addOption( "_top", _AD_MULTIMENU_TARG_TOP ); + $formgroups = new XoopsFormSelectGroup( _AD_MULTIMENU_GROUPS, "groups", true, $groups, 5, true ); + $submit_button = new XoopsFormButton( "", "submit", _AD_MULTIMENU_SUBMIT, "submit" ); + //$cancel_button = new XoopsFormButton( "", "cancel", _AD_MULTIMENU_CANCEL, "cancel" ); + + $form->addElement( $formtitle, true ); + $form->addElement( $formlink, false ); + $form->addElement( $block_id, false ); + $form->addElement( $parent_id, false ); + $form->addElement( $formhide ); + $form->addElement( $formtarget ); + $form->addElement( $formgroups ); + + $formHiddenID = new XoopsFormHidden( "id", $id ); + $form->addElement( $formHiddenID ); + + $formHiddenOP = new XoopsFormHidden( "op", "update" ); + $form->addElement( $formHiddenOP ); + + $form->addElement( $submit_button ); + //$form->addElement( $cancel_button ); //for gticket by domifara - $GLOBALS['xoopsGTicket']->addTicketXoopsFormElement( $form , __LINE__ ) ; + $GLOBALS['xoopsGTicket']->addTicketXoopsFormElement( $form, __LINE__ ); - $form->display(); - echo "

"; - xoops_cp_footer(); - } - public function im_admin_del () { - $del = isset($_POST['del']) ? 1 : 0; - $id = isset($_GET['id']) ? intval($_GET['id']) : 0; + $form->display(); - if ( $del == 1 ) { - if ( ! $GLOBALS['xoopsGTicket']->check() ) { - redirect_header('index.php',3,$GLOBALS['xoopsGTicket']->getErrors()); + xoops_cp_footer(); + } + + public function im_admin_del() { + $del = isset( $_POST['del'] ) ? 1 : 0; + $id = isset( $_GET['id'] ) ? (int) $_GET['id'] : 0; + + if ( $del == 1 ) { + if ( ! $GLOBALS['xoopsGTicket']->check() ) { + redirect_header( 'index.php', 3, $GLOBALS['xoopsGTicket']->getErrors() ); + } + $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : $id; + $modhand = xoops_getmodulehandler( 'menu' ); + $modhand->setTable( $this->mnum ); + $obj = $modhand->get( $id ); + + if ( $modhand->delete( $obj ) ) { + $modhand->im_admin_clean( $this->mnum ); + redirect_header( "index.php?mnum=" . $this->mnum, 2, _AD_MULTIMENU_UPDATED ); + } else { + redirect_header( "index.php?mnum=" . $this->mnum, 2, _AD_MULTIMENU_NOTUPDATED ); + } + exit(); + } else { + xoops_cp_header(); + echo "

" . _AD_MULTIMENU_ADMIN . $this->mnum . "

"; + xoops_confirm( array( + 'op' => 'del', + 'id' => $id, + 'del' => 1 + ) + $GLOBALS['xoopsGTicket']->getTicketArray( __LINE__ ), 'index.php?op=del&mnum=' . $this->mnum, _AD_MULTIMENU_SUREDELETE ); + xoops_cp_footer(); } - $id = isset($_POST['id']) ? intval($_POST['id']) : $id; - $modhand = xoops_getmodulehandler('menu'); - $modhand->setTable($this->mnum); - $obj = $modhand->get($id); - - if ( $modhand->delete($obj) ) { - $modhand->im_admin_clean($this->mnum); - redirect_header("index.php?mnum=".$this->mnum, 2, _AD_MULTIMENU_UPDATED); - } else { - redirect_header("index.php?mnum=".$this->mnum, 2, _AD_MULTIMENU_NOTUPDATED); - } - exit(); - } else { - xoops_cp_header(); - echo "

"._AD_MULTIMENU_ADMIN.$this->mnum."

"; - xoops_confirm(array('op' => 'del', 'id' => $id, 'del' => 1) + $GLOBALS['xoopsGTicket']->getTicketArray( __LINE__ ), 'index.php?op=del&mnum='.$this->mnum, _AD_MULTIMENU_SUREDELETE); - xoops_cp_footer(); - } - } - public function im_admin_move () { - $id = isset($_GET['id']) ? intval($_GET['id']) : 0; - $weight = isset($_GET['weight']) ? intval($_GET['weight']) : 0; - $db = $this->db->prefix( "multimenu".$this->mnum ); - $this->db->queryF("UPDATE `".$db."` SET `weight` = `weight` + 1 WHERE `weight` >= ".$weight." AND `id` <> ".$id); - $this->db->queryF("UPDATE `".$db."` SET `weight` = ".$weight." WHERE `id` = ".$id); - $modhand = xoops_getmodulehandler('menu'); - $modhand->im_admin_clean($this->mnum); - } + } + + public function im_admin_move() { + $id = isset( $_GET['id'] ) ? (int) $_GET['id'] : 0; + $weight = isset( $_GET['weight'] ) ? (int) $_GET['weight'] : 0; + $db = $this->db->prefix( "multimenu" . $this->mnum ); + $this->db->queryF( "UPDATE `" . $db . "` SET `weight` = `weight` + 1 WHERE `weight` >= " . $weight . " AND `id` <> " . $id ); + $this->db->queryF( "UPDATE `" . $db . "` SET `weight` = " . $weight . " WHERE `id` = " . $id ); + $modhand = xoops_getmodulehandler( 'menu' ); + $modhand->im_admin_clean( $this->mnum ); + } } -?> \ No newline at end of file + diff --git a/html/modules/multiMenu/admin/index.php b/html/modules/multiMenu/admin/index.php index 9272783..d7df9c9 100644 --- a/html/modules/multiMenu/admin/index.php +++ b/html/modules/multiMenu/admin/index.php @@ -1,9 +1,8 @@ \ No newline at end of file diff --git a/html/modules/multiMenu/admin/menu.php b/html/modules/multiMenu/admin/menu.php index 3939598..b578f04 100644 --- a/html/modules/multiMenu/admin/menu.php +++ b/html/modules/multiMenu/admin/menu.php @@ -1,28 +1,36 @@ \ No newline at end of file +$adminmenu[9]['link'] = "admin/myblocksadmin.php"; diff --git a/html/modules/multiMenu/admin/myblocksadmin.php b/html/modules/multiMenu/admin/myblocksadmin.php index 631a09d..51be22f 100644 --- a/html/modules/multiMenu/admin/myblocksadmin.php +++ b/html/modules/multiMenu/admin/myblocksadmin.php @@ -1,71 +1,72 @@ // -// ------------------------------------------------------------------------- // - -include_once( '../../../include/cp_header.php' ) ; -include_once( 'mygrouppermform.php' ) ; -include_once( XOOPS_ROOT_PATH.'/class/xoopsblock.php' ) ; - - -$xoops_system_url = XOOPS_URL . '/modules/system' ; - -if( !defined( 'XOOPS_CUBE_LEGACY' ) ) { - $xoops_system_path = XOOPS_ROOT_PATH . '/modules/system' ; - - // language files - $language = $xoopsConfig['language'] ; - if( ! file_exists( "$xoops_system_path/language/$language/admin/blocksadmin.php") ) $language = 'english' ; - - include_once( "$xoops_system_path/language/$language/admin.php" ) ; - include_once( "$xoops_system_path/language/$language/admin/blocksadmin.php" ) ; - $group_defs = file( "$xoops_system_path/language/$language/admin/groups.php" ) ; - foreach( $group_defs as $def ) { - if( strstr( $def , '_AM_ACCESSRIGHTS' ) || strstr( $def , '_AM_ACTIVERIGHTS' ) ) eval( $def ) ; - } -} +/** + * @package Multimenu + * @version 2.3.1 + * @author Gigamaster, 2020 XCL PHP7 + * @author Tom Hayakawa + * @copyright Copyright 2005-2021 XOOPSCube Project + * @license https://github.com/xoopscube/xcl/blob/master/docs/GPL_V2.txt + */ + +include_once( '../../../include/cp_header.php' ); +include_once( 'mygrouppermform.php' ); +include_once( XOOPS_ROOT_PATH . '/class/xoopsblock.php' ); // check $xoopsModule -if( ! is_object( $xoopsModule ) ) redirect_header( XOOPS_URL.'/user.php' , 1 , _NOPERM ) ; +if ( ! is_object( $xoopsModule ) ) { + redirect_header( XOOPS_URL . '/user.php', 1, _NOPERM ); +} // get blocks owned by the module -$block_arr =& XoopsBlock::getByModule( $xoopsModule->mid() ) ; +// $block_arr =& XoopsBlock::getByModule( $xoopsModule->mid() ) ; @gigamaster make call dynamic +$block_arr =& (new XoopsBlock)->getByModule( $xoopsModule->mid() ) ; // add by Tom -sort ($block_arr); -reset ($block_arr); +sort( $block_arr ); +reset( $block_arr ); -function list_blocks() -{ - global $xoopsUser , $xoopsConfig , $xoopsDB ; - global $block_arr , $xoops_system_url ; +function list_blocks() { + global $xoopsUser, $xoopsConfig, $xoopsDB; + global $block_arr; - $side_descs = array( 0 => _AM_SBLEFT, 1 => _AM_SBRIGHT, 3 => _AM_CBLEFT, 4 => _AM_CBRIGHT, 5 => _AM_CBCENTER ) ; + $side_descs = array( 0 => _AM_SBLEFT, 1 => _AM_SBRIGHT, 3 => _AM_CBLEFT, 4 => _AM_CBRIGHT, 5 => _AM_CBCENTER ); // displaying TH echo " - - +
"._AM_BLKDESC.""._AM_TITLE.""._AM_SIDE.""._AM_WEIGHT.""._AM_VISIBLE.""._AM_ACTION."
+ + + + + + + + "; // blocks displaying loop - if( defined( 'XOOPS_CUBE_LEGACY' ) ) { - $blockAdmin = XOOPS_URL."/modules/legacy/admin/index.php?action=BlockEdit&bid="; - $blockInstallAdmin = XOOPS_URL."/modules/legacy/admin/index.php?action=BlockInstallEdit&bid="; - }else{ - $blockAdmin = $xoops_system_url."/admin.php?fct=blocksadmin&op=edit&bid="; + if ( defined( 'XOOPS_CUBE_LEGACY' ) ) { + $blockAdmin = XOOPS_URL . "/modules/legacy/admin/index.php?action=BlockEdit&bid="; + $blockInstallAdmin = XOOPS_URL . "/modules/legacy/admin/index.php?action=BlockInstallEdit&bid="; } - $class = 'even' ; - foreach( array_keys( $block_arr ) as $i ) { - $visible = ( $block_arr[$i]->getVar("visible") == 1 ) ? _YES : _NO ; - $weight = $block_arr[$i]->getVar("weight") ; - $side_desc = $side_descs[ $block_arr[$i]->getVar("side") ] ; - $title = $block_arr[$i]->getVar("title") ; - if( $title == '' ) $title = " " ; - $name = $block_arr[$i]->getVar("name") ; - $bid = $block_arr[$i]->getVar("bid") ; + $iconVisible = ''. _NO.''; + $iconInvisible = ''. _YES.''; + + + $mBlockEdit = '' . _INSTALL . ''; + $mBlockInstall = '' . _EDIT . ''; + + $class = 'even'; + foreach ( array_keys( $block_arr ) as $i ) { + $visible = ( $block_arr[ $i ]->getVar( "visible" ) == 1 ) ? $iconVisible : $iconInvisible; + $weight = $block_arr[ $i ]->getVar( "weight" ); + $side_desc = $side_descs[ $block_arr[ $i ]->getVar( "side" ) ]; + $title = $block_arr[ $i ]->getVar( "title" ); + if ( $title == '' ) { + $title = " "; + } + $name = $block_arr[ $i ]->getVar( "name" ); + $bid = $block_arr[ $i ]->getVar( "bid" ); echo " @@ -74,60 +75,53 @@ function list_blocks() - \n" ; - - $class = ( $class == 'even' ) ? 'odd' : 'even' ; + \n"; + + $class = ( $class == 'even' ) ? 'odd' : 'even'; } echo "
" . _AM_BLKDESC . "" . _AM_TITLE . "" . _AM_SIDE . "" . _AM_WEIGHT . "" . _AM_VISIBLE . "" . _AM_ACTION . "
$name$weight $visible "; - if ($visible === _YES) { - echo ""._EDIT.""; + if ( $visible === $iconVisible ) { + echo "$mBlockEdit"; } else { - echo ""._INSTALL.""; + echo "$mBlockInstall"; } echo "
-
\n" ; + \n"; } -function list_groups() -{ - global $xoopsUser , $xoopsConfig , $xoopsDB ; - global $xoopsModule , $block_arr , $xoops_system_url ; +function list_groups() { + global $xoopsUser, $xoopsConfig, $xoopsDB; + global $xoopsModule, $block_arr; - foreach( array_keys( $block_arr ) as $i ) { - $item_list[ $block_arr[$i]->getVar("bid") ] = $block_arr[$i]->getVar("title") ; + foreach ( array_keys( $block_arr ) as $i ) { + $item_list[ $block_arr[ $i ]->getVar( "bid" ) ] = $block_arr[ $i ]->getVar( "title" ); } - $form = new MyXoopsGroupPermForm( '' , 1 , 'block_read' , _MD_AM_ADGS ) ; - $form->addAppendix('module_admin',$xoopsModule->mid(),$xoopsModule->name().' '._AM_ACTIVERIGHTS); - $form->addAppendix('module_read',$xoopsModule->mid(),$xoopsModule->name().' '._AM_ACCESSRIGHTS); - foreach( $item_list as $item_id => $item_name) { - $form->addItem( $item_id , $item_name ) ; + $form = new MyXoopsGroupPermForm( '', 1, 'block_read', _MD_AM_ADGS ); + $form->addAppendix( 'module_admin', $xoopsModule->mid(), $xoopsModule->name() . ' ' . _AM_ACTIVERIGHTS ); + $form->addAppendix( 'module_read', $xoopsModule->mid(), $xoopsModule->name() . ' ' . _AM_ACCESSRIGHTS ); + foreach ( $item_list as $item_id => $item_name ) { + $form->addItem( $item_id, $item_name ); } - echo $form->render() ; + echo $form->render(); } - -if( ! empty( $_POST['submit'] ) ) { - include( "mygroupperm.php" ) ; - redirect_header( XOOPS_URL."/modules/".$xoopsModule->dirname()."/admin/myblocksadmin.php" , 1 , _MD_AM_DBUPDATED ); +if ( ! empty( $_POST['submit'] ) ) { + include( "mygroupperm.php" ); + redirect_header( XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/admin/myblocksadmin.php", 1, _MD_AM_DBUPDATED ); } -xoops_cp_header() ; +xoops_cp_header(); + -// for multimenu admin menu -//echo "

".$xoopsModule->name()."

\n" ; require 'admin_function.php'; -$class = new multimenu($menu_num); -$class->mm_admin_menu(0, _AM_BADMIN ); +$class = new multimenu( $menu_num ); -//echo "

"._AM_BADMIN."

\n" ; -list_blocks() ; -if( !defined( 'XOOPS_CUBE_LEGACY' ) ) { - list_groups() ; -} -xoops_cp_footer() ; +$class->mm_admin_menu( 0, _AM_BADMIN ); + +list_blocks(); -?> \ No newline at end of file +xoops_cp_footer(); diff --git a/html/modules/multiMenu/admin/myblocksadmin.txt b/html/modules/multiMenu/admin/myblocksadmin.txt deleted file mode 100644 index cdae53c..0000000 --- a/html/modules/multiMenu/admin/myblocksadmin.txt +++ /dev/null @@ -1,42 +0,0 @@ -- myblocksadmin - - - -SUMMARY: - -This files add blocks admin into your module. - - -BACKGROUND: - -XOOPS's admin of blocks and groups will be hard to use, -when many modules is installed. -If each module has the block management screen for itself, -webmasters using XOOPS will feel it easy, I think. -I will recommend it to the module developers by all means. - - -HOW TO USE: - -1) copy these 3 files into XOOPS_ROOT_PATH./modules/(your module)/admin/ -2) edit admin/menu.php and add a menu item like this: - - $adminmenu[] = array( 'title' => _MI_SYSTEM_ADMENU2 , - 'link' => "admin/myblocksadmin.php" ) ; - -That's all ! - - - -CHANGELOG: - -2003-12-18 0.03 for XOOPS <= 2.0.3 patch - (gperm_handler->deleteByModule() has only 1 parameter) -2003-12-12 0.02 'module_read' and 'module_admin' to be able to change -2003-12-4 0.01 first release - - - -COPYRIGHT: - -I do not insist on the right of these codes, and don't guarantee. - diff --git a/html/modules/multiMenu/admin/mygroupperm.php b/html/modules/multiMenu/admin/mygroupperm.php index d767bd4..0ea8ab2 100644 --- a/html/modules/multiMenu/admin/mygroupperm.php +++ b/html/modules/multiMenu/admin/mygroupperm.php @@ -1,59 +1,70 @@ add(new Criteria('gperm_name', $gperm_name)); - if (isset($gperm_itemid)) { - $criteria->add(new Criteria('gperm_itemid', intval($gperm_itemid))); +function myDeleteByModule( $DB, $gperm_modid, $gperm_name = null, $gperm_itemid = null ) { + $criteria = new CriteriaCompo( new Criteria( 'gperm_modid', (int) $gperm_modid ) ); + if ( isset( $gperm_name ) ) { + $criteria->add( new Criteria( 'gperm_name', $gperm_name ) ); + if ( isset( $gperm_itemid ) ) { + $criteria->add( new Criteria( 'gperm_itemid', (int) $gperm_itemid ) ); } } - $sql = "DELETE FROM ".$DB->prefix('group_permission').' '.$criteria->renderWhere(); - if (!$result = $DB->query($sql)) { + $sql = "DELETE FROM " . $DB->prefix( 'group_permission' ) . ' ' . $criteria->renderWhere(); + if ( ! $result = $DB->query( $sql ) ) { return false; } + return true; } - // include '../../../include/cp_header.php'; GIJ -$modid = isset($HTTP_POST_VARS['modid']) ? intval($HTTP_POST_VARS['modid']) : 1; +$modid = isset( $HTTP_POST_VARS['modid'] ) ? (int) $HTTP_POST_VARS['modid'] : 1; // we dont want system module permissions to be changed here ( 1 -> 0 GIJ) -if ($modid <= 0 || !is_object($xoopsUser) || !$xoopsUser->isAdmin($modid)) { - redirect_header(XOOPS_URL.'/index.php', 1, _NOPERM); +if ( $modid <= 0 || ! is_object( $xoopsUser ) || ! $xoopsUser->isAdmin( $modid ) ) { + redirect_header( XOOPS_URL . '/index.php', 1, _NOPERM ); exit(); } -$module_handler =& xoops_gethandler('module'); -$module =& $module_handler->get($modid); -if (!is_object($module) || !$module->getVar('isactive')) { - redirect_header(XOOPS_URL.'/admin.php', 1, _MODULENOEXIST); +$module_handler =& xoops_gethandler( 'module' ); +$module =& $module_handler->get( $modid ); +if ( ! is_object( $module ) || ! $module->getVar( 'isactive' ) ) { + redirect_header( XOOPS_URL . '/admin.php', 1, _MODULENOEXIST ); exit(); } -$member_handler =& xoops_gethandler('member'); -$group_list =& $member_handler->getGroupList(); -if (is_array($HTTP_POST_VARS['perms']) && !empty($HTTP_POST_VARS['perms'])) { - $gperm_handler = xoops_gethandler('groupperm'); - foreach ($HTTP_POST_VARS['perms'] as $perm_name => $perm_data) { - foreach( $perm_data['itemname' ] as $item_id => $item_name ) { +$member_handler =& xoops_gethandler( 'member' ); +$group_list =& $member_handler->getGroupList(); +if ( is_array( $HTTP_POST_VARS['perms'] ) && ! empty( $HTTP_POST_VARS['perms'] ) ) { + $gperm_handler = xoops_gethandler( 'groupperm' ); + foreach ( $HTTP_POST_VARS['perms'] as $perm_name => $perm_data ) { + foreach ( $perm_data['itemname'] as $item_id => $item_name ) { // checking code // echo "
" ;
 			// var_dump( $HTTP_POST_VARS['perms'] ) ;
 			// exit ;
-			if (false != myDeleteByModule($gperm_handler->db,$modid,$perm_name,$item_id)) {
-				if( empty( $perm_data['groups'] ) ) continue ;
-				foreach ($perm_data['groups'] as $group_id => $item_ids) {
-	//				foreach ($item_ids as $item_id => $selected) {
-					$selected = isset( $item_ids[ $item_id ] ) ? $item_ids[ $item_id ] : 0 ;
-					if ($selected == 1) {
+			if ( false != myDeleteByModule( $gperm_handler->db, $modid, $perm_name, $item_id ) ) {
+				if ( empty( $perm_data['groups'] ) ) {
+					continue;
+				}
+				foreach ( $perm_data['groups'] as $group_id => $item_ids ) {
+					//				foreach ($item_ids as $item_id => $selected) {
+					$selected = isset( $item_ids[ $item_id ] ) ? $item_ids[ $item_id ] : 0;
+					if ( $selected == 1 ) {
 						// make sure that all parent ids are selected as well
-						if ($perm_data['parents'][$item_id] != '') {
-							$parent_ids = explode(':', $perm_data['parents'][$item_id]);
-							foreach ($parent_ids as $pid) {
-								if ($pid != 0 && !in_array($pid, array_keys($item_ids))) {
+						if ( $perm_data['parents'][ $item_id ] != '' ) {
+							$parent_ids = explode( ':', $perm_data['parents'][ $item_id ] );
+							foreach ( $parent_ids as $pid ) {
+								if ( $pid != 0 && ! in_array( $pid, array_keys( $item_ids ) ) ) {
 									// one of the parent items were not selected, so skip this item
-									$msg[] = sprintf(_MD_AM_PERMADDNG, ''.$perm_name.'', ''.$perm_data['itemname'][$item_id].'', ''.$group_list[$group_id].'').' ('._MD_AM_PERMADDNGP.')';
+									$msg[] = sprintf(_MD_AM_PERMADDNG, ''.$perm_name.'',
+											''.$perm_data['itemname'][$item_id].'',
+											''.$group_list[$group_id].'').' ('._MD_AM_PERMADDNGP.')';
 									continue 2;
 								}
 							}
@@ -64,30 +75,20 @@ function myDeleteByModule($DB, $gperm_modid, $gperm_name = null, $gperm_itemid =
 						$gperm->setVar('gperm_modid', $modid);
 						$gperm->setVar('gperm_itemid', $item_id);
 						if (!$gperm_handler->insert($gperm)) {
-							$msg[] = sprintf(_MD_AM_PERMADDNG, ''.$perm_name.'', ''.$perm_data['itemname'][$item_id].'', ''.$group_list[$group_id].'');
+							$msg[] = sprintf(_MD_AM_PERMADDNG, ''.$perm_name.'',
+								''.$perm_data['itemname'][$item_id].'',
+								''.$group_list[$group_id].'');
 						} else {
-							$msg[] = sprintf(_MD_AM_PERMADDOK, ''.$perm_name.'', ''.$perm_data['itemname'][$item_id].'', ''.$group_list[$group_id].'');
+							$msg[] = sprintf(_MD_AM_PERMADDOK, ''.$perm_name.'',
+								''.$perm_data['itemname'][$item_id].'',
+								''.$group_list[$group_id].'');
 						}
 						unset($gperm);
 					}
 				}
 			} else {
-				$msg[] = sprintf(_MD_AM_PERMRESETNG, $module->getVar('name'));
+				$msg[] = sprintf( _MD_AM_PERMRESETNG, $module->getVar( 'name' ) );
 			}
 		}
 	}
 }
-/*
-$backlink = XOOPS_URL.'/admin.php';
-if ($module->getVar('hasadmin')) {
-	$adminindex = $module->getInfo('adminindex');
-	if ($adminindex) {
-		$backlink = XOOPS_URL.'/modules/'.$module->getVar('dirname').'/'.$adminindex;
-	}
-}
-
-$msg[] = '

'._BACK.''; -xoops_cp_header(); -xoops_result($msg); -xoops_cp_footer(); GIJ */ -?> \ No newline at end of file diff --git a/html/modules/multiMenu/admin/mygrouppermform.php b/html/modules/multiMenu/admin/mygrouppermform.php index 8440278..f989448 100644 --- a/html/modules/multiMenu/admin/mygrouppermform.php +++ b/html/modules/multiMenu/admin/mygrouppermform.php @@ -1,89 +1,63 @@ // -// ------------------------------------------------------------------------ // -// This program is free software; you can redistribute it and/or modify // -// it under the terms of the GNU General Public License as published by // -// the Free Software Foundation; either version 2 of the License, or // -// (at your option) any later version. // -// // -// You may not change or alter any portion of this comment or credits // -// of supporting developers from this source code or any supporting // -// source code which is considered copyrighted (c) material of the // -// original comment or credit authors. // -// // -// This program is distributed in the hope that it will be useful, // -// but WITHOUT ANY WARRANTY; without even the implied warranty of // -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // -// GNU General Public License for more details. // -// // -// You should have received a copy of the GNU General Public License // -// along with this program; if not, write to the Free Software // -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// ------------------------------------------------------------------------ // -// Author: Kazumi Ono (AKA onokazu) // -// URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ // -// Project: The XOOPS Project // -// ------------------------------------------------------------------------- // +/** + * @package Multimenu + * @version 2.3.1 + * @author Gigamaster, 2020 XCL PHP7 + * @author Other : Kazumi Ono (AKA onokazu), grouppermform.php v 1.4 + * @copyright Copyright 2005-2021 XOOPSCube Project + * @license https://github.com/xoopscube/xcl/blob/master/docs/GPL_V2.txt + */ -require_once XOOPS_ROOT_PATH.'/class/xoopsform/formelement.php'; -require_once XOOPS_ROOT_PATH.'/class/xoopsform/formhidden.php'; -require_once XOOPS_ROOT_PATH.'/class/xoopsform/formbutton.php'; -require_once XOOPS_ROOT_PATH.'/class/xoopsform/formelementtray.php'; -require_once XOOPS_ROOT_PATH.'/class/xoopsform/form.php'; +require_once XOOPS_ROOT_PATH . '/class/xoopsform/formelement.php'; +require_once XOOPS_ROOT_PATH . '/class/xoopsform/formhidden.php'; +require_once XOOPS_ROOT_PATH . '/class/xoopsform/formbutton.php'; +require_once XOOPS_ROOT_PATH . '/class/xoopsform/formelementtray.php'; +require_once XOOPS_ROOT_PATH . '/class/xoopsform/form.php'; /** * Renders a form for setting module specific group permissions - * - * @author Kazumi Ono - * @copyright copyright (c) 2000-2003 XOOPS.org - * + * @author Kazumi Ono + * @copyright copyright (c) 2000-2021 * @package kernel * @subpackage form */ -class MyXoopsGroupPermForm extends XoopsForm -{ +class MyXoopsGroupPermForm extends XoopsForm { /** * Module ID * @var int */ - var $_modid; + public $_modid; /** * Tree structure of items * @var array */ - var $_itemTree; + public $_itemTree; /** * Name of permission * @var string */ - var $_permName; + public $_permName; /** * Description of permission * @var string */ - var $_permDesc; + public $_permDesc; /** * Appendix * @var array ('permname'=>,'itemid'=>,'itemname'=>,'selected'=>) */ - var $_appendix = array() ; + public $_appendix = array(); /** * Constructor */ - function MyXoopsGroupPermForm($title, $modid, $permname, $permdesc) - { -// $this->XoopsForm($title, 'groupperm_form', XOOPS_URL.'/modules/system/admin/groupperm.php', 'post'); GIJ - $this->XoopsForm($title, 'groupperm_form', '' , 'post'); - $this->_modid = intval($modid); + public function __construct( $title, $modid, $permname, $permdesc ) { + $this->XoopsForm( $title, 'groupperm_form', '', 'post' ); + $this->_modid = (int) $modid; $this->_permName = $permname; $this->_permDesc = $permdesc; - $this->addElement(new XoopsFormHidden('modid', $this->_modid)); + $this->addElement( new XoopsFormHidden( 'modid', $this->_modid ) ); } /** @@ -92,14 +66,14 @@ function MyXoopsGroupPermForm($title, $modid, $permname, $permdesc) * @param string $itemName * @param int $itemId * @param int $itemParent + * * @access public */ - function addItem($itemId, $itemName, $itemParent = 0) - { - $this->_itemTree[$itemParent]['children'][] = $itemId; - $this->_itemTree[$itemId]['parent'] = $itemParent; - $this->_itemTree[$itemId]['name'] = $itemName; - $this->_itemTree[$itemId]['id'] = $itemId; + function addItem( $itemId, $itemName, $itemParent = 0 ) { + $this->_itemTree[ $itemParent ]['children'][] = $itemId; + $this->_itemTree[ $itemId ]['parent'] = $itemParent; + $this->_itemTree[ $itemId ]['name'] = $itemName; + $this->_itemTree[ $itemId ]['id'] = $itemId; } /** @@ -107,9 +81,13 @@ function addItem($itemId, $itemName, $itemParent = 0) * * @access public */ - function addAppendix($permName,$itemId,$itemName) - { - $this->_appendix[] = array('permname'=>$permName,'itemid'=>$itemId,'itemname'=>$itemName,'selected'=>false); + function addAppendix( $permName, $itemId, $itemName ) { + $this->_appendix[] = array( + 'permname' => $permName, + 'itemid' => $itemId, + 'itemname' => $itemName, + 'selected' => false + ); } /** @@ -117,18 +95,18 @@ function addAppendix($permName,$itemId,$itemName) * * @param int $itemId * @param array $childIds + * * @access private */ - function _loadAllChildItemIds($itemId, &$childIds) - { - if (!empty($this->_itemTree[$itemId]['children'])) { - $first_child = $this->_itemTree[$itemId]['children']; - foreach ($first_child as $fcid) { - array_push($childIds, $fcid); - if (!empty($this->_itemTree[$fcid]['children'])) { - foreach ($this->_itemTree[$fcid]['children'] as $_fcid) { - array_push($childIds, $_fcid); - $this->_loadAllChildItemIds($_fcid, $childIds); + function _loadAllChildItemIds( $itemId, &$childIds ) { + if ( ! empty( $this->_itemTree[ $itemId ]['children'] ) ) { + $first_child = $this->_itemTree[ $itemId ]['children']; + foreach ( $first_child as $fcid ) { + array_push( $childIds, $fcid ); + if ( ! empty( $this->_itemTree[ $fcid ]['children'] ) ) { + foreach ( $this->_itemTree[ $fcid ]['children'] as $_fcid ) { + array_push( $childIds, $_fcid ); + $this->_loadAllChildItemIds( $_fcid, $childIds ); } } } @@ -141,109 +119,113 @@ function _loadAllChildItemIds($itemId, &$childIds) * @return string * @access public */ - function render() - { + function render() { // load all child ids for javascript codes - foreach (array_keys($this->_itemTree) as $item_id) { - $this->_itemTree[$item_id]['allchild'] = array(); - $this->_loadAllChildItemIds($item_id, $this->_itemTree[$item_id]['allchild']); + foreach ( array_keys( $this->_itemTree ) as $item_id ) { + $this->_itemTree[ $item_id ]['allchild'] = array(); + $this->_loadAllChildItemIds( $item_id, $this->_itemTree[ $item_id ]['allchild'] ); } - $gperm_handler =& xoops_gethandler('groupperm'); - $member_handler =& xoops_gethandler('member'); - $glist =& $member_handler->getGroupList(); - foreach (array_keys($glist) as $i) { + $gperm_handler =& xoops_gethandler( 'groupperm' ); + $member_handler =& xoops_gethandler( 'member' ); + $glist =& $member_handler->getGroupList(); + foreach ( array_keys( $glist ) as $i ) { // get selected item id(s) for each group - $selected = $gperm_handler->getItemIds($this->_permName, $i, $this->_modid); - $ele = new MyXoopsGroupFormCheckBox($glist[$i], 'perms['.$this->_permName.']', $i, $selected); - $ele->setOptionTree($this->_itemTree); + $selected = $gperm_handler->getItemIds( $this->_permName, $i, $this->_modid ); + $ele = new MyXoopsGroupFormCheckBox( $glist[ $i ], 'perms[' . $this->_permName . ']', $i, $selected ); + $ele->setOptionTree( $this->_itemTree ); - foreach( $this->_appendix as $key => $append ) { - $this->_appendix[$key]['selected'] = $gperm_handler->checkRight($append['permname'], $append['itemid'], $i, $this->_modid ) ; + foreach ( $this->_appendix as $key => $append ) { + $this->_appendix[ $key ]['selected'] = $gperm_handler->checkRight( $append['permname'], $append['itemid'], $i, $this->_modid ); } - $ele->setAppendix($this->_appendix); - $this->addElement($ele); - unset($ele); + $ele->setAppendix( $this->_appendix ); + $this->addElement( $ele ); + unset( $ele ); } // GIJ start - $jstray = new XoopsFormElementTray('   '); - $jsuncheckbutton = new XoopsFormButton('', 'none', _NONE, 'button'); - $jsuncheckbutton->setExtra( "onclick=\"with(document.groupperm_form){for(i=0;isetExtra( "onclick=\"with(document.groupperm_form){for(i=0;iaddElement( $jsuncheckbutton ) ; - $jstray->addElement( $jscheckbutton ) ; - $this->addElement($jstray); + $jstray = new XoopsFormElementTray( '   ' ); + $jsuncheckbutton = new XoopsFormButton( '', 'none', _NONE, 'button' ); + $jsuncheckbutton->setExtra( "onclick=\"with(document.groupperm_form){for(i=0;isetExtra( "onclick=\"with(document.groupperm_form){for(i=0;iaddElement( $jsuncheckbutton ); + $jstray->addElement( $jscheckbutton ); + $this->addElement( $jstray ); // GIJ end - $tray = new XoopsFormElementTray(''); - $tray->addElement(new XoopsFormButton('', 'reset', _CANCEL, 'reset')); - $tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); - $this->addElement($tray); + $tray = new XoopsFormElementTray( '' ); + + $buttonCancel = new XoopsFormButton( '', 'reset', _CANCEL, 'reset' ); + $tray->addElement( $buttonCancel ); + + $buttonSubmit = new XoopsFormButton( '', 'submit', _SUBMIT, 'submit' ); + $tray->addElement( $buttonSubmit ); + + $this->addElement( $tray ); + + $ret = '

' . $this->getTitle() . '

' . $this->_permDesc . '
'; + $ret .= "
getExtra() . ">\n"; + $ret .= "\n"; - $ret = '

'.$this->getTitle().'

'.$this->_permDesc.'
'; - $ret .= "getExtra().">\n
\n"; $elements =& $this->getElements(); - foreach(array_keys($elements) as $i) { - if (!is_object($elements[$i])) { - $ret .= $elements[$i]; - } elseif (!$elements[$i]->isHidden()) { - $ret .= "\n\n"; + $ret .= "\n\n"; } else { - $ret .= $elements[$i]->render(); + $ret .= $elements[ $i ]->render(); } } $ret .= '
".$elements[$i]->getCaption(); - if ($elements[$i]->getDescription() != '') { - $ret .= '

'.$elements[$i]->getDescription().''; + foreach ( array_keys( $elements ) as $i ) { + if ( ! is_object( $elements[ $i ] ) ) { + $ret .= $elements[ $i ]; + } elseif ( ! $elements[ $i ]->isHidden() ) { + $ret .= "
" . $elements[ $i ]->getCaption(); + if ( $elements[ $i ]->getDescription() != '' ) { + $ret .= '

' . $elements[ $i ]->getDescription() . ''; } - $ret .= "
\n".$elements[$i]->render()."\n
\n" . $elements[ $i ]->render() . "\n
'; + return $ret; } } /** * Renders checkbox options for a group permission form - * - * @author Kazumi Ono - * @copyright copyright (c) 2000-2003 XOOPS.org - * + * + * @author Kazumi Ono + * @copyright copyright (c) 2000-2021 * @package kernel * @subpackage form */ -class MyXoopsGroupFormCheckBox extends XoopsFormElement -{ +class MyXoopsGroupFormCheckBox extends XoopsFormElement { /** * Pre-selected value(s) * @var array; */ - var $_value; + public $_value; /** * Group ID * @var int */ - var $_groupId; + public $_groupId; /** * Option tree * @var array */ - var $_optionTree; + public $_optionTree; /** * Appendix * @var array ('permname'=>,'itemid'=>,'itemname'=>,'selected'=>) */ - var $_appendix = array() ; + public $_appendix = array(); /** * Constructor */ - function MyXoopsGroupFormCheckBox($caption, $name, $groupId, $values = null) - { - $this->setCaption($caption); - $this->setName($name); - if (isset($values)) { - $this->setValue($values); + public function __construct( $caption, $name, $groupId, $values = null ) { + $this->setCaption( $caption ); + $this->setName( $name ); + if ( isset( $values ) ) { + $this->setValue( $values ); } $this->_groupId = $groupId; } @@ -252,13 +234,13 @@ function MyXoopsGroupFormCheckBox($caption, $name, $groupId, $values = null) * Sets pre-selected values * * @param mixed $value A group ID or an array of group IDs + * * @access public */ - function setValue($value) - { - if (is_array($value)) { - foreach ($value as $v) { - $this->setValue($v); + function setValue( $value ) { + if ( is_array( $value ) ) { + foreach ( $value as $v ) { + $this->setValue( $v ); } } else { $this->_value[] = $value; @@ -269,10 +251,10 @@ function setValue($value) * Sets the tree structure of items * * @param array $optionTree + * * @access public */ - function setOptionTree(&$optionTree) - { + function setOptionTree( &$optionTree ) { $this->_optionTree =& $optionTree; } @@ -281,9 +263,8 @@ function setOptionTree(&$optionTree) * * @access public */ - function setAppendix($appendix) - { - $this->_appendix = $appendix ; + function setAppendix( $appendix ) { + $this->_appendix = $appendix; } /** @@ -292,42 +273,42 @@ function setAppendix($appendix) * @return string * @access public */ - function render() - { - $ret = '' ; + function render() { + $ret = ''; - if( sizeof( $this->_appendix ) > 0 ) { - $ret .= ''; + if ( count( $this->_appendix ) > 0 ) { + $ret .= '
'; $cols = 1; - foreach ($this->_appendix as $append) { - if ($cols > 4) { - $ret .= ''; + foreach ( $this->_appendix as $append ) { + if ( $cols > 4 ) { + $ret .= ''; $cols = 1; } - $checked = $append['selected'] ? 'checked="checked"' : '' ; - $name = 'perms['.$append['permname'].']' ; - $itemid = $append['itemid'] ; - $itemid = $append['itemid'] ; - $ret .= "" ; - $cols++; + $checked = $append['selected'] ? 'checked="checked"' : ''; + $name = 'perms[' . $append['permname'] . ']'; + $itemid = $append['itemid']; + $itemid = $append['itemid']; + $ret .= ""; + $cols ++; } $ret .= '
_groupId][$itemid]\" id=\"{$name}[groups][$this->_groupId][$itemid]\" value=\"1\" $checked />{$append['itemname']}
_groupId][$itemid]\" id=\"{$name}[groups][$this->_groupId][$itemid]\" value=\"1\" $checked />{$append['itemname']}
'; } - $ret .= ''; + $ret .= '
'; $cols = 1; - foreach ($this->_optionTree[0]['children'] as $topitem) { - if ($cols > 4) { - $ret .= ''; + foreach ( $this->_optionTree[0]['children'] as $topitem ) { + if ( $cols > 4 ) { + $ret .= ''; $cols = 1; } - $tree = ''; - $cols++; + $this->_renderOptionTree( $tree, $this->_optionTree[ $topitem ], $prefix ); + $ret .= $tree . ''; + $cols ++; } $ret .= '
'; + $tree = ''; $prefix = ''; - $this->_renderOptionTree($tree, $this->_optionTree[$topitem], $prefix); - $ret .= $tree.'
'; + return $ret; } @@ -338,35 +319,36 @@ function render() * @param array $option * @param string $prefix * @param array $parentIds + * * @access private */ - function _renderOptionTree(&$tree, $option, $prefix, $parentIds = array()) - { - $tree .= $prefix."getName()."[groups][".$this->_groupId."][".$option['id']."]\" id=\"".$this->getName()."[groups][".$this->_groupId."][".$option['id']."]\" onclick=\""; + function _renderOptionTree( &$tree, $option, $prefix, $parentIds = array() ) { + $tree .= $prefix . "getName() . "[groups][" . $this->_groupId . "][" . $option['id'] . "]\" id=\"" . $this->getName() . "[groups][" . $this->_groupId . "][" . $option['id'] . "]\" onclick=\""; // If there are parent elements, add javascript that will - // make them selecteded when this element is checked to make + // make them selected when this element is checked to make // sure permissions to parent items are added as well. - foreach ($parentIds as $pid) { - $parent_ele = $this->getName().'[groups]['.$this->_groupId.']['.$pid.']'; - $tree .= "var ele = xoopsGetElementById('".$parent_ele."'); if(ele.checked != true) {ele.checked = this.checked;}"; + foreach ( $parentIds as $pid ) { + $parent_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $pid . ']'; + $tree .= "var ele = xoopsGetElementById('" . $parent_ele . "'); if(ele.checked != true) {ele.checked = this.checked;}"; } // If there are child elements, add javascript that will // make them unchecked when this element is unchecked to make // sure permissions to child items are not added when there // is no permission to this item. - foreach ($option['allchild'] as $cid) { - $child_ele = $this->getName().'[groups]['.$this->_groupId.']['.$cid.']'; - $tree .= "var ele = xoopsGetElementById('".$child_ele."'); if(this.checked != true) {ele.checked = false;}"; + foreach ( $option['allchild'] as $cid ) { + $child_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $cid . ']'; + $tree .= "var ele = xoopsGetElementById('" . $child_ele . "'); if(this.checked != true) {ele.checked = false;}"; } $tree .= '" value="1"'; - if ( isset( $this->_value ) && in_array($option['id'], $this->_value)) { + if ( isset( $this->_value ) && in_array( $option['id'], $this->_value ) ) { $tree .= ' checked="checked"'; } - $tree .= " />".$option['name']."getName()."[parents][".$option['id']."]\" value=\"".implode(':', $parentIds)."\" />getName()."[itemname][".$option['id']."]\" value=\"".htmlspecialchars($option['name'])."\" />
\n"; - if( isset( $option['children'] ) ) foreach ($option['children'] as $child) { - array_push($parentIds, $option['id']); - $this->_renderOptionTree($tree, $this->_optionTree[$child], $prefix.' -', $parentIds); + $tree .= " />" . $option['name'] . "getName() . "[parents][" . $option['id'] . "]\" value=\"" . implode( ':', $parentIds ) . "\" />getName() . "[itemname][" . $option['id'] . "]\" value=\"" . htmlspecialchars( $option['name'] ) . "\" />
\n"; + if ( isset( $option['children'] ) ) { + foreach ( $option['children'] as $child ) { + array_push( $parentIds, $option['id'] ); + $this->_renderOptionTree( $tree, $this->_optionTree[ $child ], $prefix . ' -', $parentIds ); + } } } } -?> \ No newline at end of file diff --git a/html/modules/multiMenu/blocks/multimenu.php b/html/modules/multiMenu/blocks/multimenu.php index f621242..716f85c 100644 --- a/html/modules/multiMenu/blocks/multimenu.php +++ b/html/modules/multiMenu/blocks/multimenu.php @@ -1,52 +1,64 @@ assign_css(); } $block = $gmm->getblock( $options, 'multimenu' . $num ); + return $block; } -function b_multimenu_edit($options) { - $form = _BM_MULTIMENU_CHARS."  "._BM_MULTIMENU_LENGTH.""; +function b_multimenu_edit( $options ) { + $form = _BM_MULTIMENU_CHARS . "  " . _BM_MULTIMENU_LENGTH . ""; + return $form; } -?> \ No newline at end of file diff --git a/html/modules/multiMenu/class/getMultiMenu.class.php b/html/modules/multiMenu/class/getMultiMenu.class.php index 1afd31e..0859d0b 100644 --- a/html/modules/multiMenu/class/getMultiMenu.class.php +++ b/html/modules/multiMenu/class/getMultiMenu.class.php @@ -1,218 +1,235 @@ user =& $root->mContext->mXoopsUser; - $this->db =& $root->mController->mDB; - if (is_object($root->mContext->mModule)) { - $this->mdl =& $root->mContext->mModule->mXoopsModule; - } else { - $this->mdl = NULL; - } - } - - function getblock( $options, $db_name ) { - - (method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts =& MyTextSanitizer::getInstance(); - $block = array(); - $inum = 0; - $group = is_object($this->user) ? $this->user->getGroups() : array(XOOPS_GROUP_ANONYMOUS); - $db = $this->db->prefix( $db_name ); - $sql = "SELECT id, groups, link, title, target FROM ".$db." WHERE hide=0 ORDER BY weight ASC"; - $result = $this->db->query($sql); - $parent_active = false; - while ( $myrow = $this->db->fetchArray($result) ) { - //$title = $myts->makeTboxData4Show($myrow["title"]); - $title = $myts->stripSlashesGPC($myrow["title"]); // by bluemoon - if ( !XOOPS_USE_MULTIBYTES ) { - if (strlen($myrow['title']) >= $options[0]) { - $title = $myts->makeTboxData4Show(substr($myrow['title'],0,($options[0]-1)))."..."; - } + public $block = array(); + + private $db; + private $user; + private $mdl; + + function __construct() { + $root =& XCube_Root::getSingleton(); + + $this->user =& $root->mContext->mXoopsUser; + $this->db =& $root->mController->mDB; + if ( is_object( $root->mContext->mModule ) ) { + $this->mdl =& $root->mContext->mModule->mXoopsModule; + } else { + $this->mdl = null; } - $title = preg_replace("/\[XOOPS_URL\]/",XOOPS_URL,$title); - $myrow['link'] = preg_replace("/\[XOOPS_URL\]/",XOOPS_URL,$myrow['link']); - $myrow['link'] = $this->replace_userinfo($myrow['link']); - $groups = explode(" ",$myrow['groups']); - if (count(array_intersect($group,$groups)) > 0) { - $imenu = array(); - $imenu['id'] = $myrow['id']; - $imenu['title'] = $title; - $imenu['target'] = $myrow['target']; - $imenu['sublinks'] = array(); - $imenu['link'] = ''; - $mid = 0; - $head = $myrow['link'][0]; - switch($head) { - case ' ': - case '-': - // hacked by nobunobu start - $link = substr($myrow['link'], 1); - $isub = (isset($block['contents']))? count($block['contents'][$inum-1]['sublinks']) : 0; - if ($parent_active) { - $block['contents'][$inum-1]['sublinks'][$isub]['name'] = $title; - if (preg_match('/^\[([a-z0-9_\-]+)\](.*)$/i', $link, $moduledir)) { - $module_handler = & xoops_gethandler( 'module' ); - $module =& $module_handler->getByDirname($moduledir[1]); - if ( is_object( $module ) && $module->getVar( 'isactive' ) ) { - $link = XOOPS_URL."/modules/".$moduledir[1]."/".$moduledir[2]; + } + + function getblock( $options, $db_name ) { + + ( method_exists( 'MyTextSanitizer', 'sGetInstance' ) and $myts =& MyTextSanitizer::sGetInstance() ) || $myts =& MyTextSanitizer::getInstance(); + $block = array(); + $inum = 0; + $group = is_object( $this->user ) ? $this->user->getGroups() : array( XOOPS_GROUP_ANONYMOUS ); + $db = $this->db->prefix( $db_name ); + $sql = "SELECT id, groups, link, title, target FROM " . $db . " WHERE hide=0 ORDER BY weight ASC"; + $result = $this->db->query( $sql ); + $parent_active = false; + while ( $myrow = $this->db->fetchArray( $result ) ) { + //$title = $myts->makeTboxData4Show($myrow["title"]); + $title = $myts->stripSlashesGPC( $myrow["title"] ); // by bluemoon + if ( ! XOOPS_USE_MULTIBYTES ) { + if ( strlen( $myrow['title'] ) >= $options[0] ) { + $title = $myts->makeTboxData4Show( substr( $myrow['title'], 0, ( $options[0] - 1 ) ) ) . "..."; + } + } + $title = preg_replace( "/\[XOOPS_URL\]/", XOOPS_URL, $title ); + $myrow['link'] = preg_replace( "/\[XOOPS_URL\]/", XOOPS_URL, $myrow['link'] ); + $myrow['link'] = $this->replace_userinfo( $myrow['link'] ); + $groups = explode( " ", $myrow['groups'] ); + if ( count( array_intersect( $group, $groups ) ) > 0 ) { + $imenu = array(); + $imenu['id'] = $myrow['id']; + $imenu['title'] = $title; + $imenu['target'] = $myrow['target']; + $imenu['sublinks'] = array(); + $imenu['link'] = ''; + $mid = 0; + $head = $myrow['link'][0]; + switch ( $head ) { + case ' ': + case '-': + // hacked by nobunobu start + $link = substr( $myrow['link'], 1 ); + $isub = ( isset( $block['contents'] ) ) ? count( $block['contents'][ $inum - 1 ]['sublinks'] ) : 0; + if ( $parent_active ) { + $block['contents'][ $inum - 1 ]['sublinks'][ $isub ]['name'] = $title; + if ( preg_match( '/^\[([a-z0-9_\-]+)\](.*)$/i', $link, $moduledir ) ) { + $module_handler = &xoops_gethandler( 'module' ); + $module =& $module_handler->getByDirname( $moduledir[1] ); + if ( is_object( $module ) && $module->getVar( 'isactive' ) ) { + $link = XOOPS_URL . "/modules/" . $moduledir[1] . "/" . $moduledir[2]; + } } + $block['contents'][ $inum - 1 ]['sublinks'][ $isub ]['url'] = $link; } - $block['contents'][$inum-1]['sublinks'][$isub]['url'] = $link; - } - continue 2; - // hacked by nobunobu end - break; - case '[': - // [module_name]xxxx.php?aa=aa&bb=bb - if (preg_match('/^\[([a-z0-9_\-]+)\](.*)$/i', $myrow['link'], $moduledir)) { - $module_handler = & xoops_gethandler( 'module' ); - $module =& $module_handler->getByDirname($moduledir[1]); - if ( is_object( $module ) && $module->getVar( 'isactive' ) ) { - $mid = $module->getVar('mid'); - $imenu['link'] = XOOPS_URL."/modules/".$moduledir[1]."/".$moduledir[2]; - $parent_active = true; + continue 2; + // hacked by nobunobu end + break; + case '[': + // [module_name]xxxx.php?aa=aa&bb=bb + if ( preg_match( '/^\[([a-z0-9_\-]+)\](.*)$/i', $myrow['link'], $moduledir ) ) { + $module_handler = &xoops_gethandler( 'module' ); + $module =& $module_handler->getByDirname( $moduledir[1] ); + if ( is_object( $module ) && $module->getVar( 'isactive' ) ) { + $mid = $module->getVar( 'mid' ); + $imenu['link'] = XOOPS_URL . "/modules/" . $moduledir[1] . "/" . $moduledir[2]; + $parent_active = true; + } } - } - break; - case '+': - // +[module_name]xxxx.php?aa=aa&bb=bb view submenu - if (preg_match('/^\+\[([a-z0-9_\-]+)\](.*)$/i', $myrow['link'], $moduledir)) { - $module_handler = & xoops_gethandler( 'module' ); - $module =& $module_handler->getByDirname($moduledir[1]); - if ( is_object( $module ) && $module->getVar( 'isactive' ) ) { - $imenu['link'] = XOOPS_URL."/modules/".$moduledir[1]."/".$moduledir[2]; - $parent_active = true; - - $mid = $module->getVar('mid'); - $sublinks =& $module->subLink(); - if (count($sublinks) > 0) { - foreach($sublinks as $sublink){ - if ( !XOOPS_USE_MULTIBYTES ) { - if (strlen($sublink['name']) >= $options[0]) { - $sublink['name'] = $myts->makeTboxData4Show(substr($sublink['name'],0,($options[0]-1)))."..."; + break; + case '+': + // +[module_name]xxxx.php?aa=aa&bb=bb view submenu + if ( preg_match( '/^\+\[([a-z0-9_\-]+)\](.*)$/i', $myrow['link'], $moduledir ) ) { + $module_handler = &xoops_gethandler( 'module' ); + $module =& $module_handler->getByDirname( $moduledir[1] ); + if ( is_object( $module ) && $module->getVar( 'isactive' ) ) { + $imenu['link'] = XOOPS_URL . "/modules/" . $moduledir[1] . "/" . $moduledir[2]; + $parent_active = true; + + $mid = $module->getVar( 'mid' ); + $sublinks =& $module->subLink(); + if ( count( $sublinks ) > 0 ) { + foreach ( $sublinks as $sublink ) { + if ( ! XOOPS_USE_MULTIBYTES ) { + if ( strlen( $sublink['name'] ) >= $options[0] ) { + $sublink['name'] = $myts->makeTboxData4Show( substr( $sublink['name'], 0, ( $options[0] - 1 ) ) ) . "..."; + } } + $imenu['sublinks'][] = array( + 'name' => $sublink['name'], + 'url' => XOOPS_URL . '/modules/' . $moduledir[1] . '/' . $sublink['url'] + ); } - $imenu['sublinks'][] = array('name' => $sublink['name'], 'url' => XOOPS_URL.'/modules/'.$moduledir[1].'/'.$sublink['url'] ); } } } - } - break; - case '@': - if (preg_match('/^\@\[([a-z0-9_\-]+)\](.*)$/i', $myrow['link'], $moduledir)) { - $module_handler = & xoops_gethandler( 'module' ); - $module =& $module_handler->getByDirname($moduledir[1]); - if ( is_object( $module ) && $module->getVar( 'isactive' ) ) { - $imenu['link'] = XOOPS_URL."/modules/".$moduledir[1]."/".$moduledir[2]; - - $mid = $module->getVar('mid'); - $sublinks =& $module->subLink(); - - // hacked by nobunobu start - if ( (!empty($this->mdl)) && ($moduledir[1] == $this->mdl->get('dirname')) ){ - $parent_active = true; - if (count($sublinks) > 0) { - foreach($sublinks as $sublink){ - if ( !XOOPS_USE_MULTIBYTES ) { - if (strlen($sublink['name']) >= $options[0]) { - $sublink['name'] = $myts->makeTboxData4Show(substr($sublink['name'],0,($options[0]-1)))."..."; + break; + + case '@': + if ( preg_match( '/^\@\[([a-z0-9_\-]+)\](.*)$/i', $myrow['link'], $moduledir ) ) { + $module_handler = &xoops_gethandler( 'module' ); + $module =& $module_handler->getByDirname( $moduledir[1] ); + if ( is_object( $module ) && $module->getVar( 'isactive' ) ) { + $imenu['link'] = XOOPS_URL . "/modules/" . $moduledir[1] . "/" . $moduledir[2]; + + $mid = $module->getVar( 'mid' ); + $sublinks =& $module->subLink(); + + // hacked by nobunobu start + if ( ( ! empty( $this->mdl ) ) && ( $moduledir[1] == $this->mdl->get( 'dirname' ) ) ) { + $parent_active = true; + if ( count( $sublinks ) > 0 ) { + foreach ( $sublinks as $sublink ) { + if ( ! XOOPS_USE_MULTIBYTES ) { + if ( strlen( $sublink['name'] ) >= $options[0] ) { + $sublink['name'] = $myts->makeTboxData4Show( substr( $sublink['name'], 0, ( $options[0] - 1 ) ) ) . "..."; + } } + $imenu['sublinks'][] = array( + 'name' => $sublink['name'], + 'url' => XOOPS_URL . '/modules/' . $moduledir[1] . '/' . $sublink['url'] + ); } - $imenu['sublinks'][] = array('name' => $sublink['name'], 'url' => XOOPS_URL.'/modules/'.$moduledir[1].'/'.$sublink['url'] ); } + } else { + $parent_active = false; + // hacked by nobunobu end } - } else { - $parent_active = false; - // hacked by nobunobu end } } - } - break; - case '&': - // &[module_name]xxxx.php?aa=aa&bb=bb view submenu // hacked by nobunobu - if (preg_match('/^\&\[([a-z0-9_\-]+)\](.*)$/i', $myrow['link'], $moduledir)) { - $module_handler = & xoops_gethandler( 'module' ); - $module =& $module_handler->getByDirname($moduledir[1]); - if ( is_object( $module ) && $module->getVar( 'isactive' ) ) { - $imenu['link'] = XOOPS_URL."/modules/".$moduledir[1]."/".$moduledir[2]; - - $mid = $module->getVar('mid'); - if ( (!empty($this->mdl)) && ($moduledir[1] == $this->mdl->get('dirname')) ){ - $parent_active = true; - } else { - $parent_active = false; + break; + case '&': + // &[module_name]xxxx.php?aa=aa&bb=bb view submenu // hacked by nobunobu + if ( preg_match( '/^\&\[([a-z0-9_\-]+)\](.*)$/i', $myrow['link'], $moduledir ) ) { + $module_handler = &xoops_gethandler( 'module' ); + $module =& $module_handler->getByDirname( $moduledir[1] ); + if ( is_object( $module ) && $module->getVar( 'isactive' ) ) { + $imenu['link'] = XOOPS_URL . "/modules/" . $moduledir[1] . "/" . $moduledir[2]; + + $mid = $module->getVar( 'mid' ); + if ( ( ! empty( $this->mdl ) ) && ( $moduledir[1] == $this->mdl->get( 'dirname' ) ) ) { + $parent_active = true; + } else { + $parent_active = false; + } } } + break; + default: + $imenu['link'] = $myrow['link']; + } + if ( $imenu['link'] ) { + if ( $mid ) { + $imenu['mid'] = $mid; } - break; - default: - $imenu['link'] = $myrow['link']; - } - if ($imenu['link']) { - // #7 (https://github.com/XoopsX/multiMenu/issues/7) - // It's needless code, May be. - //if (substr($imenu['link'], -1) === '/') { - // $imenu['link'] .= 'index.php'; - //} - if ($mid) { - $imenu['mid'] = $mid; + $block['contents'][ $inum ] = $imenu; + $inum ++; } - $block['contents'][$inum] = $imenu; - $inum++; } } + //var_dump($block);die; + $this->block = $block; + + return $block; + } + + function replace_userinfo( $str ) { + if ( is_object( $this->user ) ) { + $str = preg_replace( "/\[xoops_uid\]/", $this->user->uid(), $str ); + } + + return $str; + } + + function getModuleConfig( $name, $mid ) { + $ret = null; + $config_handler =& xoops_gethandler( 'config' ); + $config =& $config_handler->getConfigsByCat( 0, $mid ); + if ( isset( $config[ $name ] ) ) { + $ret = preg_split( '/,|[\r\n]+/', $config[ $name ] ); + } + + return $ret; } - //var_dump($block);die; - $this->block = $block; - return $block; - } - function replace_userinfo($str) { - if (is_object($this->user)) { - $str = preg_replace("/\[xoops_uid\]/",$this->user->uid(),$str); + + function assign_module_css( $css_file ) { + $root =& XCube_Root::getSingleton(); + $renderSystem =& $root->getRenderSystem( $root->mContext->mBaseRenderSystemName ); + $css_file = preg_replace( "/\[XOOPS_URL\]/i", XOOPS_URL, $css_file ); + $header = $renderSystem->mXoopsTpl->get_template_vars( 'xoops_block_header' ); + $header .= ''; + $renderSystem->mXoopsTpl->assign( 'xoops_block_header', $header ); + } + + function assign_css() { + $ch =& xoops_gethandler( 'config' ); + $mconf = $ch->getConfigsByDirname( 'multiMenu' ); + $css_file = $mconf['css_file']; + if ( ! empty( $css_file ) ) { + $this->assign_module_css( $css_file ); + } } - return $str; - } - function getModuleConfig( $name, $mid ) { - $ret = NULL; - $config_handler =& xoops_gethandler('config'); - $config =& $config_handler->getConfigsByCat(0, $mid); - if ( isset($config[$name]) ) $ret = preg_split('/,|[\r\n]+/',$config[$name]); - return $ret; - } - function assign_module_css($css_file) { - $root =& XCube_Root::getSingleton(); - $renderSystem =& $root->getRenderSystem($root->mContext->mBaseRenderSystemName); - $css_file = preg_replace("/\[XOOPS_URL\]/i",XOOPS_URL,$css_file); - $header = $renderSystem->mXoopsTpl->get_template_vars('xoops_block_header'); - $header .= ''; - $renderSystem->mXoopsTpl->assign('xoops_block_header', $header); - } - function assign_css() { - $ch=& xoops_gethandler('config'); - $mconf = $ch->getConfigsByDirname('multiMenu'); - $css_file = $mconf['css_file']; - if (! empty($css_file)) { - $this->assign_module_css($css_file); + + function theme_menu( $modname = "multiMenu" ) { + $ch =& xoops_gethandler( 'config' ); + $mconf = $ch->getConfigsByDirname( $modname ); + $theme_menu = $mconf['theme_menu']; + + return (int) $theme_menu; } - } - function theme_menu($modname="multiMenu") { - $ch=& xoops_gethandler('config'); - $mconf = $ch->getConfigsByDirname($modname); - $theme_menu = $mconf['theme_menu']; - return intval($theme_menu); - } } -?> \ No newline at end of file diff --git a/html/modules/multiMenu/class/menu.php b/html/modules/multiMenu/class/menu.php index 248a1c3..327ab07 100644 --- a/html/modules/multiMenu/class/menu.php +++ b/html/modules/multiMenu/class/menu.php @@ -1,45 +1,49 @@ initVar('id', XOBJ_DTYPE_INT, '0', true ); - $this->initVar('title', XOBJ_DTYPE_STRING, '' ); - $this->initVar('hide', XOBJ_DTYPE_INT, 0 ); - $this->initVar('link', XOBJ_DTYPE_STRING, ''); - $this->initVar('weight', XOBJ_DTYPE_INT, 255 ); - $this->initVar('target', XOBJ_DTYPE_STRING, '_self' ); - $this->initVar('groups', XOBJ_DTYPE_STRING, ''); - } +if ( ! defined( 'XOOPS_ROOT_PATH' ) ) { + exit(); } -class MultimenuMenuHandler extends XoopsObjectGenericHandler -{ - public $mTable = 'multimenu01'; - public $mPrimary = 'id'; - public $mClass = 'MultimenuMenuObject'; +class MultimenuMenuObject extends XoopsSimpleObject { + public function __construct() { + $this->initVar( 'id', XOBJ_DTYPE_INT, '0', true ); + $this->initVar( 'title', XOBJ_DTYPE_STRING, '' ); + $this->initVar( 'hide', XOBJ_DTYPE_INT, 0 ); + $this->initVar( 'link', XOBJ_DTYPE_STRING, '' ); + $this->initVar( 'weight', XOBJ_DTYPE_INT, 191 ); + $this->initVar( 'target', XOBJ_DTYPE_STRING, '_self' ); + $this->initVar( 'groups', XOBJ_DTYPE_STRING, '' ); + } +} + +class MultimenuMenuHandler extends XoopsObjectGenericHandler { + public $mTable = 'multimenu01'; + public $mPrimary = 'id'; + public $mClass = 'MultimenuMenuObject'; + + public function __construct( &$db ) { + parent::__construct( $db ); + } + + public function setTable( $mnum ) { + $this->mTable = $this->db->prefix( 'multimenu' . $mnum ); + } - public function __construct(&$db) - { - parent::XoopsObjectGenericHandler($db); - } - - public function setTable($mnum) - { - $this->mTable = $this->db->prefix('multimenu'.$mnum); - } - - public function im_admin_clean() - { - $i = 0; - $sql = "SELECT `id` FROM `".$this->mTable."` ORDER BY `weight`"; - $result = $this->db->query($sql); - while(list($id) = $this->db->fetchRow($result)) { - $this->db->queryF("UPDATE `".$this->mTable."` SET `weight` = '".$i."' WHERE `id` = ".$id); - $i++; - } - } + public function im_admin_clean() { + $i = 0; + $sql = "SELECT `id` FROM `" . $this->mTable . "` ORDER BY `weight`"; + $result = $this->db->query( $sql ); + while ( list( $id ) = $this->db->fetchRow( $result ) ) { + $this->db->queryF( "UPDATE `" . $this->mTable . "` SET `weight` = '" . $i . "' WHERE `id` = " . $id ); + $i ++; + } + } } -?> diff --git a/html/modules/multiMenu/images/module_multimenu.svg b/html/modules/multiMenu/images/module_multimenu.svg new file mode 100644 index 0000000..5459801 --- /dev/null +++ b/html/modules/multiMenu/images/module_multimenu.svg @@ -0,0 +1,9 @@ + + + + +MultiMenu + + + diff --git a/html/modules/multiMenu/include/gtickets.php b/html/modules/multiMenu/include/gtickets.php index 36db29f..e5a2611 100644 --- a/html/modules/multiMenu/include/gtickets.php +++ b/html/modules/multiMenu/include/gtickets.php @@ -1,313 +1,329 @@ messages ) ) { + $this->messages = array( + 'err_general' => 'GTicket Error', + 'err_nostubs' => 'No stubs found', + 'err_noticket' => 'No ticket found', + 'err_nopair' => 'No valid ticket-stub pair found', + 'err_timeout' => 'Time out', + 'err_areaorref' => 'Invalid area or referer', + 'fmt_prompt4repost' => 'error(s) found:
%s
Confirm it.
And do you want to post again?', + 'btn_repost' => 'repost', + ); + } + } -class XoopsGTicket { + // render form as plain html + function getTicketHtml( $salt = '', $timeout = 1800, $area = '' ) { + return ''; + } - var $_errors = array() ; - var $_latest_token = '' ; - var $messages = array() ; + // returns an object of XoopsFormHidden including theh ticket + function getTicketXoopsForm( $salt = '', $timeout = 1800, $area = '' ) { + return new XoopsFormHidden( 'XOOPS_G_TICKET', $this->issue( $salt, $timeout, $area ) ); + } - function XoopsGTicket() - { - global $xoopsConfig ; + // add a ticket as Hidden Element into XoopsForm + function addTicketXoopsFormElement( &$form, $salt = '', $timeout = 1800, $area = '' ) { + $form->addElement( new XoopsFormHidden( 'XOOPS_G_TICKET', $this->issue( $salt, $timeout, $area ) ) ); + } - // language file - if( defined( 'XOOPS_ROOT_PATH' ) && ! empty( $xoopsConfig['language'] ) && ! strstr( $xoopsConfig['language'] , '/' ) ) { - if( file_exists( dirname( dirname( __FILE__ ) ) . '/language/' . $xoopsConfig['language'] . '/gticket_messages.phtml' ) ) { - include dirname( dirname( __FILE__ ) ) . '/language/' . $xoopsConfig['language'] . '/gticket_messages.phtml' ; - } + // returns an array for xoops_confirm() ; + function getTicketArray( $salt = '', $timeout = 1800, $area = '' ) { + return array( 'XOOPS_G_TICKET' => $this->issue( $salt, $timeout, $area ) ); } - // default messages - if( empty( $this->messages ) ) $this->messages = array( - 'err_general' => 'GTicket Error' , - 'err_nostubs' => 'No stubs found' , - 'err_noticket' => 'No ticket found' , - 'err_nopair' => 'No valid ticket-stub pair found' , - 'err_timeout' => 'Time out' , - 'err_areaorref' => 'Invalid area or referer' , - 'fmt_prompt4repost' => 'error(s) found:
%s
Confirm it.
And do you want to post again?' , - 'btn_repost' => 'repost' , - ) ; - } + // return GET parameter string. + function getTicketParamString( $salt = '', $noamp = false, $timeout = 1800, $area = '' ) { + return ( $noamp ? '' : '&' ) . 'XOOPS_G_TICKET=' . $this->issue( $salt, $timeout, $area ); + } - // render form as plain html - function getTicketHtml( $salt = '' , $timeout = 1800 , $area = '' ) - { - return '' ; - } + // issue a ticket + function issue( $salt = '', $timeout = 1800, $area = '' ) { + global $xoopsModule; - // returns an object of XoopsFormHidden including theh ticket - function getTicketXoopsForm( $salt = '' , $timeout = 1800 , $area = '' ) - { - return new XoopsFormHidden( 'XOOPS_G_TICKET' , $this->issue( $salt , $timeout , $area ) ) ; - } + // create a token + list( $usec, $sec ) = explode( " ", microtime() ); + $appendix_salt = empty( $_SERVER['PATH'] ) ? XOOPS_DB_NAME : $_SERVER['PATH']; + $token = crypt( $salt . $usec . $appendix_salt . $sec, XOOPS_DB_PREFIX ); + $this->_latest_token = $token; - // add a ticket as Hidden Element into XoopsForm - function addTicketXoopsFormElement( &$form , $salt = '' , $timeout = 1800 , $area = '' ) - { - $form->addElement( new XoopsFormHidden( 'XOOPS_G_TICKET' , $this->issue( $salt , $timeout , $area ) ) ) ; - } + if ( empty( $_SESSION['XOOPS_G_STUBS'] ) ) { + $_SESSION['XOOPS_G_STUBS'] = array(); + } - // returns an array for xoops_confirm() ; - function getTicketArray( $salt = '' , $timeout = 1800 , $area = '' ) - { - return array( 'XOOPS_G_TICKET' => $this->issue( $salt , $timeout , $area ) ) ; - } + // limit max stubs 10 + if ( sizeof( $_SESSION['XOOPS_G_STUBS'] ) > 10 ) { + $_SESSION['XOOPS_G_STUBS'] = array_slice( $_SESSION['XOOPS_G_STUBS'], - 10 ); + } - // return GET parameter string. - function getTicketParamString( $salt = '' , $noamp = false , $timeout=1800 , $area = '' ) - { - return ( $noamp ? '' : '&' ) . 'XOOPS_G_TICKET=' . $this->issue( $salt, $timeout , $area ) ; - } + // record referer if browser send it + $referer = empty( $_SERVER['HTTP_REFERER'] ) ? '' : $_SERVER['REQUEST_URI']; - // issue a ticket - function issue( $salt = '' , $timeout = 1800 , $area = '' ) - { - global $xoopsModule ; - - // create a token - list( $usec , $sec ) = explode( " " , microtime() ) ; - $appendix_salt = empty( $_SERVER['PATH'] ) ? XOOPS_DB_NAME : $_SERVER['PATH'] ; - $token = crypt( $salt . $usec . $appendix_salt . $sec , XOOPS_DB_PREFIX ) ; - $this->_latest_token = $token ; - - if( empty( $_SESSION['XOOPS_G_STUBS'] ) ) $_SESSION['XOOPS_G_STUBS'] = array() ; - - // limit max stubs 10 - if( sizeof( $_SESSION['XOOPS_G_STUBS'] ) > 10 ) { - $_SESSION['XOOPS_G_STUBS'] = array_slice( $_SESSION['XOOPS_G_STUBS'] , -10 ) ; - } + // area as module's dirname + if ( ! $area && is_object( @$xoopsModule ) ) { + $area = $xoopsModule->getVar( 'dirname' ); + } - // record referer if browser send it - $referer = empty( $_SERVER['HTTP_REFERER'] ) ? '' : $_SERVER['REQUEST_URI'] ; + // store stub + $_SESSION['XOOPS_G_STUBS'][] = array( + 'expire' => time() + $timeout, + 'referer' => $referer, + 'area' => $area, + 'token' => $token + ); - // area as module's dirname - if( ! $area && is_object( @$xoopsModule ) ) { - $area = $xoopsModule->getVar('dirname') ; + // paid md5ed token as a ticket + return md5( $token . XOOPS_DB_PREFIX ); } - // store stub - $_SESSION['XOOPS_G_STUBS'][] = array( - 'expire' => time() + $timeout , - 'referer' => $referer , - 'area' => $area , - 'token' => $token - ) ; + // check a ticket + function check( $post = true, $area = '', $allow_repost = true ) { + global $xoopsModule; - // paid md5ed token as a ticket - return md5( $token . XOOPS_DB_PREFIX ) ; - } + $this->_errors = array(); - // check a ticket - function check( $post = true , $area = '' , $allow_repost = true ) - { - global $xoopsModule ; + // CHECK: stubs are not stored in session + if ( ! is_array( @$_SESSION['XOOPS_G_STUBS'] ) ) { + $this->_errors[] = $this->messages['err_nostubs']; + $_SESSION['XOOPS_G_STUBS'] = array(); + } - $this->_errors = array() ; + // get key&val of the ticket from a user's query + $ticket = $post ? @$_POST['XOOPS_G_TICKET'] : @$_GET['XOOPS_G_TICKET']; - // CHECK: stubs are not stored in session - if( ! is_array(@$_SESSION['XOOPS_G_STUBS'])) { - $this->_errors[] = $this->messages['err_nostubs'] ; - $_SESSION['XOOPS_G_STUBS'] = array() ; - } - - // get key&val of the ticket from a user's query - $ticket = $post ? @$_POST['XOOPS_G_TICKET'] : @$_GET['XOOPS_G_TICKET'] ; + // CHECK: no tickets found + if ( empty( $ticket ) ) { + $this->_errors[] = $this->messages['err_noticket']; + } - // CHECK: no tickets found - if( empty( $ticket ) ) { - $this->_errors[] = $this->messages['err_noticket'] ; - } + // gargage collection & find a right stub + $stubs_tmp = $_SESSION['XOOPS_G_STUBS']; + $_SESSION['XOOPS_G_STUBS'] = array(); + foreach ( $stubs_tmp as $stub ) { + // default lifetime 30min + if ( $stub['expire'] >= time() ) { + if ( md5( $stub['token'] . XOOPS_DB_PREFIX ) === $ticket ) { + $found_stub = $stub; + } else { + // store the other valid stubs into session + $_SESSION['XOOPS_G_STUBS'][] = $stub; + } + } else { + if ( md5( $stub['token'] . XOOPS_DB_PREFIX ) === $ticket ) { + // not CSRF but Time-Out + $timeout_flag = true; + } + } + } - // gargage collection & find a right stub - $stubs_tmp = $_SESSION['XOOPS_G_STUBS'] ; - $_SESSION['XOOPS_G_STUBS'] = array() ; - foreach( $stubs_tmp as $stub ) { - // default lifetime 30min - if( $stub['expire'] >= time() ) { - if( md5( $stub['token'] . XOOPS_DB_PREFIX ) === $ticket ) { - $found_stub = $stub ; + // CHECK: the right stub found or not + if ( empty( $found_stub ) ) { + if ( empty( $timeout_flag ) ) { + $this->_errors[] = $this->messages['err_nopair']; } else { - // store the other valid stubs into session - $_SESSION['XOOPS_G_STUBS'][] = $stub ; + $this->_errors[] = $this->messages['err_timeout']; } } else { - if( md5( $stub['token'] . XOOPS_DB_PREFIX ) === $ticket ) { - // not CSRF but Time-Out - $timeout_flag = true ; + + // set area if necessary + // area as module's dirname + if ( ! $area && is_object( @$xoopsModule ) ) { + $area = $xoopsModule->getVar( 'dirname' ); } - } - } - // CHECK: the right stub found or not - if( empty( $found_stub ) ) { - if( empty( $timeout_flag ) ) $this->_errors[] = $this->messages['err_nopair'] ; - else $this->_errors[] = $this->messages['err_timeout'] ; - } else { + // check area or referer + if ( @$found_stub['area'] == $area ) { + $area_check = true; + } + if ( ! empty( $found_stub['referer'] ) && strstr( @$_SERVER['HTTP_REFERER'], $found_stub['referer'] ) ) { + $referer_check = true; + } - // set area if necessary - // area as module's dirname - if( ! $area && is_object( @$xoopsModule ) ) { - $area = $xoopsModule->getVar('dirname') ; + if ( empty( $area_check ) && empty( $referer_check ) ) { // loose + $this->_errors[] = $this->messages['err_areaorref']; + } } - // check area or referer - if( @$found_stub['area'] == $area ) $area_check = true ; - if( ! empty( $found_stub['referer'] ) && strstr( @$_SERVER['HTTP_REFERER'] , $found_stub['referer'] ) ) $referer_check = true ; + if ( ! empty( $this->_errors ) ) { + if ( $allow_repost ) { + // repost form + $this->draw_repost_form( $area ); + exit; + } else { + // failed + $this->clear(); - if( empty( $area_check ) && empty( $referer_check ) ) { // loose - $this->_errors[] = $this->messages['err_areaorref'] ; + return false; + } + } else { + // all green + return true; } } - if( ! empty( $this->_errors ) ) { - if( $allow_repost ) { - // repost form - $this->draw_repost_form( $area ) ; - exit ; - } else { - // failed - $this->clear() ; - return false ; + // draw form for repost + function draw_repost_form( $area = '' ) { + // Notify which file is broken + if ( headers_sent() ) { + restore_error_handler(); + set_error_handler( array( &$this, 'errorHandler4FindOutput' ) ); + header( 'Dummy: for warning' ); + restore_error_handler(); + exit; } - } else { - // all green - return true; - } - } - // draw form for repost - function draw_repost_form( $area = '' ) - { - // Notify which file is broken - if( headers_sent() ) { - restore_error_handler() ; - set_error_handler( array( &$this , 'errorHandler4FindOutput' ) ) ; - header( 'Dummy: for warning' ) ; - restore_error_handler() ; - exit ; - } - - error_reporting( 0 ) ; - while( ob_get_level() ) ob_end_clean() ; - - $table = '' ; - $form = '' ; - foreach( $_POST as $key => $val ) { - if( $key == 'XOOPS_G_TICKET' ) continue ; - if( get_magic_quotes_gpc() ) { - $key = stripslashes( $key ) ; + error_reporting( 0 ); + while ( ob_get_level() ) { + ob_end_clean(); } - if( is_array( $val ) ) { - list( $tmp_table , $tmp_form ) = $this->extract_post_recursive( htmlspecialchars($key,ENT_QUOTES) , $val ) ; - $table .= $tmp_table ; - $form .= $tmp_form ; - } else { - if( get_magic_quotes_gpc() ) { - $val = stripslashes( $val ) ; + + $table = '
'; + $form = ''; + foreach ( $_POST as $key => $val ) { + if ( $key == 'XOOPS_G_TICKET' ) { + continue; + } + if ( get_magic_quotes_gpc() ) { + $key = stripslashes( $key ); + } + if ( is_array( $val ) ) { + list( $tmp_table, $tmp_form ) = $this->extract_post_recursive( htmlspecialchars( $key, ENT_QUOTES ), $val ); + $table .= $tmp_table; + $form .= $tmp_form; + } else { + if ( get_magic_quotes_gpc() ) { + $val = stripslashes( $val ); + } + $table .= '' . "\n"; + $form .= '' . "\n"; } - $table .= ''."\n" ; - $form .= ''."\n" ; } - } - $table .= '
' . htmlspecialchars( $key, ENT_QUOTES ) . '' . htmlspecialchars( $val, ENT_QUOTES ) . '
'.htmlspecialchars($key,ENT_QUOTES).''.htmlspecialchars($val,ENT_QUOTES).'
' ; - $form .= $this->getTicketHtml(__LINE__,300,$area).'' ; + $table .= ''; + $form .= $this->getTicketHtml( __LINE__, 300, $area ) . ''; - echo ''.$this->messages['err_general'].'' . sprintf( $this->messages['fmt_prompt4repost'] , $this->getErrors() ) . $table . $form . '' ; - } + echo '' . $this->messages['err_general'] . '' . sprintf( $this->messages['fmt_prompt4repost'], $this->getErrors() ) . $table . $form . ''; + } - function extract_post_recursive( $key_name , $tmp_array ) { - $table = '' ; - $form = '' ; - foreach( $tmp_array as $key => $val ) { - if( get_magic_quotes_gpc() ) { - $key = stripslashes( $key ) ; - } - if( is_array( $val ) ) { - list( $tmp_table , $tmp_form ) = $this->extract_post_recursive( $key_name.'['.htmlspecialchars($key,ENT_QUOTES).']' , $val ) ; - $table .= $tmp_table ; - $form .= $tmp_form ; - } else { - if( get_magic_quotes_gpc() ) { - $val = stripslashes( $val ) ; + function extract_post_recursive( $key_name, $tmp_array ) { + $table = ''; + $form = ''; + foreach ( $tmp_array as $key => $val ) { + if ( get_magic_quotes_gpc() ) { + $key = stripslashes( $key ); + } + if ( is_array( $val ) ) { + list( $tmp_table, $tmp_form ) = $this->extract_post_recursive( $key_name . '[' . htmlspecialchars( $key, ENT_QUOTES ) . ']', $val ); + $table .= $tmp_table; + $form .= $tmp_form; + } else { + if ( get_magic_quotes_gpc() ) { + $val = stripslashes( $val ); + } + $table .= '' . $key_name . '[' . htmlspecialchars( $key, ENT_QUOTES ) . ']' . htmlspecialchars( $val, ENT_QUOTES ) . '' . "\n"; + $form .= '' . "\n"; } - $table .= ''.$key_name.'['.htmlspecialchars($key,ENT_QUOTES).']'.htmlspecialchars($val,ENT_QUOTES).''."\n" ; - $form .= ''."\n" ; } + + return array( $table, $form ); } - return array( $table , $form ) ; - } - // clear all stubs - function clear() - { - $_SESSION['XOOPS_G_STUBS'] = array() ; - } + // clear all stubs + function clear() { + $_SESSION['XOOPS_G_STUBS'] = array(); + } - // Ticket Using - function using() - { - if( ! empty( $_SESSION['XOOPS_G_STUBS'] ) ) { - return true; - } else { - return false; + // Ticket Using + function using() { + if ( ! empty( $_SESSION['XOOPS_G_STUBS'] ) ) { + return true; + } else { + return false; + } } - } - // return errors - function getErrors( $ashtml = true ) - { - if( $ashtml ) { - $ret = '' ; - foreach( $this->_errors as $msg ) { - $ret .= "$msg
\n" ; + // return errors + function getErrors( $ashtml = true ) { + if ( $ashtml ) { + $ret = ''; + foreach ( $this->_errors as $msg ) { + $ret .= "$msg
\n"; + } + } else { + $ret = $this->_errors; } - } else { - $ret = $this->_errors ; + + return $ret; } - return $ret ; - } - function errorHandler4FindOutput($errNo, $errStr, $errFile, $errLine) - { - if( preg_match( '?'.preg_quote(XOOPS_ROOT_PATH).'([^:]+)\:(\d+)?' , $errStr , $regs ) ) { - echo "Irregular output! check the file ".htmlspecialchars($regs[1])." line ".htmlspecialchars($regs[2]) ; - } else { - echo "Irregular output! check language files etc." ; + function errorHandler4FindOutput( $errNo, $errStr, $errFile, $errLine ) { + if ( preg_match( '?' . preg_quote( XOOPS_ROOT_PATH ) . '([^:]+)\:(\d+)?', $errStr, $regs ) ) { + echo "Irregular output! check the file " . htmlspecialchars( $regs[1] ) . " line " . htmlspecialchars( $regs[2] ); + } else { + echo "Irregular output! check language files etc."; + } + + return; } - return ; - } // end of class -} + } // create a instance in global scope -$GLOBALS['xoopsGTicket'] = new XoopsGTicket() ; + $GLOBALS['xoopsGTicket'] = new XoopsGTicket(); } -if( ! function_exists( 'admin_refcheck' ) ) { +if ( ! function_exists( 'admin_refcheck' ) ) { //Admin Referer Check By Marijuana(Rev.011) -function admin_refcheck($chkref = "") { - if( empty( $_SERVER['HTTP_REFERER'] ) ) { - return true ; - } else { - $ref = $_SERVER['HTTP_REFERER']; + function admin_refcheck( $chkref = "" ) { + if ( empty( $_SERVER['HTTP_REFERER'] ) ) { + return true; + } else { + $ref = $_SERVER['HTTP_REFERER']; + } + $cr = XOOPS_URL; + if ( $chkref != "" ) { + $cr .= $chkref; + } + if ( strpos( $ref, $cr ) !== 0 ) { + return false; + } + + return true; } - $cr = XOOPS_URL; - if ( $chkref != "" ) { $cr .= $chkref; } - if ( strpos($ref, $cr) !== 0 ) { return false; } - return true; -} } - - -?> \ No newline at end of file diff --git a/html/modules/multiMenu/include/onupdate.inc.php b/html/modules/multiMenu/include/onupdate.inc.php index 2296718..73bff71 100644 --- a/html/modules/multiMenu/include/onupdate.inc.php +++ b/html/modules/multiMenu/include/onupdate.inc.php @@ -1,6 +1,18 @@ mDelegateManager->add( 'Legacy.Admin.Event.ModuleUpdate.' . ucfirst($mydirname) . '.Success', 'multiMenu_message_append_onupdate' ) ; - $msgs = array() ; - } else { - $isCube = false ; - if( ! is_array( $msgs ) ) $msgs = array() ; + if ( defined( 'XOOPS_CUBE_LEGACY' ) ) { + $isCube = true; + $root =& XCube_Root::getSingleton(); + $root->mDelegateManager->add( 'Legacy.Admin.Event.ModuleUpdate.' . ucfirst( $mydirname ) . '.Success', 'multiMenu_message_append_onupdate' ); + $msgs = array(); } $db =& Database::getInstance() ; -// $mid = $module->getVar('mid') ; //version 1.13 -> version 1.14 $addTables = array('multimenu05','multimenu06','multimenu07','multimenu08'); @@ -31,14 +39,14 @@ function multiMenu_onupdate_base( $module, $prev_version , $mydirname ) if( empty($result) ){ $sql ="CREATE TABLE ".$db->prefix($table_name)." ( id int(5) unsigned NOT NULL auto_increment, - title varchar(2048) NOT NULL default '', + title varchar(191) NOT NULL default '', hide tinyint(1) unsigned NOT NULL default '0', - link varchar(255) default NULL, + link varchar(191) default NULL, weight tinyint(4) unsigned NOT NULL default '0', target varchar(10) default NULL, - groups varchar(255) default NULL, + groups varchar(191) default NULL, PRIMARY KEY (id) - ) ENGINE=MyISAM; + ) ENGINE = InnoDB; "; if( $db->query($sql) ){ $msgs[] = '  Table '.htmlspecialchars($db->prefix($table_name),ENT_QUOTES).' created.'; @@ -56,14 +64,14 @@ function multiMenu_onupdate_base( $module, $prev_version , $mydirname ) id int(5) unsigned NOT NULL auto_increment, block_id int(5) unsigned NOT NULL default '0', parent_id int(5) unsigned NOT NULL default '0', - title varchar(2048) NOT NULL default '', + title varchar(191) NOT NULL default '', hide tinyint(1) unsigned NOT NULL default '0', - link varchar(255) default NULL, + link varchar(191) default NULL, weight tinyint(4) unsigned NOT NULL default '0', target varchar(10) default NULL, - groups varchar(255) default NULL, + groups varchar(191) default NULL, PRIMARY KEY (id) - ) ENGINE=MyISAM; + ) ENGINE = InnoDB; "; if( $db->query($sql) ){ $msgs[] = '  Table '.htmlspecialchars($db->prefix("multimenu99"),ENT_QUOTES).' created.'; @@ -79,7 +87,7 @@ function multiMenu_onupdate_base( $module, $prev_version , $mydirname ) uid mediumint(8) NOT NULL default '0', id int(5) unsigned NOT NULL default '0', PRIMARY KEY (uid) - ) ENGINE=MyISAM; + ) ENGINE = InnoDB; "; if( $db->query($sql) ){ $msgs[] = '  Table '.htmlspecialchars($db->prefix("multimenu99"),ENT_QUOTES).' created.'; @@ -101,5 +109,3 @@ function multiMenu_message_append_onupdate( &$module_obj , &$log ) } // use mLog->addWarning() or mLog->addError() if necessary } - -?> \ No newline at end of file diff --git a/html/modules/multiMenu/index.php b/html/modules/multiMenu/index.php index e30cc7d..4b7d15e 100644 --- a/html/modules/multiMenu/index.php +++ b/html/modules/multiMenu/index.php @@ -1,41 +1,7 @@ load() ){ - echo $handler->debug(); die; -} -***************************************************/ -/* - * Ctrl - */ -/************************************************* Reserved Process -if ( $ctrl ){ - if ( !$ret = $handler->$ctrl() ){ - echo $handler->debug(); die; - } -} -***************************************************/ -/* - * View - */ -/************************************************* Reserved Process -$handler->assignRecords(); -$xoopsOption['template_main'] = $mydirname ."_". $model . ".html" ; -***************************************************/ + include( XOOPS_ROOT_PATH.'/footer.php' ) ; -?> \ No newline at end of file diff --git a/html/modules/multiMenu/language/english/admin.php b/html/modules/multiMenu/language/english/admin.php index ac62aca..fab932e 100644 --- a/html/modules/multiMenu/language/english/admin.php +++ b/html/modules/multiMenu/language/english/admin.php @@ -1,13 +1,13 @@ diff --git a/html/modules/multiMenu/language/english/blocks.php b/html/modules/multiMenu/language/english/blocks.php index 2b644ac..c4fb61e 100644 --- a/html/modules/multiMenu/language/english/blocks.php +++ b/html/modules/multiMenu/language/english/blocks.php @@ -9,4 +9,3 @@ define("_BM_MULTIMENU_TITLE_7","multiMenu 8"); define("_BM_MULTIMENU_CHARS","Length of the title"); define("_BM_MULTIMENU_LENGTH", " characters"); -?> diff --git a/html/modules/multiMenu/language/english/help/help.html b/html/modules/multiMenu/language/english/help/help.html index 2833850..759645d 100644 --- a/html/modules/multiMenu/language/english/help/help.html +++ b/html/modules/multiMenu/language/english/help/help.html @@ -1,18 +1,18 @@ -

***** multiMenu Module ******

+

multiMenu Module

[ Setting method ]

-

-

You can use the following ways to customize to link at config - menu of MultiMenu.

-

* You can specify by full length of path.

-

    Example: - http://www.hogehoge.co.jp/xoops/index.php      - etc

-

* You can specify by module name.

-
[module_name]
-
[module_name]xxxx.php?xxxx=xxxx
+ +
+

You can use the following methods to customize a link in the MultiMenu setup.

+

You can specify by full length of path. Example:

+
https://github.com/xoopscube/xcl
+ +
+ +

You can specify by module name.

+

[module_name]

+

[module_name]xxxx.php?xxxx=xxxx


- +
@@ -94,12 +94,11 @@
[module_name]xxxx.php?xxxx=xxxx
example:

-
*You can show submenu always.
-
+[module_name]
-
+[module_name]xxxx.php?xxxx=xxxx
-
- +

You can show submenu always.

+

+[module_name]

+

+[module_name]xxxx.php?xxxx=xxxx

+
+
@@ -211,13 +210,11 @@
+[module_name]xxxx.php?xxxx=xxxx
example:

 

-

* You can show sub menu of the module you access.(Same as - mainmenu.)

+

You can show sub menu of the module you access.(Same as mainmenu.)

@[module_name]
@[module_name]xxxx.php?xxxx=xxxx

- +
@@ -361,20 +358,19 @@
@[module_name]xxxx.php?xxxx=xxxx
example:

-

* You can show sub menu customised.

-
-[module_name]
-
-[module_name]xxxx.php?xxxx=xxxx
-
-http://www.hogehoge.co.jp/xoops/index.php
+

You can show sub menu customised.

+

-[module_name]

+

-[module_name]xxxx.php?xxxx=xxxx

+

-https://github.com/xoopscube/xcl


-

   The menu with a symbolic link begins with the - add - to the menu with a symbolic link not to begin with - as submenu.

+

   The menu with a symbolic link begins with the "-" add + to the menu with a symbolic link not to begin with "-" as submenu.

   How it is showed changes by parent element as the - follwing example.

+ following example.

   If you show the customized submenu with the submenu of original module, it is added to at the bottom of the submenu of the original module.

- +
@@ -621,13 +617,12 @@
-http://www.hogehoge.co.jp/xoops/index.php
example:
-

* You can show only customized submenu, when you access the +

You can show only customized submenu, when you access the module. (Don't show the submenu of original module.)

-
&[module_name]
-
&[module_name]xxxx.php?xxxx=xxxx
+

&[module_name]

+

&[module_name]xxxx.php?xxxx=xxxx


- +
@@ -704,4 +699,4 @@
&[module_name]xxxx.php?xxxx=xxxx
-
example:
\ No newline at end of file + diff --git a/html/modules/multiMenu/language/english/modinfo.php b/html/modules/multiMenu/language/english/modinfo.php index c677183..6e1987b 100644 --- a/html/modules/multiMenu/language/english/modinfo.php +++ b/html/modules/multiMenu/language/english/modinfo.php @@ -1,6 +1,6 @@ +define("_IM_MULTIMENU_DESC", "Create and manage different Custom Menus."); diff --git a/html/modules/multiMenu/language/french/admin.php b/html/modules/multiMenu/language/french/admin.php deleted file mode 100644 index 60d7860..0000000 --- a/html/modules/multiMenu/language/french/admin.php +++ /dev/null @@ -1,30 +0,0 @@ - diff --git a/html/modules/multiMenu/language/french/blocks.php b/html/modules/multiMenu/language/french/blocks.php deleted file mode 100644 index b9bab23..0000000 --- a/html/modules/multiMenu/language/french/blocks.php +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/html/modules/multiMenu/language/french/index.html b/html/modules/multiMenu/language/french/index.html deleted file mode 100644 index 990cbd6..0000000 --- a/html/modules/multiMenu/language/french/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/html/modules/multiMenu/language/french/modinfo.php b/html/modules/multiMenu/language/french/modinfo.php deleted file mode 100644 index a3f8d2e..0000000 --- a/html/modules/multiMenu/language/french/modinfo.php +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/html/modules/multiMenu/language/german/modinfo.php b/html/modules/multiMenu/language/german/modinfo.php index 147b0d8..7c1e123 100644 --- a/html/modules/multiMenu/language/german/modinfo.php +++ b/html/modules/multiMenu/language/german/modinfo.php @@ -1,6 +1,6 @@ +define("_IM_MULTIMENU_DESC", "Mit multiMenu k?nen bis verschiedene Men? erstellt werden."); + diff --git a/html/modules/multiMenu/language/germandu/admin.php b/html/modules/multiMenu/language/germandu/admin.php index 706e24c..2c4067a 100644 --- a/html/modules/multiMenu/language/germandu/admin.php +++ b/html/modules/multiMenu/language/germandu/admin.php @@ -27,4 +27,4 @@ define("_AD_MULTIMENU_UPDATED", "Die Datenbank wurde erfolgreich aktualisiert!"); define("_AD_MULTIMENU_NOTUPDATED", "Die Datenbank konnte leider nicht aktualisiert werden."); define("_AD_MULTIMENU_SUBMIT", "Abschicken"); -?> + diff --git a/html/modules/multiMenu/language/germandu/blocks.php b/html/modules/multiMenu/language/germandu/blocks.php index 06b358a..18df282 100644 --- a/html/modules/multiMenu/language/germandu/blocks.php +++ b/html/modules/multiMenu/language/germandu/blocks.php @@ -1,12 +1,12 @@ +define("_BM_MULTIMENU_TITLE", "multiMenu 1"); +define("_BM_MULTIMENU_TITLE_1", "multiMenu 2"); +define("_BM_MULTIMENU_TITLE_2", "multiMenu 3"); +define("_BM_MULTIMENU_TITLE_3", "multiMenu 4"); +define("_BM_MULTIMENU_TITLE_4", "multiMenu 5"); +define("_BM_MULTIMENU_TITLE_5", "multiMenu 6"); +define("_BM_MULTIMENU_TITLE_6", "multiMenu 7"); +define("_BM_MULTIMENU_TITLE_7", "multiMenu 8"); +define("_BM_MULTIMENU_CHARS", "L?ge des Titels"); +define("_BM_MULTIMENU_LENGTH", " Zeichen"); + diff --git a/html/modules/multiMenu/language/germandu/modinfo.php b/html/modules/multiMenu/language/germandu/modinfo.php index 147b0d8..7c1e123 100644 --- a/html/modules/multiMenu/language/germandu/modinfo.php +++ b/html/modules/multiMenu/language/germandu/modinfo.php @@ -1,6 +1,6 @@ +define("_IM_MULTIMENU_DESC", "Mit multiMenu k?nen bis verschiedene Men? erstellt werden."); + diff --git a/html/modules/multiMenu/language/ja_utf8/admin.php b/html/modules/multiMenu/language/ja_utf8/admin.php index 8dc1377..d3c1102 100644 --- a/html/modules/multiMenu/language/ja_utf8/admin.php +++ b/html/modules/multiMenu/language/ja_utf8/admin.php @@ -112,4 +112,3 @@ define('_AM_ACTIVERIGHTS','モジュール管理者権限'); define('_AM_ACCESSRIGHTS','モジュールアクセス権限'); } -?> \ No newline at end of file diff --git a/html/modules/multiMenu/language/ja_utf8/blocks.php b/html/modules/multiMenu/language/ja_utf8/blocks.php index e7b0795..6f7964c 100644 --- a/html/modules/multiMenu/language/ja_utf8/blocks.php +++ b/html/modules/multiMenu/language/ja_utf8/blocks.php @@ -9,4 +9,3 @@ define("_BM_MULTIMENU_TITLE_7","マルチメニュー 8"); define("_BM_MULTIMENU_CHARS","タイトルの文字数"); define("_BM_MULTIMENU_LENGTH"," 文字"); -?> \ No newline at end of file diff --git a/html/modules/multiMenu/language/ja_utf8/modinfo.php b/html/modules/multiMenu/language/ja_utf8/modinfo.php index d5363f6..b24897c 100644 --- a/html/modules/multiMenu/language/ja_utf8/modinfo.php +++ b/html/modules/multiMenu/language/ja_utf8/modinfo.php @@ -11,4 +11,3 @@ define("_IM_MULTIMENU_FLOW", "フローメニュー"); define("_IM_MULTIMENU_NAME_BL", "ブロック管理"); define("_IM_MULTIMENU_DESC", "8つの異なるメニューとフローを作る事ができます"); -?> \ No newline at end of file diff --git a/html/modules/multiMenu/readme_jp.txt b/html/modules/multiMenu/readme_jp.txt deleted file mode 100644 index bf168b6..0000000 --- a/html/modules/multiMenu/readme_jp.txt +++ /dev/null @@ -1,220 +0,0 @@ -***** multiMenu Module ****** -[ ˡ ] - -MultiMenṳˤ롢󥯤εˡˤϡʲˡѤǤޤ - -* ̾ɤꡢեѥˤURL - - : http://www.hogehoge.co.jp/xoops/index.php ʤ - -* ⥸塼̾ˤ -[module_name] -[module_name]xxxx.php?xxxx=xxxx - - : ==>[news] - ȥ ==> ˥塼 - -ɽ : -˥塼 - -㡧 ==> [news]article.php?storyid=11 - ȥ ==> ʥ˥塼 - -ɽ : -ʥ˥塼 - - -* ֥˥塼ɽ -+[module_name] -+[module_name]xxxx.php?xxxx=xxxx - -㡧 ==> +[news] - ȥ ==> ˥塼 - -ɽ :ʾɽƤޤ -˥塼 -˥塼 - - -㡧 ==> @[news]article.php?storyid=11 - ȥ ==> ʥ˥塼 - -ɽ :ʾɽƤޤ -ʥ˥塼 -˥塼 - - - -* ⥸塼ɽƤ֥˥塼ɽʥᥤ˥塼Ʊư -@[module_name] -@[module_name]xxxx.php?xxxx=xxxx - -㡧 ==> @[news] - ȥ ==> ˥塼 - -ɽ :̾ -˥塼 - -ɽ :ʳ⥸塼ɽƤ -˥塼 -˥塼 - - -㡧 ==> @[news]article.php?storyid=11 - ȥ ==> ʥ˥塼 - -ɽ :̾ -ʥ˥塼 - -ɽ :ʳ⥸塼ɽƤ -ʥ˥塼 -˥塼 - - - -* ॵ֥˥塼Ȥɽ --[module_name] --[module_name]xxxx.php?xxxx=xxxx --http://www.hogehoge.co.jp/xoops/index.php - --ǻϤޤ󥯤ĥ˥塼ϡ-ǻϤޤʤ󥯤ĥ˥塼Υ֥˥塼ɲäޤ -ƥ˥塼°ˤäƥ֥˥塼ɽΤϰʲΤ褦Ѥޤ⥸塼 -֥˥塼Ʊɽϡ⥸塼Υ֥˥塼ΰֲ˥ॵ֥˥塼ɲäޤ - -㡧 ==> [news] ȥ ==> ˥塼 - ==> -[news]article.php?storyid=2?storyid=2 ȥ ==> ʥ˥塼 - -ɽ :ʾɽƤޤ -˥塼 -ʥ˥塼 - -㡧 ==> +[news]ȥ ==> ˥塼 - ==> -[news]article.php?storyid=2?storyid=2 ȥ ==> ʥ˥塼 - -ɽ :ʾɽƤޤ -˥塼 -˥塼 - -ʥ˥塼 - -㡧 ==> &[news]ȥ ==> ˥塼 - ==> -[news]article.php?storyid=2?storyid=2 ȥ ==> ʥ˥塼 - -ɽ :̾ -˥塼 - -ɽ :ʳ⥸塼ɽƤ -˥塼 -˥塼 - -ʥ˥塼 - - -* ⥸塼ɽƤॵ֥˥塼ɽʥ⥸塼Υ֥˥塼ɽʤ -&[module_name] -&[module_name]xxxx.php?xxxx=xxxx - -㡧 ==> &[news]ȥ ==> ˥塼 - ==> -[news]article.php?storyid=2?storyid=2 ȥ ==> ʥ˥塼 - -ɽ :̾ -˥塼 - -ɽ :ʳ⥸塼ɽƤ -˥塼 -ʥ˥塼 - - - -[ ] -v1.20 - * XOOPS Cube Legacy 2.1.xѤ˽񤭴 - * ƥθPOSTforeachŸѻߡ - * PHP5Τб - * system⥸塼뤬ʤƤư褦˽ - * HTTP_POST_VARSѻ - * ֥åƥץ졼ȤΥե̾ѹ - * ֥åǽƤʤäΤ - --------------------------------------------------- -v1.14.08 to v1.15 2006-09-05 - * XOOPS Cube 2.1 б ե뽤 - --------------------------------------------------- -v1.14.07 to v1.14.08 2005-02-15 - * ƥץ졼ȤCSS class="menuTop" ɲ (THX hodaka) - --------------------------------------------------- -v1.14.06 to v1.14.07 2005-02-15 - * '-'դ⥸塼̾бδְ㤤 - --------------------------------------------------- -v1.14.05 to v1.14.06 2005-02-12 - * '-'դ⥸塼̾б (THX sakichi) - --------------------------------------------------- -v1.14.04 to v1.14.05 2004-10-24 - * ॵ֥˥塼Ǥ롢&ס-פεҤɲá(nobunobu˴) - --------------------------------------------------- -v1.14.03 to v1.14.04 2004-05-21 - * admin/menu.php typo - * ֥˥塼ɽΥХ - --------------------------------------------------- -v1.14.02 to v1.14.03 2004-05-20 - * @[module_name]פȤҤǡᥤ˥塼Ʊưˤʤ褦˵ǽɲ - --------------------------------------------------- -v1.14.01 to v1.14.02 - * 󥯤weight礬ʤʤХ - --------------------------------------------------- -v1.14 to v1.14-01 2004-05-05 - * ǥ쥯ȥ̾δְ㤤 - --------------------------------------------------- -v1.13.01 to v1.14 - * +[module_name]פȵҤȡ֥˥塼ɽ褦ˤ - * ˥塼򣸸Ĥˤ - * ե빽ѹ - /form/ǥ쥯ȥ꡼ ==> - /admin/admin_menu.php ==> - /admin/admin_function.php ==> ɲ - - * version_up.php κ - - * ̤Υǥѹ - * եμ㴳νѹ - --------------------------------------------------- -v1.13 to v1.13.01 - * ̤Υˡ[module_name]index.php?article=xxxxפʤɤΥ󥯤ǽˤ - --------------------------------------------------- -v1.12 to v1.13 - * BUGFIX - * Υեɲ - --------------------------------------------------- -1.11 to v1.12 - * GIJOEmyblocksadminƳޤ - --------------------------------------------------- -v1.10 to v1.11 -ܸեޤ - -ΤĤǤˡ㴳ѹޤΤǵϿƤޤ - - * ̤ˤơ˳ƥ֥åؤΥ˥塼ɲá - (ɲåե롡admin/admin_menu.php) - - * ֥å˥åȡ꤬褦ʵΤǡ - ǰΰ١ƥ֥åΥƥץ졼ȥե̡ˤޤ - (ɲåե롡template/multimenu_block01xA3.html) - - * ⥸塼ΥåץơȻ˥֥åƤޤԶν - (ե롡xoops_version.php) - - - Tom 2003/11/08 diff --git a/html/modules/multiMenu/sql/mysql.sql b/html/modules/multiMenu/sql/mysql.sql index 0d7221b..1279949 100644 --- a/html/modules/multiMenu/sql/mysql.sql +++ b/html/modules/multiMenu/sql/mysql.sql @@ -1,113 +1,106 @@ -CREATE TABLE {prefix}_multimenu01 ( - id int(5) unsigned NOT NULL auto_increment, - title varchar(2048) NOT NULL default '', - hide tinyint(1) unsigned NOT NULL default '0', - link varchar(255) default NULL, - weight tinyint(4) unsigned NOT NULL default '0', - target varchar(10) default NULL, - groups varchar(255) default NULL, - PRIMARY KEY (id) -) ENGINE=MyISAM; - - -CREATE TABLE {prefix}_multimenu02 ( - id int(5) unsigned NOT NULL auto_increment, - title varchar(2048) NOT NULL default '', - hide tinyint(1) unsigned NOT NULL default '0', - link varchar(255) default NULL, - weight tinyint(4) unsigned NOT NULL default '0', - target varchar(10) default NULL, - groups varchar(255) default NULL, - PRIMARY KEY (id) -) ENGINE=MyISAM; - - -CREATE TABLE {prefix}_multimenu03 ( - id int(5) unsigned NOT NULL auto_increment, - title varchar(2048) NOT NULL default '', - hide tinyint(1) unsigned NOT NULL default '0', - link varchar(255) default NULL, - weight tinyint(4) unsigned NOT NULL default '0', - target varchar(10) default NULL, - groups varchar(255) default NULL, - PRIMARY KEY (id) -) ENGINE=MyISAM; - - -CREATE TABLE {prefix}_multimenu04 ( - id int(5) unsigned NOT NULL auto_increment, - title varchar(2048) NOT NULL default '', - hide tinyint(1) unsigned NOT NULL default '0', - link varchar(255) default NULL, - weight tinyint(4) unsigned NOT NULL default '0', - target varchar(10) default NULL, - groups varchar(255) default NULL, - PRIMARY KEY (id) -) ENGINE=MyISAM; - -CREATE TABLE {prefix}_multimenu05 ( - id int(5) unsigned NOT NULL auto_increment, - title varchar(2048) NOT NULL default '', - hide tinyint(1) unsigned NOT NULL default '0', - link varchar(255) default NULL, - weight tinyint(4) unsigned NOT NULL default '0', - target varchar(10) default NULL, - groups varchar(255) default NULL, - PRIMARY KEY (id) -) ENGINE=MyISAM; - - -CREATE TABLE {prefix}_multimenu06 ( - id int(5) unsigned NOT NULL auto_increment, - title varchar(2048) NOT NULL default '', - hide tinyint(1) unsigned NOT NULL default '0', - link varchar(255) default NULL, - weight tinyint(4) unsigned NOT NULL default '0', - target varchar(10) default NULL, - groups varchar(255) default NULL, - PRIMARY KEY (id) -) ENGINE=MyISAM; - -CREATE TABLE {prefix}_multimenu07 ( - id int(5) unsigned NOT NULL auto_increment, - title varchar(2048) NOT NULL default '', - hide tinyint(1) unsigned NOT NULL default '0', - link varchar(255) default NULL, - weight tinyint(4) unsigned NOT NULL default '0', - target varchar(10) default NULL, - groups varchar(255) default NULL, - PRIMARY KEY (id) -) ENGINE=MyISAM; - - -CREATE TABLE {prefix}_multimenu08 ( - id int(5) unsigned NOT NULL auto_increment, - title varchar(2048) NOT NULL default '', - hide tinyint(1) unsigned NOT NULL default '0', - link varchar(255) default NULL, - weight tinyint(4) unsigned NOT NULL default '0', - target varchar(10) default NULL, - groups varchar(255) default NULL, - PRIMARY KEY (id) -) ENGINE=MyISAM; - - -CREATE TABLE {prefix}_multimenu99 ( - id int(5) unsigned NOT NULL auto_increment, - block_id int(5) unsigned NOT NULL default '0', - parent_id int(5) unsigned NOT NULL default '0', - title varchar(2048) NOT NULL default '', - hide tinyint(1) unsigned NOT NULL default '0', - link varchar(255) default NULL, - weight tinyint(4) unsigned NOT NULL default '0', - target varchar(10) default NULL, - groups varchar(255) default NULL, - PRIMARY KEY (id) -) ENGINE=MyISAM; - - -CREATE TABLE {prefix}_multimenu_log ( - uid mediumint(8) NOT NULL default '0', - id int(5) unsigned NOT NULL default '0', - PRIMARY KEY (uid) -) ENGINE=MyISAM; +CREATE TABLE `{prefix}_multimenu01` ( + `id` int(5) unsigned NOT NULL auto_increment, + `title` varchar(191) NOT NULL default '', + `hide` tinyint(1) unsigned NOT NULL default '0', + `link` varchar(191) default NULL, + `weight` tinyint(4) unsigned NOT NULL default '0', + `target` varchar(10) default NULL, + `groups` varchar(191) default NULL, + PRIMARY KEY (`id`) +) ENGINE = InnoDB; + +CREATE TABLE `{prefix}_multimenu02` ( + `id` int(5) unsigned NOT NULL auto_increment, + `title` varchar(191) NOT NULL default '', + `hide` tinyint(1) unsigned NOT NULL default '0', + `link` varchar(191) default NULL, + `weight` tinyint(4) unsigned NOT NULL default '0', + `target` varchar(10) default NULL, + `groups` varchar(191) default NULL, + PRIMARY KEY (`id`) +) ENGINE = InnoDB; + +CREATE TABLE `{prefix}_multimenu03` ( + `id` int(5) unsigned NOT NULL auto_increment, + `title` varchar(191) NOT NULL default '', + `hide` tinyint(1) unsigned NOT NULL default '0', + `link` varchar(191) default NULL, + `weight` tinyint(4) unsigned NOT NULL default '0', + `target` varchar(10) default NULL, + `groups` varchar(191) default NULL, + PRIMARY KEY (`id`) +) ENGINE = InnoDB; + +CREATE TABLE `{prefix}_multimenu04` ( + `id` int(5) unsigned NOT NULL auto_increment, + `title` varchar(191) NOT NULL default '', + `hide` tinyint(1) unsigned NOT NULL default '0', + `link` varchar(191) default NULL, + `weight` tinyint(4) unsigned NOT NULL default '0', + `target` varchar(10) default NULL, + `groups` varchar(191) default NULL, + PRIMARY KEY (`id`) +) ENGINE = InnoDB; + +CREATE TABLE `{prefix}_multimenu05` ( + `id` int(5) unsigned NOT NULL auto_increment, + `title` varchar(191) NOT NULL default '', + `hide` tinyint(1) unsigned NOT NULL default '0', + `link` varchar(191) default NULL, + `weight` tinyint(4) unsigned NOT NULL default '0', + `target` varchar(10) default NULL, + `groups` varchar(191) default NULL, + PRIMARY KEY (`id`) +) ENGINE = InnoDB; + +CREATE TABLE `{prefix}_multimenu06` ( + `id` int(5) unsigned NOT NULL auto_increment, + `title` varchar(191) NOT NULL default '', + `hide` tinyint(1) unsigned NOT NULL default '0', + `link` varchar(191) default NULL, + `weight` tinyint(4) unsigned NOT NULL default '0', + `target` varchar(10) default NULL, + `groups` varchar(191) default NULL, + PRIMARY KEY (`id`) +) ENGINE = InnoDB; + +CREATE TABLE `{prefix}_multimenu07` ( + `id` int(5) unsigned NOT NULL auto_increment, + `title` varchar(191) NOT NULL default '', + `hide` tinyint(1) unsigned NOT NULL default '0', + `link` varchar(191) default NULL, + `weight` tinyint(4) unsigned NOT NULL default '0', + `target` varchar(10) default NULL, + `groups` varchar(191) default NULL, + PRIMARY KEY (`id`) +) ENGINE = InnoDB; + +CREATE TABLE `{prefix}_multimenu08` ( + `id` int(5) unsigned NOT NULL auto_increment, + `title` varchar(191) NOT NULL default '', + `hide` tinyint(1) unsigned NOT NULL default '0', + `link` varchar(191) default NULL, + `weight` tinyint(4) unsigned NOT NULL default '0', + `target` varchar(10) default NULL, + `groups` varchar(191) default NULL, + PRIMARY KEY (`id`) +) ENGINE = InnoDB; + +CREATE TABLE `{prefix}_multimenu99` ( + `id` int(5) unsigned NOT NULL auto_increment, + `block_id` int(5) unsigned NOT NULL default '0', + `parent_id` int(5) unsigned NOT NULL default '0', + `title` varchar(191) NOT NULL default '', + `hide` tinyint(1) unsigned NOT NULL default '0', + `link` varchar(191) default NULL, + `weight` tinyint(4) unsigned NOT NULL default '0', + `target` varchar(10) default NULL, + `groups` varchar(191) default NULL, + PRIMARY KEY (`id`) +) ENGINE = InnoDB; + +CREATE TABLE `{prefix}_multimenu_log` ( + `uid` mediumint(8) NOT NULL default '0', + `id` int(5) unsigned NOT NULL default '0', + PRIMARY KEY (`uid`) +) ENGINE = InnoDB; diff --git a/html/modules/multiMenu/templates/blocks/multimenu_block01.html b/html/modules/multiMenu/templates/blocks/multimenu_block01.html index 59b36e4..b98307c 100644 --- a/html/modules/multiMenu/templates/blocks/multimenu_block01.html +++ b/html/modules/multiMenu/templates/blocks/multimenu_block01.html @@ -1,5 +1,5 @@ -
    +