本文整理汇总了PHP中Misc::decrypt方法的典型用法代码示例。如果您正苦于以下问题:PHP Misc::decrypt方法的具体用法?PHP Misc::decrypt怎么用?PHP Misc::decrypt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Misc
的用法示例。
在下文中一共展示了Misc::decrypt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSMTPInfo
function getSMTPInfo($active = true)
{
$info = array();
if (!$active || $active && $this->isSMTPEnabled()) {
$info = array('host' => $this->info['smtp_host'], 'port' => $this->info['smtp_port'], 'auth' => $this->info['smtp_auth'], 'username' => $this->info['userid'], 'password' => Misc::decrypt($this->info['userpass'], SECRET_SALT));
}
return $info;
}
示例2:
<?php
if(!defined('OSTADMININC') || basename($_SERVER['SCRIPT_NAME'])==basename(__FILE__)) die('Habari/Jambo rafiki? '); //Say hi to our friend..
if(!$thisuser || !$thisuser->isadmin()) die('Access Denied');
$info=($_POST && $errors)?$_POST:array(); //Re-use the post info on error...savekeyboards.org
if($email && $_REQUEST['a']!='new'){
$title='Edit Email';
$action='update';
if(!$info) {
$info=$email->getInfo();
$info['userpass']=$info['userpass']?Misc::decrypt($info['userpass'],SECRET_SALT):'';
}
$qstr='?t=email&id='.$email->getId();
}else {
$title='New Email';
$action='create';
$info['smtp_auth']=isset($info['smtp_auth'])?$info['smtp_auth']:1;
}
$info=Format::htmlchars($info);
//get the goodies.
$depts= db_query('SELECT dept_id,dept_name FROM '.DEPT_TABLE);
$priorities= db_query('SELECT priority_id,priority_desc FROM '.TICKET_PRIORITY_TABLE);
?>
<div class="msg"><?=$title?></div>
<table width="100%" border="0" cellspacing=0 cellpadding=0>
<form action="admin.php<?=$qstr?>" method="post">
<input type="hidden" name="do" value="<?=$action?>">
<input type="hidden" name="a" value="<?=Format::htmlchars($_REQUEST['a'])?>">
<input type="hidden" name="t" value="email">
<input type="hidden" name="email_id" value="<?=$info['email_id']?>">
示例3: fetchMail
function fetchMail(){
global $cfg;
if(!$cfg->canFetchMail())
return;
//We require imap ext to fetch emails via IMAP/POP3
if(!function_exists('imap_open')) {
$msg='PHP must be compiled with IMAP extension enabled for IMAP/POP3 fetch to work!';
Sys::log(LOG_WARN,'Mail Fetch Error',$msg);
return;
}
$MAX_ERRORS=5; //Max errors before we start delayed fetch attempts - hardcoded for now.
$sql=' SELECT email_id,mail_host,mail_port,mail_protocol,mail_encryption,mail_delete,mail_errors,userid,userpass FROM '.EMAIL_TABLE.
' WHERE mail_active=1 AND (mail_errors<='.$MAX_ERRORS.' OR (TIME_TO_SEC(TIMEDIFF(NOW(),mail_lasterror))>5*60) )'.
' AND (mail_lastfetch IS NULL OR TIME_TO_SEC(TIMEDIFF(NOW(),mail_lastfetch))>mail_fetchfreq*60) ';
//echo $sql;
if(!($accounts=db_query($sql)) || !db_num_rows($accounts))
return;
//TODO: Lock the table here??
while($row=db_fetch_array($accounts)) {
$fetcher = new MailFetcher($row['userid'],Misc::decrypt($row['userpass'],SECRET_SALT),
$row['mail_host'],$row['mail_port'],$row['mail_protocol'],$row['mail_encryption']);
if($fetcher->connect()){
$fetcher->fetchTickets($row['email_id'],$row['mail_fetchmax'],$row['mail_delete']?true:false);
$fetcher->close();
db_query('UPDATE '.EMAIL_TABLE.' SET mail_errors=0, mail_lastfetch=NOW() WHERE email_id='.db_input($row['email_id']));
}else{
$errors=$row['mail_errors']+1;
db_query('UPDATE '.EMAIL_TABLE.' SET mail_errors=mail_errors+1, mail_lasterror=NOW() WHERE email_id='.db_input($row['email_id']));
if($errors>=$MAX_ERRORS){
//We've reached the MAX consecutive errors...will attempt logins at delayed intervals
$msg="\nThe system is having trouble fetching emails from the following mail account: \n".
"\nUser: ".$row['userid'].
"\nHost: ".$row['mail_host'].
"\nError: ".$fetcher->getLastError().
"\n\n ".$errors.' consecutive errors. Maximum of '.$MAX_ERRORS. ' allowed'.
"\n\n This could be connection issues related to the host. Next delayed login attempt in aprox. 10 minutes";
Sys::alertAdmin('Mail Fetch Failure Alert',$msg,true);
}
}
}
}
示例4: addLogDetail
//.........这里部分代码省略.........
break;
case 'ScheduleFactory':
case 'ScheduleListFactory':
unset($diff_arr['recurring_schedule_template_control_id'], $diff_arr['replaced_id']);
break;
case 'PunchFactory':
case 'PunchListFactory':
unset($diff_arr['actual_time_stamp'], $diff_arr['original_time_stamp'], $diff_arr['punch_control_id'], $diff_arr['station_id'], $diff_arr['latitude'], $diff_arr['longitude']);
break;
case 'PunchControlFactory':
case 'PunchControlListFactory':
unset($diff_arr['actual_total_time']);
break;
case 'PunchControlFactory':
case 'PunchControlListFactory':
unset($diff_arr['overlap']);
break;
case 'AccrualFactory':
case 'AccrualListFactory':
unset($diff_arr['user_date_total_id']);
break;
case 'JobItemFactory':
case 'JobItemListFactory':
unset($diff_arr['type_id'], $diff_arr['department_id']);
break;
case 'ClientContactFactory':
case 'ClientContactListFactory':
unset($diff_arr['password'], $diff_arr['password_reset_key'], $diff_arr['password_reset_date']);
break;
case 'UserReviewFactory':
case 'UserReviewListFactory':
unset($diff_arr['user_review_control_id']);
break;
case 'ClientPaymentFactory':
case 'ClientPaymentListFactory':
if (getTTProductEdition() >= TT_PRODUCT_CORPORATE) {
//Only log secure values.
if (isset($diff_arr['cc_number'])) {
$old_data['cc_number'] = isset($old_data['cc_number']) ? $object->getSecureCreditCardNumber(Misc::decrypt($old_data['cc_number'])) : '';
$new_data['cc_number'] = isset($new_data['cc_number']) ? $object->getSecureCreditCardNumber(Misc::decrypt($new_data['cc_number'])) : '';
}
if (isset($diff_arr['bank_account'])) {
$old_data['bank_account'] = isset($old_data['bank_account']) ? $object->getSecureAccount($old_data['bank_account']) : '';
$new_data['bank_account'] = isset($old_data['bank_account']) ? $object->getSecureAccount($new_data['bank_account']) : '';
}
if (isset($diff_arr['cc_check'])) {
$old_data['cc_check'] = isset($old_data['cc_check']) ? $object->getSecureCreditCardCheck($old_data['cc_check']) : '';
$new_data['cc_check'] = isset($old_data['cc_check']) ? $object->getSecureCreditCardCheck($new_data['cc_check']) : '';
}
}
break;
case 'JobApplicantFactory':
case 'JobApplicantListFactory':
unset($diff_arr['password'], $diff_arr['password_reset_key'], $diff_arr['password_reset_date'], $diff_arr['first_name_metaphone'], $diff_arr['last_name_metaphone']);
break;
}
//Ignore specific columns here, like updated_date, updated_by, etc...
unset($diff_arr['id'], $diff_arr['company_id'], $diff_arr['user_date_id'], $diff_arr['name_metaphone'], $diff_arr['created_date'], $diff_arr['created_by'], $diff_arr['created_by_id'], $diff_arr['updated_date'], $diff_arr['updated_by'], $diff_arr['updated_by_id'], $diff_arr['deleted_date'], $diff_arr['deleted_by'], $diff_arr['deleted_by_id'], $diff_arr['deleted']);
//Debug::Arr($diff_arr, 'Array Diff: ', __FILE__, __LINE__, __METHOD__, 10);
if (is_array($diff_arr) and count($diff_arr) > 0) {
foreach ($diff_arr as $field => $value) {
$old_value = NULL;
if (isset($old_data[$field])) {
$old_value = $old_data[$field];
if (is_bool($old_value) and $old_value === FALSE) {
$old_value = NULL;
} elseif (is_array($old_value)) {
//$old_value = serialize($old_value);
//If the old value is an array, replace it with NULL because it will always match the NEW value too.
$old_value = NULL;
}
}
$new_value = $new_data[$field];
if (is_bool($new_value) and $new_value === FALSE) {
$new_value = NULL;
} elseif (is_array($new_value)) {
$new_value = serialize($new_value);
}
//Debug::Text('Old Value: '. $old_value .' New Value: '. $new_value, __FILE__, __LINE__, __METHOD__, 10);
if (!($old_value == '' and $new_value == '')) {
$ph[] = (int) $system_log_id;
$ph[] = $field;
$ph[] = $new_value;
$ph[] = $old_value;
$data[] = '(?,?,?,?)';
}
}
if (isset($data)) {
//Save data in a single SQL query.
$query = 'INSERT INTO ' . $this->getTable() . '(SYSTEM_LOG_ID,FIELD,NEW_VALUE,OLD_VALUE) VALUES' . implode(',', $data);
//Debug::Text('Query: '. $query, __FILE__, __LINE__, __METHOD__, 10);
$this->db->Execute($query, $ph);
Debug::Text('Logged detail records in: ' . (microtime(TRUE) - $start_time), __FILE__, __LINE__, __METHOD__, 10);
return TRUE;
}
}
}
Debug::Text('Not logging detail records, likely no data changed in: ' . (microtime(TRUE) - $start_time) . 's', __FILE__, __LINE__, __METHOD__, 10);
return FALSE;
}
示例5: fetchMail
function fetchMail()
{
global $cfg;
if (!$cfg->canFetchMail()) {
return;
}
//We require imap ext to fetch emails via IMAP/POP3
if (!function_exists('imap_open')) {
$msg = 'PHP deve ser compilado com extensão IMAP habilitado para buscar a trabalhar IMAP/POP3!';
Sys::log(LOG_WARN, 'Erro em buscar o email', $msg);
return;
}
$MAX_ERRORS = 5;
//Max errors before we start delayed fetch attempts - hardcoded for now.
$sql = ' SELECT email_id,mail_host,mail_port,mail_protocol,mail_encryption,mail_delete,mail_errors,userid,userpass FROM ' . EMAIL_TABLE . ' WHERE mail_active=1 AND (mail_errors<=' . $MAX_ERRORS . ' OR (TIME_TO_SEC(TIMEDIFF(NOW(),mail_lasterror))>5*60) )' . ' AND (mail_lastfetch IS NULL OR TIME_TO_SEC(TIMEDIFF(NOW(),mail_lastfetch))>mail_fetchfreq*60) ';
//echo $sql;
if (!($accounts = db_query($sql)) || !db_num_rows($accounts)) {
return;
}
//TODO: Lock the table here??
while ($row = db_fetch_array($accounts)) {
$fetcher = new MailFetcher($row['userid'], Misc::decrypt($row['userpass'], SECRET_SALT), $row['mail_host'], $row['mail_port'], $row['mail_protocol'], $row['mail_encryption']);
if ($fetcher->connect()) {
$fetcher->fetchTickets($row['email_id'], $row['mail_fetchmax'], $row['mail_delete'] ? true : false);
$fetcher->close();
db_query('UPDATE ' . EMAIL_TABLE . ' SET mail_errors=0, mail_lastfetch=NOW() WHERE email_id=' . db_input($row['email_id']));
} else {
$errors = $row['mail_errors'] + 1;
db_query('UPDATE ' . EMAIL_TABLE . ' SET mail_errors=mail_errors+1, mail_lasterror=NOW() WHERE email_id=' . db_input($row['email_id']));
if ($errors >= $MAX_ERRORS) {
//We've reached the MAX consecutive errors...will attempt logins at delayed intervals
$msg = "\nO sistema está tendo problemas para coletar e-mails da conta do e-mail seguinte: \n" . "\nUsuário: " . $row['userid'] . "\nHost: " . $row['mail_host'] . "\nErro: " . $fetcher->getLastError() . "\n\n " . $errors . ' erros consecutivos. Máximo de ' . $MAX_ERRORS . ' permitido' . "\n\n Isso pode ser problemas de conexão relacionados ao hospedeiro. Próxima tentativa de login em aprox. 10 minutos";
Sys::alertAdmin('Alerta de falha na busca por email', $msg, true);
}
}
}
}