function getSearchPath($locale = null) { if ($locale == '') { $help =& Help::getHelp(); $locale = $help->getLocale(); } return 'help' . DIRECTORY_SEPARATOR . $locale; }
function toc() { parent::validate(); HelpHandler::setupTemplate(); $templateMgr =& TemplateManager::getManager(); $help =& Help::getHelp(); $templateMgr->assign_by_ref('helpToc', $help->getTableOfContents()); $templateMgr->display('help/helpToc.tpl'); }
/** * Display help table of contents. * @param $args array * @param $request PKPRequest */ function toc($args, &$request) { $this->validate(); $this->setupTemplate(); $templateMgr =& TemplateManager::getManager(); import('classes.help.Help'); $help =& Help::getHelp(); $templateMgr->assign_by_ref('helpToc', $help->getTableOfContents()); $templateMgr->display('help/helpToc.tpl'); }
function &getMappingFile($tocId) { $help =& Help::getHelp(); $mappingFiles =& $help->getMappingFiles(); for ($i = 0; $i < count($mappingFiles); $i++) { // "foreach by reference" hack $mappingFile =& $mappingFiles[$i]; if ($mappingFile->containsToc($tocId)) { return $mappingFile; } unset($mappingFile); } $returner = null; return $returner; }
function _tocCacheMiss(&$cache, $id) { // Keep a secondary cache of the TOC so that a few // cache misses won't destroy the server $toc =& Registry::get('pkpHelpTocData', true, null); if ($toc === null) { $helpToc = array(); $topicId = 'index/topic/000000'; $help =& Help::getHelp(); $helpToc = $help->buildTopicSection($topicId); $toc =& $help->buildToc($helpToc); $cache->setEntireCache($toc); } return null; }
/** * Add help data for this plugin. * @param $locale string * @return boolean */ function addHelpData($locale = null) { if ($locale == '') { $locale = AppLocale::getLocale(); } import('help.Help'); $help =& Help::getHelp(); import('help.PluginHelpMappingFile'); $pluginHelpMapping = new PluginHelpMappingFile($this); $help->addMappingFile($pluginHelpMapping); return true; }
function _tocCacheMiss(&$cache, $id) { // Keep a secondary cache of the TOC so that a few // cache misses won't destroy the server static $toc; if (!isset($toc)) { $helpToc = array(); $topicId = 'index/topic/000000'; $help =& Help::getHelp(); $helpToc = $help->buildTopicSection($topicId); $toc =& $help->buildToc($helpToc); $cache->setEntireCache($toc); } return null; }
/** * Smarty usage: {help_topic key="(dir)*.page.topic" text="foo"} * * Custom Smarty function for creating anchor tags * @params $params array associative array * @params $smarty Smarty * @return anchor link to related help topic */ function smartyHelpTopic($params, &$smarty) { import('classes.help.Help'); $help =& Help::getHelp(); if (isset($params) && !empty($params)) { $translatedKey = isset($params['key']) ? $help->translate($params['key']) : $help->translate(''); $link = Request::url(null, 'help', 'view', explode('/', $translatedKey)); $text = isset($params['text']) ? $params['text'] : ''; return "<a href=\"{$link}\">{$text}</a>"; } }
//Save current page url into session for login/logout redirect............ well it does not work anyway! could be a SMF Bug. if (!strpos(currentUrl(), 'login') && !strpos(currentUrl(), 'logout') && !strpos(currentUrl(), 'includes') && !strpos(currentUrl(), 'styles') && !strpos(currentUrl(), 'img') && !strpos(currentUrl(), 'kb')) { $_SESSION['login_url'] = currentUrl(); $_SESSION['logout_url'] = currentUrl(); $_SESSION['old_url'] = currentUrl(); $_SESSION['redirect'] = currentUrl(); } $_SESSION['previous_page'] = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : $link['url']; // var_dump($_SESSION['redirect']); //Get user avatar or use the default avatar $user_avatar = $context['user']['avatar'] != null ? $context['user']['avatar']['href'] : $link['url'] . 'img/usersmall.jpg'; //Get the musicbee satble and beta release data $releaseData['stable'] = getVersionInfo(0, 'byCurrentVersion')[0]; $releaseData['beta'] = getVersionInfo(1, 'byCurrentVersion')[0]; //Contains EVERYTHING in single multidimensional array! DO NOT REMOVE IT! $mb = array('website' => array('ver' => '1.9.0', 'show_warning' => false, 'is_test' => false, 'github_link' => 'https://github.com/Avik-B/mb_web/'), 'charset' => 'UTF-8', 'user' => array('id' => $context['user']['id'], 'is_logged' => $context['user']['is_logged'], 'is_guest' => $context['user']['is_guest'], 'is_admin' => $context['user']['is_admin'], 'is_mod' => $context['user']['is_mod'], 'is_elite' => false, 'is_newbie' => false, 'rank_name' => null, 'need_approval' => true, 'can_mod' => $context['user']['can_mod'], 'username' => $context['user']['name'], 'email' => $context['user']['email'], 'name' => $context['user']['name'], 'messages' => $context['user']['messages'], 'unread_messages' => $context['user']['unread_messages'], 'avatar' => $user_avatar), 'session_var' => $context['session_var'], 'session_id' => $context['session_id'], 'current_time' => array('date' => date("F j, Y"), 'date_time' => date("F j, Y, g:i a")), 'main_menu' => array('dashboard' => array('title' => $lang['dashboard'], 'href' => $link['addon']['dashboard'], 'restriction' => 'login', 'sub_menu' => array()), 'member-panel' => array('title' => '<img src="' . $user_avatar . '" class="user_avatar">', 'href' => $link['forum'] . '?action=profile', 'restriction' => 'login', 'sub_menu' => array('user-profile' => array('title' => '' . sprintf($lang['hey_username'], $context['user']['name']) . '', 'href' => $link['forum'] . '?action=profile'), 'line1' => array('title' => $lang['line']), 'admin-panel' => array('title' => $lang['web_admin'], 'href' => $link['addon']['dashboard'] . '#admin_setting', 'icon' => $lang['20'], 'restriction' => 'admin'), 'forum-admin' => array('title' => $lang['forum_admin'], 'href' => $link['admin']['forum-panel'], 'icon' => $lang['21'], 'restriction' => 'admin'), 'line2' => array('title' => $lang['line']), 'sign-out' => array('title' => $lang['sign_out'], 'href' => $link['logout'], 'icon' => $lang['23']))), 'download' => array('title' => $lang['download'], 'href' => $link['download'], 'sub_menu' => array()), 'add-ons' => array('title' => $lang['addons'], 'href' => $link['addon']['home'], 'sub_menu' => array('1' => array('title' => $lang['skins'], 'href' => $link['addon']['home'] . "s/?type=1", 'icon' => $lang['24'], 'desc' => $lang['description_1'], 'id' => 1), '2' => array('title' => $lang['plugins'], 'href' => $link['addon']['home'] . "s/?type=2", 'icon' => $lang['25'], 'desc' => $lang['description_2'], 'id' => 2), '3' => array('title' => $lang['visualizer'], 'href' => $link['addon']['home'] . "s/?type=3", 'icon' => $lang['26'], 'desc' => $lang['description_3'], 'id' => 3), '4' => array('title' => $lang['theater_mode'], 'href' => $link['addon']['home'] . "s/?type=4", 'icon' => $lang['28'], 'desc' => $lang['description_5'], 'id' => 4), '5' => array('title' => $lang['misc'], 'href' => $link['addon']['home'] . "s/?type=5", 'icon' => $lang['29'], 'desc' => $lang['description_6'], 'id' => 5))), 'forum' => array('title' => $lang['forum'], 'href' => $link['forum'], 'sub_menu' => array()), 'help' => array('title' => $lang['help'], 'href' => $link['faq'], 'sub_menu' => array('faq' => array('title' => $lang['faq'], 'href' => $link['faq'], 'icon' => $lang['faq_icon']), 'api' => array('title' => $lang['dev_api'], 'href' => $link['api'], 'icon' => $lang['code_icon']), 'line2' => array('title' => $lang['line']), 'release-note' => array('title' => $lang['release-note'], 'href' => $link['release-note'], 'icon' => $lang['note_icon']), 'press' => array('title' => $lang['press'], 'href' => $link['press'], 'icon' => $lang['press_icon']), 'line3' => array('title' => $lang['line']), 'bug' => array('title' => $lang['report_bug'], 'href' => $link['bugreport'], 'icon' => $lang['bug_icon'], 'hide' => true), 'wiki' => array('title' => $lang['mb_wiki'], 'href' => $setting['wikiaLink'], 'icon' => $lang['wiki_icon'], 'target' => '_blank', 'hide' => true)))), 'musicbee_download' => array('stable' => array('appname' => isset($releaseData['stable']['appname']) ? $releaseData['stable']['appname'] : "NA", 'version' => isset($releaseData['stable']['version']) ? $releaseData['stable']['version'] : "NA", 'release_date' => isset($releaseData['stable']['release_date']) ? $releaseData['stable']['release_date'] : "NA", 'supported_os' => isset($releaseData['stable']['supported_os']) ? $releaseData['stable']['supported_os'] : "NA", 'download' => array('available' => isset($releaseData['stable']['available']) ? $releaseData['stable']['available'] : 0, 'installer' => array('link1' => isset($releaseData['stable']['DownloadLink']) ? $releaseData['stable']['DownloadLink'] : "NA", 'link2' => isset($releaseData['stable']['MirrorLink1']) ? $releaseData['stable']['MirrorLink1'] : null, 'link3' => isset($releaseData['stable']['MirrorLink2']) ? $releaseData['stable']['MirrorLink2'] : null), 'portable' => array('link1' => isset($releaseData['stable']['PortableLink']) ? $releaseData['stable']['PortableLink'] : "NA"))), 'beta' => array('appname' => isset($releaseData['beta']['appname']) ? $releaseData['beta']['appname'] : "NA", 'version' => isset($releaseData['beta']['version']) ? $releaseData['beta']['version'] : "NA", 'release_date' => isset($releaseData['beta']['release_date']) ? $releaseData['beta']['release_date'] : "NA", 'supported_os' => isset($releaseData['beta']['supported_os']) ? $releaseData['beta']['supported_os'] : "NA", 'download' => array('available' => isset($releaseData['beta']['available']) ? $releaseData['beta']['available'] : 0, 'link1' => isset($releaseData['beta']['DownloadLink']) ? $releaseData['beta']['DownloadLink'] : "NA"), 'message' => isset($releaseData['beta']['message']) ? $releaseData['beta']['message'] : null), 'patch' => getVersionInfo(2, 'byCurrentVersion')[0]), 'help' => Help::getHelp(), 'view_range' => array('addon_view_range' => 20, 'dashboard_all_view_range' => 20, 'release_all_view_range' => 20)); //var_dump($mb['musicbee_download']); /** * Maybe we don't wan't anyone except admin to see this, show error to anyone else. Or maybe * this is only available for logged in users. No guest is allowed kicked them to error page */ if (!$mb['user']['is_admin'] && !empty($admin_only)) { header('Location: ' . $link['kb'] . '?code=' . $errorCode['ADMIN_ACCESS']); } elseif (!$mb['user']['can_mod'] && !empty($mod_only)) { if (!empty($json_response)) { die('{"status": "0", "data": "' . $lang['dashboard_err_1'] . '"}'); } else { header('Location: ' . $link['kb'] . '?code=' . $errorCode['MOD_ACCESS']); } } elseif ($mb['user']['is_guest'] && !empty($no_guests)) { if (!empty($json_response)) {
/** * Returns a set of topics matching a specified keyword. * @param $keyword string * @return array matching HelpTopics */ function &getTopicsByKeyword($keyword) { $keyword = String::strtolower($keyword); $matchingTopics = array(); $help =& Help::getHelp(); foreach ($help->getSearchPaths() as $searchPath => $mappingFile) { $dir = opendir($searchPath); while (($file = readdir($dir)) !== false) { $currFile = $searchPath . DIRECTORY_SEPARATOR . $file; if (is_dir($currFile) && $file != 'toc' && $file != '.' && $file != '..') { HelpTopicDAO::searchDirectory($mappingFile, $matchingTopics, $keyword, $currFile); } } closedir($dir); } krsort($matchingTopics); $topics = array_values($matchingTopics); return $topics; }
/** * 返回审核公告栏信息 * @access public */ function audit() { $id = get_post_value('help_id'); $m = new Help(); $data = $m->getHelp($id); $this->assign('data', $data); }