コード例 #1
0
 function execute($request)
 {
     parent::execute($request);
     $this->assign['content'] = $this->readWrappedFile($request);
     // check existence
     if (empty($this->assign['content'])) {
         redirect_header(XOOPS_URL . "/modules/{$this->mydirname}/index.php", 2, _MD_PICO_ERR_READCONTENT);
         exit;
     }
     $cat_data = $this->currentCategoryObj->getData();
     $this->assign['category'] = $this->currentCategoryObj->getData4html();
     // permission check
     if (empty($this->assign['content']['can_read']) || empty($this->assign['content']['can_readfull'])) {
         if ($this->uid > 0) {
             redirect_header(XOOPS_URL . '/', 2, _MD_PICO_ERR_PERMREADFULL);
         } else {
             redirect_header(XOOPS_URL . '/user.php', 2, _MD_PICO_ERR_LOGINTOREADFULL);
         }
         exit;
     }
     // auto-register
     if (!empty($this->mod_config['wraps_auto_register']) && @$cat_data['cat_vpath'][0] == '/') {
         $register_class = empty($this->mod_config['auto_register_class']) ? 'PicoAutoRegisterWraps' : $this->mod_config['auto_register_class'];
         require_once dirname(__FILE__) . '/' . $register_class . '.class.php';
         $register_obj = new $register_class($this->mydirname, $this->mod_config);
         $affected_rows = $register_obj->registerByCatvpath($cat_data);
         if ($affected_rows > 0) {
             // reload if the content is updated
             header('Location: ' . pico_common_unhtmlspecialchars($this->assign['mod_url']) . '/' . pico_common_unhtmlspecialchars($this->assign['content']['link']));
             exit;
         }
     }
     // link for "tell to friends"
     // (TODO?)
     if ($this->mod_config['use_taf_module']) {
         $this->assign['content']['tellafriend_uri'] = XOOPS_URL . '/modules/tellafriend/index.php?target_uri=' . rawurlencode(pico_common_unhtmlspecialchars($this->assign['mod_url'] . '/' . $this->assign['content']['link'])) . '&subject=' . rawurlencode(sprintf(_MD_PICO_FMT_TELLAFRIENDSUBJECT, @$GLOBALS['xoopsConfig']['sitename']));
     } else {
         $this->assign['content']['tellafriend_uri'] = 'mailto:?subject=' . pico_main_escape4mailto(sprintf(_MD_PICO_FMT_TELLAFRIENDSUBJECT, @$GLOBALS['xoopsConfig']['sitename'])) . '&body=' . pico_main_escape4mailto(sprintf(_MD_PICO_FMT_TELLAFRIENDBODY, $this->assign['content']['subject'])) . '%0A' . rawurlencode(pico_common_unhtmlspecialchars($this->assign['mod_url'] . '/' . $this->assign['content']['link']));
     }
     // breadcrumbs
     $breadcrumbsObj =& AltsysBreadcrumbs::getInstance();
     $breadcrumbsObj->appendPath('', $this->assign['content']['subject']);
     $this->assign['xoops_breadcrumbs'] = $breadcrumbsObj->getXoopsbreadcrumbs();
     $this->assign['xoops_pagetitle'] = $this->assign['content']['subject'];
     // views
     switch ($request['view']) {
         case 'singlecontent':
             $this->template_name = 'db:' . $this->mydirname . '_independent_singlecontent.html';
             $this->is_need_header_footer = false;
             break;
         case 'print':
             $this->template_name = 'db:' . $this->mydirname . '_independent_print.html';
             $this->is_need_header_footer = false;
             break;
         default:
             $this->template_name = $this->mydirname . '_main_viewcontent.html';
             $this->is_need_header_footer = true;
             break;
     }
 }
コード例 #2
0
 function execute($request)
 {
     parent::execute($request);
     $cat_data = $this->currentCategoryObj->getData();
     $breadcrumbsObj =& AltsysBreadcrumbs::getInstance();
     // get $history_profile from the id
     $older_profile = pico_get_content_history_profile($this->mydirname, $request['older_history_id']);
     if (empty($request['newer_history_id'])) {
         $newer_profile = pico_get_content_history_profile($this->mydirname, 0, intval($older_profile[1]));
     } else {
         $newer_profile = pico_get_content_history_profile($this->mydirname, $request['newer_history_id']);
     }
     // check each content_ids
     if ($older_profile[1] != $newer_profile[1]) {
         die('Differenct content_ids each other');
     }
     $this->contentObj = new PicoContent($this->mydirname, $request['content_id'], $this->currentCategoryObj);
     // add breadcrumbs if the content exists
     if (!$this->contentObj->isError()) {
         $content_data = $this->contentObj->getData();
         $this->assign['content'] = $this->contentObj->getData4html();
         $breadcrumbsObj->appendPath(XOOPS_URL . '/modules/' . $this->mydirname . '/' . $this->assign['content']['link'], $this->assign['content']['subject']);
         $breadcrumbsObj->appendPath(XOOPS_URL . '/modules/' . $this->mydirname . '/index.php?page=contentmanager&content_id=' . $content_data['id'], _MD_PICO_CONTENTMANAGER);
     }
     // permission check by 'can_edit'
     if (empty($cat_data['can_edit'])) {
         redirect_header(XOOPS_URL . '/', 2, _MD_PICO_ERR_EDITCONTENT);
         exit;
     }
     // get diff
     $diff_from_file4disp = '';
     $original_error_level = error_reporting();
     error_reporting($original_error_level & ~E_NOTICE & ~E_WARNING);
     $diff = new Text_Diff(explode("\n", $older_profile[2]), explode("\n", $newer_profile[2]));
     //$renderer = new Text_Diff_Renderer_unified();
     //$diff_str = htmlspecialchars( $renderer->render( $diff ) , ENT_QUOTES ) ;
     $renderer = new Text_Diff_Renderer_inline();
     $this->assign['diff_str'] = $renderer->render($diff);
     error_reporting($original_error_level);
     // breadcrumbs
     $breadcrumbsObj->appendPath('', 'DIFF');
     $this->assign['xoops_breadcrumbs'] = $breadcrumbsObj->getXoopsbreadcrumbs();
     $this->assign['xoops_pagetitle'] = _MD_PICO_HISTORY;
     // view
     $this->view = $request['view'];
     switch ($this->view) {
         case 'diffhistories':
             $this->template_name = $this->mydirname . '_main_diffhistories.html';
             $this->is_need_header_footer = true;
             break;
         default:
             $this->is_need_header_footer = false;
             break;
     }
 }
コード例 #3
0
ファイル: lang_functions.php プロジェクト: hiro1173/legacy
function altsys_mylangadmin_errordie($target_mname, $message4disp)
{
    xoops_cp_header();
    altsys_include_mymenu();
    $breadcrumbsObj =& AltsysBreadcrumbs::getInstance();
    $breadcrumbsObj->appendPath(XOOPS_URL . '/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mylangadmin', _MI_ALTSYS_MENU_MYLANGADMIN);
    $breadcrumbsObj->appendPath('', $target_mname);
    echo '<h3>' . _MYLANGADMIN_H3_MODULE . ' : ' . $target_mname . '</h3>';
    echo '<p>' . $message4disp . '</p>';
    xoops_cp_footer();
    exit;
}
コード例 #4
0
 function execute($request)
 {
     parent::execute($request);
     $categoryHandler = new PicoCategoryHandler($this->mydirname, $this->permissions);
     $categories = $categoryHandler->getAllCategories();
     // auto-register
     foreach ($categories as $categoryObj) {
         $mod_config = $categoryObj->getOverriddenModConfig();
         $register_class = empty($mod_config['auto_register_class']) ? 'PicoAutoRegisterWraps' : $mod_config['auto_register_class'];
         require_once dirname(__FILE__) . '/' . $register_class . '.class.php';
         if (!empty($mod_config['wraps_auto_register'])) {
             $register_obj = new $register_class($this->mydirname, $mod_config);
             $register_obj->registerByCatvpath($categoryObj->getData());
         }
     }
     $categories4assign = array();
     foreach ($categories as $cat_id => $categoryObj) {
         // assign categories
         $categories4assign[$cat_id] = $categoryObj->getData4html();
         // contents loop
         $contentObjs = $categoryObj->getContents(true);
         $private_contents_counter = 0;
         foreach ($contentObjs as $contentObj) {
             $content_data = $contentObj->getData();
             if (!$content_data['public']) {
                 $private_contents_counter++;
             } else {
                 if ($content_data['show_in_menu'] && $content_data['can_read']) {
                     $categories4assign[$cat_id]['contents'][] = $contentObj->getData4html();
                 }
             }
         }
         $categories4assign[$cat_id]['private_contents_counter'] = $private_contents_counter;
     }
     $this->assign['categories'] = $categories4assign;
     // breadcrumbs and pagetitle
     $lastnode4assign = @$_GET['page'] == 'menu' ? _MD_PICO_MENU : $GLOBALS['xoopsModule']->getVar('name');
     $breadcrumbsObj =& AltsysBreadcrumbs::getInstance();
     $breadcrumbsObj->appendPath('', $lastnode4assign);
     $this->assign['xoops_breadcrumbs'] = $breadcrumbsObj->getXoopsbreadcrumbs();
     $this->assign['xoops_pagetitle'] = $lastnode4assign;
     // views (no views other than 'menu')
     $this->template_name = $this->mydirname . '_main_menu.html';
     $this->is_need_header_footer = true;
 }
コード例 #5
0
 function execute($request)
 {
     parent::execute($request);
     // check existence
     if ($this->currentCategoryObj->isError()) {
         redirect_header(XOOPS_URL . "/modules/{$this->mydirname}/index.php", 2, _MD_PICO_ERR_READCATEGORY);
         exit;
     }
     $cat_data = $this->currentCategoryObj->getData();
     $this->assign['category'] = $this->currentCategoryObj->getData4html();
     // permission check
     if (!$cat_data['can_read']) {
         redirect_header(XOOPS_URL . "/modules/{$this->mydirname}/index.php", 2, _MD_PICO_ERR_READCATEGORY);
         exit;
     }
     // auto-register
     if (!empty($this->mod_config['wraps_auto_register']) && @$cat_data['cat_vpath'][0] == '/') {
         $register_class = empty($this->mod_config['auto_register_class']) ? 'PicoAutoRegisterWraps' : $this->mod_config['auto_register_class'];
         require_once dirname(__FILE__) . '/' . $register_class . '.class.php';
         $register_obj = new $register_class($this->mydirname, $this->mod_config);
         $register_obj->registerByCatvpath($cat_data);
     }
     // contents
     $this->assign['contents'] = array();
     $contentObjs = $this->currentCategoryObj->getContents();
     foreach ($contentObjs as $contentObj) {
         $this->assign['contents'][] = $contentObj->getData4html();
     }
     // subcategories
     $categoryHandler = new PicoCategoryHandler($this->mydirname, $this->permissions);
     $subcategoryObjs = $categoryHandler->getSubCategories($request['cat_id']);
     foreach ($subcategoryObjs as $subcategoryObj) {
         $this->assign['subcategories'][] = $subcategoryObj->getData4html();
     }
     $breadcrumbsObj =& AltsysBreadcrumbs::getInstance();
     $this->assign['xoops_breadcrumbs'] = $breadcrumbsObj->getXoopsbreadcrumbs();
     $this->assign['xoops_pagetitle'] = $this->assign['category']['title'];
     // views (no views other than 'listcontents')
     $this->template_name = $this->mydirname . '_main_listcontents.html';
     $this->is_need_header_footer = true;
 }
 function execute($request)
 {
     parent::execute($request);
     $cat_data = $this->currentCategoryObj->getData();
     $breadcrumbsObj =& AltsysBreadcrumbs::getInstance();
     $this->contentObj =& new PicoContent($this->mydirname, $request['content_id'], $this->currentCategoryObj);
     // add breadcrumbs if the content exists
     if (!$this->contentObj->isError()) {
         $content_data = $this->contentObj->getData();
         $this->assign['content'] = $this->contentObj->getData4html();
         $breadcrumbsObj->appendPath(XOOPS_URL . '/modules/' . $this->mydirname . '/' . $this->assign['content']['link'], $this->assign['content']['subject']);
         $breadcrumbsObj->appendPath(XOOPS_URL . '/modules/' . $this->mydirname . '/index.php?page=contentmanager&amp;content_id=' . $content_data['id'], _MD_PICO_CONTENTMANAGER);
     }
     // permission check by 'can_edit'
     if (empty($cat_data['can_edit'])) {
         redirect_header(XOOPS_URL . '/', 2, _MD_PICO_ERR_EDITCONTENT);
         exit;
     }
     // get $history_profile from the id
     $this->assign['content_history_id'] = $request['content_history_id'];
     list(, , $history_body) = pico_get_content_history_profile($this->mydirname, $request['content_history_id']);
     $this->assign['history_body_raw'] = $history_body;
     // breadcrumbs
     $breadcrumbsObj->appendPath('', _MD_PICO_HISTORY);
     $this->assign['xoops_breadcrumbs'] = $breadcrumbsObj->getXoopsbreadcrumbs();
     $this->assign['xoops_pagetitle'] = _MD_PICO_HISTORY;
     // view
     $this->view = $request['view'];
     switch ($this->view) {
         case 'viewhistory':
             $this->template_name = $this->mydirname . '_main_viewhistory.html';
             $this->is_need_header_footer = true;
             break;
         case 'download':
         default:
             $this->is_need_header_footer = false;
             break;
     }
 }
コード例 #7
0
 function execute($request)
 {
     parent::execute($request);
     $whr = '1';
     $queries = array();
     // query type "tag"
     if (!empty($request['tag'])) {
         $queries[] = array('type' => 'tag', 'value' => $request['tag']);
         // get content_ids
         $tag_handler = new PicoTagHandler($this->mydirname);
         $content_ids_sc = $tag_handler->getContentIdsCS($request['tag']);
         if ($content_ids_sc) {
             $whr .= " AND (`content_id` IN (" . $content_ids_sc . "))";
         } else {
             $whr .= " AND 0";
         }
     }
     // content handler
     $content_handler = new PicoContentHandler($this->mydirname);
     // contents (order by modified_time DESC)
     $this->assign['contents'] = array();
     $contents4assign = $content_handler->getContents4assign($whr);
     foreach ($contents4assign as $content4assign) {
         $this->assign['contents'][] = $content4assign;
     }
     // render $queries
     $query4assign = $this->renderQueries($queries);
     $this->assign['query'] = $query4assign;
     // breadcrumbs
     $breadcrumbsObj =& AltsysBreadcrumbs::getInstance();
     $breadcrumbsObj->appendPath('', $query4assign['title']);
     $this->assign['xoops_breadcrumbs'] = $breadcrumbsObj->getXoopsbreadcrumbs();
     $this->assign['xoops_pagetitle'] = $query4assign['title'];
     // views ('list')
     $this->template_name = $this->mydirname . '_main_querycontents.html';
     $this->is_need_header_footer = true;
 }
コード例 #8
0
ファイル: makecategory.php プロジェクト: nouphet/rata
<?php

require_once dirname(dirname(__FILE__)) . '/include/main_functions.php';
require_once dirname(dirname(__FILE__)) . '/include/common_functions.php';
require_once dirname(dirname(__FILE__)) . '/class/pico.textsanitizer.php';
require_once dirname(dirname(__FILE__)) . '/class/PicoUriMapper.class.php';
require_once dirname(dirname(__FILE__)) . '/class/PicoPermission.class.php';
require_once dirname(dirname(__FILE__)) . '/class/PicoModelCategory.class.php';
require_once dirname(dirname(__FILE__)) . '/class/PicoModelContent.class.php';
require_once XOOPS_TRUST_PATH . '/libs/altsys/class/AltsysBreadcrumbs.class.php';
// breadcrumbs
$breadcrumbsObj =& AltsysBreadcrumbs::getInstance();
$breadcrumbsObj->appendPath(XOOPS_URL . '/modules/' . $mydirname . '/index.php', $xoopsModule->getVar('name'));
// permissions
$picoPermission =& PicoPermission::getInstance();
$permissions = $picoPermission->getPermissions($mydirname);
// current category object (this "current" means "parent"
$currentCategoryObj = new PicoCategory($mydirname, intval(@$_REQUEST['pid']), $permissions);
if ($currentCategoryObj->isError()) {
    redirect_header(XOOPS_URL . "/modules/{$mydirname}/index.php", 2, _MD_PICO_ERR_READCATEGORY);
    exit;
}
// override $xoopsModuleConfig
$xoopsModuleConfig = $currentCategoryObj->getOverriddenModConfig();
// append paths from each categories into breadcrumbs
$breadcrumbsObj->appendPath($currentCategoryObj->getBreadcrumbs());
// request
$picoRequest = array();
$picoRequest['makecategory'] = true;
$picoRequest['cat_id'] = -1;
if (!empty($_POST['categoryman_post'])) {
コード例 #9
0
 function form_edit($bid, $mode = 'edit')
 {
     $bid = intval($bid);
     //HACK by domifara
     $block = new XoopsBlock($bid);
     if (!$block->getVar('bid')) {
         // new defaults
         $bid = 0;
         $mode = 'new';
         $block->setVar('mid', 0);
         $block->setVar('block_type', 'C');
     }
     switch ($mode) {
         case 'clone':
             $form_title = _MD_A_MYBLOCKSADMIN_CLONEFORM;
             $button_value = _MD_A_MYBLOCKSADMIN_BTN_CLONE;
             $next_op = 'clone_ok';
             // breadcrumbs
             $breadcrumbsObj =& AltsysBreadcrumbs::getInstance();
             $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_CLONEFORM);
             break;
         case 'new':
             $form_title = _MD_A_MYBLOCKSADMIN_NEWFORM;
             $button_value = _MD_A_MYBLOCKSADMIN_BTN_NEW;
             $next_op = 'new_ok';
             // breadcrumbs
             $breadcrumbsObj =& AltsysBreadcrumbs::getInstance();
             $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_NEWFORM);
             break;
         case 'edit':
         default:
             $form_title = _MD_A_MYBLOCKSADMIN_EDITFORM;
             $button_value = _MD_A_MYBLOCKSADMIN_BTN_EDIT;
             $next_op = 'edit_ok';
             // breadcrumbs
             $breadcrumbsObj =& AltsysBreadcrumbs::getInstance();
             $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_EDITFORM);
             break;
     }
     $is_custom = in_array($block->getVar('block_type'), array('C', 'E')) ? true : false;
     $block_template = $block->getVar('template', 'n');
     $block_template_tplset = '';
     if (!$is_custom && $block_template) {
         // find template of the block
         $tplfile_handler =& xoops_gethandler('tplfile');
         $found_templates = $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', null, null, $block_template);
         $block_template_tplset = count($found_templates) > 0 ? $GLOBALS['xoopsConfig']['template_set'] : 'default';
     }
     //HACK by domifara
     /*
     	if ( !($block->getVar('c_type')) ){
     		$block->setVar('c_type','S');
     	}
     */
     $block_data = $this->preview_request + array('bid' => $bid, 'name' => $block->getVar('name', 'n'), 'title' => $block->getVar('title', 'n'), 'weight' => intval($block->getVar('weight')), 'bcachetime' => intval($block->getVar('bcachetime')), 'side' => intval($block->getVar('side')), 'visible' => intval($block->getVar('visible')), 'template' => $block_template, 'template_tplset' => $block_template_tplset, 'options' => $block->getVar('options'), 'content' => $block->getVar('content', 'n'), 'is_custom' => $is_custom, 'type' => $block->getVar('block_type'), 'ctype' => $block->getVar('c_type'));
     $block4assign = array('name_raw' => $block_data['name'], 'title_raw' => $block_data['title'], 'content_raw' => $block_data['content'], 'cell_position' => $this->renderCell4BlockPosition($block_data), 'cell_module_link' => $this->renderCell4BlockModuleLink($block_data), 'cell_group_perm' => $this->renderCell4BlockReadGroupPerm($block_data), 'cell_options' => $this->renderCell4BlockOptions($block_data), 'content_preview' => $this->previewContent($block_data)) + $block_data;
     // display
     require_once XOOPS_TRUST_PATH . '/libs/altsys/class/D3Tpl.class.php';
     $tpl = new D3Tpl();
     //dhtml
     include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
     if ($block_data['ctype'] == 'H' || empty($block_data['ctype'])) {
         $editor_configs = array();
         $editor_configs["name"] = "content_block";
         $editor_configs["value"] = $block_data['content'];
         $editor_configs["rows"] = 20;
         $editor_configs["cols"] = 100;
         $editor_configs["width"] = "100%";
         $editor_configs["height"] = "400px";
         $editor_configs["editor"] = xoops_getModuleOption('blocks_editor', 'system');
         $form = new XoopsFormEditor('', "textarea_content", $editor_configs);
         $rendered = $form->render();
         $tpl->assign('altsys_x25_dhtmltextarea', $rendered);
     } else {
         $form = new XoopsFormDhtmlTextArea('', 'textarea_content', $block_data['content'], 80, 20);
         $rendered = $form->render();
         $rendered = '<div id="textarea_content_bbcode_buttons_pre" style="display:block;">' . str_replace(array('<textarea', '</textarea><br />'), array('</div><textarea', '</textarea><div id="textarea_content_bbcode_buttons_post" style="display:block;">'), $rendered) . '</div>';
         $tpl->assign('altsys_x25_dhtmltextarea', $rendered);
     }
     $tpl->assign(array('target_dirname' => $this->target_dirname, 'target_mname' => $this->target_mname, 'language' => $this->lang, 'cachetime_options' => $this->cachetime_options, 'ctype_options' => $this->ctype_options, 'block' => $block4assign, 'op' => $next_op, 'form_title' => $form_title, 'submit_button' => $button_value, 'common_fck_installed' => file_exists(XOOPS_ROOT_PATH . '/common/fckeditor/fckeditor.js'), 'gticket_hidden' => $GLOBALS['xoopsGTicket']->getTicketHtml(__LINE__, 1800, 'myblocksadmin')));
     //HACK by domifara
     $tpl->display('db:altsys_main_myblocksadmin_edit_4x25.html');
     return;
 }
コード例 #10
0
 function execute($request)
 {
     parent::execute($request);
     // makecontent/contentmanager
     $page = empty($request['makecontent']) ? 'contentmanager' : 'makecontent';
     // $contentObj
     $contentObj = new PicoContent($this->mydirname, $request['content_id'], $this->currentCategoryObj, $page == 'makecontent');
     // check existence
     if ($contentObj->isError()) {
         redirect_header(XOOPS_URL . "/modules/{$this->mydirname}/index.php", 2, _MD_PICO_ERR_READCONTENT);
         exit;
     }
     // fetch data from DB
     $cat_data = $this->currentCategoryObj->getData();
     $this->assign['category'] = $this->currentCategoryObj->getData4html();
     $content_data = $contentObj->getData();
     $this->assign['content_base'] = $contentObj->getData4html(true);
     $this->contentObjs['content_base'] =& $contentObj;
     $this->assign['content'] = $contentObj->getData4edit();
     // permission check
     if ($page == 'makecontent') {
         if (empty($cat_data['can_post'])) {
             redirect_header(XOOPS_URL . '/', 2, _MD_PICO_ERR_CREATECONTENT);
         }
     } else {
         if (empty($content_data['can_edit'])) {
             redirect_header(XOOPS_URL . '/', 2, $content_data['locked'] ? _MD_PICO_ERR_LOCKEDCONTENT : _MD_PICO_ERR_EDITCONTENT);
         }
     }
     // category list can be read for category jumpbox etc.
     $categoryHandler = new PicoCategoryHandler($this->mydirname, $this->permissions);
     $categories = $categoryHandler->getAllCategories();
     $this->assign['categories_can_post'] = array();
     foreach ($categories as $tmpObj) {
         $tmp_data = $tmpObj->getData();
         if (empty($tmp_data['can_post']) && empty($tmp_data['can_edit'])) {
             continue;
         }
         $this->assign['categories_can_post'][$tmp_data['id']] = str_repeat('--', $tmp_data['cat_depth_in_tree']) . $tmp_data['cat_title'];
     }
     // vpath options
     $this->assign['content']['wraps_files'] = array('' => '---') + pico_main_get_wraps_files_recursively($this->mydirname, '/');
     // breadcrumbs
     $breadcrumbsObj =& AltsysBreadcrumbs::getInstance();
     if ($page == 'makecontent') {
         $breadcrumbsObj->appendPath('', _MD_PICO_LINK_MAKECONTENT);
         $this->assign['xoops_pagetitle'] = _MD_PICO_LINK_MAKECONTENT;
     } else {
         $breadcrumbsObj->appendPath(XOOPS_URL . '/modules/' . $this->mydirname . '/' . $this->assign['content']['link'], $this->assign['content']['subject']);
         $breadcrumbsObj->appendPath('', _MD_PICO_CONTENTMANAGER);
         $this->assign['xoops_pagetitle'] = _MD_PICO_CONTENTMANAGER;
     }
     $this->assign['xoops_breadcrumbs'] = $breadcrumbsObj->getXoopsbreadcrumbs();
     // misc assigns
     $this->assign['content_histories'] = pico_get_content_histories4assign($this->mydirname, $content_data['id']);
     $this->assign['page'] = $page;
     $this->assign['formtitle'] = $page == 'makecontent' ? _MD_PICO_LINK_MAKECONTENT : _MD_PICO_LINK_EDITCONTENT;
     $this->assign['gticket_hidden'] = $GLOBALS['xoopsGTicket']->getTicketHtml(__LINE__, 1800, 'pico');
     // views
     $this->template_name = $this->mydirname . '_main_content_form.html';
     $this->is_need_header_footer = true;
     // preview
     $this->processPreview($request);
     // editor (wysiwyg etc)
     $editor_assigns = $this->getEditorAssigns('body', $this->assign['content']['body_raw']);
     $this->assign['body_wysiwyg'] = $editor_assigns['body'];
     $this->html_header .= $editor_assigns['header'];
 }
コード例 #11
0
 function execute($request)
 {
     parent::execute($request);
     // $contentObj
     $contentObj =& new PicoContent($this->mydirname, $request['content_id'], $this->currentCategoryObj);
     // check existence
     if ($contentObj->isError()) {
         redirect_header(XOOPS_URL . "/modules/{$this->mydirname}/index.php", 2, _MD_PICO_ERR_READCONTENT);
         exit;
     }
     $cat_data = $this->currentCategoryObj->getData();
     $this->assign['category'] = $this->currentCategoryObj->getData4html();
     $content_data = $contentObj->getData();
     $this->assign['content'] = $contentObj->getData4html(true);
     $this->contentObjs['content'] =& $contentObj;
     // permission check
     if (empty($content_data['can_read']) || empty($content_data['can_readfull'])) {
         if ($this->uid > 0) {
             redirect_header(XOOPS_URL . '/', 2, _MD_PICO_ERR_PERMREADFULL);
         } else {
             redirect_header(XOOPS_URL . '/user.php', 2, _MD_PICO_ERR_LOGINTOREADFULL);
         }
         exit;
     }
     // auto-register
     if (!empty($this->mod_config['wraps_auto_register']) && @$cat_data['cat_vpath'][0] == '/' && $content_data['poster_uid'] == 0 && $content_data['vpath'] != '') {
         $register_class = empty($this->mod_config['auto_register_class']) ? 'PicoAutoRegisterWraps' : $this->mod_config['auto_register_class'];
         require_once dirname(dirname(__FILE__)) . '/class/' . $register_class . '.class.php';
         $register_obj =& new $register_class($this->mydirname, $this->mod_config);
         $is_updated = $register_obj->updateContent($content_data['content_id'], $content_data['vpath']);
         if ($is_updated > 0) {
             // reload if the content is updated
             header('Location: ' . pico_common_unhtmlspecialchars($this->assign['mod_url']) . '/' . pico_common_unhtmlspecialchars($this->assign['content']['link']));
             exit;
         }
     }
     // prev/next content
     $prevContentObj =& $contentObj->getPrevContent();
     $this->assign['prev_content'] = is_object($prevContentObj) ? $prevContentObj->getData4html() : array();
     $this->contentObjs['prev_content'] =& $prevContentObj;
     $nextContentObj =& $contentObj->getNextContent();
     $this->assign['next_content'] = is_object($nextContentObj) ? $nextContentObj->getData4html() : array();
     $this->contentObjs['next_content'] =& $nextContentObj;
     // link for "tell to friends"
     if ($this->mod_config['use_taf_module']) {
         $this->assign['content']['tellafriend_uri'] = XOOPS_URL . '/modules/tellafriend/index.php?target_uri=' . rawurlencode(XOOPS_URL . "/modules/{$this->mydirname}/" . pico_common_make_content_link4html($this->mod_config, $content_data)) . '&amp;subject=' . rawurlencode(sprintf(_MD_PICO_FMT_TELLAFRIENDSUBJECT, @$GLOBALS['xoopsConfig']['sitename']));
     } else {
         $this->assign['content']['tellafriend_uri'] = 'mailto:?subject=' . pico_main_escape4mailto(sprintf(_MD_PICO_FMT_TELLAFRIENDSUBJECT, @$GLOBALS['xoopsConfig']['sitename'])) . '&amp;body=' . pico_main_escape4mailto(sprintf(_MD_PICO_FMT_TELLAFRIENDBODY, $content_data['subject'])) . '%0A' . XOOPS_URL . "/modules/{$this->mydirname}/" . rawurlencode(pico_common_make_content_link4html($this->mod_config, $content_data));
     }
     // category list can be read for category jumpbox etc.
     $categoryHandler =& new PicoCategoryHandler($this->mydirname, $this->permissions);
     $categories = $categoryHandler->getAllCategories();
     $this->assign['categories_can_read'] = array();
     foreach ($categories as $tmpObj) {
         $tmp_data = $tmpObj->getData();
         $this->assign['categories_can_read'][$tmp_data['id']] = str_repeat('--', $tmp_data['cat_depth_in_tree']) . $tmp_data['cat_title'];
     }
     // count up 'viewed'
     if ($content_data['modifier_ip'] != @$_SERVER['REMOTE_ADDR']) {
         $contentObj->incrementViewed();
     }
     // breadcrumbs
     $breadcrumbsObj =& AltsysBreadcrumbs::getInstance();
     $breadcrumbsObj->appendPath('', $this->assign['content']['subject']);
     $this->assign['xoops_breadcrumbs'] = $breadcrumbsObj->getXoopsbreadcrumbs();
     $this->assign['xoops_pagetitle'] = $this->assign['content']['subject'];
     // views
     switch ($request['view']) {
         case 'singlecontent':
             $this->template_name = 'db:' . $this->mydirname . '_independent_singlecontent.html';
             $this->is_need_header_footer = false;
             break;
         case 'print':
             $this->template_name = 'db:' . $this->mydirname . '_independent_print.html';
             $this->is_need_header_footer = false;
             break;
         default:
             $this->template_name = empty($this->mod_config['tpl_viewcontent']) ? $this->mydirname . '_main_viewcontent.html' : $this->mod_config['tpl_viewcontent'];
             $this->is_need_header_footer = true;
             break;
     }
     // htmlheader
     if (!empty($this->mod_config['allow_each_htmlheader'])) {
         $this->html_header .= $content_data['htmlheader'];
     }
 }
コード例 #12
0
 function form_edit($bid, $mode = 'edit')
 {
     $bid = intval($bid);
     $block = new XoopsBlock($bid);
     if (!$block->getVar('bid')) {
         // new defaults
         $bid = 0;
         $mode = 'new';
         $block->setVar('mid', 0);
         $block->setVar('block_type', 'C');
     }
     switch ($mode) {
         case 'clone':
             $form_title = _MD_A_MYBLOCKSADMIN_CLONEFORM;
             $button_value = _MD_A_MYBLOCKSADMIN_BTN_CLONE;
             $next_op = 'clone_ok';
             // breadcrumbs
             $breadcrumbsObj =& AltsysBreadcrumbs::getInstance();
             $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_CLONEFORM);
             break;
         case 'new':
             $form_title = _MD_A_MYBLOCKSADMIN_NEWFORM;
             $button_value = _MD_A_MYBLOCKSADMIN_BTN_NEW;
             $next_op = 'new_ok';
             // breadcrumbs
             $breadcrumbsObj =& AltsysBreadcrumbs::getInstance();
             $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_NEWFORM);
             break;
         case 'edit':
         default:
             $form_title = _MD_A_MYBLOCKSADMIN_EDITFORM;
             $button_value = _MD_A_MYBLOCKSADMIN_BTN_EDIT;
             $next_op = 'edit_ok';
             // breadcrumbs
             $breadcrumbsObj =& AltsysBreadcrumbs::getInstance();
             $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_EDITFORM);
             break;
     }
     $is_custom = in_array($block->getVar('block_type'), array('C', 'E')) ? true : false;
     $block_template = $block->getVar('template', 'n');
     $block_template_tplset = '';
     if (!$is_custom && $block_template) {
         // find template of the block
         $tplfile_handler =& xoops_gethandler('tplfile');
         $found_templates = $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', null, null, $block_template);
         $block_template_tplset = count($found_templates) > 0 ? $GLOBALS['xoopsConfig']['template_set'] : 'default';
     }
     $block_data = $this->preview_request + array('bid' => $bid, 'name' => $block->getVar('name', 'n'), 'title' => $block->getVar('title', 'n'), 'weight' => intval($block->getVar('weight')), 'bcachetime' => intval($block->getVar('bcachetime')), 'side' => intval($block->getVar('side')), 'visible' => intval($block->getVar('visible')), 'template' => $block_template, 'template_tplset' => $block_template_tplset, 'options' => $block->getVar('options'), 'content' => $block->getVar('content', 'n'), 'is_custom' => $is_custom, 'type' => $block->getVar('block_type'), 'ctype' => $block->getVar('c_type'));
     $block4assign = array('name_raw' => $block_data['name'], 'title_raw' => $block_data['title'], 'content_raw' => $block_data['content'], 'cell_position' => $this->renderCell4BlockPosition($block_data), 'cell_module_link' => $this->renderCell4BlockModuleLink($block_data), 'cell_group_perm' => $this->renderCell4BlockReadGroupPerm($block_data), 'cell_options' => $this->renderCell4BlockOptions($block_data), 'content_preview' => $this->previewContent($block_data)) + $block_data;
     // display
     require_once XOOPS_TRUST_PATH . '/libs/altsys/class/D3Tpl.class.php';
     $tpl =& new D3Tpl();
     $tpl->assign(array('target_dirname' => $this->target_dirname, 'target_mname' => $this->target_mname, 'language' => $this->lang, 'cachetime_options' => $this->cachetime_options, 'ctype_options' => $this->ctype_options, 'block' => $block4assign, 'op' => $next_op, 'form_title' => $form_title, 'submit_button' => $button_value, 'common_fck_installed' => file_exists(XOOPS_ROOT_PATH . '/common/fckeditor/fckeditor.js'), 'gticket_hidden' => $GLOBALS['xoopsGTicket']->getTicketHtml(__LINE__, 1800, 'myblocksadmin')));
     $tpl->display('db:altsys_main_myblocksadmin_edit.html');
     return;
 }
コード例 #13
0
 function execute($request)
 {
     parent::execute($request);
     // makecategory/categorymanager
     $page = empty($request['makecategory']) ? 'categorymanager' : 'makecategory';
     // $categoryObj (not parent)
     $picoPermission =& PicoPermission::getInstance();
     $categoryObj = new PicoCategory($this->mydirname, $request['cat_id'], $picoPermission->getPermissions($this->mydirname), $page == 'makecategory', $this->currentCategoryObj);
     // check existence
     if ($categoryObj->isError()) {
         redirect_header(XOOPS_URL . "/modules/{$this->mydirname}/index.php", 2, _MD_PICO_ERR_READCONTENT);
         exit;
     }
     // fetch data from DB
     $cat_data = $categoryObj->getData();
     $this->assign['category_base'] = $categoryObj->getData4html(true);
     $this->categoryObjs['category_base'] =& $categoryObj;
     $this->assign['category'] = $categoryObj->getData4edit();
     // permission check
     if ($page == 'makecategory') {
         $pcat_data = $this->currentCategoryObj->getData();
         if (empty($pcat_data['can_makesubcategory'])) {
             redirect_header(XOOPS_URL . '/', 2, _MD_PICO_ERR_CREATECATEGORY);
         }
     } else {
         if (empty($cat_data['isadminormod'])) {
             redirect_header(XOOPS_URL . '/', 2, _MD_PICO_ERR_CATEGORYMANAGEMENT);
         }
     }
     // category list can be read for category jumpbox etc.
     $categoryHandler = new PicoCategoryHandler($this->mydirname, $this->permissions);
     $categories = $categoryHandler->getAllCategories();
     $this->assign['categories_can_post'] = array();
     foreach ($categories as $tmpObj) {
         $tmp_data = $tmpObj->getData();
         if (empty($tmp_data['can_makesubcategory'])) {
             continue;
         }
         $this->assign['categories_can_makesubcategory'][$tmp_data['id']] = str_repeat('--', $tmp_data['cat_depth_in_tree']) . $tmp_data['cat_title'];
     }
     // breadcrumbs
     $breadcrumbsObj =& AltsysBreadcrumbs::getInstance();
     if ($page == 'makecategory') {
         $breadcrumbsObj->appendPath('', _MD_PICO_LINK_MAKECATEGORY);
         $this->assign['xoops_pagetitle'] = _MD_PICO_LINK_MAKECATEGORY;
     } else {
         //		$breadcrumbsObj->appendPath( XOOPS_URL.'/modules/'.$this->mydirname.'/'.$this->assign['category']['link'] , $this->assign['category']['title'] ) ;
         $breadcrumbsObj->appendPath('', _MD_PICO_CATEGORYMANAGER);
         $this->assign['xoops_pagetitle'] = _MD_PICO_CATEGORYMANAGER;
     }
     $this->assign['xoops_breadcrumbs'] = $breadcrumbsObj->getXoopsbreadcrumbs();
     // misc assigns
     $this->assign['page'] = $page;
     $this->assign['formtitle'] = $page == 'makecategory' ? _MD_PICO_LINK_MAKECATEGORY : _MD_PICO_CATEGORYMANAGER;
     $this->assign['gticket_hidden'] = $GLOBALS['xoopsGTicket']->getTicketHtml(__LINE__, 1800, 'pico');
     $this->assign['category']['option_desc'] = $this->getCategoryOptions4edit();
     $this->assign['category']['wraps_directories'] = array('' => '---') + pico_main_get_wraps_directories_recursively($this->mydirname, '/');
     // views
     $this->template_name = $this->mydirname . '_main_category_form.html';
     $this->is_need_header_footer = true;
 }