From 1290d4a5e722b9bdaeb02b33cf4db3a8505816b0 Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@osticket.com> Date: Sat, 28 Jul 2012 04:04:11 -0400 Subject: [PATCH] Minor terminology changes + lint fixes (love you lint) --- api/pipe.php | 2 +- include/class.config.php | 14 +++++++------- include/class.mailfetch.php | 8 ++++---- include/client/open.inc.php | 2 +- open.php | 2 +- scp/autocron.php | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/api/pipe.php b/api/pipe.php index 381745a1c..b1835a88f 100644 --- a/api/pipe.php +++ b/api/pipe.php @@ -21,7 +21,7 @@ require_once(INCLUDE_DIR.'class.mailparse.php'); require_once(INCLUDE_DIR.'class.email.php'); //Make sure piping is enabled! -if(!$cfg->enableEmailPiping()) +if(!$cfg->isEmailPipingEnabled()) api_exit(EX_UNAVAILABLE,'Email piping not enabled - check MTA settings.'); //Get the input $data=isset($_SERVER['HTTP_HOST'])?file_get_contents('php://input'):file_get_contents('php://stdin'); diff --git a/include/class.config.php b/include/class.config.php index 2c9afb244..cc9b49768 100644 --- a/include/class.config.php +++ b/include/class.config.php @@ -320,23 +320,23 @@ class Config { return ($this->config['clickable_urls']); } - function canFetchMail() { - return ($this->config['enable_mail_polling']); - } - function enableStaffIPBinding() { return ($this->config['staff_ip_binding']); } - function enableCaptcha() { + function isCaptchaEnabled() { return (extension_loaded('gd') && function_exists('gd_info') && $this->config['enable_captcha']); } - function enableAutoCron() { + function isAutoCronEnabled() { return ($this->config['enable_auto_cron']); } + + function isEmailPollingEnabled() { + return ($this->config['enable_mail_polling']); + } - function enableEmailPiping() { + function isEmailPipingEnabled() { return ($this->config['enable_email_piping']); } diff --git a/include/class.mailfetch.php b/include/class.mailfetch.php index 39e19f21c..b655b6bb9 100644 --- a/include/class.mailfetch.php +++ b/include/class.mailfetch.php @@ -389,7 +389,7 @@ class MailFetcher { $var['subject']=$mailinfo['subject']?$this->mime_decode($mailinfo['subject']):'[No Subject]'; $var['message']=Format::stripEmptyLines($this->getBody($mid)); $var['header']=$this->getHeader($mid); - $var['emailId']=$emailid?$emailid:$ost->getConfig()->getDefaultEmailId(); //ok to default? + $var['emailId']=$emailId?$emailId:$ost->getConfig()->getDefaultEmailId(); //ok to default? $var['name']=$var['name']?$var['name']:$var['email']; //No name? use email $var['mid']=$mailinfo['mid']; @@ -403,9 +403,9 @@ class MailFetcher { $newticket=true; //Check the subject line for possible ID. if($var['subject'] && preg_match ("[[#][0-9]{1,10}]", $var['subject'], $regs)) { - $extid=trim(preg_replace("/[^0-9]/", "", $regs[0])); + $tid=trim(preg_replace("/[^0-9]/", "", $regs[0])); //Allow mismatched emails?? For now NO. - if(!($ticket=Ticket::lookupByExtId($extId)) || strcasecmp($ticket->getEmail(), $var['email'])) + if(!($ticket=Ticket::lookupByExtId($tid)) || strcasecmp($ticket->getEmail(), $var['email'])) $ticket=null; } @@ -496,7 +496,7 @@ class MailFetcher { function run() { global $ost; - if(!$ost->getConfig()->canFetchMail()) + if(!$ost->getConfig()->isEmailPollingEnabled()) return; //We require imap ext to fetch emails via IMAP/POP3 diff --git a/include/client/open.inc.php b/include/client/open.inc.php index 42cf10c92..2fd076100 100644 --- a/include/client/open.inc.php +++ b/include/client/open.inc.php @@ -122,7 +122,7 @@ $info=($_POST && $errors)?Format::htmlchars($_POST):$info; } ?> <?php - if($cfg && $cfg->enableCaptcha() && (!$thisclient || !$thisclient->isValid())) { + if($cfg && $cfg->isCaptchaEnabled() && (!$thisclient || !$thisclient->isValid())) { if($_POST && $errors && !$errors['captcha']) $errors['captcha']='Please re-enter the text again'; ?> diff --git a/open.php b/open.php index 7bdc8fc8f..a7f064fb9 100644 --- a/open.php +++ b/open.php @@ -22,7 +22,7 @@ if($_POST): if($thisclient) { $_POST['name']=$thisclient->getName(); $_POST['email']=$thisclient->getEmail(); - } elseif($cfg->enableCaptcha()) { + } elseif($cfg->isCaptchaEnabled()) { if(!$_POST['captcha']) $errors['captcha']='Enter text shown on the image'; elseif(strcmp($_SESSION['captcha'],md5($_POST['captcha']))) diff --git a/scp/autocron.php b/scp/autocron.php index 0e8938160..08b65ba34 100644 --- a/scp/autocron.php +++ b/scp/autocron.php @@ -33,9 +33,9 @@ $sec=time()-$_SESSION['lastcroncall']; if($sec>180): //user can call cron once every 3 minutes. require_once(INCLUDE_DIR.'class.cron.php'); Cron::TicketMonitor(); //Age tickets: We're going to age tickets regardless of cron settings. -if($cfg && $cfg->enableAutoCron()){ //ONLY fetch tickets if autocron is enabled! +if($cfg && $cfg->isAutoCronEnabled()) { //ONLY fetch tickets if autocron is enabled! Cron::MailFetcher(); //Fetch mail. - $ost->logDebug('Autocron', 'Cron job executed ['.$thisstaff->getUserName().']'); + $ost->logDebug('Auto Cron', 'Mail fetcher cron call ['.$thisstaff->getUserName().']'); } $_SESSION['lastcroncall']=time(); -- GitLab