本文整理汇总了PHP中cache::getDefaultDescLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP cache::getDefaultDescLanguage方法的具体用法?PHP cache::getDefaultDescLanguage怎么用?PHP cache::getDefaultDescLanguage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cache
的用法示例。
在下文中一共展示了cache::getDefaultDescLanguage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: archive_cache
public function archive_cache($cache_id, $comment, $months = 0)
{
global $opt, $login, $translate;
$log = cachelog::createNew($cache_id, $login->userid);
if ($log === false) {
echo $this->name . ": cannot create log for cache {$cache_id}\n";
} else {
$cache = new cache($cache_id);
if (!$cache->setStatus(3) || !$cache->save()) {
echo $this->name . ": cannot change status of cache {$cache_id}\n";
} else {
// create log
$log->setType(cachelog::LOGTYPE_ARCHIVED, true);
$log->setOcTeamComment(true);
$log->setDate(date('Y-m-d'));
// Log without time, so that owner reactions will always appear AFTER
// the system log, no matter if logged with or without date.
// create log text in appropriate language
$translated_comment = $translate->t($comment, '', '', 0, '', 1, $cache->getDefaultDescLanguage());
$translated_comment = str_replace('%1', $months, $translated_comment);
$log->setText('<p>' . $translated_comment . '</p>');
$log->setTextHtml(1);
if (!$log->save()) {
echo $this->name . ": could not save archive log for cache {$cache_id}\n";
}
}
}
}
示例2: disable
function disable()
{
global $login, $translate;
if ($this->canDisable() == false) {
return false;
}
// write old record to log
$backup = array();
$backup['username'] = $this->getUsername();
$backup['email'] = $this->getEMail();
$backup['last_name'] = $this->getLastName();
$backup['first_name'] = $this->getFirstName();
sql("INSERT INTO `logentries` (`module`, `eventid`, `userid`, `objectid1`, `objectid2`, `logtext`, `details`)\n\t\t VALUES ('user', 6, '&1', '&2', '&3', '&4', '&5')", $login->userid, $this->nUserId, 0, 'User ' . sql_escape($this->getUsername()) . ' disabled', serialize($backup));
// delete private data
sql("UPDATE `user` SET `password`=NULL, `email`=NULL, \n\t\t `is_active_flag`=0, \n\t\t `latitude`=0, `longitude`=0, \n\t\t `last_name`='', `first_name`='', `country`=NULL, `accept_mailing`=0, `pmr_flag`=0,\n\t\t `new_pw_code`=NULL, `new_pw_date`=NULL,\n\t\t `new_email`=NULL, `new_email_code`=NULL, `new_email_date`=NULL,\n\t\t `email_problems`=0, `first_email_problem`=NULL, `last_email_problem`=NULL,\n\t\t `permanent_login_flag`=0, `activation_code`='',\n\t\t `notify_radius`=0\n\t\t WHERE `user_id`='&1'", $this->nUserId);
// Statpic and profile description texts are published under the data license
// terms and therefore need not to be deleted.
sql("DELETE FROM `user_options` WHERE `user_id`='&1'", $this->nUserId);
$this->reload();
sql("DELETE FROM `cache_lists` WHERE `user_id`='&1'", $this->nUserId);
// Triggers will do all the dependent clean-up.
sql("DELETE FROM `cache_adoption` WHERE `user_id`='&1'", $this->nUserId);
sql("DELETE FROM `cache_ignore` WHERE `user_id`='&1'", $this->nUserId);
sql("DELETE FROM `cache_watches` WHERE `user_id`='&1'", $this->nUserId);
sql("DELETE FROM `watches_waiting` WHERE `user_id`='&1'", $this->nUserId);
sql("DELETE FROM `notify_waiting` WHERE `user_id`='&1'", $this->nUserId);
// lock the user's caches
$error = false;
$rs = sql("SELECT `cache_id` FROM `caches` WHERE `user_id`='&1' AND `status` IN (1,2,3)", $this->nUserId);
while (($rCache = sql_fetch_assoc($rs)) && !$error) {
$error = true;
$cache = new cache($rCache['cache_id']);
if ($cache->setStatus(6) && $cache->save()) {
$log = cachelog::createNew($rCache['cache_id'], $login->userid, true);
if ($log !== false) {
$log->setType(cachelog::LOGTYPE_LOCKED, true);
$log->setOcTeamComment(true);
$log->setDate(date('Y-m-d'));
$log->setText($translate->t('The user account has been disabled.', '', '', 0, '', 1, $cache->getDefaultDescLanguage()));
$log->setTextHtml(false);
if ($log->save()) {
$error = false;
}
}
}
echo "\n";
}
sql_free_result($rs);
return !$error;
}
示例3: disable
public function disable()
{
global $login, $translate;
if ($this->canDisable() == false) {
return false;
}
// write old record to log
$backup = array();
$backup['username'] = $this->getUsername();
$backup['email'] = $this->getEMail();
$backup['last_name'] = $this->getLastName();
$backup['first_name'] = $this->getFirstName();
$backup['country'] = $this->getCountryCode();
$backup['latitude'] = $this->getLatitude();
$backup['longitude'] = $this->getLongitude();
sql("INSERT INTO `logentries` (`module`, `eventid`, `userid`, `objectid1`, `objectid2`, `logtext`, `details`)\n VALUES ('user', 6, '&1', '&2', '&3', '&4', '&5')", $login->userid, $this->nUserId, 0, 'User ' . sql_escape($this->getUsername()) . ' disabled', serialize($backup));
// delete private and system data
sql("UPDATE `user` SET `password`=NULL, `email`=NULL, `last_name`='', `first_name`='',\n `country`=NULL, `latitude`=0, `longitude`=0, `is_active_flag`=0, `activation_code`='',\n `new_pw_code`=NULL, `new_pw_date`=NULL, `new_email`=NULL, `new_email_code`=NULL,\n `new_email_date`=NULL, `email_problems`=0, `first_email_problem`=NULL,\n `last_email_problem`=NULL\n WHERE `user_id`='&1'", $this->nUserId);
// non-private data which need not to be deleted:
//
// - Statpic and profile description texts - published under the data license
// - profile settings: accept_mailing, pmr_flag, permanent_login_flag, notify_radius,
// user_options entries
// - watch and ignore lists
// - adoptions: may still be executed if offered to another user
// Handling of cache lists is unclear. They may be deleted by the Opencaching team
// if not considered useful.
// lock the user's caches
$error = false;
$rs = sql("SELECT `cache_id` FROM `caches` WHERE `user_id`='&1' AND `status` IN (1,2,3)", $this->nUserId);
while (($rCache = sql_fetch_assoc($rs)) && !$error) {
$error = true;
$cache = new cache($rCache['cache_id']);
if ($cache->setStatus(6) && $cache->save()) {
$log = cachelog::createNew($rCache['cache_id'], $login->userid, true);
if ($log !== false) {
$log->setType(cachelog::LOGTYPE_LOCKED, true);
$log->setOcTeamComment(true);
$log->setDate(date('Y-m-d'));
$log->setText($translate->t('The user account has been disabled.', '', '', 0, '', 1, $cache->getDefaultDescLanguage()));
$log->setTextHtml(false);
if ($log->save()) {
$error = false;
}
}
}
echo "\n";
}
sql_free_result($rs);
return !$error;
}