本文整理汇总了PHP中strrpos函数的典型用法代码示例。如果您正苦于以下问题:PHP strrpos函数的具体用法?PHP strrpos怎么用?PHP strrpos使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strrpos函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: openfire_authenticate
function openfire_authenticate($user, $username, $password)
{
global $openfire;
$openfire->of_logInfo("openfire_authenticate 1 " . $username . " " . $password);
if (!openfire_wants_to_login()) {
return new WP_Error('user_logged_out', sprintf(__('You are now logged out of Azure AD.', AADSSO), $username));
}
// Don't re-authenticate if already authenticated
if (strrpos($username, "@") == false || is_a($user, 'WP_User')) {
return $user;
}
$openfire->of_logInfo("openfire_authenticate 2 ");
// Try to find an existing user in WP where the UPN of the current AAD user is
// (depending on config) the 'login' or 'email' field
if ($username && $password && $openfire->of_authenticate_365($username, $password)) {
$user = get_user_by("email", $username);
if (!is_a($user, 'WP_User')) {
$openfire->of_logInfo("openfire_authenticate 3");
// Since the user was authenticated with AAD, but not found in WordPress,
// need to decide whether to create a new user in WP on-the-fly, or to stop here.
$openfire->of_logInfo("openfire_authenticate 4");
$paras = explode("@", $username);
$userid = $paras[0] . "." . $paras[1];
$new_user_id = wp_create_user($userid, $password, $username);
$user = new WP_User($new_user_id);
$user->set_role('subscriber');
$first_name = $openfire->of_get_given_name();
$last_name = $openfire->get_family_name();
$display_name = $first_name . " " . $last_name;
wp_update_user(array('ID' => $new_user_id, 'display_name' => $display_name, 'first_name' => $first_name, 'last_name' => $last_name));
}
}
return $user;
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:34,代码来源:ofsocial.php
示例2: sanitize_uri
function sanitize_uri()
{
global $PATH_INFO, $SCRIPT_NAME, $REQUEST_URI;
if (isset($PATH_INFO) && $PATH_INFO != "") {
$SCRIPT_NAME = $PATH_INFO;
$REQUEST_URI = "";
}
if ($REQUEST_URI == "") {
//necessary for some IIS installations (CGI in particular)
$get = httpallget();
if (count($get) > 0) {
$REQUEST_URI = $SCRIPT_NAME . "?";
reset($get);
$i = 0;
while (list($key, $val) = each($get)) {
if ($i > 0) {
$REQUEST_URI .= "&";
}
$REQUEST_URI .= "{$key}=" . URLEncode($val);
$i++;
}
} else {
$REQUEST_URI = $SCRIPT_NAME;
}
$_SERVER['REQUEST_URI'] = $REQUEST_URI;
}
$SCRIPT_NAME = substr($SCRIPT_NAME, strrpos($SCRIPT_NAME, "/") + 1);
if (strpos($REQUEST_URI, "?")) {
$REQUEST_URI = $SCRIPT_NAME . substr($REQUEST_URI, strpos($REQUEST_URI, "?"));
} else {
$REQUEST_URI = $SCRIPT_NAME;
}
}
开发者ID:stephenKise,项目名称:Legend-of-the-Green-Dragon,代码行数:33,代码来源:php_generic_environment.php
示例3: process
/**
* Processes this test, when one of its tokens is encountered.
*
* @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
* @param int $stackPtr The position of the current token in the
* stack passed in $tokens.
*
* @return void
*/
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();
// Make sure this is the first PHP open tag so we don't process
// the same file twice.
$prevOpenTag = $phpcsFile->findPrevious(T_OPEN_TAG, $stackPtr - 1);
if ($prevOpenTag !== false) {
return;
}
$fileName = $phpcsFile->getFileName();
$extension = substr($fileName, strrpos($fileName, '.'));
$nextClass = $phpcsFile->findNext(array(T_CLASS, T_INTERFACE), $stackPtr);
if ($extension === '.php') {
if ($nextClass !== false) {
$error = '%s found in ".php" file; use ".inc" extension instead';
$data = array(ucfirst($tokens[$nextClass]['content']));
$phpcsFile->addError($error, $stackPtr, 'ClassFound', $data);
}
} else {
if ($extension === '.inc') {
if ($nextClass === false) {
$error = 'No interface or class found in ".inc" file; use ".php" extension instead';
$phpcsFile->addError($error, $stackPtr, 'NoClass');
}
}
}
}
开发者ID:CobaltBlueDW,项目名称:oddsandends,代码行数:36,代码来源:FileExtensionSniff.php
示例4: __set
public function __set($strName, $mixValue)
{
switch ($strName) {
case "HtmlIncludeFilePath":
// Passed-in value is null -- use the "default" path name of file".tpl.php"
if (!$mixValue) {
$strPath = realpath(substr(QApplication::$ScriptFilename, 0, strrpos(QApplication::$ScriptFilename, '.php')) . '.tpl.php');
} else {
$strPath = realpath($mixValue);
}
// Verify File Exists, and if not, throw exception
if (is_file($strPath)) {
$this->strHtmlIncludeFilePath = $strPath;
return $strPath;
} else {
throw new QCallerException('Accompanying HTML Include File does not exist: "' . $mixValue . '"');
}
break;
case "CssClass":
try {
return $this->strCssClass = QType::Cast($mixValue, QType::String);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
default:
try {
return parent::__set($strName, $mixValue);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
}
}
开发者ID:kmcelhinney,项目名称:qcodo,代码行数:34,代码来源:QFormBase.class.php
示例5: packageDoc
/** Constructor
*
* @param str name
* @param RootDoc root
*/
function packageDoc($name, &$root)
{
$this->_name = $name;
$this->_root =& $root;
$phpdoctor =& $root->phpdoctor();
// parse overview file
$packageCommentDir = $phpdoctor->getOption('packageCommentDir');
$packageCommentFilename = strtolower(str_replace('/', '.', $this->_name)) . '.html';
if (isset($packageCommentDir) && is_file($packageCommentDir . $packageCommentFilename)) {
$overviewFile = $packageCommentDir . $packageCommentFilename;
} else {
$pos = strrpos(str_replace('\\', '/', $phpdoctor->_currentFilename), '/');
if ($pos !== FALSE) {
$overviewFile = substr($phpdoctor->_currentFilename, 0, $pos) . '/package.html';
} else {
$overviewFile = $phpdoctor->sourcePath() . $this->_name . '.html';
}
}
if (is_file($overviewFile)) {
$phpdoctor->message("\n" . 'Reading package overview file "' . $overviewFile . '".');
if ($html = $this->getHTMLContents($overviewFile)) {
$this->_data = $phpdoctor->processDocComment('/** ' . $html . ' */', $this->_root);
$this->mergeData();
}
}
}
开发者ID:hobodave,项目名称:phpdoctor,代码行数:31,代码来源:packageDoc.php
示例6: generateClass
/**
* Generate Class
*
* @param string $className
* @return string
* @throws \Magento\Framework\Exception
* @throws \InvalidArgumentException
*/
public function generateClass($className)
{
// check if source class a generated entity
$entity = null;
$entityName = null;
foreach ($this->_generatedEntities as $entityType => $generatorClass) {
$entitySuffix = ucfirst($entityType);
// if $className string ends on $entitySuffix substring
if (strrpos($className, $entitySuffix) === strlen($className) - strlen($entitySuffix)) {
$entity = $entityType;
$entityName = rtrim(substr($className, 0, -1 * strlen($entitySuffix)), \Magento\Framework\Autoload\IncludePath::NS_SEPARATOR);
break;
}
}
if (!$entity || !$entityName) {
return self::GENERATION_ERROR;
}
// check if file already exists
$autoloader = $this->_autoloader;
if ($autoloader::getFile($className)) {
return self::GENERATION_SKIP;
}
if (!isset($this->_generatedEntities[$entity])) {
throw new \InvalidArgumentException('Unknown generation entity.');
}
$generatorClass = $this->_generatedEntities[$entity];
$generator = new $generatorClass($entityName, $className, $this->_ioObject);
if (!$generator->generate()) {
$errors = $generator->getErrors();
throw new \Magento\Framework\Exception(implode(' ', $errors));
}
return self::GENERATION_SUCCESS;
}
开发者ID:Mohitsahu123,项目名称:mtf,代码行数:41,代码来源:Generator.php
示例7: render
/**
* Render method
*
* @throws Exception
* @return string
*/
public function render()
{
$sources = $this->getSourcesFromArgument();
if (0 === count($sources)) {
throw new Exception('No audio sources provided.', 1359382189);
}
foreach ($sources as $source) {
if (TRUE === is_string($source)) {
if (FALSE !== strpos($source, '//')) {
$src = $source;
$type = substr($source, strrpos($source, '.') + 1);
} else {
$src = substr(GeneralUtility::getFileAbsFileName($source), strlen(PATH_site));
$type = pathinfo($src, PATHINFO_EXTENSION);
}
} elseif (TRUE === is_array($source)) {
if (FALSE === isset($source['src'])) {
throw new Exception('Missing value for "src" in sources array.', 1359381250);
}
$src = $source['src'];
if (FALSE === isset($source['type'])) {
throw new Exception('Missing value for "type" in sources array.', 1359381255);
}
$type = $source['type'];
} else {
// skip invalid source
continue;
}
if (FALSE === in_array(strtolower($type), $this->validTypes)) {
throw new Exception('Invalid audio type "' . $type . '".', 1359381260);
}
$type = $this->mimeTypesMap[$type];
$src = $this->preprocessSourceUri($src);
$this->renderChildTag('source', array('src' => $src, 'type' => $type), FALSE, 'append');
}
$tagAttributes = array('width' => $this->arguments['width'], 'height' => $this->arguments['height'], 'preload' => 'auto');
if (TRUE === (bool) $this->arguments['autoplay']) {
$tagAttributes['autoplay'] = 'autoplay';
}
if (TRUE === (bool) $this->arguments['controls']) {
$tagAttributes['controls'] = 'controls';
}
if (TRUE === (bool) $this->arguments['loop']) {
$tagAttributes['loop'] = 'loop';
}
if (TRUE === (bool) $this->arguments['muted']) {
$tagAttributes['muted'] = 'muted';
}
if (TRUE === in_array($this->validPreloadModes, $this->arguments['preload'])) {
$tagAttributes['preload'] = 'preload';
}
if (NULL !== $this->arguments['poster']) {
$tagAttributes['poster'] = $this->arguments['poster'];
}
$this->tag->addAttributes($tagAttributes);
if (NULL !== $this->arguments['unsupported']) {
$this->tag->setContent($this->tag->getContent() . LF . $this->arguments['unsupported']);
}
return $this->tag->render();
}
开发者ID:JostBaron,项目名称:vhs,代码行数:66,代码来源:AudioViewHelper.php
示例8: readUrl
function readUrl($url)
{
var_dump($url);
die;
$urldata = parse_url($url);
if (isset($urldata['host'])) {
if ($this->host and $this->host != $urldata['host']) {
return false;
}
$this->protocol = $urldata['scheme'];
$this->host = $urldata['host'];
$this->path = $urldata['path'];
return $url;
}
if (preg_match('#^/#', $url)) {
$this->path = $urldata['path'];
return $this->protocol . '://' . $this->host . $url;
} else {
if (preg_match('#/$#', $this->path)) {
return $this->protocol . '://' . $this->host . $this->path . $url;
} else {
if (strrpos($this->path, '/') !== false) {
return $this->protocol . '://' . $this->host . substr($this->path, 0, strrpos($this->path, '/') + 1) . $url;
} else {
return $this->protocol . '://' . $this->host . '/' . $url;
}
}
}
}
开发者ID:kd-brinex,项目名称:kd,代码行数:29,代码来源:Parser.php
示例9: deserializationAction
function deserializationAction(&$body)
{
$data = $body->getValue();
//Get the method that is being called
$description = xmlrpc_parse_method_descriptions($data);
$target = $description['methodName'];
$baseClassPath = $GLOBALS['amfphp']['classPath'];
$lpos = strrpos($target, '.');
$methodname = substr($target, $lpos + 1);
$trunced = substr($target, 0, $lpos);
$lpos = strrpos($trunced, ".");
if ($lpos === false) {
$classname = $trunced;
$uriclasspath = $trunced . ".php";
$classpath = $baseClassPath . $trunced . ".php";
} else {
$classname = substr($trunced, $lpos + 1);
$classpath = $baseClassPath . str_replace(".", "/", $trunced) . ".php";
// removed to strip the basecp out of the equation here
$uriclasspath = str_replace(".", "/", $trunced) . ".php";
// removed to strip the basecp out of the equation here
}
$body->methodName = $methodname;
$body->className = $classname;
$body->classPath = $classpath;
$body->uriClassPath = $uriclasspath;
$body->packageClassMethodName = $description['methodName'];
}
开发者ID:FalconGT,项目名称:DrEvony,代码行数:28,代码来源:Actions.php
示例10: generateattach
function generateattach($name, $size, $price, $auth, $id, $free, $count)
{
$extension = substr($name, strrpos($name, ".") + 1);
$supportedExt = explode(" ", "bmp csv gif html jpg jpeg key mov mp3 mp4 numbers pages pdf png rtf tiff txt zip ipa ipsw doc docx ppt pptx xls avi wmv mkv mts");
$imgsrc = "file";
if (in_array($extension, $supportedExt)) {
$imgsrc = $extension;
}
$imgsrc = "../assets/fileicons/" . $imgsrc . ".png";
$s = '<div class="attachdark" onclick="attachdl(\'' . $name . '\',' . $price . ',' . $auth . ',' . $id . ',' . ($free ? "true" : "false") . ')">';
$s = $s . '<img src="' . $imgsrc . '" class="fileicon">';
$s = $s . '<div class="fileinfo"><span class="filename">' . $name . '<br></span>';
$s = $s . '<span class="sub">' . packSize($size) . '<br>';
if ($free) {
$s = $s . '您可以免费下载';
} else {
if ($price == 0) {
$s = $s . '免费';
} else {
$s = $s . '售价:' . $price . "积分";
}
}
if ($count == 0) {
$s = $s . "(暂时无人下载)";
} else {
$s = $s . "(下载次数:" . $count . ")";
}
$s = $s . "</span>";
$s = $s . '</div></div>';
return $s;
}
开发者ID:hun-tun,项目名称:CAPUBBS,代码行数:31,代码来源:index.php
示例11: getClassShortName
/**
* {@inheritDoc}
*/
public function getClassShortName($className)
{
if (strpos($className, '\\') !== false) {
$className = substr($className, strrpos($className, "\\") + 1);
}
return $className;
}
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:10,代码来源:StaticReflectionService.php
示例12: classToTableName
/**
* {@inheritdoc}
*/
public function classToTableName($className)
{
if (strpos($className, '\\') !== false) {
$className = substr($className, strrpos($className, '\\') + 1);
}
return $this->underscore($className);
}
开发者ID:BusinessCookies,项目名称:CoffeeMachineProject,代码行数:10,代码来源:UnderscoreNamingStrategy.php
示例13: get_profile_url
function get_profile_url($html)
{
$profiles = array();
$keys = array();
$doc = new \DOMDocument();
$html = "<html><head> <title> test </title> </head> <body> " . $html . "</body> </html>";
@$doc->loadHTML($html);
$links = $doc->getElementsByTagName("a");
$length = $links->length;
if ($length <= 0) {
return $profiles;
}
for ($i = 0; $i < $length; $i++) {
//individual link node
$link = $links->item($i);
$href = $link->getAttribute("href");
//does the link href end in profile?
$pos = strrpos($href, "/");
if ($pos !== false) {
$token = substr($href, $pos + 1);
if (strcasecmp($token, "profile") == 0) {
$key = md5($href);
//avoid duplicates!
if (!in_array($key, $keys)) {
array_push($profiles, $href);
array_push($keys, $key);
}
}
}
}
return $profiles;
}
开发者ID:rjha,项目名称:sc,代码行数:32,代码来源:curl-search.php
示例14: getExtension
public static function getExtension($host, $addr)
{
$BBC_IP2EXT_PATH = dirname(__FILE__) . '/../ip2ext/';
// generic extensions which need to be looked up first
$gen_ext = array("ac", "aero", "ag", "arpa", "as", "biz", "cc", "cd", "com", "coop", "cx", "edu", "eu", "gb", "gov", "gs", "info", "int", "la", "mil", "ms", "museum", "name", "net", "nu", "org", "pro", "sc", "st", "su", "tc", "tf", "tk", "tm", "to", "tv", "vu", "ws");
// hosts with reliable country extension don't need to be looked up
$cnt_ext = array("ad", "ae", "af", "ai", "al", "am", "an", "ao", "aq", "ar", "at", "au", "aw", "az", "ba", "bb", "bd", "be", "bf", "bg", "bh", "bi", "bj", "bm", "bn", "bo", "br", "bs", "bt", "bv", "bw", "by", "bz", "ca", "cf", "cg", "ch", "ci", "ck", "cl", "cm", "cn", "co", "cr", "cs", "cu", "cv", "cy", "cz", "de", "dj", "dk", "dm", "do", "dz", "ec", "ee", "eg", "eh", "er", "es", "et", "fi", "fj", "fk", "fm", "fo", "fr", "ga", "gd", "ge", "gf", "gg", "gh", "gi", "gl", "gm", "gn", "gp", "gq", "gr", "gt", "gu", "gw", "gy", "hk", "hm", "hn", "hr", "ht", "hu", "id", "ie", "il", "im", "in", "io", "iq", "ir", "is", "it", "je", "jm", "jo", "jp", "ke", "kg", "kh", "ki", "km", "kn", "kp", "kr", "kw", "ky", "kz", "lb", "lc", "li", "lk", "lr", "ls", "lt", "lu", "lv", "ly", "ma", "mc", "md", "me", "mg", "mh", "mk", "ml", "mm", "mn", "mo", "mp", "mq", "mr", "mt", "mu", "mv", "mw", "mx", "my", "mz", "na", "nc", "ne", "nf", "ng", "ni", "nl", "no", "np", "nr", "nz", "om", "pa", "pe", "pf", "pg", "ph", "pk", "pl", "pm", "pn", "pr", "ps", "pt", "pw", "py", "qa", "re", "ro", "ru", "rs", "rw", "sa", "sb", "sd", "se", "sg", "sh", "si", "sj", "sk", "sl", "sm", "sn", "so", "sr", "sv", "sy", "sz", "td", "tg", "th", "tj", "tl", "tn", "tp", "tr", "tt", "tw", "tz", "ua", "ug", "uk", "um", "us", "uy", "uz", "va", "vc", "ve", "vg", "vi", "vn", "wf", "ye", "yt", "yu", "za", "zm", "zr", "zw");
$file = $BBC_IP2EXT_PATH . (substr($addr, 0, strpos($addr, ".")) . ".inc");
$ext = strtolower(substr($host, strrpos($host, ".") + 1));
// Don't look up if there's already a country extension
if (in_array($ext, $cnt_ext)) {
return $ext;
}
if (!is_readable($file)) {
return self::legacy_ext($ext, $gen_ext);
}
$long = ip2long($addr);
$long = sprintf("%u", $long);
$fp = fopen($file, "rb");
while (($range = fgetcsv($fp, 32, "|")) !== false) {
if ($long >= $range[1] && $long <= $range[1] + $range[2] - 1) {
// don't hose our stats if the database returns an unexpected extension
$db_ext = in_array($range[0], $cnt_ext) || in_array($range[0], $gen_ext) ? $range[0] : self::legacy_ext($ext, $gen_ext);
break;
}
}
fclose($fp);
return !empty($db_ext) ? $db_ext : self::legacy_ext($ext, $gen_ext);
}
开发者ID:beejhuff,项目名称:Bouncer,代码行数:29,代码来源:Bbclone.php
示例15: getParentPath
function getParentPath()
{
if (($pos = strrpos($this->path, '/')) === FALSE) {
return "";
}
return substr($this->path, 0, $pos);
}
开发者ID:abhinay100,项目名称:forma_app,代码行数:7,代码来源:lib.treedb.php
示例16: _ark_parse_query_path
/**
* Parse the query path
* url_mod 0: pathinfo, 1: rewrite, 2: normal(?r=)
* @param string $key
* @return array
* - mode: 0, 1, 2; unknown if not set
* - path:
* - basename
*/
function _ark_parse_query_path($key = 'r')
{
$q = array();
$script_name = $_SERVER['SCRIPT_NAME'];
$request_uri = $_SERVER['REQUEST_URI'];
if (false !== ($pos = strpos($request_uri, '?'))) {
$request_uri = substr($request_uri, 0, $pos);
}
$basename = basename($script_name);
$basename_length = strlen($basename);
$slash_pos = strrpos($script_name, '/');
//remove base path
$request_uri = substr($request_uri, $slash_pos + 1);
if ($request_uri === false) {
$request_uri = '';
}
//pathinfo
if (substr($request_uri, 0, $basename_length + 1) === $basename . '/') {
$q['mode'] = 0;
$q['path'] = substr($request_uri, $basename_length + 1);
} elseif ($request_uri !== '' && (substr($request_uri, 0, $basename_length) !== $basename || isset($request_uri[$basename_length]))) {
$q['mode'] = 1;
$q['path'] = $request_uri;
} elseif (null !== $key && isset($_GET[$key])) {
$q['mode'] = 2;
$q['path'] = $_GET[$key];
} else {
$q['path'] = '';
}
$q['basename'] = $basename;
return $q;
}
开发者ID:ddliu,项目名称:tinyark,代码行数:41,代码来源:utils.php
示例17: getAll
public function getAll()
{
global $lC_Language, $lC_Vqmod;
$media = $_GET['media'];
$lC_DirectoryListing = new lC_DirectoryListing('includes/modules/product_attributes');
$lC_DirectoryListing->setIncludeDirectories(false);
$lC_DirectoryListing->setStats(true);
$localFiles = $lC_DirectoryListing->getFiles();
$addonFiles = lC_Addons_Admin::getAdminAddonsProductAttributesFiles();
$files = array_merge((array) $localFiles, (array) $addonFiles);
$cnt = 0;
$result = array('aaData' => array());
$installed_modules = array();
foreach ($files as $file) {
include $lC_Vqmod->modCheck($file['path']);
$class = substr($file['name'], 0, strrpos($file['name'], '.'));
if (class_exists('lC_ProductAttributes_' . $class)) {
$moduleClass = 'lC_ProductAttributes_' . $class;
$mod = new $moduleClass();
$lC_Language->loadIniFile('modules/product_attributes/' . $class . '.php');
$title = '<td>' . $lC_Language->get('product_attributes_' . $mod->getCode() . '_title') . '</td>';
$action = '<td class="align-right vertical-center"><span class="button-group compact">';
if ($mod->isInstalled()) {
$action .= '<a href="' . ((int) ($_SESSION['admin']['access']['modules'] < 4) ? '#' : 'javascript://" onclick="uninstallModule(\'' . $mod->getCode() . '\', \'' . urlencode($mod->getTitle()) . '\')') . '" class="button icon-minus-round icon-red' . ((int) ($_SESSION['admin']['access']['modules'] < 4) ? ' disabled' : NULL) . '">' . ($media === 'mobile-portrait' || $media === 'mobile-landscape' ? NULL : $lC_Language->get('icon_uninstall')) . '</a>';
} else {
$action .= '<a href="' . ((int) ($_SESSION['admin']['access']['modules'] < 3) ? '#' : 'javascript://" onclick="installModule(\'' . $mod->getCode() . '\', \'' . urlencode($lC_Language->get('product_attributes_' . $mod->getCode() . '_title')) . '\')') . '" class="button icon-plus-round icon-green' . ((int) ($_SESSION['admin']['access']['modules'] < 3) ? ' disabled' : NULL) . '">' . ($media === 'mobile-portrait' || $media === 'mobile-landscape' ? NULL : $lC_Language->get('button_install')) . '</a>';
}
$action .= '</span></td>';
$result['aaData'][] = array("{$title}", "{$action}");
$cnt++;
}
}
$result['total'] = $cnt;
return $result;
}
开发者ID:rajeshb001,项目名称:itpl_loaded7,代码行数:35,代码来源:product_attributes.php
示例18: CheckLoginCookie
function CheckLoginCookie()
{
global $wpdb, $ewd_feup_user_table_name;
$LoginTime = get_option("EWD_FEUP_Login_Time");
$Salt = get_option("EWD_FEUP_Hash_Salt");
$CookieName = "EWD_FEUP_Login" . "%" . sha1(md5(get_site_url() . $Salt));
$cookie_name_url_encoded = urlencode($CookieName);
$Cookie = null;
if (isset($_COOKIE[$CookieName])) {
$Cookie = $_COOKIE[$CookieName];
}
if (isset($_COOKIE[$cookie_name_url_encoded])) {
$Cookie = $_COOKIE[$cookie_name_url_encoded];
}
$Username = substr($Cookie, 0, strpos($Cookie, "%"));
$TimeStamp = substr($Cookie, strpos($Cookie, "%") + 1, strrpos($Cookie, "%") - strpos($Cookie, "%"));
$SecCheck = substr($Cookie, strrpos($Cookie, "%") + 1);
$UserAgent = $_SERVER['HTTP_USER_AGENT'];
if (isset($_COOKIE[$CookieName]) || isset($_COOKIE[$cookie_name_url_encoded]) and $TimeStamp < time() + $LoginTime * 60) {
$UserDB = $wpdb->get_row($wpdb->prepare("SELECT User_Sessioncheck , User_Password FROM {$ewd_feup_user_table_name} WHERE Username ='%s'", $Username));
$DBSeccheck = $UserDB->User_Sessioncheck;
if (strcmp(sha1($SecCheck . $UserAgent), $DBSeccheck) === 0) {
$User = array('Username' => $Username, 'User_Password' => $UserDB->User_Password);
return $User;
} else {
return false;
}
}
return false;
}
开发者ID:jeremygeltman,项目名称:ThinkThinly,代码行数:30,代码来源:CheckLoginCookie.php
示例19: process
/**
* Process the current request
*
* $request - The current request parameters. Leave as NULL to default to use $_REQUEST.
*/
public static function process($request = NULL)
{
// Setup request variable
Hybrid_Endpoint::$request = $request;
if (is_null(Hybrid_Endpoint::$request)) {
// Fix a strange behavior when some provider call back ha endpoint
// with /index.php?hauth.done={provider}?{args}...
// >here we need to recreate the $_REQUEST
if (strrpos($_SERVER["QUERY_STRING"], '?')) {
$_SERVER["QUERY_STRING"] = str_replace("?", "&", $_SERVER["QUERY_STRING"]);
parse_str($_SERVER["QUERY_STRING"], $_REQUEST);
}
Hybrid_Endpoint::$request = $_REQUEST;
}
// If windows_live_channel requested, we return our windows_live WRAP_CHANNEL_URL
if (isset(Hybrid_Endpoint::$request["get"]) && Hybrid_Endpoint::$request["get"] == "windows_live_channel") {
Hybrid_Endpoint::processWindowsLiveChannel();
}
// If openid_policy requested, we return our policy document
if (isset(Hybrid_Endpoint::$request["get"]) && Hybrid_Endpoint::$request["get"] == "openid_policy") {
Hybrid_Endpoint::processOpenidPolicy();
}
// If openid_xrds requested, we return our XRDS document
if (isset(Hybrid_Endpoint::$request["get"]) && Hybrid_Endpoint::$request["get"] == "openid_xrds") {
Hybrid_Endpoint::processOpenidXRDS();
}
// If we get a hauth.start
if (isset(Hybrid_Endpoint::$request["hauth_start"]) && Hybrid_Endpoint::$request["hauth_start"]) {
Hybrid_Endpoint::processAuthStart();
} elseif (isset(Hybrid_Endpoint::$request["hauth_done"]) && Hybrid_Endpoint::$request["hauth_done"]) {
Hybrid_Endpoint::processAuthDone();
} else {
Hybrid_Endpoint::processOpenidRealm();
}
}
开发者ID:a303,项目名称:smart_lp2,代码行数:40,代码来源:Endpoint.php
示例20: smarty_function_show_sort
function smarty_function_show_sort($params, $smarty)
{
global $url_path;
if (isset($_REQUEST[$params['sort']])) {
$p = $_REQUEST[$params['sort']];
} elseif ($s = $smarty->getTemplateVars($params['sort'])) {
$p = $s;
}
if (isset($params['sort']) and isset($params['var']) and isset($p)) {
$prop = substr($p, 0, strrpos($p, '_'));
$order = substr($p, strrpos($p, '_') + 1);
if (strtolower($prop) == strtolower(trim($params['var']))) {
$smarty->loadPlugin('smarty_function_icon');
$icon_params = array('alt' => tra('Invert Sort'), 'style' => 'vertical-align:middle');
switch ($order) {
case 'asc':
case 'nasc':
$icon_params['_id'] = 'resultset_up';
return smarty_function_icon($icon_params, $smarty);
break;
case 'desc':
case 'ndesc':
$icon_params['_id'] = 'resultset_down';
return smarty_function_icon($icon_params, $smarty);
break;
}
}
}
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:29,代码来源:function.show_sort.php
注:本文中的strrpos函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论