예제 #1
0
function defacer_adminMenu($currentoption = 0, $breadcrumb = '')
{
    $defacer =& DefacerDefacer::getInstance();
    /* Nice buttons styles */
    echo "\r\n    <style type='text/css'>\r\n    #buttontop { float:left; width:100%; background: #e7e7e7; font-size:93%; line-height:normal; border-top: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; margin: 0; }\r\n    #buttonbar { float:left; width:100%; background: #e7e7e7 url('" . XOOPS_URL . "/modules/" . $defacer->getModule()->dirname() . "/images/bg.png') repeat-x left bottom; font-size:93%; line-height:normal; border-left: 1px solid black; border-right: 1px solid black; margin-bottom: 12px; }\r\n    #buttonbar ul { margin:0; margin-top: 15px; padding:10px 10px 0; list-style:none; }\r\n    #buttonbar li { display:inline; margin:0; padding:0; }\r\n    #buttonbar a { float:left; background:url('" . XOOPS_URL . "/modules/" . $defacer->getModule()->dirname() . "/images/left_both.png') no-repeat left top; margin:0; padding:0 0 0 9px; border-bottom:1px solid #000; text-decoration:none; }\r\n    #buttonbar a span { float:left; display:block; background:url('" . XOOPS_URL . "/modules/" . $defacer->getModule()->dirname() . "/images/right_both.png') no-repeat right top; padding:5px 15px 4px 6px; font-weight:bold; color:#765; }\r\n    /* Commented Backslash Hack hides rule from IE5-Mac \\*/\r\n    #buttonbar a span {float:none;}\r\n    /* End IE5-Mac hack */\r\n    #buttonbar a:hover span { color:#333; }\r\n    #buttonbar #current a { background-position:0 -150px; border-width:0; }\r\n    #buttonbar #current a span { background-position:100% -150px; padding-bottom:5px; color:#333; }\r\n    #buttonbar a:hover { background-position:0% -150px; }\r\n    #buttonbar a:hover span { background-position:100% -150px; }\r\n    </style>\r\n    ";
    $tblColors = array('', '', '', '', '');
    if ($currentoption >= 0) {
        $tblColors[$currentoption] = 'current';
    }
    if (file_exists($filename = XOOPS_ROOT_PATH . '/modules/' . $defacer->getModule()->dirname() . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/modinfo.php')) {
        include_once $filename;
    } else {
        include_once XOOPS_ROOT_PATH . '/modules/' . $defacer->getModule()->dirname() . '/language/english/modinfo.php';
    }
    echo "<div id='buttontop'>";
    echo "<table style=\"width: 100%; padding: 0; \" cellspacing=\"0\"><tr>";
    echo "<td style=\"width: 60%; font-size: 10px; text-align: left; color: #2F5376; padding: 0 6px; line-height: 18px;\"><a class=\"nobutton\" href=\"../../system/admin.php?fct=preferences&amp;op=showmod&amp;mod=" . $defacer->getModule()->mid() . "\">" . _AM_DEFACER_GENERALSET . "</a>";
    echo "<td style=\"width: 40%; font-size: 10px; text-align: right; color: #2F5376; padding: 0 6px; line-height: 18px;\"><b>" . $defacer->getModule()->name() . "  " . _AM_DEFACER_MODULEADMIN . "</b> " . $breadcrumb . "</td>";
    echo "</tr></table>";
    echo "</div>";
    echo "<div id='buttonbar'>";
    echo "<ul>";
    echo "<li id='" . $tblColors[0] . "'><a href=\"admin_page.php\"\"><span>" . _MI_DEFACER_PAGEMANAGER . "</span></a></li>\n";
    echo "<li id='" . $tblColors[1] . "'><a href=\"admin_theme.php\"\"><span>" . _MI_DEFACER_THEMEMANAGER . "</span></a></li>\n";
    echo "<li id='" . $tblColors[2] . "'><a href=\"admin_meta.php\"\"><span>" . _MI_DEFACER_METAMANAGER . "</span></a></li>\n";
    echo "<li id='" . $tblColors[3] . "'><a href=\"admin_permission.php\"\"><span>" . _MI_DEFACER_PERMISSIONMANAGER . "</span></a></li>\n";
    echo "<li id='" . $tblColors[4] . "'><a href=\"admin_about.php\"\"><span>" . _MI_DEFACER_ABOUT . "</span></a></li>\n";
    echo "</ul></div><div>&nbsp;</div>";
}
예제 #2
0
function defacer_getPageInfo($ids = array())
{
    $defacer =& DefacerDefacer::getInstance();
    $proto = @$_SERVER['HTTPS'] == 'on' ? 'https' : 'http';
    $fullurl = $proto . "://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
    $url = ltrim(str_replace($defacer->getConfig('xoops_url'), '', $fullurl), '/');
    $criteria = new CriteriaCompo(new Criteria('page_status', 1));
    if (count($ids) > 0) {
        $criteria->add(new Criteria('page_id', '(' . implode(',', $ids) . ')', 'IN'));
    }
    $pages = $defacer->getHandler('page')->getObjects($criteria);
    $pid = -1;
    $bigone['url'] = '';
    $bigone['pid'] = -1;
    foreach ($pages as $page) {
        $purl = $page->getVar('page_url');
        if ($page->getVar('page_moduleid') > 1) {
            $purl = 'modules/' . $page->getVar('dirname') . '/' . $purl;
        }
        if (substr($purl, -1) == '*') {
            $purl = substr($purl, 0, -1);
            if (substr($url, 0, strlen($purl)) == $purl || substr($fullurl, 0, strlen($purl)) == $purl) {
                $pid = $page->getVar('page_id');
                if (strlen($purl) >= strlen($bigone['url'])) {
                    $bigone['url'] = $purl;
                    $bigone['pid'] = $pid;
                }
            }
        } else {
            if ($purl == $url || $purl == $fullurl) {
                $pid = $page->getVar('page_id');
                if (strlen($purl) >= strlen($bigone['url'])) {
                    $bigone['url'] = $purl;
                    $bigone['pid'] = $pid;
                }
            }
        }
    }
    return $bigone['pid'];
}
예제 #3
0
<?php

/*
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.
*/
/**
 * @copyright       The XUUPS Project http://sourceforge.net/projects/xuups/
 * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
 * @package         Defacer
 * @since           1.0
 * @author          trabis <*****@*****.**>
 * @version         $Id: common.php 0 2009-06-11 18:47:04Z trabis $
 */
defined('XOOPS_ROOT_PATH') or die("XOOPS root path not defined");
include_once dirname(__FILE__) . '/functions.php';
include_once dirname(dirname(__FILE__)) . '/class/defacer.php';
$debug = true;
$defacer =& DefacerDefacer::getInstance($debug);
예제 #4
0
function defacer_form($itemid = 0)
{
    $defacer =& DefacerDefacer::getInstance();
    $obj = $defacer->getHandler('page')->get($itemid);
    if ($obj->isNew()) {
        $ftitle = _EDIT;
    } else {
        $ftitle = _ADD;
    }
    $form = new XoopsThemeForm($ftitle, 'page_form', basename(__FILE__), 'post', true);
    $mid = new XoopsFormSelect(_AM_DEFACER_PAGE_MODULE, 'page_moduleid', $obj->getVar('page_moduleid', 'e'));
    $mid->customValidationCode[] = 'var value = document.getElementById(\'page_moduleid\').value; if (value == 0){alert("' . _AM_DEFACER_SELECTMODULE_ERR . '"); return false;}';
    $module_handler =& xoops_gethandler('module');
    $criteria = new CriteriaCompo(new Criteria('hasmain', 1));
    $criteria->add(new Criteria('isactive', 1));
    //$criteria->setSort('name');
    //$criteria->setOrder('ASC'); xoopsModule does not accpet this :(
    $moduleslist = $module_handler->getList($criteria);
    $module = $module_handler->get(1);
    $list = array($module->getVar('mid') => $module->getVar('name'));
    $moduleslist = $list + $moduleslist;
    $mid->addOptionArray($moduleslist);
    $form->addElement($mid, true);
    $form->addElement(new XoopsFormText(_AM_DEFACER_PAGE_TITLE, 'page_title', 50, 255, $obj->getVar('page_title', 'e')), true);
    $furl = new XoopsFormText(_AM_DEFACER_PAGE_URL, 'page_url', 50, 255, $obj->getVar('page_url', 'e'));
    $furl->setDescription(_AM_DEFACER_PAGE_URL_DESC);
    $form->addElement($furl, true);
    $form->addElement(new XoopsFormRadioYN(_AM_DEFACER_PAGE_DISPLAY, 'page_status', $obj->getVar('page_status', 'e'), _YES, _NO));
    $tray = new XoopsFormElementTray('', '');
    $tray->addElement(new XoopsFormButton('', 'defacer_button', _SUBMIT, 'submit'));
    $btn = new XoopsFormButton('', 'reset', _CANCEL, 'button');
    if (!$obj->isNew()) {
        $btn->setExtra('onclick="document.location.href=\'' . basename(__FILE__) . '\'"');
    } else {
        $btn->setExtra('onclick="document.getElementById(\'form\').style.display = \'none\'; return false;"');
    }
    $tray->addElement($btn);
    $form->addElement($tray);
    if (!$obj->isNew()) {
        $form->addElement(new XoopsFormHidden('op', 'editok'));
        $form->addElement(new XoopsFormHidden('itemid', $itemid));
    } else {
        $form->addElement(new XoopsFormHidden('op', 'add'));
    }
    return $form->render();
}
예제 #5
0
function defacer_form($itemid = 0)
{
    $defacer =& DefacerDefacer::getInstance();
    $obj = $defacer->getHandler('theme')->get($itemid);
    if ($obj->isNew()) {
        $ftitle = _EDIT;
    } else {
        $ftitle = _ADD;
    }
    $form = new XoopsThemeForm($ftitle, 'theme_form', basename(__FILE__), 'post', true);
    $page_select = new XoopsFormSelect(_AM_DEFACER_PAGE, 'theme_id', $obj->getVar('theme_id', 'e'));
    $page_select->customValidationCode[] = 'var value = document.getElementById(\'theme_id\').value; if (value == 0){alert("' . _AM_DEFACER_SELECTPAGE_ERR . '"); return false;}';
    $criteria = new CriteriaCompo(new Criteria('page_status', 1));
    $criteria->setSort('name');
    $criteria->setOrder('ASC');
    $pageslist = $defacer->getHandler('page')->getList($criteria);
    $list = array('0' => '--------------------------');
    $pageslist = $list + $pageslist;
    $page_select->addOptionArray($pageslist);
    $form->addElement($page_select, true);
    $dirname = XOOPS_THEME_PATH . '/';
    $dirlist = array();
    if (is_dir($dirname) && ($handle = opendir($dirname))) {
        while (false !== ($file = readdir($handle))) {
            if (!preg_match("/^[\\.]{1,2}\$/", $file)) {
                if (strtolower($file) != 'cvs' && is_dir($dirname . $file) && $file != 'z_changeable_theme') {
                    $dirlist[$file] = $file;
                }
            }
        }
        closedir($handle);
        asort($dirlist);
        reset($dirlist);
    }
    $theme_select = new XoopsFormSelect(_AM_DEFACER_THEME, 'theme_name', $obj->getVar('theme_name', 'e'));
    $theme_select->addOptionArray($dirlist);
    $form->addElement($theme_select);
    $tray = new XoopsFormElementTray('', '');
    $tray->addElement(new XoopsFormButton('', 'defacer_button', _SUBMIT, 'submit'));
    $btn = new XoopsFormButton('', 'reset', _CANCEL, 'button');
    if (!$obj->isNew()) {
        $btn->setExtra('onclick="document.location.href=\'' . basename(__FILE__) . '\'"');
    } else {
        $btn->setExtra('onclick="document.getElementById(\'form\').style.display = \'none\'; return false;"');
    }
    $tray->addElement($btn);
    $form->addElement($tray);
    if (!$obj->isNew()) {
        $form->addElement(new XoopsFormHidden('op', 'editok'));
        $form->addElement(new XoopsFormHidden('itemid', $itemid));
    } else {
        $form->addElement(new XoopsFormHidden('op', 'add'));
    }
    return $form->render();
}
예제 #6
0
 function isRedirectActive()
 {
     require_once dirname(dirname(__FILE__)) . '/include/common.php';
     $defacer =& DefacerDefacer::getInstance();
     return $defacer->getConfig('enable_redirect');
 }
예제 #7
0
function defacer_form($itemid = 0)
{
    $defacer =& DefacerDefacer::getInstance();
    $obj = $defacer->getHandler('permission')->get($itemid);
    if ($obj->isNew()) {
        $ftitle = _EDIT;
    } else {
        $ftitle = _ADD;
    }
    $form = new XoopsThemeForm($ftitle, 'permission_form', basename(__FILE__), 'post', true);
    $page_select = new XoopsFormSelect(_AM_DEFACER_PAGE, 'permission_id', $obj->getVar('permission_id', 'e'));
    $page_select->customValidationCode[] = 'var value = document.getElementById(\'permission_id\').value; if (value == 0){alert("' . _AM_DEFACER_SELECTPAGE_ERR . '"); return false;}';
    $criteria = new CriteriaCompo(new Criteria('page_status', 1));
    $criteria->setSort('name');
    $criteria->setOrder('ASC');
    $pageslist = $defacer->getHandler('page')->getList($criteria);
    $list = array('0' => '--------------------------');
    $pageslist = $list + $pageslist;
    $page_select->addOptionArray($pageslist);
    $form->addElement($page_select, true);
    $form->addElement(new XoopsFormSelectGroup(_AM_DEFACER_PERMISSION_GROUPS, 'permission_groups', true, $obj->getVar('permission_groups', 'e'), 8, true));
    $tray = new XoopsFormElementTray('', '');
    $tray->addElement(new XoopsFormButton('', 'defacer_button', _SUBMIT, 'submit'));
    $btn = new XoopsFormButton('', 'reset', _CANCEL, 'button');
    if (!$obj->isNew()) {
        $btn->setExtra('onclick="document.location.href=\'' . basename(__FILE__) . '\'"');
    } else {
        $btn->setExtra('onclick="document.getElementById(\'form\').style.display = \'none\'; return false;"');
    }
    $tray->addElement($btn);
    $form->addElement($tray);
    if (!$obj->isNew()) {
        $form->addElement(new XoopsFormHidden('op', 'editok'));
        $form->addElement(new XoopsFormHidden('itemid', $itemid));
    } else {
        $form->addElement(new XoopsFormHidden('op', 'add'));
    }
    return $form->render();
}