public function __construct() { log_info("info", "controller initialized"); global $config; $url = parseurl(); if (file_exists($config['controller'] . '/' . $url[0] . '.php')) { $this->controller = $url[0]; } unset($url[0]); require_once $config['controller'] . '/' . $this->controller . '.php'; log_info("info", "{$this->controller} included"); $this->controller = new $this->controller(); log_info("info", "main controller object created"); if (isset($url[1])) { if (!(method_exists($this->controller, $url[1]) && parent_method_exists($this->controller, $url[1]))) { if (method_exists($this->controller, $url[1])) { $this->method = $url[1]; } log_info("info", "{$url['1']} exist"); } } unset($url[1]); $url = array_filter($url); $this->param = $url ? array_values($url) : []; $this->controller->{$this->method}($this->param); }
function bbcode($message, $parseurl=0) { global $_SGLOBAL; if(empty($_SGLOBAL['search_exp'])) { $_SGLOBAL['search_exp'] = array( "/\s*\[quote\][\n\r]*(.+?)[\n\r]*\[\/quote\]\s*/is", "/\[url\]\s*(https?:\/\/|ftp:\/\/|gopher:\/\/|news:\/\/|telnet:\/\/|rtsp:\/\/|mms:\/\/|callto:\/\/|ed2k:\/\/){1}([^\[\"']+?)\s*\[\/url\]/i", "/\[em:(.+?):\]/i", ); $_SGLOBAL['replace_exp'] = array( "<div class=\"quote\"><span class=\"q\">\\1</span></div>", "<a href=\"\\1\\2\" target=\"_blank\">\\1\\2</a>", "<img src=\"image/face/\\1.gif\" class=\"face\">" ); $_SGLOBAL['search_str'] = array('[b]', '[/b]','[i]', '[/i]', '[u]', '[/u]'); $_SGLOBAL['replace_str'] = array('<b>', '</b>', '<i>','</i>', '<u>', '</u>'); } if($parseurl==2) {//深度解析 $_SGLOBAL['search_exp'][] = "/\[img\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/ies"; $_SGLOBAL['replace_exp'][] = 'bb_img(\'\\1\')'; $message = parseurl($message); } @$message = str_replace($_SGLOBAL['search_str'], $_SGLOBAL['replace_str'],preg_replace($_SGLOBAL['search_exp'], $_SGLOBAL['replace_exp'], $message, 20)); return nl2br(str_replace(array("\t", ' ', ' '), array(' ', ' ', ' '), $message)); }
function output() { extract($GLOBALS); $_G['forum_thread']['replies'] = $_G['forum_thread']['replies'] >= 0 ? $_G['forum_thread']['replies'] : 0; if ($_G['page'] > @ceil(($_G['forum_thread']['replies'] + 1) / $_G['ppp'])) { $content = ''; } elseif ($postlist) { if (!function_exists('mobileoem_template')) { include_once DISCUZ_ROOT . './source/plugin/mobileoem/discuzcode.func.php'; } $variable = array(); foreach ($GLOBALS['aimgs'] as $pid => $aids) { foreach ($aids as $aid) { $_url = parse_url($postlist[$pid]['attachments'][$aid]['url']); $variable['imagelist'][$aid] = (!$postlist[$pid]['attachments'][$aid]['remote'] && !$_url['scheme'] ? $_G['siteurl'] : '') . $postlist[$pid]['attachments'][$aid]['url'] . $postlist[$pid]['attachments'][$aid]['attachment']; if (strexists($postlist[$pid]['message'], '[attach]' . $aid . '[/attach]')) { $postlist[$pid]['message'] = str_replace('[attach]' . $aid . '[/attach]', mobileoem_parseimg($postlist[$pid]['attachments'][$aid]['width'], 0, $variable['imagelist'][$aid]), $postlist[$pid]['message']); } else { $postlist[$pid]['message'] .= '<br /><br />' . mobileoem_parseimg($postlist[$pid]['attachments'][$aid]['width'], 0, $variable['imagelist'][$aid]); } } } foreach ($postlist as $pid => $post) { if ($post['attachlist']) { foreach ($post['attachlist'] as $aid) { $aidencode = packaids($postlist[$pid]['attachments'][$aid]); $_code = parseurl('/forum.php?mod=attachment&aid=' . $aidencode, $postlist[$pid]['attachments'][$aid]['filename'], 0); if (strexists($postlist[$pid]['message'], '[attach]' . $aid . '[/attach]')) { $postlist[$pid]['message'] = str_replace('[attach]' . $aid . '[/attach]', $_code, $postlist[$pid]['message']); } else { $postlist[$pid]['message'] .= '<br /><br />' . $_code; } } } $postlist[$pid]['message'] = preg_replace("/\\[attach\\]\\d+\\[\\/attach\\]/i", '', $postlist[$pid]['message']); } $get = $_GET; unset($get['page'], $get['debug']); $nexturl = http_build_query($get); include mobileoem_template('forum/viewthread'); if (!empty($_GET['debug'])) { exit; } $content = ob_get_contents(); ob_end_clean(); } $variable['forumname'] = $forum['name']; $variable['datatype'] = $_G['page'] == 1 ? 0 : 1; $variable['webview_page'] = $content; $variable['ppp'] = $_G['ppp']; $variable['posts'] = count($postlist); $variable['page'] = $_G['page']; if ($_G['forum_discuzcode']['passwordauthor']) { $variable['passwordpid'] = array_keys($_G['forum_discuzcode']['passwordauthor']); } mobile_core::result(mobile_core::variable($variable)); }
function print_file($sid, $showlink = 0, $includeabsolute = 0, $f2 = false, $smarksid = -1) { global $u_cookieid, $setctl, $cfg, $marksid; if (!$f2) { $f2 = new file2($sid, true); } $inf = $f2->getid3(); $title = $f2->gentitle(array('title', 'album')); echo '<tr><td><input type="checkbox" name="fsel[]" value="' . $sid . '"/> '; if ($cfg['id3editor'] && db_guinfo('u_access') == 0 && function_exists('file_id3editor')) { $id3link = '&id3sid=' . $sid; echo '<a href="javascript: void(0);" onclick="' . jswin('id3editor', '?action=id3edit' . $id3link) . '">id3</a> '; } if (ALLOWDOWNLOAD && db_guinfo('u_allowdownload')) { if (URLSECURITY) { $urlextra = '&' . urlsecurity($f2->fdate, $sid); } else { $urlextra = ''; } echo '<span class="file"><a href="' . PHPSELF . "?downloadfile=" . $sid . '&c=' . $u_cookieid . $urlextra . '">' . '<img src="' . getimagelink('saveicon.gif') . '" alt="' . get_lang(117) . '" border="0"/></a></span> '; } if (SHOWLYRICSLINK && !empty($inf['title']) && !empty($inf['artist'])) { $url = parseurl($setctl->get('lyricsurl'), $inf['title'], $inf['artist'], $inf['album']); echo '<a class="file" onclick="' . jswin('lyrics', $url, 410, 675, true, 'newwinscroll', '') . '"'; echo ' href="javascript: void(0);"><img border="0" src="' . getimagelink('lyrics.gif') . '" alt="' . get_lang(303) . '"/></a> '; } if (MAILMP3 && db_guinfo('allowemail') && class_exists('mailmp3')) { echo '<a href="javascript: void(0);" onclick="' . jswin('mp3mail', '?action=sendmail&id=' . $sid . '&c=' . $u_cookieid, 195, 390) . '">' . '<img src="' . getimagelink('sendmail.gif') . '" alt="' . get_lang(223) . '" border="0"/></a> '; } if ($showlink) { echo '<a href="' . PHPSELF . '?pwd=' . $f2->getdir64() . '&d=' . $f2->drive . '&marksid=' . $smarksid . '" title="' . get_lang(116, checkchs($f2->relativepath)) . '">' . '<img src="' . getimagelink('link.gif') . '" alt="' . get_lang(116, checkchs($f2->relativepath)) . '" border="0"/></a> '; } if (ismarked($f2->fname . $title) || $f2->sid == $marksid) { $useclass = 'filemarked'; } else { $useclass = 'file'; } $fd = new filedesc($f2->fname); if (WINDOWPLAYER && $fd->m3u) { $kpwjs = new kpwinjs(); $link = '" onclick="javascript: ' . $kpwjs->single($f2->sid) . ' return false;'; } else { $link = $f2->mklink(); } echo file_parse($f2, $link, $useclass); echo '</td></tr>'; }
function recv() { global $_SERVER; $ip = $_SERVER['REMOTE_ADDR']; # get data $type = g('type', 'pageview'); $uid = readSecureId(g('u', ''), "userid"); if ($uid == -1) { return; } $location = trim(g('l', '')); if (strlen($location) == 0) { return; } $referer = trim(g('r', '')); $width = gi('w', 0); $height = gi('h', 0); $historylen = gi('hl', 0); $agent = g('a', ''); $cookies = strtolower(trim(g('c', 'na'))); if ($cookies != 'na' && $cookies != 'y' && $cookies != 'n') { $cookies = 'na'; } # split domain info $url = parseurl($location); if ($url === false) { return; } $time = time(); $ispro = isPro($uid); $eventid = LOG_EVENT_PAGEVIEW; if ($type == 'adclick') { $eventid = LOG_EVENT_ADCLICK; } if (!$ispro && $eventid != LOG_EVENT_PAGEVIEW) { return; } # Log the visit. We assign a new event ID to every logged event. # Note that PHP running on 32 bit systems will overflow the ID soon # or later. $r = redisLink(); $logid = $r->incr("global:nextLogId"); $aux = array("time" => $time, "user_id" => $uid, "event_id" => $eventid, "location" => $location, "proto" => $url['proto'], "domain" => $url['domain'], "path" => $url['path'], "query" => $url['query'], "ref" => $referer, "swidth" => $width, "sheight" => $height, "cookies" => $cookies, "ip" => $ip, "agent" => $agent, "historylen" => $historylen, "id" => $logid); # Insert new $r->push("last:{$uid}", serialize($aux), false); # History length is different for PRO / non PRO user. $r->ltrim("last:{$uid}", 0, $ispro ? 1000 : 50); if ($eventid != LOG_EVENT_PAGEVIEW) { return; } # Update stats $nv = gi('nv', 0); $rv = gi('rv', 0); $t = time(); $t = $t - $t % (3600 * 24); # Update unique visits if ($nv) { $r->incr("day:uv:{$uid}:{$t}"); if ($rv) { $r->incr("day:rv:{$uid}:{$t}"); } } $r->incr("day:pv:{$uid}:{$t}"); }
} } else { if ($_POST['preview'] == "Preview") { ## Menyatukan code CSS, HTML dan JS dalam satu file $code = ''; ## Jika inputan CDN tidak kosong maka if (!empty($_POST['cdn_url'])) { $cdn = $_POST['cdn_url']; # Mendapatkan semua url CDN foreach ($cdn as $cdn_url) { ## Mengecek file extension di url CDN. if (parseurl($cdn_url) == 'css') { ## Jika file extension CDN == css maka $code .= '<link rel="stylesheet" href="' . $cdn_url . '">'; } else { if (parseurl($cdn_url) == 'js') { ## Jika file extension CDN == js maka $code .= '<script type="text/javascript" src="' . $cdn_url . '"></script>'; } } } } ## Memasukan code CSS yang ada di textarea kedalam <style> {CSS Code} </style> diatas code HTML if (!empty($_POST['css'])) { $code .= '<style>' . $_POST['css'] . '</style>'; } ## Memasukan code HTML yang ada di textarea dibawah code CSS dan diatas code JS if (!empty($_POST['html'])) { $code .= $_POST['html']; } ## Memasukan code JS yang ada di textarea kedalam <script> {JS Code} </script> dibawah code CSS dan HTML
public function verifyUrl() { global $config; $unsecuredpages = $config['unsecuredpages']; $tmpinarray = true; if (!isset($_SESSION[$this->securitytoken_coin])) { $_SESSION[$this->securitytoken_coin] = $this->securitytoken; } if (strtolower($unsecuredpages[0]) != "all") { $tmpinarray = in_array(parseurl()[0], $unsecuredpages); } if (strtoupper($_SERVER['REQUEST_METHOD']) == 'GET' && !$tmpinarray) { $this->cookietoken = session("securitytoken"); if (!(isset($this->urltoken, $this->cookietoken) && $this->urltoken == $this->cookietoken)) { die("[Security Guard] authentication problem (token missing) click <a href='" . BASEPATH . "'>here</a> to go home "); } } }
function discuzcode($message, $smileyoff, $bbcodeoff, $htmlon = 0, $allowsmilies = 1, $allowbbcode = 1, $allowimgcode = 1, $allowhtml = 0, $jammer = 0, $parsetype = '0', $authorid = '0', $allowmediacode = '0', $pid = 0, $lazyload = 0, $pdateline = 0, $first = 0) { global $_G; static $authorreplyexist; if ($pid && strpos($message, '[/password]') !== FALSE) { if ($authorid != $_G['uid'] && !$_G['forum']['ismoderator']) { $message = preg_replace_callback("/\\s?\\[password\\](.+?)\\[\\/password\\]\\s?/i", function ($matches) use($pid) { return parsepassword($matches[1], $pid); }, $message); if ($_G['forum_discuzcode']['passwordlock'][$pid]) { return ''; } } else { $message = preg_replace("/\\s?\\[password\\](.+?)\\[\\/password\\]\\s?/i", "", $message); $_G['forum_discuzcode']['passwordauthor'][$pid] = 1; } } if ($parsetype != 1 && !$bbcodeoff && $allowbbcode && (strpos($message, '[/code]') || strpos($message, '[/CODE]')) !== FALSE) { $message = preg_replace_callback("/\\s?\\[code\\](.+?)\\[\\/code\\]\\s?/is", function ($matches) { return codedisp($matches[1]); }, $message); } $msglower = strtolower($message); $htmlon = $htmlon && $allowhtml ? 1 : 0; if (!$htmlon) { $message = dhtmlspecialchars($message); } else { $message = preg_replace("/<script[^\\>]*?>(.*?)<\\/script>/i", '', $message); } if ($_G['setting']['plugins']['func'][HOOKTYPE]['discuzcode']) { $_G['discuzcodemessage'] =& $message; $param = func_get_args(); hookscript('discuzcode', 'global', 'funcs', array('param' => $param, 'caller' => 'discuzcode'), 'discuzcode'); } if (!$smileyoff && $allowsmilies) { $message = parsesmiles($message); } if ($_G['setting']['allowattachurl'] && strpos($msglower, 'attach://') !== FALSE) { $message = preg_replace_callback("/attach:\\/\\/(\\d+)\\.?(\\w*)/i", function ($matches) { return parseattachurl($matches[1], $matches[2], 1); }, $message); } if ($allowbbcode) { if (strpos($msglower, 'ed2k://') !== FALSE) { $message = preg_replace_callback("/ed2k:\\/\\/(.+?)\\//", function ($matches) { return parseed2k($matches[1]); }, $message); } } if (!$bbcodeoff && $allowbbcode) { if (strpos($msglower, '[/url]') !== FALSE) { $message = preg_replace_callback("/\\[url(=((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|thunder|qqdl|synacast){1}:\\/\\/|www\\.|mailto:)?([^\r\n\\[\"']+?))?\\](.+?)\\[\\/url\\]/is", function ($matches) { return parseurl($matches[1], $matches[5], $matches[2]); }, $message); } if (strpos($msglower, '[/email]') !== FALSE) { $message = preg_replace_callback("/\\[email(=([a-z0-9\\-_.+]+)@([a-z0-9\\-_]+[.][a-z0-9\\-_.]+))?\\](.+?)\\[\\/email\\]/is", function ($matches) { return parseemail($matches[1], $matches[4]); }, $message); } $nest = 0; while (strpos($msglower, '[table') !== FALSE && strpos($msglower, '[/table]') !== FALSE) { $message = preg_replace_callback("/\\[table(?:=(\\d{1,4}%?)(?:,([\\(\\)%,#\\w ]+))?)?\\]\\s*(.+?)\\s*\\[\\/table\\]/is", function ($matches) { return parsetable($matches[1], $matches[2], $matches[3]); }, $message); if (++$nest > 4) { break; } } $message = str_replace(array('[/color]', '[/backcolor]', '[/size]', '[/font]', '[/align]', '[b]', '[/b]', '[s]', '[/s]', '[hr]', '[/p]', '[i=s]', '[i]', '[/i]', '[u]', '[/u]', '[list]', '[list=1]', '[list=a]', '[list=A]', "\r\n[*]", '[*]', '[/list]', '[indent]', '[/indent]', '[/float]'), array('</font>', '</font>', '</font>', '</font>', '</div>', '<strong>', '</strong>', '<strike>', '</strike>', '<hr class="l" />', '</p>', '<i class="pstatus">', '<i>', '</i>', '<u>', '</u>', '<ul>', '<ul type="1" class="litype_1">', '<ul type="a" class="litype_2">', '<ul type="A" class="litype_3">', '<li>', '<li>', '</ul>', '<blockquote>', '</blockquote>', '</span>'), preg_replace(array("/\\[color=([#\\w]+?)\\]/i", "/\\[color=((rgb|rgba)\\([\\d\\s,]+?\\))\\]/i", "/\\[backcolor=([#\\w]+?)\\]/i", "/\\[backcolor=((rgb|rgba)\\([\\d\\s,]+?\\))\\]/i", "/\\[size=(\\d{1,2}?)\\]/i", "/\\[size=(\\d{1,2}(\\.\\d{1,2}+)?(px|pt)+?)\\]/i", "/\\[font=([^\\[\\<]+?)\\]/i", "/\\[align=(left|center|right)\\]/i", "/\\[p=(\\d{1,2}|null), (\\d{1,2}|null), (left|center|right)\\]/i", "/\\[float=left\\]/i", "/\\[float=right\\]/i"), array("<font color=\"\\1\">", "<font style=\"color:\\1\">", "<font style=\"background-color:\\1\">", "<font style=\"background-color:\\1\">", "<font size=\"\\1\">", "<font style=\"font-size:\\1\">", "<font face=\"\\1\">", "<div align=\"\\1\">", "<p style=\"line-height:\\1px;text-indent:\\2em;text-align:\\3\">", "<span style=\"float:left;margin-right:5px\">", "<span style=\"float:right;margin-left:5px\">"), $message)); if ($pid && !defined('IN_MOBILE')) { $message = preg_replace_callback("/\\s?\\[postbg\\]\\s*([^\\[\\<\r\n;'\"\\?\\(\\)]+?)\\s*\\[\\/postbg\\]\\s?/is", function ($matches) use($pid) { return parsepostbg($matches[1], $pid); }, $message); } else { $message = preg_replace("/\\s?\\[postbg\\]\\s*([^\\[\\<\r\n;'\"\\?\\(\\)]+?)\\s*\\[\\/postbg\\]\\s?/is", "", $message); } if ($parsetype != 1) { if (strpos($msglower, '[/quote]') !== FALSE) { $message = preg_replace("/\\s?\\[quote\\][\n\r]*(.+?)[\n\r]*\\[\\/quote\\]\\s?/is", tpl_quote(), $message); } if (strpos($msglower, '[/free]') !== FALSE) { $message = preg_replace("/\\s*\\[free\\][\n\r]*(.+?)[\n\r]*\\[\\/free\\]\\s*/is", tpl_free(), $message); } } if (!defined('IN_MOBILE')) { if (strpos($msglower, '[/media]') !== FALSE) { $message = preg_replace_callback("/\\[media=([\\w,]+)\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/media\\]/is", function ($matches) use($allowmediacode) { return $allowmediacode ? parsemedia($matches[1], $matches[2]) : bbcodeurl($matches[2], '<a href="{url}" target="_blank">{url}</a>'); }, $message); } if (strpos($msglower, '[/audio]') !== FALSE) { $message = preg_replace_callback("/\\[audio(=1)*\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/audio\\]/is", function ($matches) use($allowmediacode) { return $allowmediacode ? parseaudio($matches[2], 400) : bbcodeurl($matches[2], '<a href="{url}" target="_blank">{url}</a>'); }, $message); } if (strpos($msglower, '[/flash]') !== FALSE) { $message = preg_replace_callback("/\\[flash(=(\\d+),(\\d+))?\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/flash\\]/is", function ($matches) use($allowmediacode) { return $allowmediacode ? parseflash($matches[2], $matches[3], $matches[4]) : bbcodeurl($matches[4], '<a href="{url}" target="_blank">{url}</a>'); }, $message); } } else { if (strpos($msglower, '[/media]') !== FALSE) { $message = preg_replace("/\\[media=([\\w,]+)\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/media\\]/is", "[media]\\2[/media]", $message); } if (strpos($msglower, '[/audio]') !== FALSE) { $message = preg_replace("/\\[audio(=1)*\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/audio\\]/is", "[media]\\2[/media]", $message); } if (strpos($msglower, '[/flash]') !== FALSE) { $message = preg_replace("/\\[flash(=(\\d+),(\\d+))?\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/flash\\]/is", "[media]\\4[/media]", $message); } } if ($parsetype != 1 && $allowbbcode < 0 && isset($_G['cache']['bbcodes'][-$allowbbcode])) { $message = preg_replace($_G['cache']['bbcodes'][-$allowbbcode]['searcharray'], $_G['cache']['bbcodes'][-$allowbbcode]['replacearray'], $message); } if ($parsetype != 1 && strpos($msglower, '[/hide]') !== FALSE && $pid) { if ($_G['setting']['hideexpiration'] && $pdateline && (TIMESTAMP - $pdateline) / 86400 > $_G['setting']['hideexpiration']) { $message = preg_replace("/\\[hide[=]?(d\\d+)?[,]?(\\d+)?\\]\\s*(.*?)\\s*\\[\\/hide\\]/is", "\\3", $message); $msglower = strtolower($message); } if (strpos($msglower, '[hide=d') !== FALSE) { $message = preg_replace_callback("/\\[hide=(d\\d+)?[,]?(\\d+)?\\]\\s*(.*?)\\s*\\[\\/hide\\]/is", function ($matches) use($pdateline) { return expirehide($matches[1], $matches[2], $matches[3], $pdateline); }, $message); $msglower = strtolower($message); } if (strpos($msglower, '[hide]') !== FALSE) { if ($authorreplyexist === null) { if (!$_G['forum']['ismoderator']) { if ($_G['uid']) { $_post = C::t('forum_post')->fetch('tid:' . $_G['tid'], $pid); $authorreplyexist = $_post['tid'] == $_G['tid'] ? C::t('forum_post')->fetch_pid_by_tid_authorid($_G['tid'], $_G['uid']) : FALSE; } } else { $authorreplyexist = TRUE; } } if ($authorreplyexist) { $message = preg_replace("/\\[hide\\]\\s*(.*?)\\s*\\[\\/hide\\]/is", tpl_hide_reply(), $message); } else { $message = preg_replace("/\\[hide\\](.*?)\\[\\/hide\\]/is", tpl_hide_reply_hidden(), $message); $message = '<script type="text/javascript">replyreload += \',\' + ' . $pid . ';</script>' . $message; } } if (strpos($msglower, '[hide=') !== FALSE) { $message = preg_replace_callback("/\\[hide=(\\d+)\\]\\s*(.*?)\\s*\\[\\/hide\\]/is", function ($matches) use($pid, $authorid) { return creditshide($matches[1], $matches[2], $pid, $authorid); }, $message); } } } if (!$bbcodeoff) { if ($parsetype != 1 && strpos($msglower, '[swf]') !== FALSE) { $message = preg_replace_callback("/\\[swf\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/swf\\]/is", function ($matches) { return bbcodeurl($matches[1], ' <img src="' . STATICURL . 'image/filetype/flash.gif" align="absmiddle" alt="" /> <a href="{url}" target="_blank">Flash: {url}</a> '); }, $message); } if (defined('IN_MOBILE') && !defined('TPL_DEFAULT') && !defined('IN_MOBILE_API')) { $allowimgcode = false; } $attrsrc = !IS_ROBOT && $lazyload ? 'file' : 'src'; if (strpos($msglower, '[/img]') !== FALSE) { $patterns = array("/\\[img\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/is", "/\\[img=(\\d{1,4})[x|\\,](\\d{1,4})\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/is"); $callbacks = $allowimgcode ? array(function ($matches) use($lazyload, $pid) { return parseimg(0, 0, $matches[1], intval($lazyload), intval($pid), 'onmouseover="img_onmouseoverfunc(this)" ' . ($lazyload ? 'lazyloadthumb="1"' : 'onload="thumbImg(this)"')); }, function ($matches) use($lazyload, $pid) { return parseimg($matches[1], $matches[2], $matches[3], intval($lazyload), intval($pid)); }) : ($allowbbcode ? array(function ($matches) { return !defined('IN_MOBILE') ? bbcodeurl($matches[1], '<a href="{url}" target="_blank">{url}</a>') : bbcodeurl($matches[1], ''); }, function ($matches) { return !defined('IN_MOBILE') ? bbcodeurl($matches[3], '<a href="{url}" target="_blank">{url}</a>') : bbcodeurl($matches[3], ''); }) : array(function ($matches) { return bbcodeurl($matches[1], '{url}'); }, function ($matches) { return bbcodeurl($matches[3], '{url}'); })); foreach ($patterns as $key => $p) { $message = preg_replace_callback($p, $callbacks[$key], $message); } } } for ($i = 0; $i <= $_G['forum_discuzcode']['pcodecount']; $i++) { $message = str_replace("[\tDISCUZ_CODE_{$i}\t]", $_G['forum_discuzcode']['codehtml'][$i], $message); } unset($msglower); if ($jammer) { $message = preg_replace_callback("/\r\n|\n|\r/", "jammer", $message); } if ($first) { if (helper_access::check_module('group')) { $message = preg_replace("/\\[groupid=(\\d+)\\](.*)\\[\\/groupid\\]/i", lang('forum/template', 'fromgroup') . ': <a href="forum.php?mod=forumdisplay&fid=\\1" target="_blank">\\2</a>', $message); } else { $message = preg_replace("/(\\[groupid=\\d+\\].*\\[\\/groupid\\])/i", '', $message); } } return $htmlon ? $message : nl2br(str_replace(array("\t", ' ', ' '), array(' ', ' ', ' '), $message)); }
<?php /** * Stupid simple dispatcher */ $url = parseurl(); /** * Takes a url (or the current one) and "parses" it. Everything after * the first `/` is considered a param * * @param string $url * @return array */ function parseurl($url = null) { if (!$url) { $url = $_GET['url']; } $host = $_SERVER['HTTP_HOST']; $path = trim(str_replace($_GET['url'], '', $_SERVER['REQUEST_URI']), '/'); $parsed = parse_url($path); $url = explode('/', $_GET['url']); $url = array_filter($url); if (empty($url)) { $url = array('home'); } return array('base' => "http://{$host}/{$parsed['path']}", 'page' => $url[0], 'params' => array_slice($url, 1)); } /** * Quick redirect helper *
// && !get_magic_quotes_gpc() foreach ($form as $a => $b) { $form["{$a}"] = addslashes(trim($b)); } } /////////////////////////////////// // SOME SESSIONS AND VARS /////////////////////////////////// error_reporting(E_ERROR | E_WARNING | E_PARSE); session_name(swid); session_start(); $SID = session_id(); $session = "swid=" . session_id(); $session_form = "<input type=hidden name=\"swid\" value=\"" . session_id() . "\">"; $relativpath = $DOCUMENT_ROOT . "/"; $tmp = parseurl($httpurl, 0); $httphost = $tmp[host]; unset($tmp); /////////////////////////////////// // Classes /////////////////////////////////// $dir = dir("./classes"); while ($f = $dir->read()) { if (preg_match("#^class\\.#", $f)) { include "./classes/" . $f; } } /////////////////////////////////// // DECLARATIONS /////////////////////////////////// if (!$database) {
public function __construct() { log_message("info", "Bootstrap initialized"); global $config; global $url; global $model; $this->model = $model; $url = parseurl(); /* * Router function check */ if (file_exists($config['core'] . "Router.php") && file_exists($config['config'] . "Routers.php")) { require_once $config['core'] . "Router.php"; require_once $config['config'] . "Routers.php"; log_message("info", "Routers added"); } /* * Router ends */ if (file_exists($config['controller'] . $url[0] . '.php')) { $this->controller = $url[0]; } else { $this->controller = 'error'; } unset($url[0]); require_once $config['controller'] . $this->controller . '.php'; log_message("info", "{$this->controller} included"); $thispageurl = [$this->controller]; $this->controller = new $this->controller(); log_message("info", "controller object created"); if (isset($url[1])) { if (strtolower($url[1]) != "__construct") { if (!(method_exists($this->controller, $url[1]) && $this->parent_method_exists($this->controller, $url[1]))) { if (method_exists($this->controller, $url[1])) { $this->method = $url[1]; log_message("info", "{$this->method} exist in {controller} "); } } } else { log_message("info", "__construct may exist but not alloweded as controller/method "); } array_push($thispageurl, $this->method); unset($url[1]); } $url = array_filter($url); $thispageurl = array_merge($thispageurl, $url); $this->param = $url ? array_values($url) : []; $this->thispageurl = $thispageurl; /* * cache creation and handling */ if (false) { if (file_exists($config['core'] . 'MlCache.php')) { require_once $config['core'] . 'MlCache.php'; $cache = new MlCache($config['plugin'] . "mlcache/cache.php", $config['cache']); $cache->start($thispageurl, function () { global $start_time; //time calculation $end_time = microtime(true); $total_time = $end_time - $start_time; log_message("TIME", $total_time); }); } } $this->controller->{$this->method}($this->param); if (isset($cache)) { $cache->end(); } }
public function GetAidaImaginiPachete($operator) { File::cleanDirectory("Pachete/{$operator}"); $pachete = Pachete::all()->lists('PackID'); // dd($AidaImgPachet); foreach ($pachete as $pachet) { $AidaImgPachet = Soap::AidaSoap($operator, 'PackDetails', ['AIDA_PackDetailsRQ' => ['Package' => ['ID' => $pachet]]])->Package->Picture; if (@$AidaImgPachet->URL != null) { $numefisier = parseurl($AidaImgPachet->URL, 'url'); Image::make(file_get_contents($AidaImgPachet->URL))->save("Pachete/{$operator}/{$numefisier}"); Pachete::where('PackID', $pachet)->update(['Picture' => $numefisier]); } // dd($AidaImgPachet); } echo 'Actualizare finalizata cu success. Puteti inchide fereastra.'; }