public function testExecute() { $instance = new Help(''); $session = new \Pry\Session(__FILE__); ob_start(); $status = $instance->execute($session); $actual = ob_get_contents(); ob_end_clean(); $this->assertTrue($status); $expected = implode(PHP_EOL, [' clear Clears the screen (Ctrl-L) ', ' help Displays command help ', ' show-classes Displays all declared classes ', ' show-constants Displays all defined constants ', ' show-functions Displays all user defined functions ', ' show-vars Displays all defined variables ', ' quit Quits pry (Ctrl-D) ', ' trace Displays the call stack trace ', ' whereami Displays the inspected code ', '']); $this->assertEquals($expected, $actual); }
public static function fromArray($data) { $settings = new RoleSettings(); foreach ($data as $key => $value) { if (property_exists(get_class($settings), $key)) { if (is_array($value)) { if ($key == "transactions") { $settings->{$key} = Transactions::fromArray($value); } if ($key == "reports") { $settings->{$key} = Reports::fromArray($value); } if ($key == "help") { $settings->{$key} = Help::fromArray($value); } if ($key == "mobileVTAccess") { $settings->{$key} = MobileVTAcces::fromArray($value); } if ($key == "admin") { $settings->{$key} = Admin::fromArray($value); } if ($key == "customer") { $settings->{$key} = Customers::fromArray($value); } if ($key == "webPosAccess") { $settings->{$key} = WebPosAccess::fromArray($value); } } else { $settings->{$key} = $value; } } } return $settings; }
/** * 注册方法 * 完成数据的插入 * @return boolean whether register is successful */ public function register() { //将已经验证成功的数据插入数据库 if (!$this->hasErrors()) { $user = new Users(); $user->username = $this->username; $user->email = $this->email; $user->salt = Help::fetchSalt(); $user->password = md5(md5($this->password) . $user->salt); $user->reg_ip = Yii::app()->request->userHostAddress; $user->last_ip = Yii::app()->request->userHostAddress; $user->reg_time = time(); $user->last_login = time(); if (!$user->save()) { return false; } } //实行登入操作 if ($this->_identity === null) { $this->_identity = new UserIdentity($this->email, $this->password); $this->_identity->authenticate(); } if ($this->_identity->errorCode === UserIdentity::ERROR_NONE) { Yii::app()->user->login($this->_identity); return true; } else { return false; } }
/** * Return an instance of the Help class * * Use this for generating or retrieving instance of Help * objects so that if the Help class needs to be abstracted * in the future, this common interface can still be used * * @return object New instance of Help class if one doesnt * already exist. Otherwise return the current instance */ static function getInstance() { if (empty(self::$instance)) { self::$instance = new Help(); } return self::$instance; }
function getSearchPath($locale = null) { if ($locale == '') { $help =& Help::getHelp(); $locale = $help->getLocale(); } return 'help' . DIRECTORY_SEPARATOR . $locale; }
/** * Constructor * @since Version 3.5 * @param int $id */ public function __construct($id = false) { parent::__construct(); if ($id) { $this->id = $id; $this->fetch(); } }
public function __construct($cache = false, $cacheLiftime = 3600) { global $USER, $ADMIN, $FORETAG, $urlHandler, $security, $adressbok, $urlChecker, $db, $sajtDelarObj; $this->template_dir = ROOT . '/templates'; $this->compile_dir = ROOT . '/templates_c'; $this->config_dir = ROOT . '/php/libs/smarty/configs'; $this->cache_dir = ROOT . '/php/libs/smarty/cache'; // Visar t.ex. trunkomera.se ist�llet f�r MotioMera, om s� �r fallet. if ($_SERVER['HTTP_HOST'] != 'motiomera.se') { $this->assign("pagename", ucfirst($_SERVER['HTTP_HOST'])); } else { $this->assign("pagename", "MotioMera"); } if (defined('DEBUG_SMARTY') && DEBUG_SMARTY) { $this->assign('debugSmarty', true); } //$this->assign("pagename", "MotioMera"); $this->assign("microtime", Misc::get_milliseconds(true)); $this->assign("_GET", $_GET); $this->assign("_POST", $_POST); $this->assign("_SERVER", $_SERVER); $this->assign("urlHandler", $urlHandler); $this->assign("sajtDelarObj", $sajtDelarObj); $this->assign("urlChecker", $urlChecker); $this->assign("security", $security); $this->assign("GOOGLEMAPS_APIKEY", GOOGLEMAPS_APIKEY); $this->assign("DEBUG", DEBUG); $this->contentCacheLifetime = $cacheLiftime; $this->compile_check = true; //the rss flow from mabra.com $file = ROOT . "/files/rsscache/motiofeed.txt"; $fh = fopen($file, "r") or die("cant open file"); $smotiofeed = file_get_contents($file); fclose($fh); $rss = unserialize($smotiofeed); $this->assign("rss", $rss); if ($cache) { $this->caching = 2; } else { $this->caching = false; } $this->assign("BROWSER", Medlem::getCurrentBrowserVersion(true)); $helpers = Help::listByPage($_SERVER['PHP_SELF']); $this->assign("helpers", $helpers); $this->assign('currentPage', Misc::getCurrentPage()); if ($USER) { $this->assign("USER", $USER); $this->assign("adressbok", $adressbok); } if ($ADMIN) { $this->assign("ADMIN", $ADMIN); $this->assign("inAdmin", true); } if ($FORETAG) { $this->assign("FORETAG", $FORETAG); } $this->register_function('stegToKm', array('Steg', 'stegToKm')); }
private static function getTopics() { if (self::$topics !== null) { return self::$topics; } // we need this in function as function calls are not allowed in static properties self::$topics = array('main' => array('title' => ev_gettext('Help Topics'), 'parent' => ''), 'report' => array('title' => ev_gettext('Reporting Issues'), 'parent' => 'main'), 'report_category' => array('title' => ev_gettext('Category Field'), 'parent' => 'report'), 'report_priority' => array('title' => ev_gettext('Priority Field'), 'parent' => 'report'), 'report_assignment' => array('title' => ev_gettext('Assignment Field'), 'parent' => 'report'), 'report_release' => array('title' => ev_gettext('Scheduled Release Field'), 'parent' => 'report'), 'report_summary' => array('title' => ev_gettext('Summary Field'), 'parent' => 'report'), 'report_description' => array('title' => ev_gettext('Description Field'), 'parent' => 'report'), 'report_estimated_dev_time' => array('title' => ev_gettext('Estimated Development Time Field'), 'parent' => 'report'), 'scm_integration' => array('title' => ev_gettext('SCM Integration'), 'parent' => 'main'), 'scm_integration_usage' => array('title' => ev_gettext('Usage Examples'), 'parent' => 'scm_integration'), 'scm_integration_installation' => array('title' => ev_gettext('Installation Instructions'), 'parent' => 'scm_integration'), 'list' => array('title' => ev_gettext('Listing / Searching for Issues'), 'parent' => 'main'), 'adv_search' => array('title' => ev_gettext('Advanced Search / Creating Custom Queries'), 'parent' => 'main'), 'support_emails' => array('title' => ev_gettext('Associate Emails'), 'parent' => 'main'), 'preferences' => array('title' => ev_gettext('Account Preferences'), 'parent' => 'main'), 'notifications' => array('title' => ev_gettext('Email Notifications'), 'parent' => 'main'), 'view' => array('title' => ev_gettext('Viewing Issues'), 'parent' => 'main'), 'email_blocking' => array('title' => ev_gettext('Email Blocking'), 'parent' => 'main'), 'link_filters' => array('title' => ev_gettext('Link Filters'), 'parent' => 'main'), 'field_display' => array('title' => ev_gettext('Edit Fields to Display'), 'parent' => 'main'), 'column_display' => array('title' => ev_gettext('Edit Columns to Display'), 'parent' => 'main'), 'customize_listing' => array('title' => ev_gettext('Customize Issue Listing Screen'), 'parent' => 'main'), 'segregate_reporter' => array('title' => ev_gettext('Segregate Reporters'), 'parent' => 'main'), 'permission_levels' => array('title' => ev_gettext('User Permission Levels'), 'parent' => 'main')); return self::$topics; }
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'); }
/** * 更改账户信息 */ public function actionCheckAccount() { //var_dump($_POST); //exit(); if (!Yii::app()->request->isPostRequest) { $this->error('一定是你的提交方式不对'); } $data = array(); if (!isset($_POST['username']) || !isset($_POST['sex']) || !isset($_POST['email'])) { $this->error('相关字段不能为空'); } $data['username'] = $_POST['username']; $data['sex'] = $_POST['sex']; $data['mobile'] = $_POST['mobile']; //判断用户名是否已经存在 if (Users::model()->exists('uid <> :uid AND username=:username', array(':uid' => Yii::app()->user->id, ':username' => $data['username']))) { $this->error('用户名已经存在'); return; } //判断是否需要改密码 if ($_POST['old_password'] != '' && $_POST['re_password'] != '' && $_POST['password'] != '') { //密码长度不能小于4 if (strlen($_POST['password']) < 4) { $this->error('密码长度不能小于4'); } //判断两次密码输入是否正确 if ($_POST['password'] != $_POST['re_password']) { $this->error('两次密码输入不相同'); } //判断初始密码是否正确 $user = Users::model()->find('uid=? AND password=MD5(CONCAT(MD5(?),`salt`))', array(Yii::app()->user->id, $_POST['old_password'])); if (!$user) { $this->error('初始密码输入不正确!'); } //可以更新密码 $data['salt'] = Help::fetchSalt(); $data['password'] = md5(md5(trim($_POST['password'])) . $data['salt']); } //头像更新 //更新头像 $image = Help::uploadAvatar(Yii::app()->user->id, 'avatar'); if ($image) { $data['avatar_file'] = $image; //更新头像session // } if (false !== Users::model()->updateByPk(Yii::app()->user->id, $data)) { //更新 userInfo 信息 $user = Users::model()->findByPk(Yii::app()->user->id); Yii::app()->user->setState('userInfo', $user); $this->success('更新成功'); } }
/** * Answer a component with help text * * @return Component * @access public * @since 3/4/08 */ public function getMessage() { ob_start(); print "<p>"; print _("On this screen you can choose to import your Segue 1 sites into Segue 2."); print " " . _("This process will not change or delete your Segue 1 site."); print " " . _("You can only import sites into empty placeholders."); print "</p>"; print "<p>"; print str_replace('%1', Help::link('Copy Sites'), _("If you import a segue1 site more than once, redirects from old links will point at the most recent import of that site. If you wish to maintain old links and duplicate a site, import it once and then use the 'copy site' (%1) in the portal to make additional copies.")); print "</p>"; return new Block(ob_get_clean(), STANDARD_BLOCK); }
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 sendchatmsg($data) { $need = array('msg'); $ec = 1; $odata = 0; if (!Fun::isAllSet($need, $data)) { $ec = -9; } else { if ($data["msg"] != "") { if (!($_SESSION["chatthid"] > 0)) { $_SESSION["chatthid"] = Sqle::insertVal("chattingthread", array("ip" => $_SERVER['REMOTE_ADDR'], "time" => time(), "uid" => User::loginId(), "isclosed" => "f")); } $odata = array("msgid" => Help::sendchatmsg($data["msg"], $_SESSION["chatthid"])); } } return array('ec' => $ec, 'data' => $odata); }
/** Delete a help topic * @access public * @return void */ public function deleteAction() { if ($this->_request->isPost()) { $id = (int) $this->_request->getPost('id'); $del = $this->_request->getPost('del'); if ($del == 'Yes' && $id > 0) { $where = 'id = ' . $id; $this->_help->delete($where); $this->getFlash()->addMessage('Record deleted!'); } $this->redirect('/admin/help/'); } else { $id = (int) $this->_request->getParam('id'); if ($id > 0) { $this->view->content = $this->_help->fetchRow('id=' . $id); } } }
public function execute(array $args, array $options = array()) { if (empty($args)) { $formater = new TextFormater(array('quote' => ' * ')); $this->writeln('Available commands:', Colors::BLACK | Colors::BOLD); foreach ($this->console->getCommands() as $name => $fqdn) { if ($fqdn !== __CLASS__) { $this->writeln($formater->format($name)); } } $scriptName = basename($_SERVER['SCRIPT_FILENAME']); $this->writeln("Use './{$scriptName} help command' for more info"); } else { $commandFQDN = $this->console->getCommand($args[0]); $help = Help::fromFQDN($commandFQDN, Utils::get($args, 1)); $this->writeln($help); } }
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; }
<?php $keyhelp = Help::loadById(29); $urlHandler = new UrlHandler(); //$campaignCodes = Order::getCampaignCodes("foretag"); ?> <h3>Tilläggsbeställning</h3> <p> Här kan du anmäla fler deltagare till tävlingen. Vi skickar ut nya stegräknare och deltagarbrev så fort vi hinner. Glöm inte att lägga in de nya deltagarna i rätt lag efter att de har aktiverat sina MotioMera-konton. </p> <br/> <form action="<?php echo $urlHandler->getUrl(Order, URL_SEND); ?> " method="post"> <input type="hidden" name="typ" value="foretag_tillagg"> <input type="hidden" name="fid" value="<?php echo $foretag->getId(); ?> "> <table border="0" cellpadding="0" cellspacing="0" class="motiomera_form_table" > <tr> <td></td> <td>Antal deltagare</td> <td></td>
} } } $this->Template->rows = $rows; } // Add an explanation if (isset($arrData['explanation'])) { $this->loadLanguageFile('explain'); $key = $arrData['explanation']; if (!is_array($GLOBALS['TL_LANG']['XPL'][$key])) { $this->Template->explanation = trim($GLOBALS['TL_LANG']['XPL'][$key]); } else { $this->Template->rows = $GLOBALS['TL_LANG']['XPL'][$key]; } } $this->Template->theme = $this->getTheme(); $this->Template->base = Environment::get('base'); $this->Template->language = $GLOBALS['TL_LANGUAGE']; $this->Template->title = specialchars($GLOBALS['TL_LANG']['MSC']['helpWizardTitle']); $this->Template->charset = $GLOBALS['TL_CONFIG']['characterSet']; $this->Template->headline = $arrData['label'][0] ?: $field; $this->Template->helpWizard = $GLOBALS['TL_LANG']['MSC']['helpWizard']; $GLOBALS['TL_CONFIG']['debugMode'] = false; $this->Template->output(); } } /** * Instantiate the controller */ $objHelp = new Help(); $objHelp->run();
/** * Answer a string of controls html to go along with this folder. In many cases * it will be empty, but some implementations may need controls for adding new slots. * * @return string * @access public * @since 4/1/08 */ public function getControlsHtml() { $message = ''; try { $this->createNewSlotIfRequested(); } catch (OperationFailedException $e) { $message = $e->getMessage(); } // Form if (PersonalSlot::hasPersonal()) { ob_start(); $harmoni = Harmoni::instance(); $authN = Services::getService("AuthN"); $harmoni->request->startNamespace('personal_slot'); $url = $harmoni->request->quickURL(); print "<div style='float: left;'>"; print "<strong>" . _("Create a new site") . " <span style='font-size: smaller;'>(" . Help::link('Portal') . ")</span>:</strong><br/>"; print "<span style='font-size: smaller;'>" . _("1. Chose a name for the placeholder of your new site. <br/>2. Create a new site in that placeholder.") . "</span>"; print "</div>"; print "<div style='float: right;'>"; print "\n<form class='add_slot_form' method='post' action='{$url}'>"; print "<div style='text-align: center;'>" . _("Placeholder Name:") . "</div>"; print PersonalSlot::getPersonalShortname($authN->getFirstUserId()); print "-"; print "\n\t<input type='text' name='" . RequestContext::name('slot_postfix') . "' value='' size='10'/>"; print "\n\t<input type='submit' value='" . _('Create') . "'/>"; if (strlen($message)) { print "\n\t<div class='error'>" . $message . "</div>"; } print "\n</form>\n"; print "\n\t</div>"; print "\n\t<div class='no_float_spacer'>"; $harmoni->request->endNamespace(); return ob_get_clean(); } }
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>"; } }
/** * Method used to get all of the navigation links related to a * specific help topic. * * @access public * @param string $topic The topic title * @return array The list of navigation links */ function getNavigationLinks($topic) { global $topics; $links = array(); $links[] = @array("topic" => "", "title" => $topics[$topic]["title"]); while ($parent = Help::getParent($topic)) { $links[] = array("topic" => $parent["topic"], "title" => $parent["title"]); $topic = $parent["topic"]; } $links = array_reverse($links); return $links; }
} if ($show == 'index') { require HORDE_TEMPLATES . '/help/index.inc'; } else { require HORDE_TEMPLATES . '/common-header.inc'; if ($show == 'menu') { require HORDE_TEMPLATES . '/help/menu.inc'; } elseif ($show == 'about') { require $fileroot . '/lib/version.php'; eval('$version = "' . ucfirst($module) . ' " . ' . String::upper($module) . '_VERSION;'); $credits = Util::bufferOutput('include', $fileroot . '/docs/CREDITS'); $credits = String::convertCharset($credits, 'iso-8859-1', NLS::getCharset()); require HORDE_TEMPLATES . '/help/about.inc'; } else { require HORDE_TEMPLATES . '/help/header.inc'; $help = new Help(HELP_SOURCE_FILE, array($help_file, $help_file_fallback)); if ($show == 'entry' && !empty($topic)) { $help->lookup($topic); $help->display(); } else { $topics = $help->topics(); foreach ($topics as $id => $title) { $link = Horde::url($registry->getParam('webroot', 'horde') . '/services/help/'); $link = Util::addParameter($link, array('show' => 'entry', 'module' => $module, 'topic' => $id)); echo Horde::link($link, '', 'helpitem'); echo $title . "</a><br />\n"; } } $help->cleanup(); require HORDE_TEMPLATES . '/help/footer.inc'; }
/** * Returns the item name for the specified type and code. * @param string the item code (corresponding to the 'code' column value) * @param string the item name ('title' or 'content'). * @return string the value for the specified the type and code. False is returned if the item type or code does not exist. */ public static function item($code, $name, $edit = false) { if (!isset(self::$_item)) { self::loadItems($code, $name); } $item = isset(self::$_items[$code][$name]) ? self::$_items[$code][$name] : null; if ($item && $edit) { $item = $item . ' ' . Help::model()->buildEditLink(self::$_items[$code]['id']); } return $item; }
<?php require_once $_SERVER["DOCUMENT_ROOT"] . "/php/init.php"; $smarty = new PopSmarty(); $id = $_GET["id"]; $texteditor = Help::loadById($id); $smarty->assign("texteditor", $texteditor); $smarty->display('help.tpl');
$layout_pref = array(); } // Store the apps we need to load stylesheets for. $cssApps = array(); foreach ($layout_pref as $row) { foreach ($row as $item) { if (is_array($item) && !in_array($item['app'], $cssApps)) { $cssApps[] = $item['app']; } } } $title = _("My Portal"); $cssApp = 'app[]=' . implode(ini_get('arg_separator.output') . 'app[]=', $cssApps); require HORDE_TEMPLATES . '/common-header.inc'; require HORDE_TEMPLATES . '/portal/menu.inc'; Help::javascript(); $notification->notify(array('listeners' => 'status')); require HORDE_TEMPLATES . '/portal/header.inc'; $covered = array(); foreach ($layout_pref as $row_num => $row) { $width = floor(100 / count($row)); echo "<tr>\n"; foreach ($row as $col_num => $item) { if (isset($covered[$row_num]) && isset($covered[$row_num][$col_num])) { continue; } if (is_array($item)) { $block = $registry->callByPackage($item['app'], 'block', $item['params']); if (is_a($block, 'Horde_Block')) { if (isset($item['height'])) { $block->setHeight($item['height']);
} if (!empty($_POST["tema"])) { $texteditor->setTema($_POST["tema"]); } if (!empty($_POST["texten"])) { $texteditor->setTexten($_POST["texten"]); } $texteditor->commit(); } $urlHandler->redirect("TextEditor", URL_ADMIN_EDIT, $texteditor->getId()); break; case "help": if (empty($_GET["id"])) { $help = new Help($_POST["namn"], $_POST["tema"], $_POST["sida"], $_POST["auto"], $_POST["sizeX"], $_POST["sizeY"]); } else { $help = Help::loadById($_GET["id"]); if (!empty($_POST["namn"])) { $help->setNamn($_POST["namn"]); } if (!empty($_POST["tema"])) { $help->setTema($_POST["tema"]); } if (!empty($_POST["texten"])) { $help->setTexten($_POST["texten"]); } if (!empty($_POST["sida"])) { $help->setPage($_POST["sida"]); } if (!empty($_POST["auto"])) { $help->setAuto($_POST["auto"]); }
<?php session_name('nessquik'); session_start(); // Used for including files if (!defined("_ABSPATH")) { define("_ABSPATH", dirname(dirname(__FILE__))); } require_once _ABSPATH . '/confs/config-inc.php'; require_once _ABSPATH . '/lib/Smarty.php'; require_once _ABSPATH . '/lib/functions.php'; require_once _ABSPATH . '/lib/Help.php'; $db = nessquikDB::getInstance(); $sa = resultsDB::getInstance(); $_hlp = Help::getInstance(); $tpl = SmartyTemplate::getInstance(); $tpl->template_dir = _ABSPATH . '/templates/'; $tpl->compile_dir = _ABSPATH . '/templates_c/'; if ($_POST) { $action = import_var('action', 'P'); } else { $action = import_var('action', 'G'); switch ($action) { case "make_report": continue; default: exit; } } switch ($action) { case "show_help_categories":