Ejemplo n.º 1
0
 /**
  * Constructor
  * @param        $title
  * @param        $modid
  * @param        $permname
  * @param        $permdesc
  * @param string $url
  * @param bool   $anonymous
  */
 public function __construct($title, $modid, $permname, $permdesc, $url = '', $anonymous = true)
 {
     parent::__construct($title, 'groupperm_form', XOOPS_URL . '/modules/system/admin/groupperm.php', 'post');
     $this->_modid = (int) $modid;
     $this->_permName = $permname;
     $this->_permDesc = $permdesc;
     $this->addElement(new XoopsFormHidden('modid', $this->_modid));
     $this->addElement(new XoopsFormHiddenToken($permname));
     if ($url != '') {
         $this->addElement(new XoopsFormHidden('redirect_url', $url));
     }
     $this->_showAnonymous = $anonymous;
 }
Ejemplo n.º 2
0
            $criteria = new CriteriaCompo($crit_to);
            $criteria->add($crit_from, "OR");
        } else {
            $criteria = new CriteriaCompo(new Criteria('to_delete', 0));
            $criteria->add(new Criteria('to_userid', $GLOBALS['xoopsUser']->getVar('uid')));
            $criteria->add(new Criteria('to_save', 0));
        }
    }
    $criteria->setLimit(1);
    $criteria->setStart($start);
    $criteria->setSort('msg_time');
    $criteria->setOrder("DESC");
    list($pm) = $pm_handler->getObjects($criteria);
}
include_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
$pmform = new XoopsForm('', 'pmform', 'readpmsg.php', 'post', true);
if (is_object($pm) && !empty($pm)) {
    if ($pm->getVar('from_userid') != $GLOBALS['xoopsUser']->getVar('uid')) {
        $reply_button = new XoopsFormButton('', 'send', _PM_REPLY);
        $reply_button->setExtra("onclick='javascript:openWithSelfMain(\"" . XOOPS_URL . "/modules/pm/pmlite.php?reply=1&msg_id=" . $pm->getVar("msg_id") . "\", \"pmlite\", 565,500);'");
        $pmform->addElement($reply_button);
    }
    $pmform->addElement(new XoopsFormButton('', 'delete_message', _PM_DELETE, 'submit'));
    $pmform->addElement(new XoopsFormButton('', 'move_message', $_REQUEST['op'] == 'save' ? _PM_UNSAVE : _PM_TOSAVE, 'submit'));
    $pmform->addElement(new XoopsFormButton('', 'email_message', _PM_EMAIL, 'submit'));
    $pmform->addElement(new XoopsFormHidden('msg_id', $pm->getVar("msg_id")));
    $pmform->addElement(new XoopsFormHidden('op', $_REQUEST['op']));
    $pmform->addElement(new XoopsFormHidden('action', 1));
    $pmform->assign($GLOBALS['xoopsTpl']);
    if ($pm->getVar("from_userid") == $GLOBALS['xoopsUser']->getVar("uid")) {
        $poster = new XoopsUser($pm->getVar("to_userid"));
Ejemplo n.º 3
0
        $member_handler =& xoops_gethandler('member');
        $senders =& $member_handler->getUserList(new Criteria('uid', "(" . implode(',', array_unique($uids)) . ")", "IN"));
        foreach (array_keys($pm_arr) as $i) {
            $message = $pm_arr[$i]->toArray();
            $message['msg_time'] = formatTimestamp($message["msg_time"]);
            if (isset($_REQUEST['op']) && $_REQUEST['op'] == "out") {
                $message['postername'] = $senders[$pm_arr[$i]->getVar('to_userid')];
                $message['posteruid'] = $pm_arr[$i]->getVar('to_userid');
            } else {
                $message['postername'] = $senders[$pm_arr[$i]->getVar('from_userid')];
                $message['posteruid'] = $pm_arr[$i]->getVar('from_userid');
            }
            $message['msg_no'] = $i;
            $xoopsTpl->append('messages', $message);
        }
    }
    include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
    $send_button = new XoopsFormButton('', 'send', _PM_SEND);
    $send_button->setExtra("onclick='javascript:openWithSelfMain(\"" . XOOPS_URL . "/modules/pm/pmlite.php?send=1\",\"pmlite\",550,450);'");
    $delete_button = new XoopsFormButton('', 'delete_messages', _PM_DELETE, 'submit');
    $move_button = new XoopsFormButton('', 'move_messages', $_REQUEST['op'] == 'save' ? _PM_UNSAVE : _PM_TOSAVE, 'submit');
    $empty_button = new XoopsFormButton('', 'empty_messages', _PM_EMPTY, 'submit');
    $pmform = new XoopsForm('', 'pmform', 'viewpmsg.php', 'post', true);
    $pmform->addElement($send_button);
    $pmform->addElement($move_button);
    $pmform->addElement($delete_button);
    $pmform->addElement($empty_button);
    $pmform->addElement(new XoopsFormHidden('op', $_REQUEST['op']));
    $pmform->assign($xoopsTpl);
    include XOOPS_ROOT_PATH . "/footer.php";
}
Ejemplo n.º 4
0
function list_blocks()
{
    global $xoopsUser, $xoopsConfig, $xoopsTpl, $xoopsOption;
    include_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
    $block_handler =& xoops_gethandler('block');
    if ($_REQUEST["selmod"] < 1) {
        $crit = null;
    } else {
        $crit = new Criteria("mid", $_REQUEST["selmod"]);
    }
    $criteria = new CriteriaCompo($crit);
    $criteria->setSort('name');
    $blocks =& $block_handler->getObjects($criteria, true);
    unset($criteria);
    $module_handler =& xoops_gethandler('module');
    $modules =& $module_handler->getObjects(null, true);
    include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
    $newform = new XoopsForm('', 'newform', 'admin.php');
    $block_select = new XoopsFormSelect('', 'bid');
    foreach ($blocks as $block) {
        $block_arr[$block->getVar('mid')]['modname'] = $modules[$block->getVar('mid')]->getVar('name');
        $block_arr[$block->getVar('mid')]['blocks'][$block->getVar('bid')] = " - " . $block->getVar('name');
        $modnames[$block->getVar('mid')] = $modules[$block->getVar('mid')]->getVar('name');
        $bids[] = $block->getVar('bid');
    }
    array_multisort($modnames, SORT_ASC, $block_arr);
    foreach (array_keys($block_arr) as $i) {
        $block_select->addOption("-" . $i, $block_arr[$i]['modname'], true);
        $block_select->addOptionArray($block_arr[$i]['blocks']);
        //$newblockarray[] = $modules[$i]->getVar('name');
        //foreach ($block_arr[$i] as $bid => $bname) {
        //$newblockarray[] = " - ".$bname;
        //}
    }
    //$block_select->addOptionArray($newblockarray);
    $newform->addElement($block_select);
    $newform->addElement(new XoopsFormHidden('op', 'new'));
    $newform->addElement(new XoopsFormHidden('fct', 'blocksadmin'));
    $newform->addElement(new XoopsFormButton('', 'submit', _ADD, 'submit'));
    $newform->assign($xoopsTpl);
    $blockform = new XoopsForm('', 'blockform', 'admin.php', 'post', true);
    $crit = is_object($crit) ? new Criteria("bid", "(" . implode(",", $bids) . ")", "IN") : null;
    $criteria = new CriteriaCompo($crit);
    $criteria->setSort('visible ASC, side ASC, weight');
    $instance_handler =& xoops_gethandler('blockinstance');
    $instances =& $instance_handler->getObjects($criteria, true, true);
    foreach (array_keys($instances) as $i) {
        $visiblein = $instances[$i]->getVisibleIn();
        //quickfix for upgraded installations where visibility was still a yes-no toggle in addition to side selector
        if ($instances[$i]->getVar('visible') == 0) {
            $instances[$i]->setVar('side', -1);
        }
        $instances[$i] = $instances[$i]->toArray();
        $blockform->addElement(new XoopsFormHidden('id[' . $i . ']', $i));
        $instances[$i]['block_name'] = isset($blocks[$instances[$i]['bid']]) ? $blocks[$instances[$i]['bid']]->getVar('name') : "";
        $instances[$i]['module_name'] = isset($blocks[$instances[$i]['bid']]) ? $modules[$blocks[$instances[$i]['bid']]->getVar('mid')]->getVar('name') : "";
        $instances[$i]['visiblein'] = $visiblein;
        $xoopsTpl->append('instances', $instances[$i]);
    }
    $xoopsTpl->assign('selmod', $_REQUEST["selmod"]);
    $blockform->addElement(new XoopsFormHidden('selmod', $_REQUEST["selmod"]));
    $blockform->addElement(new XoopsFormHidden('fct', 'blocksadmin'));
    $blockform->addElement(new XoopsFormHidden('op', 'order'));
    $blockform->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
    $blockform->assign($xoopsTpl);
    $side_options = array(-1 => _AM_NOTVISIBLE, 0 => _AM_SBLEFT, 1 => _AM_SBRIGHT, 3 => _AM_CBLEFT, 4 => _AM_CBRIGHT, 5 => _AM_CBCENTER);
    $xoopsTpl->assign('side_options', $side_options);
    //Get modules and pages for visible in
    $module_list[_AM_SYSTEMLEVEL]["0-2"] = _AM_ADMINBLOCK;
    $module_list[_AM_SYSTEMLEVEL]["0-1"] = _AM_TOPPAGE;
    $module_list[_AM_SYSTEMLEVEL]["0-0"] = _AM_ALLPAGES;
    $criteria = new CriteriaCompo(new Criteria('hasmain', 1));
    $criteria->add(new Criteria('isactive', 1));
    $module_main =& $module_handler->getObjects($criteria, true, true);
    if (count($module_main) > 0) {
        foreach (array_keys($module_main) as $mid) {
            $module_list[$module_main[$mid]->getVar('name')][$mid . "-0"] = _AM_ALLMODULEPAGES;
            $pages = $module_main[$mid]->getInfo("pages");
            if ($pages == false) {
                $pages = $module_main[$mid]->getInfo("sub");
            }
            if (is_array($pages) && $pages != array()) {
                foreach ($pages as $id => $pageinfo) {
                    $module_list[$module_main[$mid]->getVar('name')][$mid . "-" . $id] = $pageinfo['name'];
                }
            }
        }
    }
    //ksort($module_list);
    $xoopsTpl->assign('module_options', $module_list);
    $xoopsOption['template_main'] = 'system_admin_block.html';
}
Ejemplo n.º 5
0
loadModuleAdminMenu(1, "");
$cat_id = isset($_GET["cat_id"]) ? intval($_GET["cat_id"]) : 0;
$op = isset($_GET["op"]) ? trim($_GET["op"]) : "";
$category_handler = xoops_getmodulehandler("category", "press");
$cat_obj = $category_handler->get($cat_id);
if (!empty($op) && $op == "delete") {
    xoops_confirm(array("cat_id" => $cat_id, "op" => "delcat"), "action.php", sprintf(_AM_PROFILE_FORM_RUSUREDEL, $cat_obj->getVar("cat_name")));
    include 'footer.php';
    exit;
}
$cat = array();
if ($cat_obj) {
    $cat = $cat_obj->getValues();
} else {
    $cat["cat_id"] = 0;
    $cat["cat_name"] = "";
}
include XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
$form = new XoopsForm("", "form", "action.php", "post", true);
$form->addElement(new XoopsFormText(_AM_PRESS_FORM_TITLE, "cat_name", 60, 255, $cat["cat_name"]));
$form->addElement(new XoopsFormHidden("op", "savecategory"));
$form->addElement(new XoopsFormHidden("cat_id", $cat["cat_id"]));
$form->addElement(new XoopsFormButton("", "submit", _SUBMIT, "submit"));
$form->assign($xoopsTpl);
$criteria = new CriteriaCompo();
$criteria->setSort('cat_id');
$criteria->setOrder('ASC');
$cat_list = $category_handler->getAll($criteria, null, false);
$xoopsTpl->assign("cat_list", $cat_list);
$template_main = "press_cp_category.html";
include 'footer.php';
Ejemplo n.º 6
0
     $limit = 50;
     $subscribers =& $handler->getRecipientList($id, $limit, $start);
     unset($criteria);
     if (count($subscribers) > 0) {
         $xoopsTpl->assign('subscribers', $subscribers);
     }
     $smartOption['template_main'] = $typetemplate;
     if ($count > $limit) {
         include_once XOOPS_ROOT_PATH . "/class/pagenav.php";
         $nav = new XoopsPageNav($count, $limit, $start, "start");
         $xoopsTpl->assign("pagenav", $nav->renderNav(50));
     }
     $newsletter_handler = xoops_getmodulehandler('newsletter');
     $xoopsTpl->assign('newsletter', $newsletter_handler->get($id, false));
     include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
     $form = new XoopsForm('', 'form', 'subscribers.php');
     $form->addElement(new XoopsFormHidden('id', $id));
     $form->addElement(new XoopsFormHidden('op', 'add'));
     $form->addElement(new XoopsFormSelectUser('', 'uid'));
     $form->addElement(new XoopsFormButton('', 'submit', _NL_AM_ADDUSER, 'submit'));
     $form->assign($xoopsTpl);
     break;
 case "add":
     if ($id == 0 || !isset($_REQUEST['uid'])) {
         redirect_header('index.php', 2, _NL_AM_NOSELECTION);
     }
     $uid = intval($_REQUEST['uid']);
     $user_handler = xoops_gethandler('user');
     $user = $user_handler->get($uid);
     if ($handler->subscribe($user, $id)) {
         redirect_header('subscribers.php?id=' . $id, 3, _NL_AM_USERADDED);
Ejemplo n.º 7
0
 } elseif ($reply == 1 || $send == 1 || $send2 == 1 || ($sendmod = 1)) {
     if ($reply == 1) {
         $pm_handler =& xoops_gethandler('privmessage');
         $pm =& $pm_handler->get($msg_id);
         if ($pm->getVar("to_userid") == $xoopsUser->getVar('uid')) {
             $pm_uname = XoopsUser::getUnameFromId($pm->getVar("from_userid"));
             $message = "[quote]\n";
             $message .= sprintf(_PM_USERWROTE, $pm_uname);
             $message .= "\n" . $pm->getVar("msg_text", "E") . "\n[/quote]";
         } else {
             unset($pm);
             $reply = $send2 = 0;
         }
     }
     include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
     $pmform = new XoopsForm('', 'pmform', 'pmlite.php', 'post', true);
     if ($reply == 1) {
         $subject = $pm->getVar('subject', 'E');
         if (!preg_match("/^Re:/i", $subject)) {
             $subject = 'Re: ' . $subject;
         }
         $xoopsTpl->assign('to_username', $pm_uname);
         $pmform->addElement(new XoopsFormHidden('to_userid', $pm->getVar("from_userid")));
     } elseif ($sendmod == 1) {
         $xoopsTpl->assign('to_username', XoopsUser::getUnameFromId($_POST["to_userid"]));
         $pmform->addElement(new XoopsFormHidden('to_userid', $_POST["to_userid"]));
         $subject = $myts->htmlSpecialChars($myts->stripSlashesGPC($_POST['subject']));
         $message = $myts->htmlSpecialChars($myts->stripSlashesGPC($_POST['message']));
     } else {
         if ($send2 == 1) {
             $xoopsTpl->assign('to_username', XoopsUser::getUnameFromId($to_userid, false));
Ejemplo n.º 8
0
 /**
  *
  */
 public function __construct()
 {
     parent::__construct('', '', '');
 }
Ejemplo n.º 9
0
     $pm_handler = xoops_getModuleHandler('message', 'pm');
     $pm = $pm_handler->get($msg_id);
     if ($pm->getVar('to_userid') == $GLOBALS['xoopsUser']->getVar('uid')) {
         $pm_uname = XoopsUser::getUnameFromId($pm->getVar('from_userid'));
         $message = "[quote]\n";
         $message .= sprintf(_PM_USERWROTE, $pm_uname);
         $message .= "\n" . $pm->getVar('msg_text', 'E') . "\n[/quote]";
     } else {
         unset($pm);
         $reply = $send2 = 0;
     }
 }
 include_once $GLOBALS['xoops']->path('class/template.php');
 $GLOBALS['xoopsTpl'] = new XoopsTpl();
 include_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
 $pmform = new XoopsForm('', 'pmform', 'pmlite.php', 'post', true);
 if ($reply == 1) {
     $subject = $pm->getVar('subject', 'E');
     if (!preg_match('/^' . _RE . '/i', $subject)) {
         $subject = _RE . ' ' . $subject;
     }
     $GLOBALS['xoopsTpl']->assign('to_username', $pm_uname);
     $pmform->addElement(new XoopsFormHidden('to_userid', $pm->getVar('from_userid')));
 } elseif ($sendmod == 1) {
     $GLOBALS['xoopsTpl']->assign('to_username', XoopsUser::getUnameFromId(XoopsRequest::getInt('to_userid', 0, 'POST')));
     $pmform->addElement(new XoopsFormHidden('to_userid', XoopsRequest::getInt('to_userid', 0, 'POST')));
     $subject = $myts->htmlSpecialChars(XoopsRequest::getString('subject', '', 'POST'));
     $message = $myts->htmlSpecialChars(XoopsRequest::getString('message', '', 'POST'));
 } else {
     if ($send2 == 1) {
         $GLOBALS['xoopsTpl']->assign('to_username', XoopsUser::getUnameFromId($to_userid, false));
Ejemplo n.º 10
0
<?php

if (!defined("XOOPS_ROOT_PATH")) {
    exit;
}
include XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
$form = new XoopsForm("", "form", "action.php", "post", true);
$category_handler = xoops_getmodulehandler("category", "press");
$catarr = $category_handler->getCategorySelect(null);
$cat_id = new XoopsFormSelect(_AM_PRESS_CATEGORIES, "cat_id", @$cat_id);
$cat_id->addOptionArray($catarr);
$form->addElement($cat_id, true);
$subject = new XoopsFormText(_AM_PRESS_SUBJECT, "subject", 60, 255, @$subject);
$form->addElement($subject, true);
$configs = array('editor' => 'fckeditor', 'width' => '100%', 'height' => '500px', 'value' => @$content);
$form->addElement(new XoopsFormEditor(_AM_PRESS_CONTENT, 'content', $configs), true);
$form->addElement(new XoopsFormDateTime("发布时间", "topic_date", "", @$date));
$form->addElement(new XoopsFormHidden("topic_id", @$topic_id));
$form->addElement(new XoopsFormHidden("op", "save"));
$form->addElement(new XoopsFormButton("", "submit", _SUBMIT, "submit"));
$form->assign($xoopsTpl);
Ejemplo n.º 11
0
 * 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 XOOPS Project http://sourceforge.net/projects/xoops/
 * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
 * @package         tools
 * @since           2.00
 * @author          Susheng Yang <*****@*****.**>
 * @version         $Id$
 */
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
$form = new XoopsForm(_EDIT . _AM_TOOLS_BC_BLOCK, 'form', 'blockscall.php', "post", true);
$form->addElement(new XoopsFormLabel(_AM_TOOLS_BC_NAME, $block_data['name']));
$form->addElement(new XoopsFormText(_AM_TOOLS_BC_DESCRIPTION, "desc", 60, 255, $block_data['desciption']));
if ($block_data['template'] != '') {
    $form->addElement(new XoopsFormLabel(_AM_TOOLS_BC_CONTENT, '<a href="blockscall.php?op=edittpl&amp;bid=' . $block_data['bid'] . '">' . _AM_TOOLS_BC_EDITTPL . '</a>'));
}
if ($block_data['edit_form'] != false) {
    $form->addElement(new XoopsFormLabel(_AM_TOOLS_BC_OPTIONS, $block_data['edit_form']));
}
$cache_select = new XoopsFormSelect(_AM_TOOLS_BC_BCACHETIME, 'bcachetime', $block_data['bcachetime']);
$cache_select->addOptionArray(array('0' => _NOCACHE, '30' => sprintf(_SECONDS, 30), '60' => _MINUTE, '300' => sprintf(_MINUTES, 5), '1800' => sprintf(_MINUTES, 30), '3600' => _HOUR, '18000' => sprintf(_HOURS, 5), '86400' => _DAY, '259200' => sprintf(_DAYS, 3), '604800' => _WEEK, '2592000' => _MONTH));
$form->addElement($cache_select);
$cachemodel_select = new XoopsFormSelect(_AM_TOOLS_BC_BCACHEMODEL, 'bcachemodel', $block_data['bcachemodel']);
$cachemodel_select->addOptionArray(array('0' => _AM_TOOLS_BC_GLOBAL, '1' => _AM_TOOLS_BC_GROUP, '2' => _AM_TOOLS_BC_USER));
$form->addElement($cachemodel_select);
$form->addElement(new XoopsFormHidden('bid', $block_data['bid']));