function processPreview($request)
 {
     // Ticket Check
     if (!$GLOBALS['xoopsGTicket']->check(true, 'pico')) {
         redirect_header(XOOPS_URL . '/', 3, $GLOBALS['xoopsGTicket']->getErrors());
     }
     // initialize
     $cat_data = $this->currentCategoryObj->getData();
     $myts =& PicoTextSanitizer::getInstance();
     // assigning other than preview/request
     // parent::execute( $request ) ;
     // permission check (can_edit) done
     // request
     $request = pico_get_requests4content($this->mydirname, $errors = array(), $cat_data['post_auto_approved'], $cat_data['isadminormod'], $this->assign['content']['id']);
     $request['body_raw'] = $request['body'];
     $request['subject_raw'] = $request['subject'];
     $request4assign = array_map('htmlspecialchars_ent', $request);
     $this->assign['request'] = $request4assign;
     // override content data for edit
     $this->assign['content'] = $request4assign + $this->assign['content'];
     $this->assign['content']['filter_infos'] = pico_main_get_filter_infos($request['filters'], $cat_data['isadminormod']);
     $this->assign['content']['body_raw'] = $request['body'];
     $this->assign['content']['extra_fields'] = $request['extra_fields'];
     $this->assign['content']['ef'] = pico_common_unserialize($request['extra_fields']);
     // temporary $contentObj
     $tmpContentObj = new PicoContent($this->mydirname, 0, $this->currentCategoryObj, true);
     // preview
     $this->assign['preview'] = array('errors' => $errors, 'htmlheader' => $request['htmlheader'], 'subject' => $myts->makeTboxData4Show($request['subject'], 1, 1), 'body' => $tmpContentObj->filterBody($this->assign['content']));
 }
Пример #2
0
function pico_xcode($mydirname, $text, $content4assign)
{
    require_once dirname(dirname(__FILE__)) . '/class/pico.textsanitizer.php';
    $myts =& PicoTextSanitizer::getInstance();
    // html=on, smiley=0, xcode=1, $image=1, $br=0
    $text = $myts->displayTarea($text, 1, 0, 1, 1, 0);
    $text = $myts->pageBreak($mydirname, $text, $content4assign);
    return $text;
}
Пример #3
0
 function filterBody($content4assign)
 {
     $db =& Database::getInstance();
     // marking for compiling errors
     if ($content4assign['last_cached_time'] < $content4assign['modified_time']) {
         if ($content4assign['body_cached'] == _MD_PICO_ERR_COMPILEERROR) {
             return $content4assign['body_cached'];
         } else {
             $db->queryF("UPDATE " . $db->prefix($this->mydirname . "_contents") . " SET body_cached='" . mysql_real_escape_string(_MD_PICO_ERR_COMPILEERROR) . "' WHERE content_id=" . intval($content4assign['content_id']));
         }
     }
     // wraps special check (compare filemtime with modified_time )
     /*if( strstr( $content4assign['filters'] , 'wraps' ) && $content4assign['vpath'] ) {
     		$wrap_full_path = XOOPS_TRUST_PATH._MD_PICO_WRAPBASE.'/'.$this->mydirname.str_replace('..','',$content4assign['vpath']) ;
     		if( @filemtime( $wrap_full_path ) > @$content4assign['modified_time'] ) {
     			$db->queryF( "UPDATE ".$db->prefix($this->mydirname."_contents")." SET modified_time='".filemtime( $wrap_full_path )."' WHERE content_id=".intval($content4assign['content_id']) ) ;
     		}
     	}*/
     // process each filters
     $text = $content4assign['body_raw'];
     $filters = explode('|', $content4assign['filters']);
     foreach (array_keys($filters) as $i) {
         $filter = trim($filters[$i]);
         if (empty($filter)) {
             continue;
         }
         // xcode special check
         if ($filter == 'xcode') {
             $nl2br = $smiley = 0;
             for ($j = $i + 1; $j < $i + 3; $j++) {
                 if (@$filters[$j] == 'nl2br') {
                     $nl2br = 1;
                     $filters[$j] = '';
                 } else {
                     if (@$filters[$j] == 'smiley') {
                         $smiley = 1;
                         $filters[$j] = '';
                     }
                 }
             }
             require_once dirname(dirname(__FILE__)) . '/class/pico.textsanitizer.php';
             $myts =& PicoTextSanitizer::getInstance();
             $text = $myts->displayTarea($text, 1, $smiley, 1, 1, $nl2br);
             $text = $myts->pageBreak($this->mydirname, $text, $content4assign);
             continue;
         }
         $func_name = 'pico_' . $filter;
         $file_path = dirname(dirname(__FILE__)) . '/filters/pico_' . $filter . '.php';
         if (!function_exists($func_name)) {
             require_once $file_path;
         }
         $text = $func_name($this->mydirname, $text, $content4assign);
     }
     // store the result into body_cached and for_search field just after modification of the content
     // if( empty( $content4assign['for_search'] ) ) {
     if ($content4assign['last_cached_time'] < $content4assign['modified_time']) {
         $for_search = $content4assign['subject_raw'] . ' ' . strip_tags($text) . ' ' . implode(' ', array_values(pico_common_unserialize(@$content4assign['extra_fields'])));
         $db->queryF("UPDATE " . $db->prefix($this->mydirname . "_contents") . " SET body_cached='" . mysql_real_escape_string($text) . "', for_search='" . mysql_real_escape_string($for_search) . "', last_cached_time=UNIX_TIMESTAMP() WHERE content_id=" . intval($content4assign['content_id']));
     }
     return $text;
 }
Пример #4
0
<?php

require_once dirname(dirname(__FILE__)) . '/include/main_functions.php';
require_once dirname(dirname(__FILE__)) . '/include/common_functions.php';
require_once dirname(dirname(__FILE__)) . '/include/transact_functions.php';
require_once dirname(dirname(__FILE__)) . '/include/import_functions.php';
require_once dirname(dirname(__FILE__)) . '/include/history_functions.php';
require_once dirname(dirname(__FILE__)) . '/class/pico.textsanitizer.php';
require_once dirname(dirname(__FILE__)) . '/class/gtickets.php';
$myts =& PicoTextSanitizer::getInstance();
$db =& Database::getInstance();
define('SPECIAL_CAT_ID_ALL', -1);
define('SPECIAL_CAT_ID_DELETED', -2);
// get exportable modules
$module_handler =& xoops_gethandler('module');
$modules =& $module_handler->getObjects();
$exportable_modules = array('0' => '----');
foreach ($modules as $module) {
    $mid = $module->getVar('mid');
    $dirname = $module->getVar('dirname');
    $dirpath = XOOPS_ROOT_PATH . '/modules/' . $dirname;
    $mytrustdirname = '';
    $tables = $module->getInfo('tables');
    if (file_exists($dirpath . '/mytrustdirname.php')) {
        include $dirpath . '/mytrustdirname.php';
    }
    if ($mytrustdirname == 'pico' && $dirname != $mydirname) {
        // pico
        $exportable_modules[$mid] = $module->getVar('name') . " ({$dirname})";
    }
}
 function getData4html()
 {
     $myts =& PicoTextSanitizer::getInstance();
     return array('link' => pico_common_make_category_link4html($this->mod_config, $this->data), 'title' => $myts->makeTboxData4Show($this->data['cat_title'], 1, 1), 'desc' => $myts->displayTarea($this->data['cat_desc'], 1), 'weight' => intval($this->data['cat_weight'])) + $this->data;
 }