function __construct($instance, $version) { if ($this->isVersionAllowed($version)) { $this->apiVersion = self::$wallabagVersions[$version]; } else { // Default API version: 1.x. $this->apiVersion = self::$wallabagVersions[1]; } $this->instanceUrl = add_trailing_slash($instance); }
function set_default($setting_key) { global $phpEx, $wpuAbs, $phpbb_root_path, $phpEx; require_once $phpbb_root_path . 'wp-united/wpu-helper-funcs.' . $phpEx; $server = add_http(add_trailing_slash($wpuAbs->config('server_name'))); $scriptPath = add_trailing_slash($wpuAbs->config('script_path')); $scriptPath = $scriptPath[0] == "/" ? substr($scriptPath, 1) : $scriptPath; $defaultBlogUri = $server . $scriptPath . "blog." . $phpEx; $defaults = array('blogsUri' => $defaultBlogUri, 'wpUri' => '', 'wpPath' => '', 'integrateLogin' => 0, 'permList' => $wpuAbs->ver == 'PHPBB3' ? '' : '<S:><C:><A:>PHPBB:[USER]<E:>PHPBB:[MOD]</:>PHPBB:[ADMIN]', 'showHdrFtr' => 'FWD', 'cssFirst' => 0, 'wpSimpleHdr' => 1, 'dtdSwitch' => 0, 'installLevel' => 0, 'usersOwnBlogs' => 0, 'buttonsProfile' => 0, 'buttonsPost' => 0, 'allowStyleSwitch' => 0, 'useBlogHome' => 0, 'blogListHead' => $wpuAbs->lang('WPWiz_BlogListHead_Default'), 'blogIntro' => $wpuAbs->lang('WPWiz_blogIntro_Default'), 'blogsPerPage' => 6, 'blUseCSS' => 1, 'charEncoding' => $wpuAbs->ver == 'PHPBB3' ? 'NO_CHANGE' : 'MATCH_WP', 'phpbbCensor' => 1, 'wpuVersion' => $wpuAbs->lang('WPU_Not_Installed'), 'wpPageName' => 'page.php', 'phpbbPadding' => $wpuAbs->ver == 'PHPBB3' ? '0-0-0-0' : '20-20-20-20', 'mustLogin' => 0, 'upgradeRun' => 0, 'xposting' => 0, 'phpbbSmilies' => 0, 'fixHeader' => 1, 'wpuAutolinkingXpost' => 0); return $defaults[$setting_key]; }
/** * Run Hook * * Runs a particular hook * * @access private * @param array the hook details * @return bool */ function _run_hook($data) { if (!is_array($data)) { return FALSE; } // ----------------------------------- // Safety - Prevents run-away loops // ----------------------------------- // If the script being called happens to have the same // hook call within it a loop can happen if ($this->in_progress == TRUE) { return; } // ----------------------------------- // Set file path // ----------------------------------- if (!isset($data['filepath']) or !isset($data['filename'])) { return FALSE; } // Using absolute filepath? if (substr($data['filepath'], 0, 1) == '/') { $filepath = add_trailing_slash($data['filepath']) . $data['filename']; } else { $filepath = FCPATH . APPPATH . add_trailing_slash($data['filepath']) . $data['filename']; } if (!file_exists($filepath)) { return FALSE; } // ----------------------------------- // Set class/function name // ----------------------------------- $class = FALSE; $function = FALSE; $params = ''; if (isset($data['class']) and $data['class'] != '') { $class = $data['class']; } if (isset($data['function'])) { $function = $data['function']; } if (isset($data['params'])) { $params = $data['params']; } if ($class === FALSE and $function === FALSE) { return FALSE; } // ----------------------------------- // Set the in_progress flag // ----------------------------------- $this->in_progress = TRUE; // ----------------------------------- // Call the requested class and/or function // ----------------------------------- if ($class !== FALSE) { if (!class_exists($class)) { require $filepath; } $HOOK = new $class(); $HOOK->{$function}($params); } else { if (!function_exists($function)) { require $filepath; } $function($params); } $this->in_progress = FALSE; return TRUE; }
/** * Process settings */ function wpu_process_settings() { global $wpUnited, $wpdb; $type = 'setup'; if (isset($_POST['type'])) { if ($_POST['type'] == 'wp-united-settings') { $type = 'settings'; } } $data = array(); /** * First process path to phpBB */ if (!isset($_POST['wpu-path'])) { die('[ERROR] ' . __("ERROR: You must specify a valid path for phpBB's config.php", 'wp-united')); } $wpuPhpbbPath = (string) $_POST['wpu-path']; $wpuPhpbbPath = str_replace('http:', '', $wpuPhpbbPath); $wpuPhpbbPath = add_trailing_slash($wpuPhpbbPath); if (!@file_exists($wpUnited->get_plugin_path())) { die('[ERROR] ' . __("ERROR:The path you selected for phpBB's config.php is not valid", 'wp-united')); return; } if (!@file_exists($wpuPhpbbPath . 'config.php')) { die('[ERROR] ' . __("ERROR: phpBB's config.php could not be found at the location you chose", 'wp-united')); return; } if ($type == 'setup') { $data['phpbb_path'] = $wpuPhpbbPath; } $wpUnited->update_settings($data); if ($type == 'settings') { /** * Process 'use forum page' */ $data['useForumPage'] = isset($_POST['wpuforumpage']) ? 1 : 0; $forum_page_ID = get_option('wpu_set_forum'); if (!empty($data['useForumPage'])) { $content = '<!--wp-united-phpbb-forum-->'; $title = __('Forum', 'wp-united'); if (!empty($forum_page_ID)) { // we no longer reset title & date $wpdb->query("UPDATE IGNORE {$wpdb->posts} SET\n\t\t\t\t\t\tpost_author = '0',\n\t\t\t\t\t\tpost_content = '{$content}',\n\t\t\t\t\t\tpost_content_filtered = '',\n\t\t\t\t\t\tpost_excerpt = '',\n\t\t\t\t\t\tpost_status = 'publish',\n\t\t\t\t\t\tpost_type = 'page',\n\t\t\t\t\t\tcomment_status = 'closed',\n\t\t\t\t\t\tping_status = 'closed',\n\t\t\t\t\t\tpost_password = '',\n\t\t\t\t\t\tpost_name = 'forum',\n\t\t\t\t\t\tto_ping = '',\n\t\t\t\t\t\tpinged = '',\n\t\t\t\t\t\tpost_modified = '" . current_time('mysql') . "',\n\t\t\t\t\t\tpost_modified_gmt = '" . current_time('mysql', 1) . "',\n\t\t\t\t\t\tpost_parent = '0',\n\t\t\t\t\t\tmenu_order = '0'\n\t\t\t\t\t\tWHERE ID = {$forum_page_ID}"); } else { $wpdb->query("INSERT IGNORE INTO {$wpdb->posts}\n\t\t\t\t\t\t(post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t('0', '" . current_time('mysql') . "', '" . current_time('mysql', 1) . "', '{$content}', '', '{$title}', '', 'publish', 'page', 'closed', 'closed', '', 'forum', '', '', '" . current_time('mysql') . "', '" . current_time('mysql', 1) . "', '0', '0', '')"); $forum_page_ID = $wpdb->insert_id; } update_option('wpu_set_forum', $forum_page_ID); } else { if (!empty($forum_page_ID)) { update_option('wpu_set_forum', ''); @wp_delete_post($forum_page_ID); } } /** * Process login integration settings */ $data['integrateLogin'] = isset($_POST['wpuloginint']) && !defined('WPU_CANNOT_OVERRIDE') ? 1 : 0; if ($data['integrateLogin']) { $data['integcreatewp'] = isset($_POST['wpucreatewacct']) ? 1 : 0; $data['integcreatephpbb'] = isset($_POST['wpucreatepacct']) ? 1 : 0; $data['avatarsync'] = isset($_POST['wpuavatar']) ? 1 : 0; $data['xposting'] = isset($_POST['wpuxpost']) ? 1 : 0; if ($data['xposting']) { $xpostType = !isset($_POST['rad_xpost_type']) ? 'excerpt' : $_POST['rad_xpost_type']; if ($xpostType == 'askme') { $data['xposttype'] = 'askme'; } else { if ($xpostType == 'fullpost') { $data['xposttype'] = 'fullpost'; } else { $data['xposttype'] = 'excerpt'; } } $data['xpostautolink'] = isset($_POST['wpuxpostcomments']) ? 1 : 0; if ($data['xpostautolink']) { // xPostSpam could be 'yes', 'no' or 'all' $xPostSpam = !isset($_POST['rad_xpostcomappr']) ? 'all' : (string) $_POST['rad_xpostcomappr']; if ($xPostSpam == 'no') { $data['xpostspam'] = 0; } else { if ($xPostSpam == 'yes') { $data['xpostspam'] = 1; } else { $data['xpostspam'] = 'all'; } } } $data['xpostforce'] = isset($_POST['wpuxpostforce']) ? (int) $_POST['wpuxpostforce'] : -1; $data['xpostprefix'] = isset($_POST['wpuxpostprefix']) ? (string) $_POST['wpuxpostprefix'] : __('[BLOG] ', 'wp-united'); } else { //cross-posting disabled, set to default $data = array_merge($data, array('xposttype' => 'excerpt', 'wpuxpostcomments' => 0, 'xpostforce' => -1, 'xpostautolink' => 0, 'xpostspam' => 'all')); } } else { // logins not integrated, set to default $data = array_merge($data, array('integcreatewp' => 1, 'integcreatephpbb' => 1, 'avatarsync' => 1, 'xposting' => 0, 'xposttype' => 'excerpt', 'wpuxpostcomments' => 0, 'xpostforce' => -1, 'xpostautolink' => 0, 'xpostspam' => 'all', 'xpostprefix' => __('[BLOG] ', 'wp-united'))); } /** * Process 'theme integration' settings */ $tplInt = isset($_POST['wputplint']) ? 1 : 0; if ($tplInt) { $tplDir = isset($_POST['rad_tpl']) ? (string) $_POST['rad_tpl'] : 'fwd'; if ($tplDir == 'rev') { $data['showHdrFtr'] = 'REV'; } else { $data['showHdrFtr'] = 'FWD'; } $cssmLevel = isset($_POST['wpucssmlevel']) ? (int) $_POST['wpucssmlevel'] : 2; switch ($cssmLevel) { case 0: $data['cssMagic'] = 0; $data['templateVoodoo'] = 0; break; case 1: $data['cssMagic'] = 1; $data['templateVoodoo'] = 0; break; default: $data['cssMagic'] = 1; $data['templateVoodoo'] = 1; } $simpleHeader = isset($_POST['wpuhdrftrspl']) ? $_POST['wpuhdrftrspl'] : 0; // set defaults $data['wpSimpleHdr'] = 1; $data['wpPageName'] = 'page.php'; if (!empty($simpleHeader)) { // we would check for existence of the file, but TEMPLATEPATH isn't initialised here yet. $data['wpSimpleHdr'] = 0; $data['wpPageName'] = $simpleHeader; } $padT = isset($_POST['wpupadtop']) ? $_POST['wpupadtop'] : ''; $padR = isset($_POST['wpupadright']) ? $_POST['wpupadright'] : ''; $padB = isset($_POST['wpupadbtm']) ? $_POST['wpupadbtm'] : ''; $padL = isset($_POST['wpupadleft']) ? $_POST['wpupadleft'] : ''; if ($padT == '' && $padR == '' && $padB == '' && $padL == '') { $data['phpbbPadding'] = 'NOT_SET'; } else { $data['phpbbPadding'] = (int) $padT . '-' . (int) $padR . '-' . (int) $padB . '-' . (int) $padL; } $data['dtdSwitch'] = isset($_POST['wpudtd']) ? 1 : 0; } else { $data = array_merge($data, array('showHdrFtr' => 'NONE', 'cssMagic' => 0, 'templateVoodoo' => 0, 'wpSimpleHdr' => 1, 'wpPageName' => 'page.php', 'phpbbPadding' => '6-12-6-12', 'dtdSwitch' => 0)); } /** * Process 'behaviour' settings */ $data = array_merge($data, array('phpbbCensor' => isset($_POST['wpucensor']) ? 1 : 0, 'phpbbSmilies' => isset($_POST['wpusmilies']) ? 1 : 0)); } $wpUnited->update_settings($data); }
public function get_board_url() { global $config; if (empty($this->url)) { $fStateChanged = $this->foreground(); $config['force_server_vars'] = 1; $this->url = add_trailing_slash(generate_board_url()); $this->restore_state($fStateChanged); } return $this->url; }
/** * Modify links in header to stylesheets to use CSS Magic instead * @param string $headerInfo The snipped head of the page (By reference) * @param mixed $position Set to "inner" if we are processing HEAD of the application that is destined * for the inner portion of the page (defaults to "outer") * @return array an array of stylesheet links and modifications */ function wpu_get_stylesheet_links($headerInfo, $position = 'outer') { global $phpbb_root_path, $wpUnited, $phpbbForum; $wpuCache = WPU_Cache::getInstance(); $package = $position == 'outer' ? $wpUnited->get_outer_package() : $wpUnited->get_inner_package(); $pkg = 'pkg=' . $package; $pos = "pos=" . $position; $pathHere = dirname($_SERVER['SCRIPT_FILENAME']); if (!empty($pathHere)) { $pathHere = add_trailing_slash($pathHere); } // grep all styles preg_match_all('/<link[^>]*?href=[\'"][^>]*?(style\\.php\\?|\\.css)[^>]*?\\/>/i', $headerInfo, $matches); preg_match_all('/@import url\\([^\\)]+?\\)/i', $headerInfo, $matches2); preg_match_all('/@import "[^"]+?"/i', $headerInfo, $matches3); $matches = array_merge($matches[0], $matches2[0], $matches3[0]); $links = array(); $repl = array(); $keys = array(); if (is_array($matches)) { foreach ($matches as $match) { // ignore wp-united resets, css magic & widget islands $ignores = array('usecssm=1', 'island=1', 'wp-united/theme/'); foreach ($ignores as $ignore) { if (strstr($match, $ignore) !== false) { continue 2; } } // extract css location $and = '&'; if (stristr($match, "@import url") !== false) { // import URL $el = str_replace(array("@import", "(", "url", ")", " ", "'", '"'), "", $match); } elseif (stristr($match, "@import") !== false) { // import $el = str_replace(array("@import", "(", ")", " ", "'", '"'), "", $match); } else { // link href -- xxx.css or style.php /** * Need to extract the stylesheet name, by extracting from between 'href =' and ('|"| ) * Bearing in mind that there could be an = in the stylesheet name */ $els = explode("href", $match); // split around href, RHS will get ="xxxx" foo="bar" $els = explode('=', $els[1]); // could also split = in stylesheet URL .. array_shift($els); // so ditch start and rejoin $els = implode('=', $els); // elements of a stylesheet tag could be delimited by ",' or ' ', in that order of likelihood: $delimChars = array('"', "'", ' '); foreach ($delimChars as $delimChar) { if (strpos($els, $delimChar) !== FALSE) { $els = explode($delimChar, $els); break; } } $el = str_replace($delimChars, "", $els[1]); $and = '&'; } $tv = $position == 'inner' && $wpUnited->get_setting('templateVoodoo') ? "{$and}tv=" : ''; if (stristr($el, ".css") !== false) { /** * We need to ensure the stylesheet maps to a real file on disk as fopen_url will not work on most * servers. * We try various methods to find the file */ // Absolute path to CSS, in phpBB if (stristr($el, $phpbbForum->get_board_url()) !== false) { $cssLnk = str_replace($phpbbForum->get_board_url(), $wpUnited->get_setting('phpbb_path'), $el); // Absolute path to CSS, in WordPress } elseif (stristr($el, $wpUnited->get_wp_base_url()) !== false) { $cssLnk = str_replace($wpUnited->get_wp_base_url(), $wpUnited->get_wp_path(), $el); } elseif (substr($el, 0, 1) === '/') { // An absolute path to doc root. Doc root could be different for phpBB & WP. if ($package == 'wp') { $cssLnk = $wpUnited->get_wp_doc_root() . $el; } else { global $config; $path = str_replace($config['script_path'], '', $wpUnited->get_setting('phpbb_path')); $cssLnk = $path . $el; } } else { // else: relative path to here $cssLnk = $pathHere . $el; } // remove query vars $cssLnk = explode('?', $cssLnk); $cssLnk = $cssLnk[0]; $cssLnk = str_replace('//', '/', $cssLnk); $cssLnk = stristr(PHP_OS, "WIN") ? str_replace("/", "\\", $cssLnk) : $cssLnk; $cssLnk = @realpath($cssLnk); if (stristr($cssLnk, 'http:') === false && stristr($cssLnk, 'https:') === false && @file_exists($cssLnk)) { $links[] = $el; $key = $wpuCache->issue_style_key($cssLnk, $position); $keys[] = $key; $repl[] = "{$phpbbForum->get_board_url()}wp-united/style-fixer.php?usecssm=1{$and}style={$key}{$and}{$pos}{$and}{$pkg}{$tv}"; } } elseif (stristr($el, "style.php?") !== false) { /** * phpBB style.php css */ // standardise the path to style.php, so that cache can be used properly if (stristr($el, $phpbbForum->get_board_url()) !== false) { $cssLnk = str_replace($phpbbForum->get_board_url(), $wpUnited->get_setting('phpbb_path'), $el); } else { $cssLnk = $pathHere . $el; } $cssLnk = @realpath($cssLnk); $links[] = $el; $key = $wpuCache->issue_style_key($cssLnk, $position); $keys[] = $key; $repl[] = "{$el}{$and}usecssm=1{$and}{$pos}{$and}cloc={$key}{$and}{$pkg}{$tv}"; } } } return array('links' => $links, 'keys' => $keys, 'replacements' => $repl); }
} # TODO: clean out functions.inc.php include_once 'lib/core/functions.inc.php'; # parse the url for the folders $uri = call_user_func(function ($t) { return array('path' => $t[0], 'query' => $t[1]); }, explode('?', $_SERVER['REQUEST_URI'])); # check if quick serve $check_paths = array(array('path' => null, 'is_file' => true), array('path' => '/index.html'), array('path' => '/index.htm')); foreach ($check_paths as $p) { $path = $uri['path'] . $p['path']; if (!file_exists_incpath($path, $p['is_file'])) { continue; } if (!$p['is_file']) { add_trailing_slash(); $_SERVER['REQUEST_URI'] = '/' . $path; } if (substr($path, -4) == '.php' && substr($path, 0, 6) != 'pages/') { # if serving a php file not in pages/ $_SERVER['REQUEST_URI'] = $path; include substr($path, 1); } else { # serve file with correct mime-type include 'lib/core/quick-serve/file.php'; } exit; } $path = null; ########################################################################################## # if we got this far we are serving a page #
function mainPage_show() { global $wpuAbs, $phpEx, $ignorePrompt, $phpbb_root_path; $this->page_title = 'ACP_WPU_INDEX_TITLE'; $this->tpl_name = 'acp_wp_united'; //get integration package settings $wpSettings = $this->get_settings_set_defaults(); //The captions and order of the buttons on the page changes depending on if the package has been installed prior if ($wpSettings['installLevel'] < 10) { //not yet installed. Recommend wizard. $introAdd = $wpuAbs->lang('WP_Main_IntroFirst'); $button1Title = $wpuAbs->lang('WP_Wizard_Title'); $button1Explain = $wpuAbs->lang('WP_Wizard_ExplainFirst'); $button1Value = $wpuAbs->lang('WP_SubmitWiz'); $button2Title = $wpuAbs->lang('WP_Detailed_Title'); $button2Explain = $wpuAbs->lang('WP_Detailed_ExplainFirst'); $button2Value = $wpuAbs->lang('WP_SubmitDet'); $recommended = $wpuAbs->lang('WP_Recommended'); $mode1 = 'wizard'; $mode2 = 'detailed'; } else { // installed. Show settings page first. $introAdd = $wpuAbs->lang('WP_Main_IntroAdd'); $button1Title = $wpuAbs->lang('WP_Detailed_Title'); $button1Explain = $wpuAbs->lang('WP_Detailed_Explain'); $button1Value = $wpuAbs->lang('WP_SubmitDet'); $button2Title = $wpuAbs->lang('WP_Wizard_Title'); $button2Explain = $wpuAbs->lang('WP_Wizard_Explain'); $button2Value = $wpuAbs->lang('WP_SubmitWiz'); $mode1 = 'detailed'; $mode2 = 'wizard'; $recommended = ""; } // set the page section to show $passBlockVars = array('switch_main_page' => array()); //If this is an upgrade, and that upgrade requires an install script, throw up a message if ($wpSettings['wpuVersion'] != $wpuAbs->lang('WPU_Default_Version')) { //clear the phpBB cache global $cache; $cache->purge(); $ver = $wpuAbs->lang('WPU_Not_Installed'); if ($wpSettings['upgradeRun'] == 1 && $wpSettings['installLevel'] >= 5 && !$ignorePrompt) { $passBlockVars['switch_main_page.switch_upgrade_warning'] = array('L_WP_UPGRADE_TITLE' => $wpuAbs->lang('WPU_Must_Upgrade_Title'), 'L_WP_UPGRADE_EXPLAIN1' => sprintf($wpuAbs->lang('WPU_Must_Upgrade_Explain1'), '<a href="' . append_sid('wpu_usermap.' . $phpEx) . '" title="upgrade script" style="color: #fff;">', '</a>'), 'L_WP_UPGRADE_EXPLAIN2' => sprintf($wpuAbs->lang('WPU_Must_Upgrade_Explain2'), '<a href="' . append_sid('admin_wordpress.' . $phpEx . '?ignore=1') . '" title="ignore this prompt" style="color: #fff;">', '</a>')); } } else { $ver = $wpSettings['wpuVersion']; } // pass strings $passVars = array('L_WPMAIN_TITLE' => $wpuAbs->lang('WP_Main_Title'), 'L_WPMAIN_INTRO' => $wpuAbs->lang('WP_Main_Intro'), 'L_WPMAIN_INTROADD' => $introAdd, 'S_WPMAIN_ACTION' => append_sid("index.{$phpEx}?i=wp_united"), 'L_WPMAIN_TH' => $wpuAbs->lang('WordPress_Integration'), 'L_WPB1_TITLE' => $button1Title, 'L_RECOMMENDED' => $recommended, 'L_WPB1_EXPLAIN' => $button1Explain, 'L_SUBMITB1' => $button1Value, 'L_WPB2_TITLE' => $button2Title, 'L_WPB2_EXPLAIN' => $button2Explain, 'L_SUBMITB2' => $button2Value, 'S_MODE_1' => $mode1, 'S_MODE_2' => $mode2, 'L_PAYPAL_TITLE' => $wpuAbs->lang('WP_Support'), 'L_PAYPAL_EXPLAIN' => $wpuAbs->lang('WP_Support_Explain'), 'L_WP_VERSION' => sprintf($wpuAbs->lang('WP_Version_Text'), $ver)); //show user mapping link, if package is handling WP logins if (!empty($wpSettings['integrateLogin']) && !empty($wpSettings['wpUri'])) { $mapLink = append_sid('wpu_usermap.' . $phpEx); $passBlockVars['switch_main_page.switch_show_wpmap'] = array('L_MAPLINK_EXPLAIN' => $wpuAbs->lang('WP_MapLink_Explain'), 'U_MAPLINK' => append_sid("index.{$phpEx}?i=wp_united"), 'L_MAPLINK_TITLE' => $wpuAbs->lang('WP_MapLink_Title'), 'L_MAPLINK' => $wpuAbs->lang('WP_MapLink')); } //Check that wp-united/cache is writable if (!is_writable(add_trailing_slash($phpbb_root_path) . "wp-united/cache/")) { $passBlockVars['switch_main_page.switch_cache_unwritable'] = array('L_CACHE_UNWRITABLE' => $wpuAbs->lang('WPU_Cache_Unwritable')); } //Check that wpu-install has been deleted if (file_exists(add_trailing_slash($phpbb_root_path) . "wpu-install." . $phpEx)) { $passBlockVars['switch_main_page.switch_install_file_exists'] = array('L_INSTALL_EXISTS' => $wpuAbs->lang('WPU_Install_Exists')); } //show the page $this->showPage($passVars, $passBlockVars); }
$wpuNoHead = false; $latest = false; if (isset($HTTP_GET_VARS['latest'])) { $latest = true; // run in latest posts mode, for showing latest posts on portal page, etc. $wpuNoHead = true; } // number of posts to show on portal page in latest posts mode if (isset($HTTP_GET_VARS['numposts'])) { $postsToShow = (int) $HTTP_GET_VARS['numposts']; $postsToShow = $postsToShow > 10 ? 10 : $postsToShow; $postsToShow = $postsToShow < 1 ? 3 : $postsToShow; } // These will be useful later on $server = add_http(add_trailing_slash($wpuAbs->config('server_name'))); $scriptPath = add_trailing_slash($wpuAbs->config('script_path')); $scriptPath = $scriptPath[0] == "/" ? substr($scriptPath, 1) : $scriptPath; $scriptPath = $server . $scriptPath; // set some strings for the blogs home page. This needs to be moved out. if ($phpbb_logged_in) { if ($wpuAbs->userdata('user_wpublog_id')) { $wpuGetBlog = $wpSettings['usersOwnBlogs'] ? $wpuAbs->lang('add_to_blog') : $wpuAbs->lang('go_wp_admin'); $wpuGetBlogIntro = $wpuAbs->lang('blog_intro_add'); } else { $wpuGetBlog = $wpSettings['usersOwnBlogs'] ? $wpuAbs->lang('get_blog') : $wpuAbs->lang('go_wp_admin'); $wpuGetBlogIntro = $wpuAbs->lang('blog_intro_get'); } } else { $wpuGetBlogIntro = $wpSettings['usersOwnBlogs'] ? $wpuAbs->lang('blog_intro_loginreg_ownblogs') : $wpuAbs->lang('blog_intro_loginreg'); } // WP-query screws up the path when we have a single trailing slash in pathinfo.. so remove it:
without specific prior written permission of Edward Eliot. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Last Updated: 7th January 2007 */ /***************************************************************/ define('CACHE_PATH', add_trailing_slash(sys_get_temp_dir())); class PhpCache { var $sFile; var $sFileLock; var $iCacheTime; var $oCacheObject; function PhpCache($sKey, $iCacheTime) { $this->sFile = CACHE_PATH . md5($sKey) . ".txt"; $this->sFileLock = "{$this->sFile}.lock"; $iCacheTime >= 10 ? $this->iCacheTime = $iCacheTime : ($this->iCacheTime = 10); } function Check() { if (file_exists($this->sFileLock)) {
function getbaseurl($baseurl = '') { $baseurl = 'http://' . $_SERVER['HTTP_HOST'] . str_replace('/' . basename(dirname($_SERVER['REQUEST_URI'])), '', dirname($_SERVER['REQUEST_URI'])); return add_trailing_slash($baseurl); }
function wpu_done_head() { global $wpu_done_head, $wpSettings, $scriptPath, $wp_the_query; $wpu_done_head = true; if (defined('WPU_DEBUG') && WPU_DEBUG == TRUE) { if (!$GLOBALS['wpUtdInt']->debugBufferFull) { $GLOBALS['wpUtdInt']->lDebug('', 1); } echo $GLOBALS['wpUtdInt']->debugBuffer; } //add the frontpage stylesheet, if needed: if (!empty($wpSettings['blUseCSS']) && !empty($wpSettings['useBlogHome'])) { echo '<link rel="stylesheet" href="' . add_trailing_slash($scriptPath) . 'wp-united/theme/wpu-blogs-homepage.css" type="text/css" media="screen" />'; } if (defined('WPU_REVERSE_INTEGRATION') && $wpSettings['cssFirst'] == 'W') { echo '[--PHPBB*HEAD--]'; } }
/** * Get the filesystem directory path (with trailing slash) for the plugin __FILE__ passed in. * * @since 6.2.0 * * @param string $filename * The filename of the plugin (__FILE__). * @return string The filesystem path of the directory that contains the plugin. */ public function plugin_dir_path($filename) { return add_trailing_slash(dirname($filename)); }
function wpu_login_user_info($titleLoggedIn, $titleLoggedOut, $loginForm, $rankBlock, $newPosts, $write, $admin, $position, $before_title, $after_title) { global $user, $db, $scriptPath, $wpSettings, $auth, $wpuAbs, $phpbb_sid, $wpSettings, $phpEx; if ($wpuAbs->ver == 'PHPBB2') { echo "Not phpBB2 compatible."; return false; } $wpu_usr = get_wpu_phpbb_username(); if (!empty($user->data['is_registered'])) { echo $before_title . $titleLoggedIn . $after_title; //style for position sidebar/header $style = $position == "sidebar" ? 'display:block; margin:0 5px;' : 'float:left; display:inline; margin:0 5px;'; if ($position == "sidebar") { echo '<p style="' . $style . '" class="wpu_username"><a href="' . add_trailing_slash($scriptPath) . 'ucp.php?i=164"><strong>' . $wpu_usr . '</strong></a></p>'; echo '<p style="' . $style . '" class="wpu_avatar"><img src="' . get_avatar_reader() . '" alt="' . __(avatar) . '" /></p>'; } else { echo '<p style="' . $style . '" class="wpu_avatar"><img src="' . get_avatar_reader() . '" alt="' . __(avatar) . '" /></p>'; echo '<p style="' . $style . '" class="wpu_username"><a href="' . add_trailing_slash($scriptPath) . 'ucp.php?i=164"><strong>' . $wpu_usr . '</strong></a></p>'; } if ($rankBlock) { wpu_phpbb_rankblock(); } if ($newPosts) { echo '<p class="wpu_newposts">'; wpu_newposts_link(); echo '</p> '; } // Handle new PMs if ($user->data['user_new_privmsg']) { $l_message_new = $user->data['user_new_privmsg'] == 1 ? $wpuAbs->lang('NEW_PM') : $wpuAbs->lang('NEW_PMS'); $l_privmsgs_text = sprintf($l_message_new, $user->data['user_new_privmsg']); echo '<p class="wpu_pm"><a title="' . $l_privmsgs_text . '" href="' . add_trailing_slash($scriptPath) . 'ucp.php?i=pm&folder=inbox">' . $l_privmsgs_text . '</a></p>'; } else { $l_privmsgs_text = $wpuAbs->lang('NO_NEW_PM'); $s_privmsg_new = false; echo '<p class="wpu_pm"><a title="' . $l_privmsgs_text . '" href="' . add_trailing_slash($scriptPath) . 'ucp.php?i=pm&folder=inbox">' . $l_privmsgs_text . '</a></p>'; } if ($write) { if (current_user_can('publish_posts')) { echo '<p class="wpu_write"><a href="' . $wpSettings['wpUri'] . 'wp-admin/post-new.php" title="' . __('Write a Post') . '">' . __('Write a Post') . '</a></p> '; } } if ($admin) { $connSettings = get_settings('wputd_connection'); if (current_user_can('publish_posts')) { echo '<p class="wpu_siteadmin"><a href="' . $wpSettings['wpUri'] . 'wp-admin/" title="Admin Site">' . __('Dashboard') . '</a></p> '; } if ($auth->acl_get('a_')) { echo '<p class="wpu_forumadmin"><a href="' . $scriptPath . 'adm/index.php?' . $phpbb_sid . '" title="Admin Forum">' . $wpuAbs->lang('ACP') . '</a></p>'; } } echo '<p class="wpu_logout">'; wp_loginout(); echo '</p> '; } else { echo $before_title . $titleLoggedOut . $after_title; if ($loginForm) { $login_link = $wpuAbs->ver == 'PHPBB2' ? 'login.' . $phpEx . '?redirect=wp-united-blog&sid=' . $phpbb_sid : 'ucp.' . $phpEx . '?mode=login&sid=' . $phpbb_sid . '&redirect=http://' . $_SERVER['SERVER_NAME'] . '' . attribute_escape($_SERVER["REQUEST_URI"]); echo '<form method="post" action="' . add_trailing_slash($scriptPath) . $login_link . '">'; echo '<p class="wpu_user"><label for="phpbb_username">' . $wpuAbs->lang('USERNAME') . '</label> <input tabindex="1" class="inputbox autowidth" type="text" name="username" id="phpbb_username"/></p>'; echo '<p class="wpu_password"><label for="phpbb_password">' . $wpuAbs->lang('PASSWORD') . '</label> <input tabindex="2" class="inputbox autowidth" type="password" name="password" id="phpbb_password" maxlength="32" /></p>'; if ($wpuAbs->config('allow_autologin')) { echo '<p class="wpu_remember"><input tabindex="3" type="checkbox" id="phpbb_autologin" name="autologin" /><label for="phpbb_autologin"> ' . $wpuAbs->lang('LOG_ME_IN') . '</label> </p>'; } echo '<p class="wpu_login"><input type="submit" name="login" class="button1" value="' . $wpuAbs->lang('LOGIN') . '" /></p>'; echo '<p class="wpu_signup"><a href="' . append_sid(add_trailing_slash($scriptPath) . "ucp.php?mode=register") . '">' . $wpuAbs->lang('REGISTER') . '</a></p>'; echo '<p class="wpu_rempassword"><a href="' . append_sid(add_trailing_slash($scriptPath)) . 'ucp.php?mode=sendpassword">' . $wpuAbs->lang('FORGOT_PASS') . '</a></p>'; echo '</form>'; } else { echo '<p class="wpu_logout">'; wp_loginout(); echo '</p> '; } } if ($position == "header") { echo '<p style="clear:both;"></p>'; } }
/** * Returns a link to the user's phpBB profile without displaying it * @param int $wpID the WordPress ID, leave blank for currently logged-in user */ function get_wpu_phpbb_profile_link($wpID = false) { global $phpbbForum, $wpUnited, $phpEx; if (!$wpUnited->is_working()) { return false; } if ($wpID == false) { if (!$phpbbForum->user_logged_in()) { return false; } else { $phpbbID = $phpbbForum->get_userdata('user_id'); } } else { if (!$wpUnited->get_setting('integrateLogin')) { return false; } else { $phpbbID = wpu_get_integrated_phpbbuser($wpID); } } if ($phpbbID) { $profile_path = "memberlist.{$phpEx}"; return add_trailing_slash($phpbbForum->get_board_url()) . "{$profile_path}?mode=viewprofile&u={$phpbbID}"; } return false; }