Exemplo n.º 1
0
 /**
  * Render the comments in thread view
  * This method calls itself recursively
  *
  * @param integer $comment_id Should be "0" when called by client
  * @param boolean $admin_view
  * @param boolean $show_nav
  *
  * @return void
  */
 public function renderThreadView($comment_id = 0, $admin_view = false, $show_nav = true)
 {
     // construct comment tree
     $xot = new XoopsObjectTree($this->comments, 'id', 'pid', 'rootid');
     $tree = $xot->getTree();
     $image = false != $this->useIcons ? $this->getTitleIcon($tree[$comment_id]['obj']->getVar('icon')) : '';
     $title = $tree[$comment_id]['obj']->getVar('title');
     if (false != $show_nav && $tree[$comment_id]['obj']->getVar('pid') != 0) {
         $this->tpl->assign('lang_top', _MD_COMMENTS_TOP);
         $this->tpl->assign('lang_parent', _MD_COMMENTS_PARENT);
         $this->tpl->assign('show_threadnav', true);
     } else {
         $this->tpl->assign('show_threadnav', false);
     }
     if (false != $admin_view) {
         // admins can see all
         $text = $tree[$comment_id]['obj']->getVar('text') . '<div style="text-align:right; margin-top: 2px; margin-bottom: 0px; margin-right: 2px;">' . _MD_COMMENTS_STATUS . ': ' . $this->statusText[$tree[$comment_id]['obj']->getVar('status')] . '<br />IP: <span style="font-weight: bold;">' . $tree[$comment_id]['obj']->getVar('ip') . '</span></div>';
     } else {
         // hide comments that are not active
         if (Comments::STATUS_ACTIVE != $tree[$comment_id]['obj']->getVar('status')) {
             // if there are any child comments, display them as root comments
             if (isset($tree[$comment_id]['child']) && !empty($tree[$comment_id]['child'])) {
                 foreach ($tree[$comment_id]['child'] as $child_id) {
                     $this->renderThreadView($child_id, $admin_view, false);
                 }
             }
             return;
         } else {
             $text = $tree[$comment_id]['obj']->getVar('text');
         }
     }
     $replies = array();
     $this->renderThreadReplies($tree, $comment_id, $replies, '&nbsp;&nbsp;', $admin_view);
     $show_replies = count($replies) > 0 ? true : false;
     $this->tpl->append('comments', array('pid' => $tree[$comment_id]['obj']->getVar('pid'), 'id' => $tree[$comment_id]['obj']->getVar('id'), 'itemid' => $tree[$comment_id]['obj']->getVar('itemid'), 'rootid' => $tree[$comment_id]['obj']->getVar('rootid'), 'image' => $image, 'title' => $title, 'text' => $text, 'date_posted' => XoopsLocale::formatTimestamp($tree[$comment_id]['obj']->getVar('created'), 'm'), 'date_modified' => XoopsLocale::formatTimestamp($tree[$comment_id]['obj']->getVar('modified'), 'm'), 'poster' => $this->getPosterArray($tree[$comment_id]['obj']->getVar('uid')), 'replies' => $replies, 'show_replies' => $show_replies));
 }
Exemplo n.º 2
0
$item_page_id = Request::getInt('page', -1);
if ($itemid == 0) {
    $xoops->redirect("javascript:history.go(-1)", 1, _MD_PUBLISHER_NOITEMSELECTED);
}
// Creating the item object for the selected item
/* @var $itemObj PublisherItem */
$itemObj = $publisher->getItemHandler()->get($itemid);
// if the selected item was not found, exit
if (!$itemObj) {
    $xoops->redirect("javascript:history.go(-1)", 1, _MD_PUBLISHER_NOITEMSELECTED);
}
// Creating the category object that holds the selected item
$categoryObj = $publisher->getCategoryHandler()->get($itemObj->getVar('categoryid'));
// Check user permissions to access that category of the selected item
if (!$itemObj->accessGranted()) {
    $xoops->redirect("javascript:history.go(-1)", 1, XoopsLocale::E_NO_ACCESS_PERMISSION);
}
$publisher->loadLanguage('main');
$tpl = new XoopsTpl();
$tpl->assign('item', $itemObj->toArray('all'));
$tpl->assign('display_whowhen_link', $publisher->getConfig('item_disp_whowhen_link'));
$content = $tpl->fetch('module:publisher/pdf.tpl');
$xoops->service('htmltopdf')->startPdf();
$xoops->service('htmltopdf')->setAuthor($itemObj->posterName());
$xoops->service('htmltopdf')->setTitle($itemObj->getVar('title'));
$xoops->service('htmltopdf')->setKeywords($itemObj->getVar('meta_keywords'));
$xoops->service('htmltopdf')->setSubject($categoryObj->getVar('name'));
$xoops->service('htmltopdf')->addHtml($content);
$name = $itemObj->getVar('short_url') . '.pdf';
$xoops->service('htmltopdf')->outputPdfInline($name);
exit;
Exemplo n.º 3
0
             }
             $xoopsTpl->append('images', array('id' => $images[$i]->getVar('image_id'), 'nicename' => $images[$i]->getVar('image_nicename'), 'mimetype' => $images[$i]->getVar('image_mimetype'), 'src' => $src));
         }
     }
     break;
 case 'upload':
     $category = $helper->getHandlerCategories()->get($imgcat_id);
     if ($imgcat_id > 0 && is_object($category)) {
         $perm_handler = $xoops->getHandlerGroupPermission();
         if ($perm_handler->checkRight('imgcat_write', $imgcat_id, $groups)) {
             $xoops->simpleHeader();
             $xoopsTpl = new XoopsTpl();
             $obj = $helper->getHandlerImages()->create();
             $obj->setVar('imgcat_id', $imgcat_id);
             $form = $helper->getForm(array('obj' => $obj, 'target' => null), 'image_imagemanager');
             $xoopsTpl->assign('form', $form->render());
         }
     }
     break;
 case 'save':
     if (!$xoops->security()->check()) {
         $xoops->redirect('xoops_images.php?imgcat_id=' . $imgcat_id, 3, implode('<br />', $xoops->security()->getErrors()));
     }
     $mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png');
     $msg[] = _AM_IMAGES_IMG_SAVE;
     $category = $helper->getHandlerCategories()->get($imgcat_id);
     $image_id = Request::getInt('image_id', 0);
     $obj = $helper->getHandlerImages()->create();
     $obj->setVar('image_nicename', Request::getString('image_nicename', ''));
     $obj->setVar('image_created', time());
     $obj->setVar('image_display', Request::getInt('image_display', 1));
Exemplo n.º 4
0
// Check user permissions to access that category of the selected ITEM
if (!$itemObj->accessGranted()) {
    $xoops->redirect("javascript:history.go(-1)", 1, XoopsLocale::E_NO_ACCESS_PERMISSION);
}
// Creating the category object that holds the selected ITEM
$categoryObj = $itemObj->category();
$xoopsTpl = new XoopsTpl();
$myts = \Xoops\Core\Text\Sanitizer::getInstance();
$item['title'] = $itemObj->title();
$item['body'] = $itemObj->body();
$item['categoryname'] = $myts->displayTarea($categoryObj->getVar('name'));
$mainImage = $itemObj->getMainImage();
if ($mainImage['image_path'] != '') {
    $item['image'] = '<img src="' . $mainImage['image_path'] . '" alt="' . $myts->undoHtmlSpecialChars($mainImage['image_name']) . '"/>';
}
$xoopsTpl->assign('item', $item);
$xoopsTpl->assign('printtitle', $xoops->getConfig('sitename') . " - " . PublisherUtils::html2text($categoryObj->getCategoryPath()) . " > " . $myts->displayTarea($itemObj->title()));
$xoopsTpl->assign('printlogourl', $publisher->getConfig('print_logourl'));
$xoopsTpl->assign('printheader', $myts->displayTarea($publisher->getConfig('print_header'), 1));
$xoopsTpl->assign('lang_category', _CO_PUBLISHER_CATEGORY);
$xoopsTpl->assign('lang_author_date', sprintf(_MD_PUBLISHER_WHO_WHEN, $itemObj->posterName(), $itemObj->datesub()));
$doNotStartPrint = false;
$noTitle = false;
$noCategory = false;
$smartPopup = false;
$xoopsTpl->assign('doNotStartPrint', $doNotStartPrint);
$xoopsTpl->assign('noTitle', $noTitle);
$xoopsTpl->assign('smartPopup', $smartPopup);
$xoopsTpl->assign('current_language', $xoops->getConfig('language'));
if ($publisher->getConfig('print_footer') === 'item footer' || $publisher->getConfig('print_footer') === 'both') {
    $xoopsTpl->assign('itemfooter', $myts->displayTarea($publisher->getConfig('item_footer'), 1));
Exemplo n.º 5
0
 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.
*/
use Xoops\Core\Request;
use Xoops\Core\XoopsTpl;
/**
 * smilies module
 *
 * @copyright       XOOPS Project (http://xoops.org)
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @package         smilies
 * @since           2.6.0
 * @author          Mage Grégory (AKA Mage)
 */
include dirname(dirname(__DIR__)) . '/mainfile.php';
$xoops = Xoops::getInstance();
$xoops->logger()->quiet();
$target = Request::getString('target', '');
$xoops->simpleHeader(false);
if ($target && preg_match('/^[0-9a-z_]*$/i', $target)) {
    $tpl = new XoopsTpl();
    $tpl->assign('target', $target);
    $tpl->assign('smileys', $xoops->getModuleHandler('smiley', 'smilies')->getActiveSmilies(false));
    $tpl->assign('closebutton', 1);
    $tpl->display('module:smilies/smilies_smiley.tpl');
}
$xoops->simpleFooter();
Exemplo n.º 6
0
    $mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png');
    $upload_size = 500000;
    $uploader = new XoopsMediaUploader(\XoopsBaseConfig::get('uploads-path') . '/smilies', $mimetypes, $upload_size, null, null);
    if ($uploader->fetchMedia($xoops_upload_file[0])) {
        $uploader->setPrefix('smil');
        if (!$uploader->upload()) {
            $msg[] = $uploader->getErrors();
            $obj->setVar('smiley_url', 'blank.gif');
        } else {
            $obj->setVar('smiley_url', 'smilies/' . $uploader->getSavedFileName());
        }
    }
    if ($helper->getHandlerSmilies()->insert($obj)) {
        $xoops->redirect('xoops_smilies.php', 2, implode('<br />', $msg));
    }
}
$xoopsTpl = new XoopsTpl();
if ($op === 'more') {
    $xoopsTpl->assign('smileys', Xoops\Module\Helper::getHelper('smilies')->getHandlerSmilies()->getSmilies(0, 0, false));
} else {
    $xoopsTpl->assign('smileys', Xoops\Module\Helper::getHelper('smilies')->getHandlerSmilies()->getActiveSmilies(false));
}
// check user/group
$groups = $xoops->getUserGroups();
$gperm_handler = $xoops->getHandlerGroupPermission();
$admin = $gperm_handler->checkRight('system_admin', $xoops->getHandlerModule()->getByDirname('smilies')->getVar('mid'), $groups);
if ($admin) {
    $xoopsTpl->assign('form_add', $helper->getForm($helper->getHandlerSmilies()->create(), 'smilies')->render());
}
$xoopsTpl->display('module:smilies/smilies_tinymce.tpl');
$xoops->simpleFooter();
Exemplo n.º 7
0
 /**
  * Blocks::buildBlock()
  *
  * @param XoopsBlock $xobject  block to render
  * @param XoopsTpl   $template template engine
  *
  * @return array|bool
  */
 public function buildBlock(XoopsBlock $xobject, XoopsTpl $template)
 {
     $xoops = \Xoops::getInstance();
     // The lame type workaround will change
     // bid is added temporarily as workaround for specific block manipulation
     $dirname = $xobject->getVar('dirname');
     $block = array('id' => $xobject->getVar('bid'), 'module' => $dirname, 'title' => $xobject->getVar('title'), 'weight' => $xobject->getVar('weight'), 'lastmod' => $xobject->getVar('last_modified'));
     $bcachetime = (int) $xobject->getVar('bcachetime');
     if (empty($bcachetime)) {
         $template->caching = 0;
     } else {
         $template->caching = 2;
         $template->cache_lifetime = $bcachetime;
     }
     $template->setCompileId($dirname);
     $tplName = ($tplName = $xobject->getVar('template')) ? "block:{$dirname}/{$tplName}" : "module:system/system_block_dummy.tpl";
     //$tplName = str_replace('.html', '.tpl', $tplName);
     $cacheid = $this->generateCacheId('blk_' . $xobject->getVar('bid'));
     $xoops->preload()->triggerEvent('core.themeblocks.buildblock.start', array($xobject, $template->isCached($tplName, $cacheid)));
     if (!$bcachetime || !$template->isCached($tplName, $cacheid)) {
         //Get theme metas
         $old = array();
         if ($this->theme && $bcachetime) {
             foreach ($this->theme->metas as $type => $value) {
                 $old[$type] = $this->theme->metas[$type];
             }
         }
         //build block
         if ($bresult = $xobject->buildBlock()) {
             $template->assign('block', $bresult);
             $block['content'] = $template->fetch($tplName, $cacheid);
         } else {
             $block = false;
         }
         //check if theme added new metas
         if ($this->theme && $bcachetime) {
             $metas = array();
             foreach ($this->theme->metas as $type => $value) {
                 $dif = \Xoops\Utils::arrayRecursiveDiff($this->theme->metas[$type], $old[$type]);
                 if (count($dif)) {
                     $metas[$type] = $dif;
                 }
             }
             if (count($metas)) {
                 \Xoops\Cache::write($cacheid, $metas);
             }
         }
     } else {
         $block['content'] = $template->fetch($tplName, $cacheid);
     }
     //add block cached metas
     if ($this->theme && $bcachetime) {
         if ($metas = \Xoops\Cache::read($cacheid)) {
             foreach ($metas as $type => $value) {
                 $this->theme->metas[$type] = array_merge($this->theme->metas[$type], $metas[$type]);
             }
         }
     }
     $template->setCompileId();
     return $block;
 }
Exemplo n.º 8
0
 /**
  * Render a confirmation form to a string
  *
  * @param array   $hiddens  associative array of values used to complete confirmed action
  * @param string  $action   form action (URL)
  * @param string  $msg      message to display
  * @param string  $submit   submit button message
  * @param boolean $addtoken true to add CSRF token
  *
  * @return string rendered confirm message
  */
 public function confirm($hiddens, $action, $msg, $submit = '', $addtoken = true)
 {
     $tpl = new XoopsTpl();
     $submit = $submit != '' ? trim($submit) : XoopsLocale::A_SUBMIT;
     $tpl->assign('msg', $msg);
     $tpl->assign('action', $action);
     $tpl->assign('submit', $submit);
     $str_hiddens = '';
     foreach ($hiddens as $name => $value) {
         if (is_array($value)) {
             foreach ($value as $caption => $newvalue) {
                 $str_hiddens .= '<input type="radio" name="' . $name . '" value="' . htmlspecialchars($newvalue) . '" > ' . $caption . NWLINE;
             }
             $str_hiddens .= '<br />' . NWLINE;
         } else {
             $str_hiddens .= '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value) . '" />' . NWLINE;
         }
     }
     if ($addtoken != false) {
         $tpl->assign('token', $this->security()->getTokenHTML());
     }
     $tpl->assign('hiddens', $str_hiddens);
     return $tpl->fetch('module:system/system_confirm.tpl');
 }
Exemplo n.º 9
0
 /**
  * assign - assign to smarty form template instead of displaying directly
  *
  * @param \XoopsTpl $tpl template
  *
  * @return void
  */
 public function assign(XoopsTpl $tpl)
 {
     $i = -1;
     $elements = array();
     if (count($this->getRequired()) > 0) {
         $this->elements[] = new Raw("<tr class='foot'><td colspan='2'>* = " . \XoopsLocale::REQUIRED . "</td></tr>");
     }
     foreach ($this->getElements() as $ele) {
         ++$i;
         /* @var Element $ele */
         $ele_name = $ele->getName();
         $ele_description = $ele->getDescription();
         $n = $ele_name ? $ele_name : $i;
         $elements[$n]['name'] = $ele_name;
         $elements[$n]['caption'] = $ele->getCaption();
         $elements[$n]['body'] = $ele->render();
         $elements[$n]['hidden'] = $ele->isHidden();
         $elements[$n]['required'] = $ele->isRequired();
         if ($ele_description != '') {
             $elements[$n]['description'] = $ele_description;
         }
     }
     $js = $this->renderValidationJS();
     $tpl->assign($this->getName(), array('title' => $this->getTitle(), 'name' => $this->getName(), 'action' => $this->getAction(), 'method' => $this->getMethod(), 'extra' => 'onsubmit="return xoopsFormValidate_' . $this->getName() . '();"' . $this->getExtra(), 'javascript' => $js, 'elements' => $elements));
 }
Exemplo n.º 10
0
 */
require __DIR__ . '/mainfile.php';
$xoops = Xoops::getInstance();
$xoops->disableErrorReporting();
$myts = \Xoops\Core\Text\Sanitizer::getInstance();
$xoops_url = \XoopsBaseConfig::get('url');
if (function_exists('mb_http_output')) {
    mb_http_output('pass');
}
header('Content-Type:text/xml; charset=utf-8');
$dirname = $xoops->isModule() ? $xoops->module->getVar('dirname') : 'system';
$tpl = new XoopsTpl();
$tpl->caching = 2;
$tpl->cache_lifetime = 3600;
if (!$tpl->isCached('module:' . $dirname . '/system_rss.tpl')) {
    $tpl->assign('channel_title', $myts->htmlSpecialChars($xoops->getConfig('sitename')));
    $tpl->assign('channel_link', $xoops_url . '/');
    $tpl->assign('channel_desc', $myts->htmlSpecialChars($xoops->getConfig('slogan')));
    $tpl->assign('channel_lastbuild', XoopsLocale::formatTimestamp(time(), 'rss'));
    $tpl->assign('channel_webmaster', $xoops->checkEmail($xoops->getConfig('adminmail'), true));
    $tpl->assign('channel_editor', $xoops->checkEmail($xoops->getConfig('adminmail'), true));
    $tpl->assign('channel_category', 'News');
    $tpl->assign('channel_generator', 'XOOPS');
    $tpl->assign('channel_language', XoopsLocale::getLangCode());
    $xoTheme = $xoops->theme();
    $imgPath = $xoTheme->resourcePath('/images/logo.png');
    $tpl->assign('image_url', $xoops->url($imgPath));
    $dimension = getimagesize($xoops->path($imgPath));
    $tpl->assign('image_width', $dimension[0]);
    $tpl->assign('image_height', $dimension[1]);
    $items = array();
Exemplo n.º 11
0
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
use Xoops\Core\Request;
use Xoops\Core\XoopsTpl;
/**
 * @copyright       XOOPS Project (http://xoops.org)
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @author          trabis <*****@*****.**>
 * @version         $Id$
 */
include dirname(dirname(__DIR__)) . '/mainfile.php';
$xoops = Xoops::getInstance();
if (Request::getBool('pdf', false)) {
    $content = \Xoops\Utils::dumpVar($xoops->getConfigs(), false);
    $tpl = new XoopsTpl();
    $tpl->assign('dummy_content', $content);
    $content2 = $tpl->fetch('module:system/system_dummy.tpl');
    if ($xoops->service('htmltopdf')->isAvailable()) {
        $xoops->service('htmltopdf')->addHtml($content2);
        $xoops->service('htmltopdf')->outputPdfInline('codex_example.pdf');
    } else {
        $xoops->header();
        echo 'Please install an HtmlToPdf provider!';
        \Xoops\Utils::dumpFile(__FILE__);
        $xoops->footer();
    }
} else {
    $xoops->header();
    echo '<a href="?pdf=1">Make Pdf</a>';
    \Xoops\Utils::dumpFile(__FILE__);
    $xoops->footer();
Exemplo n.º 12
0
         $onlineUsers[$i]['module'] = $onlines[$i]['online_module'] > 0 ? $modules[$onlines[$i]['online_module']] : '';
         if ($onlines[$i]['online_uid'] != 0 && is_object($user = new XoopsUser($onlines[$i]['online_uid']))) {
             $onlineUsers[$i]['name'] = $user->getVar('uname');
             $response = $xoops->service("Avatar")->getAvatarUrl($user);
             $avatar = $response->getValue();
             $avatar = empty($avatar) ? $xoops_upload_url . '/blank.gif' : $avatar;
             $onlineUsers[$i]['avatar'] = $avatar;
         } else {
             $onlineUsers[$i]['name'] = $xoops->getConfig('anonymous');
             $onlineUsers[$i]['avatar'] = $xoops_upload_url . '/blank.gif';
         }
     }
     $tpl = new XoopsTpl();
     if ($online_total > 20) {
         $nav = new XoopsPageNav($online_total, 20, $start, 'start', 'action=showpopups&amp;type=online');
         $tpl->assign('nav', $nav->renderNav());
     }
     $tpl->assign('onlineusers', $onlineUsers);
     $tpl->assign('isadmin', $isadmin);
     $tpl->assign('closebutton', $closebutton);
     $tpl->display('module:system/system_misc_online.tpl');
     break;
 case 'ssllogin':
     if ($xoops->getConfig('use_ssl') && isset($_POST[$xoops->getConfig('sslpost_name')]) && $xoops->isUser()) {
         $xoops->loadLanguage('user');
         echo sprintf(XoopsLocale::E_INCORRECT_LOGIN, $xoops->user->getVar('uname'));
         echo '<div style="text-align:center;"><input class="formButton" value="' . XoopsLocale::A_CLOSE . '" type="button" onclick="window.opener.location.reload();window.close();" /></div>';
         $closebutton = false;
     }
     break;
 default:
Exemplo n.º 13
0
function menus_mainmenu_show()
{
    $block = array();
    $xoops = Xoops::getInstance();
    $helper = Xoops::getModuleHelper('menus');
    $module_handler = $xoops->getHandlerModule();
    $criteria = new CriteriaCompo(new Criteria('hasmain', 1));
    $criteria->add(new Criteria('isactive', 1));
    $criteria->add(new Criteria('weight', 0, '>'));
    $modules = $module_handler->getObjectsArray($criteria, true);
    $moduleperm_handler = $xoops->getHandlerGroupPermission();
    $groups = $xoops->getUserGroups();
    $read_allowed = $moduleperm_handler->getItemIds('module_read', $groups);
    $menus = array();
    $menu = $helper->getHandlerMenu()->create();
    $menu->setVar('id', 1);
    $menu->setVar('pid', 0);
    $menu->setVar('alt_title', _MB_MENUS_HOME);
    $menu->setVar('title', _MB_MENUS_HOME);
    $menu->setVar('link', \XoopsBaseConfig::get('url'));
    $menu->setVar('image', 'icon-home');
    $menus[] = $menu->getValues();
    foreach (array_keys($modules) as $i) {
        if (in_array($i, $read_allowed)) {
            /* @var $plugin MenusPluginInterface */
            $menu = $helper->getHandlerMenu()->create();
            $menu->setVar('id', $i);
            $menu->setVar('pid', 0);
            $menu->setVar('title', $modules[$i]->getVar('name'));
            $menu->setVar('alt_title', $modules[$i]->getVar('name'));
            $menu->setVar('link', \XoopsBaseConfig::get('url') . '/modules/' . $modules[$i]->getVar('dirname'));
            $menu->setVar('image', 'icon-tags');
            $menus[] = $menu->getValues();
            if ($xoops->isModule() && $xoops->module->getVar('dirname') == $modules[$i]->getVar('dirname') && ($plugin = \Xoops\Module\Plugin::getPlugin($modules[$i]->getVar('dirname'), 'menus'))) {
                $sublinks = $plugin->subMenus();
                $j = -1;
                foreach ($sublinks as $sublink) {
                    $menu = $helper->getHandlerMenu()->create();
                    $menu->setVar('id', $j);
                    $menu->setVar('pid', $i);
                    $menu->setVar('title', $sublink['name']);
                    $menu->setVar('alt_title', $sublink['name']);
                    $menu->setVar('link', \XoopsBaseConfig::get('url') . '/modules/' . $modules[$i]->getVar('dirname') . '/' . $sublink['url']);
                    $menus[] = $menu->getValues();
                    $j--;
                }
            }
        }
    }
    $builder = new MenusBuilder($menus);
    $block = $builder->render();
    $skin_info = $helper->getSkinInfo('mainmenu', false);
    $blockTpl = new XoopsTpl();
    $blockTpl->assign('block', $block);
    $blockTpl->assign('config', $skin_info['config']);
    $blockTpl->assign('skinurl', $skin_info['url']);
    $blockTpl->assign('skinpath', $skin_info['path']);
    $block['content'] = $blockTpl->fetch($skin_info['template']);
    return $block;
}
Exemplo n.º 14
0
             }
             $xoopsTpl->append('images', array('id' => $images[$i]->getVar('image_id'), 'nicename' => $images[$i]->getVar('image_nicename'), 'mimetype' => $images[$i]->getVar('image_mimetype'), 'src' => $src, 'lxcode' => $lcode, 'xcode' => $code, 'rxcode' => $rcode));
         }
     }
     break;
 case 'upload':
     $category = $helper->getHandlerCategories()->get($imgcat_id);
     if ($imgcat_id > 0 && is_object($category)) {
         $perm_handler = $xoops->getHandlerGroupPermission();
         if ($perm_handler->checkRight('imgcat_write', $imgcat_id, $groups)) {
             $xoops->simpleHeader();
             $xoopsTpl = new XoopsTpl();
             $obj = $helper->getHandlerImages()->create();
             $obj->setVar('imgcat_id', $imgcat_id);
             $form = $helper->getForm(array('obj' => $obj, 'target' => $target), 'image_imagemanager');
             $xoopsTpl->assign('form', $form->render());
         }
     }
     break;
 case 'save':
     if (!$xoops->security()->check()) {
         $xoops->redirect('imagemanager.php?imgcat_id=' . $imgcat_id, 3, implode('<br />', $xoops->security()->getErrors()));
     }
     $mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png');
     $msg[] = _AM_IMAGES_IMG_SAVE;
     $category = $helper->getHandlerCategories()->get($imgcat_id);
     $image_id = Request::getInt('image_id', 0);
     $obj = $helper->getHandlerImages()->create();
     $obj->setVar('image_nicename', Request::getString('image_nicename', ''));
     $obj->setVar('image_created', time());
     $obj->setVar('image_display', Request::getInt('image_display', 1));
Exemplo n.º 15
0
                $subject = $myts->htmlSpecialChars($_POST['subject']);
                $message = $myts->htmlSpecialChars($_POST['message']);
            } else {
                if ($send2 == 1) {
                    $form->addElement(new Xoops\Form\Label(XoopsLocale::C_TO, XoopsUser::getUnameFromId($to_userid, false)));
                    $form->addElement(new Xoops\Form\Hidden('to_userid', $to_userid));
                } else {
                    $form->addElement(new Xoops\Form\SelectUser(XoopsLocale::C_TO, 'to_userid'));
                }
                $subject = "";
                $message = "";
            }
        }
        $form->addElement(new Xoops\Form\Text(XoopsLocale::SUBJECT, 'subject', 4, 100, $subject), true);
        $icons = new Xoops\Form\Radio(XoopsLocale::MESSAGE_ICON, 'msg_image', '', true);
        \Xoops\Core\Lists\SubjectIcon::setOptionsArray($icons);
        $form->addElement($icons, false);
        $form->addElement(new Xoops\Form\DhtmlTextArea(XoopsLocale::MESSAGE, 'message', $message, 8, 37), true);
        $form->addElement(new Xoops\Form\Hidden('op', 'submit'));
        $buttons = new Xoops\Form\ElementTray('');
        $buttons->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'));
        $buttons->addElement(new Xoops\Form\Button('', 'reset', XoopsLocale::A_CLEAR, 'reset'));
        $cancel_send = new Xoops\Form\Button('', 'cancel', XoopsLocale::CANCEL_SEND, 'button');
        $cancel_send->set('onclick', 'javascript:window.close();');
        $buttons->addElement($cancel_send);
        $form->addElement($buttons);
        $tpl->assign('form', $form->render());
        $tpl->display("module:system/system_pmlite.tpl");
    }
}
$xoops->simpleFooter();
Exemplo n.º 16
0
if (function_exists('mb_http_output')) {
    mb_http_output('pass');
}
$categoryid = isset($_GET['categoryid']) ? $_GET['categoryid'] : -1;
if ($categoryid != -1) {
    /* @var $categoryObj PublisherCategory */
    $categoryObj = $publisher->getCategoryHandler()->get($categoryid);
}
header('Content-Type:text/xml; charset=' . XoopsLocale::getCharset());
$tpl = new XoopsTpl();
$tpl->caching = 2;
$tpl->cache_lifetime = 0;
$myts = \Xoops\Core\Text\Sanitizer::getInstance();
if (!$tpl->isCached('module:publisher/publisher_rss.tpl')) {
    $channel_category = $publisher->getModule()->getVar('name');
    $tpl->assign('channel_charset', XoopsLocale::getCharset());
    $tpl->assign('channel_title', htmlspecialchars($xoops->getConfig('sitename'), ENT_QUOTES));
    $tpl->assign('channel_link', PUBLISHER_URL);
    $tpl->assign('channel_desc', htmlspecialchars($xoops->getConfig('slogan'), ENT_QUOTES));
    $tpl->assign('channel_lastbuild', XoopsLocale::formatTimestamp(time(), 'rss'));
    $tpl->assign('channel_webmaster', $xoops->getConfig('adminmail'));
    $tpl->assign('channel_editor', $xoops->getConfig('adminmail'));
    if ($categoryid != -1) {
        $channel_category .= " > " . $categoryObj->getVar('name');
    }
    $tpl->assign('channel_category', htmlspecialchars($channel_category));
    $tpl->assign('channel_generator', $publisher->getModule()->getVar('name'));
    $tpl->assign('channel_language', XoopsLocale::getLangCode());
    $tpl->assign('image_url', \XoopsBaseConfig::get('url') . '/images/logo.gif');
    $dimention = getimagesize(\XoopsBaseConfig::get('root-path') . '/images/logo.gif');
    if (empty($dimention[0])) {
Exemplo n.º 17
0
 */
include_once 'header.php';
// Call header
$xoops->logger()->quiet();
// Get ID
$content_id = Request::getInt('id', 0);
// Permission to view
$perm_view = $gperm_Handler->checkRight('page_view_item', $content_id, $groups, $module_id, false);
if (!$perm_view) {
    $xoops->redirect('javascript:history.go(-1)', 2, XoopsLocale::E_NO_ACCESS_PERMISSION);
    exit;
}
// Get content
$view_content = $content_Handler->get($content_id);
// Test if the page exist
if (count($view_content) == 0 || $view_content->getVar('content_status') == 0) {
    $xoops->redirect('index.php', 3, PageLocale::E_NOT_EXIST);
    exit;
}
$tpl = new XoopsTpl();
// content
$content = $view_content->getValues();
foreach ($content as $k => $v) {
    $tpl->assign($k, $v);
}
// related
$tpl->assign('related', $link_Handler->menu_related($content_id));
$tpl->assign('xoops_sitename', $xoops->getConfig('sitename'));
// Meta
$tpl->assign('xoops_pagetitle', strip_tags($view_content->getVar('content_title') . ' - ' . XoopsLocale::A_PRINT . ' - ' . $xoopsModule->name()));
$tpl->display('module:page/page_print.tpl');
Exemplo n.º 18
0
if ($op === 'save') {
    if (!$xoops->security()->check()) {
        $xoops->redirect('xoops_xlanguage.php', 2, implode(',', $xoops->security()->getErrors()));
    }
    XoopsLoad::load('system', 'system');
    $lang = $helper->getHandlerLanguage()->create();
    $lang->CleanVarsForDB();
    if ($helper->getHandlerLanguage()->insert($lang)) {
        $helper->getHandlerLanguage()->createConfig();
        $xoops->redirect('xoops_xlanguage.php', 2, _AM_XLANGUAGE_SAVED);
    }
}
// check user/group
$groups = $xoops->getUserGroups();
$gperm_handler = $xoops->getHandlerGroupPermission();
$admin = false;
if ($gperm_handler) {
    $xlanguage = $xoops->getHandlerModule()->getByDirname('xlanguage');
    if ($xlanguage) {
        $admin = $gperm_handler->checkRight('system_admin', $xlanguage->getVar('mid'), $groups);
    }
}
$xoopsTpl = new XoopsTpl();
if ($helper) {
    $xoopsTpl->assign('form_txt', $helper->getForm($helper->getHandlerLanguage()->loadConfig(), 'tinymce')->render());
    if ($admin) {
        $xoopsTpl->assign('form_add', $helper->getForm($helper->getHandlerLanguage()->create(), 'language')->render());
    }
}
$xoopsTpl->display('module:xlanguage/xlanguage_tinymce.tpl');
$xoops->simpleFooter();
Exemplo n.º 19
0
use Xoops\Core\XoopsTpl;
require_once dirname(__FILE__) . '/../../../../../../mainfile.php';
$xoops = Xoops::getInstance();
$xoops->disableErrorReporting();
$xoops->simpleHeader(true);
$form = new Xoops\Form\ThemeForm('', 'imagecat_form', '#', false, 'vertical');
$form->addElement(new Xoops\Form\TextArea(XoopsLocale::PASTE_THE_QUOTE_YOU_WANT_TO_INSERT, 'text_id', '', 9, 7));
/**
 * Buttons
 */
$button_tray = new Xoops\Form\ElementTray('', '');
$button_tray->addElement(new Xoops\Form\Hidden('op', 'save'));
$button = new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit');
$button->setExtra('onclick="Xoops_quoteDialog.insert();"');
$button->setClass('btn btn-success');
$button_tray->addElement($button);
$button_2 = new Xoops\Form\Button('', 'reset', XoopsLocale::A_RESET, 'reset');
$button_2->setClass('btn btn-warning');
$button_tray->addElement($button_2);
$button_3 = new Xoops\Form\Button('', 'button', XoopsLocale::A_CLOSE, 'button');
$button_3->setExtra('onclick="tinyMCEPopup.close();"');
$button_3->setClass('btn btn-danger');
$button_tray->addElement($button_3);
$form->addElement($button_tray);
$xoopsTpl = new XoopsTpl();
$xoopsTpl->assign('js_file', 'js/xoops_quote.js');
$xoopsTpl->assign('css_file', 'css/xoops_quote.css');
$xoopsTpl->assign('form', $form->render());
$xoopsTpl->assign('include_html', '');
$xoopsTpl->display('module:system/system_tinymce.tpl');
$xoops->simpleFooter();
Exemplo n.º 20
0
 /**
  * Render the page
  * The theme engine builds pages from 2 templates: canvas and content.
  * A module can call this method directly and specify what templates the theme engine must use.
  * If render() hasn't been called before, the theme defaults will be used for the canvas and
  * page template (and xoopsOption['template_main'] for the content).
  *
  * @param string $canvasTpl  The canvas template, if different from the theme default
  * @param string $pageTpl    The page template, if different from the theme default (unsupported, 2.3+ only)
  * @param string $contentTpl The content template
  * @param array  $vars       Template variables to send to the template engine
  *
  * @return bool
  */
 public function render($canvasTpl = null, $pageTpl = null, $contentTpl = null, $vars = array())
 {
     if ($this->renderCount) {
         return false;
     }
     $xoops = \Xoops::getInstance();
     $xoops->events()->triggerEvent('core.theme.render.start', array($this));
     $cache = $xoops->cache($this->headersCacheEngine);
     //Get meta information for cached pages
     if ($this->contentCacheLifetime && $this->contentCacheId && ($content = $cache->read($this->contentCacheId))) {
         //we need to merge metas set by blocks with the module cached meta
         $this->htmlHeadStrings = array_merge($this->htmlHeadStrings, $content['htmlHeadStrings']);
         foreach ($content['metas'] as $type => $value) {
             $this->metas[$type] = array_merge($this->metas[$type], $content['metas'][$type]);
         }
         $xoops->setOption('xoops_pagetitle', $content['xoops_pagetitle']);
         $xoops->setOption('xoops_module_header', $content['header']);
     }
     if ($xoops->getOption('xoops_pagetitle')) {
         $this->template->assign('xoops_pagetitle', $xoops->getOption('xoops_pagetitle'));
     }
     $header = !$xoops->getOption('xoops_module_header') ? $this->template->getTemplateVars('xoops_module_header') : $xoops->getOption('xoops_module_header');
     //save meta information of cached pages
     if ($this->contentCacheLifetime && $this->contentCacheId && !$contentTpl) {
         $content['htmlHeadStrings'] = (array) $this->htmlHeadStrings;
         $content['metas'] = (array) $this->metas;
         $content['xoops_pagetitle'] = $this->template->getTemplateVars('xoops_pagetitle');
         $content['header'] = $header;
         $cache->write($this->contentCacheId, $content);
     }
     //  @internal : Lame fix to ensure the metas specified in the xoops config page don't appear twice
     $old = array('robots', 'keywords', 'description', 'rating', 'author', 'copyright');
     foreach ($this->metas['meta'] as $name => $value) {
         if (in_array($name, $old)) {
             $this->template->assign("xoops_meta_{$name}", htmlspecialchars($value, ENT_QUOTES));
             unset($this->metas['meta'][$name]);
         }
     }
     // We assume no overlap between $GLOBALS['xoopsOption']['xoops_module_header'] and
     // $this->template->getTemplateVars( 'xoops_module_header' ) ?
     $this->template->assign('xoops_module_header', $this->renderMetas(true) . "\n" . $header);
     if ($canvasTpl) {
         $this->canvasTemplate = $canvasTpl;
     }
     if ($contentTpl) {
         $this->contentTemplate = $contentTpl;
     }
     if (!empty($vars)) {
         $this->template->assign($vars);
     }
     if ($this->contentTemplate) {
         $this->content = $this->template->fetch($this->contentTemplate, $this->contentCacheId);
     }
     if ($this->bufferOutput) {
         $this->content .= ob_get_contents();
         ob_end_clean();
     }
     $this->template->assignByRef('xoops_contents', $this->content);
     // Do not cache the main (theme.html) template output
     $this->template->caching = 0;
     if (false === (bool) $xoops->getConfig('disable_theme_shortcodes')) {
         $this->template->loadFilter('output', 'shortcodes');
     }
     $this->template->display($this->path . '/' . $this->canvasTemplate);
     $this->renderCount++;
     $xoops->events()->triggerEvent('core.theme.render.end', array($this));
     return true;
 }