本文整理汇总了PHP中_S函数的典型用法代码示例。如果您正苦于以下问题:PHP _S函数的具体用法?PHP _S怎么用?PHP _S使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_S函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
// Construct any possible parent;
parent::__construct();
// Do the tie ...
$this->tieInCommonConfiguration();
// Set the proper configuration options, from the config file;
self::$objSettingsCountryTable = $this->getConfigKey(new S('settings_country_table'));
self::$objSettingsCountryTableFIso = $this->getConfigKey(new S('settings_country_table_field_iso'));
self::$objSettingsCountryTableFName = $this->getConfigKey(new S('settings_country_table_field_name'));
self::$objSettingsCountryTableFPrnt = $this->getConfigKey(new S('settings_country_table_field_printable_name'));
self::$objSettingsCountryTableFIsoT = $this->getConfigKey(new S('settings_country_table_field_iso3'));
self::$objSettingsCountryTableFCode = $this->getConfigKey(new S('settings_country_table_field_numcode'));
// Errors ...
self::$objSettingsErrTable = $this->getConfigKey(new S('settings_error_pages_table'));
self::$objSettingsErrTableFId = $this->getConfigKey(new S('settings_error_pages_table_field_id'));
self::$objSettingsErrTableFCode = $this->getConfigKey(new S('settings_error_pages_table_error_code'));
self::$objSettingsErrTableFTitle = $this->getConfigKey(new S('settings_error_pages_table_title'));
self::$objSettingsErrTableFContent = $this->getConfigKey(new S('settings_error_pages_table_content'));
// DB: Auto-CREATE:
$objQueryDB = new FileContent($this->getPathToModule()->toRelativePath() . _S . CFG_DIR . _S . __CLASS__ . SCH_EXTENSION);
// Make a FOREACH on each ...
foreach (_S($objQueryDB->toString())->fromStringToArray(RA_SCHEMA_HASH_TAG) as $k => $v) {
// Make'em ...
$this->_Q(_S($v));
}
}
示例2: __construct
public function __construct()
{
// Construct any possible parent;
parent::__construct();
// Do the tie ...
$this->tieInCommonConfiguration();
// Set some configuration defaults, taking them from the config file;
self::$objContactTable = $this->getConfigKey(new S('contact_table_message'));
self::$objContactTableFId = $this->getConfigKey(new S('contact_table_message_field_id'));
self::$objContactTableFMessage = $this->getConfigKey(new S('contact_table_message_content'));
self::$objContactTableFSubjectId = $this->getConfigKey(new S('contact_table_message_subject_id'));
self::$objContactTableFEMAIL = $this->getConfigKey(new S('contact_table_message_email'));
self::$objContactTableFResolved = $this->getConfigKey(new S('contact_table_message_resolved'));
self::$objContactTableFComment = $this->getConfigKey(new S('contact_table_message_comment'));
self::$objContactTableFReceived = $this->getConfigKey(new S('contact_table_message_received'));
self::$objContactTableFLastEdited = $this->getConfigKey(new S('contact_table_message_last_edited'));
// Subjects ..
self::$objContactSubjectTable = $this->getConfigKey(new S('contact_table_subject'));
self::$objContactSubjectFId = $this->getConfigKey(new S('contact_table_subject_field_id'));
self::$objContactSubjectFTitle = $this->getConfigKey(new S('contact_table_subject_title'));
// DB: Auto-CREATE:
$objQueryDB = new FileContent($this->getPathToModule()->toRelativePath() . _S . CFG_DIR . _S . __CLASS__ . SCH_EXTENSION);
// Make a FOREACH on each ...
foreach (_S($objQueryDB->toString())->fromStringToArray(RA_SCHEMA_HASH_TAG) as $k => $v) {
// Make'em ...
$this->_Q(_S($v));
}
// Load'em defaults ... ATH, STG and others ...
$this->ATH = MOD::activateModule(new FilePath('mod/authentication'), new B(TRUE));
$this->STG = MOD::activateModule(new FilePath('mod/settings'), new B(TRUE));
}
示例3: connect
/**
* Subscribe to a signal.
*
* Signal::connect('user.auth', 'function');
*
* The subscribed function should receive a two arguments and will have
* this signature:
*
* function callback($object, $data);
*
* Where the $object argument is the object originating the signal, and
* the $options is a hash-array of other information originating from-
* and pertaining to the signal.
*
* The value of the $data argument is not defined. It is signal
* specific. It should be a hash-array of data; however, no runtime
* checks are made to ensure such an interface.
*
* Optionally, if $object is a class and is passed into the ::connect()
* method, only instances of the named class or subclass will actually
* be connected to the callable function.
*
* A predicate function, $check, can be used to filter calls to the
* signal handler. The function will receive the signal data and should
* return true if the signal handler should be called.
*/
static function connect($signal, $callable, $object = null, $check = null)
{
if (!isset(self::$subscribers[$signal])) {
self::$subscribers[$signal] = array();
}
// XXX: Ensure $object if set is a class
if ($object && !is_string($object)) {
trigger_error(sprintf(_S("Invalid object: %s: Expected class"), $object));
} elseif ($check && !is_callable($check)) {
trigger_error(_S("Invalid check function: Must be callable"));
$check = null;
}
self::$subscribers[$signal][] = array($object, $callable, $check);
}
示例4: __construct
/**
* @param array $set array to be managed
*/
public function __construct($type, $set = null)
{
if (is_callable($type)) {
$this->type = $type;
} else {
if (!string::isString($type)) {
throw new \InvalidArgumentException('invalid type specifier');
} else {
$this->type = trim(_S($type)->asUtf8);
}
}
if (func_num_args() > 1) {
parent::__construct($this->filterByType($set, false));
} else {
parent::__construct();
}
}
示例5: __construct
public function __construct()
{
// Construct any possible parent;
parent::__construct();
// Do the tie ...
$this->tieInCommonConfiguration();
// Set the proper configuration options, from the config file;
self::$objFaqTable = $this->getConfigKey(new S('faq_table'));
self::$objFaqTableFId = $this->getConfigKey(new S('faq_table_field_id'));
self::$objFaqTableFQuestion = $this->getConfigKey(new S('faq_table_field_question'));
self::$objFaqTableFSEO = $this->getConfigKey(new S('faq_table_field_seo'));
self::$objFaqTableFAnswer = $this->getConfigKey(new S('faq_table_field_answer'));
// Load'em defaults ... ATH, STG and others ...
$this->ATH = MOD::activateModule(new FilePath('mod/authentication'), new B(TRUE));
$this->STG = MOD::activateModule(new FilePath('mod/settings'), new B(TRUE));
// DB: Auto-CREATE:
$objQueryDB = new FileContent($this->getPathToModule()->toRelativePath() . _S . CFG_DIR . _S . __CLASS__ . SCH_EXTENSION);
// Make a FOREACH on each ...
foreach (_S($objQueryDB->toString())->fromStringToArray(RA_SCHEMA_HASH_TAG) as $k => $v) {
// Make'em ...
$this->_Q(_S($v));
}
}
示例6: renderForm
/**
* Will render a specified form, the name of the form given by the first parameter;
*
* This method will render one of the forms for our object, invoked by giving the proper form identifier to the current form.
* We have chosen this method of invoking forms, because we just had too many this->renderSomethingMethod (), which really had
* an impact on code massiveness. Also, having code organized in switch/case statements leads us to be able to share common
* settings between different forms, as we've done with the methods defined in the __CALL method above;
*
* For example, if we wanted to share some common configuration between a create and an edit form, we could have introduced
* two switches in this method, one that would have set the common options, and the second, would have just passed through
* again, and get the already set configuration options, using them. This means that if we needed to change behavior of
* some interconnected forms, that would mean modifying the needed code one place only, which is a big advantage over
* having separated methods for each form. Maybe if we extended this object, you guys could understand the functionality best;
*
* @param string $objFormToRender The name of the form to render;
* @return mixed Depends on the rendered form if it returns something or not;
*/
public function renderForm(S $objFormToRender, A $objFA = NULL)
{
// Make them defaults ...
if ($objFA == NULL) {
$objFA = new A();
}
// Do a switch ...
switch ($objFormToRender) {
case 'textSearch':
// Get some predefines;
if (isset($_GET[ADMIN_ACTION_BY])) {
$objSearchBy = $_GET[ADMIN_ACTION_BY];
} else {
$objSearchBy = new S();
}
if (isset($_GET[ADMIN_ACTION_SEARCH])) {
$objSearchWas = $_GET[ADMIN_ACTION_SEARCH];
} else {
$objSearchWas = new S();
}
// Do some work;
if ($this->checkPOST(new S('search_submit'))->toBoolean() == TRUE) {
if ($this->getPOST(new S('search_by'))->toLength()->toInt() == 0) {
if (isset($_GET[ADMIN_ACTION_SEARCH])) {
// Erase search terms ...
$this->setHeaderKey(URL::rewriteURL(new A(array(ADMIN_ACTION_SEARCH, ADMIN_ACTION_BY))), new S('Location'));
}
// Set an input error;
$this->setErrorOnInput(new S('search_by'), new S(ARTICLE_SEARCH_FIELD_IS_EMPTY));
// Unset the post ...
$this->unsetPOST();
} else {
// Get what to search and where ...
$objWhatToSearch = $this->getPOST(new S('search_by'));
$objWhereToSearch = $this->getPOST(new S('search_field'));
// And go there ...
$this->setHeaderKey(URL::rewriteURL(new A(array(ADMIN_ACTION_SEARCH, ADMIN_ACTION_BY)), new A(array($objWhatToSearch, $objWhereToSearch))), new S('Location'));
}
}
// Check the option that has been selected;
$objWasSelected = new A(array(new B($objSearchBy == TEXTS_SEARCH_TITLE ? TRUE : FALSE), new B($objSearchBy == TEXTS_SEARCH_CONTENT ? TRUE : FALSE)));
// Do the form, make it happen;
$this->setMethod(new S('POST'))->setEnctype(new S('multipart/form-data'))->setFieldset(new S(TEXTS_SEARCH_BY))->setName($objFormToRender)->setInputType(new S('text'))->setInputInfoMessage($this->getHELP($objFormToRender))->setName(new S('search_by'))->setvalue($objSearchWas)->setLabel(new S(TEXTS_SEARCH_BY))->setJSRegExpReplace(new S('[^a-zA-Z0-9 -]'))->setContainerDiv(new B(TRUE))->setInputType(new S('select'))->setName(new S('search_field'))->setContainerDiv(new B(TRUE))->setLabel(new S(TEXTS_SEARCH_IN))->setInputType(new S('option'))->setName(new S('article_title'))->setValue(new S(TEXTS_SEARCH_TITLE))->setLabel(new S(TEXTS_SEARCH_TITLE))->setSelected($objWasSelected[0])->setInputType(new S('option'))->setName(new S('article_content'))->setValue(new S(TEXTS_SEARCH_CONTENT))->setLabel(new S(TEXTS_SEARCH_CONTENT))->setSelected($objWasSelected[1])->setInputType(new S('submit'))->setContainerDiv(new B(TRUE))->setValue(new S(TEXTS_SEARCH_BY))->setName(new S('search_submit'))->setFormEndAndExecute(new B(TRUE));
break;
case 'textCreate':
// The URL to go back too;
$objURLToGoBack = URL::rewriteURL();
// Do some work;
if ($this->checkPOST(self::$objTextTableFTitle)->toBoolean() == TRUE) {
if ($this->getPOST(self::$objTextTableFTitle)->toLength()->toInt() == 0) {
$this->setErrorOnInput(self::$objTextTableFTitle, new S(TEXTS_TITLE_CANNOT_BE_EMPTY));
} else {
// Set some requirements ...
$objToCheck = $this->getPOST(self::$objTextTableFTitle);
// Check title is unique;
if ($this->checkTextTitleIsUnique($objToCheck)->toBoolean() == FALSE) {
$this->setErrorOnInput(self::$objTextTableFTitle, new S(TEXTS_TITLE_MUST_BE_UNIQUE));
}
// Check URL is unique;
if ($this->checkTextURLIsUnique(URL::getURLFromString(clone $objToCheck))->toBoolean() == FALSE) {
$this->setErrorOnInput(self::$objTextTableFTitle, new S(TEXTS_URL_MUST_BE_UNIQUE));
}
}
if ($this->getPOST(self::$objTextTableFContent)->toLength()->toInt() == 0) {
$this->setErrorOnInput(self::$objTextTableFContent, new S(TEXTS_CONTENT_CANNOT_BE_EMPTY));
}
}
// Get AJAX;
$this->getAjaxErrors();
// Do the form, make it happen;
$this->setMethod(new S('POST'))->setName($objFormToRender)->setAJAXEnabledForm(new B(FALSE))->setFieldset(new S(TEXTS_ADD_ARTICLE))->setRedirect($objURLToGoBack)->setSQLAction(new S('update'))->setTableName(self::$objTextTable)->setUpdateId(new S('#nextTableAutoIncrement'))->setUpdateField(self::$objTextTableFId);
if ($this->checkPOST(self::$objTextTableFTitle)->toBoolean() == TRUE) {
$this->setExtraUpdateData(self::$objTextTableFSEO, URL::getURLFromString($this->getPOST(self::$objTextTableFTitle)));
}
// ONLY if != BIG-MAN;
if ((int) $this->ATH->getCurrentUserInfoById(Authentication::$objAuthUsersTableFId)->toString() != 1) {
$this->setExtraUpdateData(self::$objTextTableAuthorId, $this->ATH->getCurrentUserInfoById(Authentication::$objAuthUsersTableFId));
}
// Add the SEO ...
$this->setExtraUpdateData(self::$objTextTableFDatePublished, new S((string) $_SERVER['REQUEST_TIME']))->setInputType(new S('submit'))->setValue(new S(TEXTS_ADD_ARTICLE))->setInputInfoMessage($this->getHELP($objFormToRender))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objTextTableFTags)->setLabel(new S(TEXTS_TAGS))->setJSRegExpReplace(new S(self::REGEXP_JS_TAGS))->setContainerDiv(new B(TRUE));
// If we're the BIG MAN, we can set the author of an entry;
if ((int) $this->ATH->getCurrentUserInfoById(Authentication::$objAuthUsersTableFId)->toString() == 1) {
$this->setInputType(new S('select'))->setName(self::$objTextTableFAuthorId)->setLabel(new S(TEXTS_AUTHOR))->setContainerDiv(new B(TRUE));
//.........这里部分代码省略.........
示例7: checkOverdue
function checkOverdue()
{
$sql = 'SELECT ticket_id FROM ' . TICKET_TABLE . ' T1 ' . ' INNER JOIN ' . TICKET_STATUS_TABLE . ' status
ON (status.id=T1.status_id AND status.state="open") ' . ' LEFT JOIN ' . SLA_TABLE . ' T2 ON (T1.sla_id=T2.id AND T2.isactive=1) ' . ' WHERE isoverdue=0 ' . ' AND ((reopened is NULL AND duedate is NULL AND TIME_TO_SEC(TIMEDIFF(NOW(),T1.created))>=T2.grace_period*3600) ' . ' OR (reopened is NOT NULL AND duedate is NULL AND TIME_TO_SEC(TIMEDIFF(NOW(),reopened))>=T2.grace_period*3600) ' . ' OR (duedate is NOT NULL AND duedate<NOW()) ' . ' ) ORDER BY T1.created LIMIT 50';
//Age upto 50 tickets at a time?
if (($res = db_query($sql)) && db_num_rows($res)) {
while (list($id) = db_fetch_row($res)) {
if (($ticket = Ticket::lookup($id)) && $ticket->markOverdue()) {
$ticket->logActivity(_S('Ticket Marked Overdue'), _S('Ticket flagged as overdue by the system.'));
}
}
} else {
//TODO: Trigger escalation on already overdue tickets - make sure last overdue event > grace_period.
}
}
示例8: logDBError
function logDBError($title, $error, $alert = true)
{
if ($alert && !$this->getConfig()->alertONSQLError()) {
$alert = false;
}
$e = new Exception();
$bt = str_replace(ROOT_DIR, _S('(root)') . '/', $e->getTraceAsString());
$error .= nl2br("\n\n---- " . _S('Backtrace') . " ----\n" . $bt);
return $this->log(LOG_ERR, $title, $error, $alert);
}
示例9: setHTAutoPHP
/**
* Sets some automatic RA PHP Framework .htaccess options that really drive the core of the framework. These include some Apache
* specific settings, or some of the PHP_INI_PERDIR configuration options that can be set only through the .htaccess file. Also,
* the auto_append_file and auto_prepend_file settings are automatically written here so the developer is cleared having to
* think what's included and where, as we provide an autoloading mechanism for this framework;
*
* @return B Will return true if everything was fine and dandy
* @author Catalin Z. Alexandru <catalin.zamfir@raphpframework.ro>
* @copyright Under the terms of the GNU General Public License v3
* @version $Id: 07_APC.php 313 2009-10-09 13:27:52Z catalin.zamfir $
* @since Version 1.0
* @access protected
* @static
* @final
*/
protected static final function setHTAutoPHP()
{
self::$objHTWriteIt = new I(1);
if (is_writeable(DOCUMENT_ROOT)) {
// Make them URLs VALID && the 401 error URL, needs to be LOCAL ...
define('ERROR_DOC_HOST', _S(DOCUMENT_HOST)->doToken(_SP, '%20')->doToken('www.', _NONE));
define('ERROR_401_HOST', _S(DOCUMENT_HOST)->doToken(_SP, '%20')->doToken(DOCUMENT_HOST, _NONE));
// We need some .htaccess defaults;
self::$objHT[] = 'IndexIgnore *';
self::$objHT[] = 'AddType text/x-component .htc';
self::$objHT[] = 'SetEnv TZ ' . DATE_TIMEZONE;
self::$objHT[] = 'Options All ' . APACHE_OPTIONS;
self::$objHT[] = 'AddDefaultCharset ' . DEFAULT_CHARSET;
self::$objHT[] = 'ServerSignature ' . APACHE_SERVER_SIGNATURE;
self::$objHT[] = 'php_value auto_prepend_file "' . DOCUMENT_ROOT . INCLUDE_DIR . _S . AUTO_PREPEND_FILE . '"';
self::$objHT[] = 'php_value auto_append_file "' . DOCUMENT_ROOT . INCLUDE_DIR . _S . AUTO_APPEND_FILE . '"';
self::$objHT[] = 'php_value upload_max_filesize ' . UPLOAD_MAX_FILESIZE;
self::$objHT[] = 'php_value post_max_size ' . POST_MAX_SIZE;
self::$objHT[] = 'php_value asp_tags ' . ASP_TAGS;
self::$objHT[] = 'php_value register_long_arrays ' . REGISTER_LONG_GPC;
self::$objHT[] = 'php_value short_open_tag ' . SHORT_OPEN_TAG;
self::$objHT[] = 'php_value max_input_time ' . MAX_INPUT_TIME;
self::$objHT[] = 'php_value tidy.clean_output ' . TIDY_CLEAN_OUTPUT;
self::$objHT[] = 'php_value session.gc_maxlifetime ' . SESSIONCACHEEXPIRE;
self::$objHT[] = 'php_value session.use_trans_sid ' . SESSION_USE_TRANSPARENT_ID;
self::$objHT[] = 'ErrorDocument 400 ' . ERROR_DOC_HOST . 'Error/400';
self::$objHT[] = 'ErrorDocument 401 ' . ERROR_401_HOST . 'Error/401';
self::$objHT[] = 'ErrorDocument 402 ' . ERROR_DOC_HOST . 'Error/402';
self::$objHT[] = 'ErrorDocument 403 ' . ERROR_DOC_HOST . 'Error/403';
self::$objHT[] = 'ErrorDocument 404 ' . ERROR_DOC_HOST . 'Error/404';
self::$objHT[] = 'ErrorDocument 405 ' . ERROR_DOC_HOST . 'Error/405';
self::$objHT[] = 'ErrorDocument 406 ' . ERROR_DOC_HOST . 'Error/406';
self::$objHT[] = 'ErrorDocument 407 ' . ERROR_DOC_HOST . 'Error/407';
self::$objHT[] = 'ErrorDocument 408 ' . ERROR_DOC_HOST . 'Error/408';
self::$objHT[] = 'ErrorDocument 409 ' . ERROR_DOC_HOST . 'Error/409';
self::$objHT[] = 'ErrorDocument 410 ' . ERROR_DOC_HOST . 'Error/410';
self::$objHT[] = 'ErrorDocument 411 ' . ERROR_DOC_HOST . 'Error/411';
self::$objHT[] = 'ErrorDocument 412 ' . ERROR_DOC_HOST . 'Error/412';
self::$objHT[] = 'ErrorDocument 413 ' . ERROR_DOC_HOST . 'Error/413';
self::$objHT[] = 'ErrorDocument 414 ' . ERROR_DOC_HOST . 'Error/414';
self::$objHT[] = 'ErrorDocument 415 ' . ERROR_DOC_HOST . 'Error/415';
self::$objHT[] = 'ErrorDocument 416 ' . ERROR_DOC_HOST . 'Error/416';
self::$objHT[] = 'ErrorDocument 417 ' . ERROR_DOC_HOST . 'Error/417';
self::$objHT[] = 'ErrorDocument 422 ' . ERROR_DOC_HOST . 'Error/422';
self::$objHT[] = 'ErrorDocument 423 ' . ERROR_DOC_HOST . 'Error/423';
self::$objHT[] = 'ErrorDocument 424 ' . ERROR_DOC_HOST . 'Error/424';
self::$objHT[] = 'ErrorDocument 426 ' . ERROR_DOC_HOST . 'Error/426';
self::$objHT[] = 'ErrorDocument 500 ' . ERROR_DOC_HOST . 'Error/500';
self::$objHT[] = 'ErrorDocument 501 ' . ERROR_DOC_HOST . 'Error/501';
self::$objHT[] = 'ErrorDocument 502 ' . ERROR_DOC_HOST . 'Error/502';
self::$objHT[] = 'ErrorDocument 503 ' . ERROR_DOC_HOST . 'Error/503';
self::$objHT[] = 'ErrorDocument 504 ' . ERROR_DOC_HOST . 'Error/504';
self::$objHT[] = 'ErrorDocument 505 ' . ERROR_DOC_HOST . 'Error/505';
self::$objHT[] = 'ErrorDocument 506 ' . ERROR_DOC_HOST . 'Error/506';
self::$objHT[] = 'ErrorDocument 507 ' . ERROR_DOC_HOST . 'Error/507';
self::$objHT[] = 'ErrorDocument 510 ' . ERROR_DOC_HOST . 'Error/510';
// Add CSS/JS PHP interpretation;
if (PHPIZE_JSS_FILES == TRUE) {
self::$objHT[] = 'AddHandler application/x-httpd-php .js';
}
if (PHPIZE_CSS_FILES == TRUE) {
self::$objHT[] = 'AddHandler application/x-httpd-php .css';
}
// Check the mod_rewrite is ON;
if (in_array('mod_rewrite', apache_get_modules())) {
// What should we do with the REWRITE_ENGINE
REWRITE_ENGINE == TRUE ? self::rewriteHTLine(new S('RewriteEngine On')) : self::rewriteHTLine(new S('RewriteEngine Off'));
// ONLY, if the rewrite is OK;
if (REWRITE_ENGINE == TRUE) {
// Protect US from BOTS;
self::rewriteHTLine(new S('RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]'));
self::rewriteHTLine(new S('RewriteCond %{HTTP_USER_AGENT} ^Bot\\ mailto:craftbot@yahoo.com [OR]'));
self::rewriteHTLine(new S('RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]'));
self::rewriteHTLine(new S('RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]'));
self::rewriteHTLine(new S('RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]'));
self::rewriteHTLine(new S('RewriteCond %{HTTP_USER_AGENT} ^Download\\ Demon [OR]'));
self::rewriteHTLine(new S('RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]'));
self::rewriteHTLine(new S('RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]'));
self::rewriteHTLine(new S('RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]'));
self::rewriteHTLine(new S('RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]'));
self::rewriteHTLine(new S('RewriteCond %{HTTP_USER_AGENT} ^Express\\ WebPictures [OR]'));
self::rewriteHTLine(new S('RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]'));
self::rewriteHTLine(new S('RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]'));
self::rewriteHTLine(new S('RewriteCond %{HTTP_USER_AGENT} ^WebGo\\ IS [OR]'));
self::rewriteHTLine(new S('RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]'));
//.........这里部分代码省略.........
示例10: __construct
public function __construct()
{
// Construct any possible parent, parse the configuration while doing that;
parent::__construct();
// Tie in common configuration data;
$this->tieInCommonConfiguration();
// Set the proper configuration options for this object;
self::$objAuthUsersTable = $this->getConfigKey(new S('authentication_users_table'));
self::$objAuthUsersTableFId = $this->getConfigKey(new S('authentication_users_table_field_id'));
self::$objAuthUsersTableFUName = $this->getConfigKey(new S('authentication_users_table_field_username'));
self::$objAuthUsersTableFUPass = $this->getConfigKey(new S('authentication_users_table_field_password'));
self::$objAuthUsersTableFEML = $this->getConfigKey(new S('authentication_users_table_field_email'));
self::$objAuthUsersTableFPhone = $this->getConfigKey(new S('authentication_users_table_field_phone'));
self::$objAuthUsersTableFFName = $this->getConfigKey(new S('authentication_users_table_field_first_name'));
self::$objAuthUsersTableFLName = $this->getConfigKey(new S('authentication_users_table_field_last_name'));
self::$objAuthUsersTableFUGId = $this->getConfigKey(new S('authentication_users_table_field_group_id'));
self::$objAuthUsersTableFRegOn = $this->getConfigKey(new S('authentication_users_table_field_registered_on'));
self::$objAuthUsersTableFLastLog = $this->getConfigKey(new S('authentication_users_table_field_visited_on'));
self::$objAuthUsersTableFHash = $this->getConfigKey(new S('authentication_users_table_field_hash'));
self::$objAuthUsersTableFActivated = $this->getConfigKey(new S('authentication_users_table_field_activated'));
self::$objAuthUsersTableFCountry = $this->getConfigKey(new S('authentication_users_table_field_country'));
self::$objAuthUsersTableFSignature = $this->getConfigKey(new S('authentication_users_table_field_signature'));
self::$objAuthUsersTableFDesc = $this->getConfigKey(new S('authentication_users_table_field_description'));
self::$objAuthUsersTableFYM = $this->getConfigKey(new S('authentication_users_table_field_ym'));
self::$objAuthUsersTableFMSN = $this->getConfigKey(new S('authentication_users_table_field_msn'));
self::$objAuthUsersTableFICQ = $this->getConfigKey(new S('authentication_users_table_field_icq'));
self::$objAuthUsersTableFAOL = $this->getConfigKey(new S('authentication_users_table_field_aol'));
self::$objAuthUsersTableFCity = $this->getConfigKey(new S('authentication_users_table_field_city'));
self::$objAuthUsersTableFAvatar = $this->getConfigKey(new S('authentication_users_table_field_avatar'));
self::$objAuthUsersTableFIp = $this->getConfigKey(new S('authentication_users_table_field_ip'));
// Groups ...
self::$objAuthGroupTable = $this->getConfigKey(new S('authentication_group_table'));
self::$objAuthGroupTableFId = $this->getConfigKey(new S('authentication_group_table_field_id'));
self::$objAuthGroupTableFName = $this->getConfigKey(new S('authentication_group_table_field_name'));
self::$objAuthGroupTableFSEO = $this->getConfigKey(new S('authentication_group_table_field_seo'));
// Zones ...
self::$objAuthZonesTable = $this->getConfigKey(new S('authentication_zones_table'));
self::$objAuthZonesTableFId = $this->getConfigKey(new S('authentication_zones_table_field_id'));
self::$objAuthZonesTableFName = $this->getConfigKey(new S('authentication_zones_table_field_name'));
self::$objAuthZonesTableFDesc = $this->getConfigKey(new S('authentication_zones_table_field_description'));
self::$objAuthZonesTableFPrice = $this->getConfigKey(new S('authentication_zones_table_field_price'));
// Zone mappings ...
self::$objAuthZoneMTable = $this->getConfigKey(new S('authentication_gtozm_table'));
self::$objAuthZoneMTableFId = $this->getConfigKey(new S('authentication_gtozm_table_field_id'));
self::$objAuthZoneMTableFZId = $this->getConfigKey(new S('authentication_gtozm_table_field_zone_id'));
self::$objAuthZoneMTableFUGId = $this->getConfigKey(new S('authentication_gtozm_table_field_ug_id'));
self::$objAuthZoneMTableFIUG = $this->getConfigKey(new S('authentication_gtozm_table_field_is_group'));
self::$objAuthZoneMTableFAorD = $this->getConfigKey(new S('authentication_gtozm_table_field_deny_or_allow'));
self::$objAuthZoneMTableFErase = $this->getConfigKey(new S('authentication_gtozm_table_field_eraseable'));
// Configuration ...
self::$objAuthDefaultGroup = $this->getConfigKey(new S('authentication_default_group'));
self::$objAuthDefaultUsername = $this->getConfigKey(new S('authentication_default_admin_username'));
self::$objAuthDefaultPassword = $this->getConfigKey(new S('authentication_default_admin_password'));
// DB: Auto-CREATE:
$objQueryDB = new FileContent($this->getPathToModule()->toRelativePath() . _S . CFG_DIR . _S . __CLASS__ . SCH_EXTENSION);
// Make a FOREACH on each ...
foreach (_S($objQueryDB->toString())->fromStringToArray(RA_SCHEMA_HASH_TAG) as $k => $v) {
// Make'em ...
$this->_Q(_S($v));
}
// Check non-modified user data, to prevent hackers;
if ($this->checkIfUserIsLoggedIn()->toBoolean() == TRUE) {
$this->checkIfUserDataIsOK();
}
// Get an MPTT Object, build the ROOT, make sure the table is OK;
self::$objMPTT = new MPTT(self::$objAuthGroupTable, self::$objAuthDefaultGroup);
self::$objMPTTForZones = new MPTT(self::$objAuthZonesTable, $this->getObjectCLASS());
// Load'em defaults ... ATH, STG and others ...
$this->STG = MOD::activateModule(new FilePath('mod/settings'), new B(TRUE));
// Check that the default administrator user exists, or create it;
$this->setDefaultAdministratorSettings();
// Check to see if this zone exists, and if not, add it;
if ($this->checkZoneByName(new S(__CLASS__))->toBoolean() == FALSE) {
$this->doMakeZone(new S(__CLASS__), self::$objAuthZonesTableFName);
}
if ($this->checkAdministratorIsMappedToZone($this->getObjectCLASS())->toBoolean() == FALSE) {
$this->doMapAdministratorToZone($this->getObjectCLASS());
}
// Do the tie, with myself, just for sub-zones;
$this->tieInWithAuthentication($this);
}
示例11: renderWidget
/**
* Will render a requested widget;
*
* This method is used to render a widget that usually is used in the frontend part of any website done with the help of this
* platform. What are widgets you ask?! Well, it's quite simple. They are pieces of PHP code, usually tied to some
* configuration options that control the way the widget functions or showns;
*
* Usually, configured widgets have enough power to be used in any way you want or need. For most of the times, the widgets
* are called in the proper section of the frontend, but this method must permit the use of widgets, independent of the place
* the developer needs them;
*
* @param $objWidgetToRender The widget to render;
* @return mixed Depends on the widget;
*/
public function renderWidget(S $objW, A $objWA = NULL)
{
// Make an empty array if NULL ...
if ($objWA == NULL) {
$objWA = new A();
}
// XML & RSS: Do a switch ...
switch ($objW) {
case 'widgetXML':
// Yo man ... woohoooooo ...
foreach ($this->getLyrics(_S('ORDER
BY %objLyricsTableFDateAdded DESC LIMIT %LowerLimit, %UpperLimit')->doToken('%LowerLimit', ((int) $objWA['objId']->toString() - 1) * 25000)->doToken('%UpperLimit', 25000)) as $k => $v) {
// Set some requirements ...
$objDTE = date('Y-m-d', (int) $v[self::$objLyricsTableFDateAdded]->toString());
$objLOC = URL::staticURL(new A(array(LYRICS_ITEM_URL, FRONTEND_SECTION_URL)), new A(array($v[self::$objLyricsTableFSEO], FRONTEND_LYRICS_URL)));
// Get the (INNER) CHILD of every young SEO freak ...
$objURL = $objWA['objXML']->addCHILD(Frontend::XML_URL);
// Set the XML Sitemap kids ...
$objURL->addCHILD(Frontend::XML_LOCATION, $objLOC);
$objURL->addCHILD(Frontend::XML_LAST_MOD, $objDTE);
$objURL->addCHILD(Frontend::XML_CHANGE_FREQ, self::XML_SITEMAP_FREQUENCY);
$objURL->addCHILD(Frontend::XML_PRIORITY, self::XML_SITEMAP_PRIORITY);
}
// BK;
break;
case 'widgetRSS':
// Yo man ... woohoooooo ...
if ($_GET[FRONTEND_FEED_URL] == __CLASS__) {
// Get'em 30 ...
foreach ($this->getApprovedAudioFiles(new S('ORDER BY %objAudioTableFUploadedDate
DESC LIMIT 0, 30')) as $k => $v) {
// Set some requirements ...
$objDTE = date(DATE_RFC822, (int) $v[self::$objAudioTableFUploadedDate]->toString());
$objLOC = URL::staticURL(new A(array(AUDIO_ITEM_URL, FRONTEND_SECTION_URL)), new A(array($v[self::$objAudioTableFSEO], FRONTEND_AUDIO_URL)));
$objTTL = $v[self::$objAudioTableFTitle]->appendString(_DCSP)->appendString($v[self::$objAudioTableFArtist])->appendString(_DCSP)->appendString($v[self::$objAudioTableFAlbum]);
$objDSC = $v[self::$objAudioTableFDescription]->entityEncode(ENT_QUOTES)->entityDecode(ENT_QUOTES)->stripTags();
// Get the (INNER) CHILD of every young SEO freak ...
$objURL = $objWA['objXML']->addCHILD(Frontend::RSS_ITEM);
// Set the RSS kids ...
$objURL->addCHILD(Frontend::RSS_TITLE, $objTTL);
$objURL->addCHILD(Frontend::RSS_LINK, $objLOC);
$objURL->addCHILD(Frontend::RSS_GUID, $objLOC);
$objURL->addCHILD(Frontend::RSS_PUBLISHED_DATE, $objDTE);
$objURL->addCHILD(Frontend::RSS_DESCRIPTION, $objDSC);
}
}
// BK;
break;
}
// Do a switch ...
switch ($objW) {
case 'widgetList':
// Check some needed requirements ...
if ($_GET[FRONTEND_SECTION_URL] == FRONTEND_LYRICS_URL) {
// Set some requirements ...
$objPag = isset($_GET[LYRICS_PAGE_URL]) ? $_GET[LYRICS_PAGE_URL] : new S((string) 1);
$objPag = new I((int) $objPag->toString());
// Fixes for a bugged user ...
if ($objPag->toInt() == 0) {
// Make the proper header, at first ...
$this->setHeaderStr(new S(HDR::HEADER_404_NOT_FOUND));
// Give me back my free hardcore, Quoth the server, '404' ...
$this->setHeaderKey(URL::staticURL(new A(array(FRONTEND_ERROR_URL)), new A(array('404'))), new S('Location'));
} else {
// Make it a string again ...
$objPag = new S((string) $objPag->toInt());
}
// Get your switches on ...
if (isset($_GET[LYRICS_ITEM_URL])) {
// Check that the article exists, before doing anything stupid ...
if ($this->checkLyricURLIsUnique($objURL = $_GET[LYRICS_ITEM_URL])->toBoolean() == TRUE) {
// Make the proper header, at first ...
$this->setHeaderStr(new S(HDR::HEADER_404_NOT_FOUND));
// Give me back my free hardcore, Quoth the server, '404' ...
$this->setHeaderKey(URL::staticURL(new A(array(FRONTEND_ERROR_URL)), new A(array('404'))), new S('Location'));
} else {
// Make me SEO ... yah!
TPL::manageTTL($objTTL = $this->getLyricInfoByURL($objURL, self::$objLyricsTableFTitle));
TPL::manageTTL($objART = $this->getLyricInfoByURL($objURL, self::$objLyricsTableFArtist));
TPL::manageTTL($objALB = $this->getLyricInfoByURL($objURL, self::$objLyricsTableFAlbum));
TPL::manageTAG(new S('description'), new S('Titlu: ' . $objTTL . ', Artist: ' . $objART . ', Album: ' . $objALB . ', Lyrics: ' . $this->getLyricInfoByURL($objURL, self::$objLyricsTableFLyrics)->entityDecode(ENT_QUOTES)->doToken('<br />', _SP)->stripTags()->doSubStr(0, 128)));
// Set the template file ...
$tpF = new FilePath($this->getPathToSkin()->toRelativePath() . $objW . '-Item' . TPL_EXTENSION);
TPL::tpSet($objWA, new S('objWidgetArray'), $tpF);
TPL::tpSet($objURL, new S('objURL'), $tpF);
TPL::tpSet($this->ATH, new S('ATH'), $tpF);
//.........这里部分代码省略.........
示例12: doMAIL
/**
* Will send the email, at the specified address, using the specified subject and content;
*
* This method will send out the given email and subject, to the given address, while decoding the content from entities; You,
* as the user, SHOULD ALWAYS remember, that the content gets decoded in this method, thus allowing you to work with your
* content where you've called it, without modifying it;
*
* @param S $objMAILTo The email to send it to;
* @param S $objMAILSubject The subject to set;
* @param S $objMAILContent And the content;
* @todo CLEAN THIS URGENTLY! ...
*/
public function doMAIL(S $objMAILTo, S $objMAILSubject, S $objMAILContent)
{
// First of ALL, get a CLONE ...
$objMAILClone = clone $objMAILContent;
$objMAILClone = $objMAILClone->entityDecode(ENT_QUOTES)->stripTags();
// #0: proper MULTIPART;
$objMAILContent->prependString(new S(_N_))->prependString(_S(self::MAIL_HEADER_CONTENT_ENCODING_SEVENBIT . _N_))->prependString(_S(self::MAIL_HEADER_CONTENT_TYPE_HTML . _N_))->prependString(_S(self::MAIL_HEADER_PHP_ALTERNATIVE . _N_)->doToken('%s', self::$objHASHId))->prependString(_S(_N_))->prependString(_S($objMAILClone . _N_))->prependString(_S(_N_))->prependString(_S(self::MAIL_HEADER_CONTENT_ENCODING_SEVENBIT . _N_))->prependString(_S(self::MAIL_HEADER_CONTENT_TYPE_PLAIN . _N_))->prependString(_S(self::MAIL_HEADER_PHP_ALTERNATIVE . _N_)->doToken('%s', self::$objHASHId))->prependString(_S(_N_))->prependString(_S(self::MAIL_HEADER_MULTIPART_ALTERNATIVE . _N_)->doToken('%s', self::$objHASHId))->prependString(_S(self::MAIL_HEADER_PHP_MIXED . _N_)->doToken('%s', self::$objHASHId));
// #4: ... end PLAIN and HTML ...
$objMAILContent->appendString(_S(_N_))->appendString(_S(self::MAIL_HEADER_PHP_ALTERNATIVE_END . _N_)->doToken('%s', self::$objHASHId));
// #5: ... attachments;
foreach (self::$objEMLAttachment as $k => $v) {
// #5.1
$objMAILContent->appendString(_S(self::MAIL_HEADER_PHP_MIXED . _N_)->doToken('%s', self::$objHASHId))->appendString(_S(self::MAIL_HEADER_ATTACHMENT_TYPE_NAME . _N_)->doToken('%t', $v['attachment_type'])->doToken('%n', $v['attachment_name']))->appendString(_S(self::MAIL_HEADER_ENCODING_BASE64 . _N_))->appendString(_S(self::MAIL_HEADER_DISPOSITION_ATTACHMENT . _N_))->appendString(_S(_N_))->appendString($v['attachment_base64'])->appendString(_S(self::MAIL_HEADER_PHP_MIXED . _N_)->doToken('%s', self::$objHASHId));
}
// Finish ...
$objMAILContent->appendString(_S(_N_))->appendString(_S(self::MAIL_HEADER_PHP_MIXED_END)->doToken('%s', self::$objHASHId));
// Go ... everyhing IS ok and life's grand ...
MAIL($objMAILTo, $objMAILSubject, $objMAILContent->entityDecode(ENT_QUOTES), self::$objFromHeader . self::$objReceiptTo . self::$objReplyTo . self::$objMIMEHeader . self::$objTypeHTML);
}
示例13: authstrike
function authstrike($credentials)
{
global $ost;
$cfg = $ost->getConfig();
$authsession =& $_SESSION['_auth']['user'];
$username = $credentials['username'];
$password = $credentials['password'];
$authsession['strikes'] += 1;
if ($authsession['strikes'] > $cfg->getClientMaxLogins()) {
$authsession['laststrike'] = time();
$alert = _S('Excessive login attempts by a user.') . "\n" . _S('Username') . ": {$username}\n" . _S('IP') . ": {$_SERVER['REMOTE_ADDR']}\n" . _S('Time') . ": " . date('M j, Y, g:i a T') . "\n\n" . _S('Attempts') . ": {$authsession['strikes']}";
$ost->logError(_S('Excessive login attempts (user)'), $alert, $cfg->alertONLoginError());
return new AccessDenied(__('Access Denied'));
} elseif ($authsession['strikes'] % 3 == 0) {
//Log every third failed login attempt as a warning.
$alert = _S('Username') . ": {$username}\n" . _S('IP') . ": {$_SERVER['REMOTE_ADDR']}\n" . _S('Time') . ": " . date('M j, Y, g:i a T') . "\n\n" . _S('Attempts') . ": {$authsession['strikes']}";
$ost->logWarning(_S('Failed login attempt (user)'), $alert);
}
}
示例14: sendUnlockEmail
protected function sendUnlockEmail($template)
{
global $ost, $cfg;
$token = Misc::randCode(48);
// 290-bits
$email = $cfg->getDefaultEmail();
$content = Page::lookup(Page::getIdByType($template));
if (!$email || !$content) {
return new Error(sprintf(_S('%s: Unable to retrieve template'), $template));
}
$vars = array('url' => $ost->getConfig()->getBaseUrl(), 'token' => $token, 'user' => $this->getUser(), 'recipient' => $this->getUser(), 'link' => sprintf("%s/pwreset.php?token=%s", $ost->getConfig()->getBaseUrl(), $token));
$vars['reset_link'] =& $vars['link'];
$info = array('email' => $email, 'vars' => &$vars, 'log' => true);
Signal::send('auth.pwreset.email', $this->getUser(), $info);
$msg = $ost->replaceTemplateVariables(array('subj' => $content->getName(), 'body' => $content->getBody()), $vars);
$_config = new Config('pwreset');
$_config->set($vars['token'], $this->getUser()->getId());
$email->send($this->getUser()->getEmail(), Format::striptags($msg['subj']), $msg['body']);
return true;
}
示例15: __construct
function __construct($body, $type = 'text', $options = array())
{
$type = strtolower($type);
if (!in_array($type, static::$types)) {
throw new Exception("{$type}: Unsupported ThreadBody type");
}
$this->body = (string) $body;
if (strlen($this->body) > 250000) {
$max_packet = db_get_variable('max_allowed_packet', 'global');
// Truncate just short of the max_allowed_packet
$this->body = substr($this->body, 0, $max_packet - 2048) . ' ... ' . _S('(truncated)');
}
$this->type = $type;
$this->options = array_merge($this->options, $options);
}