function readWrappedFile($request) { $wrap_full_path = XOOPS_TRUST_PATH . _MD_PICO_WRAPBASE . '/' . $this->mydirname . $request['path_info']; ob_start(); include $wrap_full_path; $full_content = pico_convert_encoding_to_ie(ob_get_contents()); ob_end_clean(); // parse full_content (get subject, body etc.) $file = substr(strrchr($wrap_full_path, '/'), 1); $mtime = intval(@filemtime($wrap_full_path)); if (preg_match('/\\<title\\>([^<>]+)\\<\\/title\\>/is', $full_content, $regs)) { $subject = $regs[1]; } else { $subject = $file; } if (preg_match('/\\<body[^<>]*\\>(.*)\\<\\/body\\>/is', $full_content, $regs)) { $body = $regs[1]; } else { $body = $full_content; } $cat_data = $this->currentCategoryObj->getData(); $link = empty($this->mod_config['use_rewrite']) ? 'index.php' . $request['path_info'] : substr($request['path_info'], 1); return array('id' => 0, 'link' => $link, 'created_time' => $mtime, 'created_time_formatted' => formatTimestamp($mtime), 'subject_raw' => pico_common_unhtmlspecialchars($subject), 'subject' => $subject, 'body' => $body, 'can_read' => $cat_data['isadminormod'] || $cat_data['can_read'], 'can_readfull' => $cat_data['isadminormod'] || $cat_data['can_readfull'], 'can_edit' => false, 'can_vote' => false); }
function pico_wraps($mydirname, $text, $content4assign) { if (empty($content4assign['vpath'])) { return $text; } if (!function_exists('pico_convert_encoding_to_ie')) { @(include_once XOOPS_TRUST_PATH . '/modules/pico/language/' . @$GLOBALS['xoopsConfig']['language'] . '/main.php'); } $wrap_full_path = XOOPS_TRUST_PATH . _MD_PICO_WRAPBASE . '/' . $mydirname . str_replace('..', '', $content4assign['vpath']); if (file_exists($wrap_full_path)) { ob_start(); include $wrap_full_path; $text = ob_get_contents(); ob_end_clean(); if (preg_match('/\\<body[^<>]*\\>(.*)\\<\\/body\\>/is', $text, $regs)) { $text = $regs[1]; } } if (function_exists('pico_convert_encoding_to_ie')) { return pico_convert_encoding_to_ie($text); } else { return $text; } }
function getFileInfo($vpath) { $wrap_full_path = $this->wrap_base . $vpath; ob_start(); include $wrap_full_path; $full_content = pico_convert_encoding_to_ie(ob_get_contents()); ob_end_clean(); // file name $filename = substr(strrchr($wrap_full_path, '/'), 1); // parse full_content (get subject, body etc.) if (preg_match('/\\<title\\>([^<>]+)\\<\\/title\\>/is', $full_content, $regs)) { $subject = pico_common_unhtmlspecialchars($regs[1]); } else { $subject = false; } if (preg_match('/\\<body[^<>]*\\>(.*)\\<\\/body\\>/is', $full_content, $regs)) { $body = $regs[1]; } else { $body = $full_content; } return array('mtime' => intval(@filemtime($wrap_full_path)), 'subject' => $subject, 'subject_alt' => $subject ? $subject : $filename, 'filename' => $filename, 'body' => $body); }