Exemplo n.º 1
0
        CMED_setMI();
        $msg = CMED_validateMI($mode);
        if (empty($msg)) {
            $msg = CMED_saveMenuitems($mode);
            $CMED_CSRF_TOKEN = SEC_createToken();
            $display = $msg;
            $display .= CMED_listMenuitems();
            $display = COM_createHTMLDocument($display, array('pagetitle' => $LANG_CMED['manager']));
        } else {
            $display = COM_startBlock($LANG_CMED_EDITOR['error_field'], '', COM_getBlockTemplate('_msg_block', 'header'));
            $display .= $msg;
            $display .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
            $display .= CMED_editMenuitem($mid, 'edit', $MI);
            $display = COM_createHTMLDocument($display, array('pagetitle' => $LANG_CMED_EDITOR['custommenueditor']));
        }
    } else {
        if ($mode == 'create' || $mode == 'edit' || $mode == 'clone') {
            $display = CMED_editMenuitem($mid, $mode);
            $display = COM_createHTMLDocument($display, array('pagetitle' => $LANG_CMED_EDITOR['custommenueditor']));
        } else {
            if ($mode != 'cancel' && $mode != 'move') {
                require_once $_CONF['path'] . 'plugins/custommenu/autoinstall.php';
                CMED_addPluginsMenuitems();
            }
            $CMED_CSRF_TOKEN = SEC_createToken();
            $display = CMED_listMenuitems();
            $display = COM_createHTMLDocument($display, array('pagetitle' => $LANG_CMED['manager']));
        }
    }
}
COM_output($display);
Exemplo n.º 2
0
function plugin_postinstall_custommenu($pi_name)
{
    global $_CONF, $_TABLES, $LANG01;
    $inst_parms = plugin_autoinstall_custommenu($pi_name);
    $pi_admin = key($inst_parms['groups']);
    $admin_group_id = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = '{$pi_admin}'");
    $blockadmin_id = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'Block Admin'");
    $DEFVALUES = array();
    $url = addslashes('[site_url]/');
    $DEFVALUES[] = "INSERT INTO " . $_TABLES['menuitems'] . " (mid, type, mode, label, label_var,               url, menuorder, owner_id, group_id, perm_anon) VALUES ('home',       'gldefault', 'variable', '" . $LANG01[90] . "', 'LANG01[90]',                           '{$url}', 10, 2, '#group#' ,2)";
    $url = addslashes('[site_url]/submit.php?type=story');
    $DEFVALUES[] = "INSERT INTO " . $_TABLES['menuitems'] . " (mid, type, mode, label, label_var, php_function, url, menuorder, owner_id, group_id, perm_anon) VALUES ('contribute', 'gldefault', 'php',      '" . $LANG01[71] . "', 'LANG01[71]', 'phpmenuitem_contribute', '{$url}', 20, 2, '#group#' ,2)";
    $url = addslashes('[site_url]/search.php');
    $DEFVALUES[] = "INSERT INTO " . $_TABLES['menuitems'] . " (mid, type, mode, label, label_var,               url, menuorder, owner_id, group_id, perm_anon) VALUES ('search',     'gldefault', 'variable', '" . $LANG01[75] . "', 'LANG01[75]',                           '{$url}', 30, 2, '#group#' ,2)";
    $url = addslashes('[site_url]/stats.php');
    $DEFVALUES[] = "INSERT INTO " . $_TABLES['menuitems'] . " (mid, type, mode, label, label_var,               url, menuorder, owner_id, group_id, perm_anon) VALUES ('stats',      'gldefault', 'variable', '" . $LANG01[76] . "', 'LANG01[76]',                           '{$url}', 40, 2, '#group#' ,2)";
    $url = addslashes('[site_url]/directory.php');
    $DEFVALUES[] = "INSERT INTO " . $_TABLES['menuitems'] . " (mid, type, mode, label, label_var,               url, menuorder, owner_id, group_id, perm_anon) VALUES ('directory',  'gldefault', 'variable', '" . $LANG01[117] . "', 'LANG01[117]',                          '{$url}', 50, 2, '#group#' ,2)";
    $url = addslashes('[site_url]/usersettings.php?mode=edit');
    $DEFVALUES[] = "INSERT INTO " . $_TABLES['menuitems'] . " (mid, type, mode, label, label_var,               url, menuorder, owner_id, group_id, perm_anon) VALUES ('prefs',      'gldefault', 'variable', '" . $LANG01[48] . "', 'LANG01[48]',                           '{$url}', 60, 2, '#group#' ,0)";
    $DEFVALUES[] = "INSERT INTO " . $_TABLES['menuitems'] . " (mid, type, mode, label, label_var, php_function, url, menuorder, owner_id, group_id, perm_anon) VALUES ('login',      'custom',    'php',      '" . $LANG01[47] . "', '',           'phpmenuitem_login',      '',     70, 2, '#group#' ,2)";
    foreach ($DEFVALUES as $sql) {
        $sql = str_replace('#group#', $admin_group_id, $sql);
        DB_query($sql, 1);
        if (DB_error()) {
            COM_error("SQL error in custommenu plugin postinstall, SQL: " . $sql);
            return false;
        }
    }
    // Set menu elements
    $c = config::get_instance();
    $c->set('menu_elements', array('custom'));
    CMED_addPluginsMenuitems();
    return true;
}