$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"; }
} 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")); } else { $poster = new XoopsUser($pm->getVar("from_userid")); } if (!is_object($poster)) { $GLOBALS['xoopsTpl']->assign('poster', false); $GLOBALS['xoopsTpl']->assign('anonymous', $xoopsConfig['anonymous']); } else { $GLOBALS['xoopsTpl']->assign('poster', $poster); } if ($pm->getVar("to_userid") == $GLOBALS['xoopsUser']->getVar("uid") && $pm->getVar('read_msg') == 0) { $pm_handler->setRead($pm); } $message = $pm->getValues();
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'; }