Changeset 1583085
- Timestamp:
- 01/26/2017 11:52:02 PM (9 years ago)
- Location:
- ose-firewall/trunk
- Files:
-
- 2 added
- 4 edited
-
ose_firewall_badge.php (modified) (1 diff)
-
ose_wordpress_firewall.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
vendor/oseframework/emails/oseEmail.php (modified) (1 diff)
-
vendor/oseframework/emails/oseEmailBase.php (added)
-
vendor/oseframework/emails/oseEmailWP.php (added)
Legend:
- Unmodified
- Added
- Removed
-
ose-firewall/trunk/ose_firewall_badge.php
r1581695 r1583085 4 4 Description: Plugin For Showing Centrora Security Badge 5 5 Author: Centrora Security 6 Version: 6.6. 16 Version: 6.6.2 7 7 */ 8 8 //include(dirname(__FILE__).'/includes/oseBadgeWidget.php'); -
ose-firewall/trunk/ose_wordpress_firewall.php
r1581695 r1583085 5 5 Description: Centrora Security (previously OSE Firewall) - A WordPress Security Firewall plugin created by Centrora. Protect your WordPress site by identify any malicious codes, spam, virus, SQL injection, and security vulnerabilities. 6 6 Author: Centrora (Previously ProWeb) 7 Version: 6.6. 17 Version: 6.6.2 8 8 Author URI: http://www.centrora.com/ 9 9 */ -
ose-firewall/trunk/readme.txt
r1581695 r1583085 5 5 Tags: wordpress security, admin, anti-spam, comments, anti-hack, anti-virus, firewall, plugin, virus cleaning, google, phishing, malware, google drive, google drive backup, dropbox, dropbox backup, one drive, one drive backup, virus scanner, malware scanning, malware removal, backup, wordpress backup 6 6 Requires at least: 3.7 7 Tested up to: 4.7. 18 Stable tag: 6.6. 17 Tested up to: 4.7.2 8 Stable tag: 6.6.2 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 164 164 165 165 == Changelog == 166 167 = 6.6.2 = 168 * Update Mailer class to remove Joomla version codes 166 169 167 170 = 6.6.1 = -
ose-firewall/trunk/vendor/oseframework/emails/oseEmail.php
r1581695 r1583085 29 29 } 30 30 31 class oseEmail 32 { 33 protected $table = '#__ose_app_email'; 34 protected $app = null; 35 protected $db = null; 36 protected $cms = null; 37 public function __construct($app) 38 { 39 $this->app = $app; 40 $this->setCMS(); 41 $this->setDB(); 42 $this->loadRequest (); 43 } 44 private function loadRequest() 45 { 46 oseFramework::loadRequest(); 47 } 48 private function setCMS() 49 { 50 $this->cms = OSE_CMS; 51 } 52 private function setDB() 53 { 54 switch ($this->cms) 55 { 56 case 'joomla': 57 $this->db = oseJoomla::getDBO(); 58 break; 59 case 'wordpress': 60 $this->db = oseWordpress::getDBO(); 61 break; 62 } 63 } 64 public function getEmailList() 65 { 66 $limit = oRequest::getInt('limit', 25); 67 $start = oRequest::getInt('start', 0); 68 $page = oRequest::getInt('page', 1); 69 $search = oRequest::getVar('search', null); 70 $start = $limit * ($page - 1); 71 return $this->convertEmail($this->getEmailListDB ($search, $start, $limit)); 72 } 73 private function getEmailListDB($search, $start, $limit) 74 { 75 $query = " SELECT `id`, `subject` FROM `{$this->table}` "." WHERE `app` = ".$this->db->quoteValue($this->app)." LIMIT ".$start.", ".$limit; 76 $this->db->setQuery($query); 77 return $this->db->loadObjectList(); 78 } 79 private function convertEmail($results) 80 { 81 $i = 0; 82 foreach ($results as $result) 83 { 84 $results[$i]->view = $this->getViewIcon ($results[$i]->id); 85 $i++; 86 } 87 return $results; 88 } 89 private function getViewIcon($id) 90 { 91 return "<a href='#' onClick= 'viewEmailDetail(".urlencode($id).", url, option, controller, \"getEmail\")' ><div class='ose-grid-info'></div></a>"; 92 } 93 public function getEmailListTotal() 94 { 95 $query = " SELECT COUNT(`id`) as `count` FROM `{$this->table}` WHERE `app` = ".$this->db->quoteValue($this->app); 96 $this->db->setQuery($query); 97 $result = (object) ($this->db->loadResult()); 98 return $result->count; 99 } 100 public function getAdminEmailList() 101 { 102 oseFramework::loadRequest(); 103 $limit = oRequest::getInt('limit', 25); 104 $start = oRequest::getInt('start', 0); 105 $page = oRequest::getInt('page', 1); 106 $search = oRequest::getVar('search', null); 107 $start = $limit * ($page - 1); 108 $list = $this->getAdminEmailListDB($search, $start, $limit); 109 return $list; 110 } 111 public function getAdminEmailListDB($search, $start, $limit) 112 { 113 oseFirewall::callLibClass('convertviews', 'convertviews'); 114 $where = array(); 115 if (!empty($search)) 116 { 117 $where[] = "`subject` LIKE ".$this->db->quoteValue('%'.$search.'%', true); 118 } 119 $where[] = "`email`.`app` = ".$this->db->quoteValue($this->app); 120 $where = $this->db->implodeWhere($where); 121 if (OSE_CMS == 'joomla') 122 { 123 $attrList = array("`email`.subject AS subject", "`email`.id AS id", "`email`.id AS email_id", "`users`.id AS user_id", "`users`.name AS name", ); 124 } 125 else 126 { 127 $attrList = array("`email`.subject AS subject", "`email`.id AS id", "`email`.id AS email_id", "`users`.ID AS user_id", "`users`.display_name AS name", ); 128 } 129 $sql = convertViews::convertAdminEmail($attrList); 130 $query = $sql.$where; 131 $this->db->setQuery($query); 132 return $this->db->loadObjectList(); 133 } 134 public function getEmailParams($id) 135 { 136 $result = $this->getEmailParamsDB($id); 137 $params = oseJSON::decode($result); 138 $return = array(); 139 $i = 0; 140 foreach ($params as $key => $value) 141 { 142 $return[$i]['key'] = $key; 143 $return[$i]['value'] = $value; 144 $i++; 145 } 146 return $return; 147 } 148 private function getEmailParamsDB($id) 149 { 150 $where = array(); 151 $where[] = " `id` = ".(int) $id; 152 $where = $this->db->implodeWhere($where); 153 $query = " SELECT `params` FROM `#__ose_app_email` ".$where; 154 $this->db->setQuery($query); 155 $result = $this->db->loadResult(); 156 return (!empty($result['params'])) ? $result['params'] : false; 157 } 158 public function getEmail($id) 159 { 160 $query = " SELECT `id`, `subject` as emailSubject, `body` as emailBody, `type` as emailType FROM `{$this->table}` WHERE `id` = ".(int) $id; 161 $this->db->setQuery($query); 162 $item = $this->db->loadObject(); 163 return $item; 164 } 165 public function saveemail($id, $emailType, $emailBody, $emailSubject) 166 { 167 $varValues = array( 168 'type' => $emailType, 169 'subject' => $emailSubject, 170 'body' => $emailBody 171 ); 172 $id = $this->db->addData('update', '#__ose_app_email', 'id', (int) $id, $varValues); 173 if ($id == true) 174 { 175 return $id; 176 } 177 else 178 { 179 return false; 180 } 181 } 182 public function addemail($emailType, $emailBody, $emailSubject) 183 { 184 $varValues = array( 185 'id' => 'DEFAULT', 186 'app' => $this->app, 187 'type' => $emailType, 188 'subject' => $emailSubject, 189 'body' => $emailBody 190 ); 191 $id = $this->db->addData('insert', '#__ose_app_email', '', '', $varValues); 192 if (!empty($id)) 193 { 194 return $id; 195 } 196 else 197 { 198 return false; 199 } 200 } 201 public function addadminemailmap($userid, $emailid) 202 { 203 $admin_id = $this->getadminid($userid); 204 if (empty($admin_id)) 205 { 206 $admin_id = $this->addadminid($userid); 207 } 208 $varValues = array( 209 'admin_id' => (int) $admin_id, 210 'email_id' => (int) $emailid 211 ); 212 $this->db->addData('insert', '#__ose_app_adminrecemail', '', '', $varValues); 213 $success = $this->isMappingExits ($userid, $emailid); 214 return $success; 215 } 216 private function isMappingExits($userid, $emailid) 217 { 218 $admin_id = $this->getadminid($userid); 219 $query = " SELECT COUNT(`admin_id`) AS count FROM `#__ose_app_adminrecemail` WHERE `admin_id` = ".(int) $admin_id." AND `email_id` = ".$emailid; 220 $this->db->setQuery($query); 221 $item = (object) $this->db->loadResult(); 222 return ($item->count > 0) ? true : false; 223 } 224 public function getadminid($userid) 225 { 226 $query = " SELECT `id` FROM `#__ose_app_admin` WHERE `user_id` = ".(int) $userid." LIMIT 1"; 227 $this->db->setQuery($query); 228 $item = $this->db->loadObject(); 229 return (isset($item->id) && !empty($item->id)) ? $item->id : null; 230 } 231 private function addadminid($userid) 232 { 233 $varValues = array( 234 'id' => 'DEFAULT', 235 'user_id' => (int) $userid 236 ); 237 $id = $this->db->addData('insert', '#__ose_app_admin', '', '', $varValues); 238 return $id; 239 } 240 public function deleteadminemailmap($admin_id, $email_id) 241 { 242 return $this->db->deleteRecord(array( 243 'admin_id' => $admin_id, 244 'email_id' => $email_id 245 ), '#__ose_app_adminrecemail'); 246 } 247 public function getEmailByType($type) 248 { 249 $query = " SELECT `id`, `subject` as emailSubject, `body` as emailBody, `type` as emailType FROM `{$this->table}` WHERE `type` = ".$this->db->quoteValue($type, true)." LIMIT 1"; 250 $this->db->setQuery($query); 251 $item = $this->db->loadObject(); 252 return $item; 253 } 254 public function sendMail($email, $config_var) 255 { 256 $receiptients = $this->getReceiptients($email->id); 257 if (empty($receiptients)) 258 { 259 return false; 260 } 261 foreach ($receiptients as $receiptient) 262 { 263 $email->body = str_replace('[user]', $receiptient->name, $email->body); 264 require_once(OSE_FRAMEWORKDIR.ODS.'oseframework'.ODS.'emails'.ODS.'oseEmailHelper.php'); 265 if (OSE_CMS=='wordpress') { 266 require_once(OSE_ABSPATH.'/wp-includes/class-phpmailer.php'); 267 $mailer = new PHPMailer(); 268 } 269 else { 270 require_once(OSE_FRAMEWORKDIR.ODS.'oseframework'.ODS.'emails'.ODS.'phpmailer'.ODS.'phpmailer.php'); 271 require_once(OSE_FRAMEWORKDIR.ODS.'oseframework'.ODS.'emails'.ODS.'phpmailer'.ODS.'smtp.php'); 272 $mailer = new cPHPMailer(); 273 if ($config_var->mailer == 'smtp') 274 { 275 $mailer->useSMTP($config_var->smtpauth, $config_var->smtphost, $config_var->smtpuser, $config_var->smtppass, $config_var->smtpsecure, $config_var->smtpport); 276 } 277 } 278 $mailer->From = $config_var->mailfrom; 279 $mailer->FromName = $config_var->fromname; 280 $this->addRecipient($mailer, $receiptient->email); 281 $mailer->Subject = OSEMailHelper::cleanLine($email->subject); 282 $mailer->Body = OSEMailHelper::cleanText($email->body); 283 $mailer->IsHTML(true); 284 $mailer->Send(); 285 } 286 return true; 287 } 288 public function sendMailTo($email, $config_var, $receiptients) 289 { 290 if (empty($receiptients)) 291 { 292 return false; 293 } 294 foreach ($receiptients as $receiptient) 295 { 296 $email->body = str_replace('[user]', $receiptient->name, $email->body); 297 require_once(OSE_FRAMEWORKDIR.ODS.'oseframework'.ODS.'emails'.ODS.'oseEmailHelper.php'); 298 if (OSE_CMS=='wordpress') { 299 require_once(OSE_ABSPATH.'/wp-includes/class-phpmailer.php'); 300 $mailer = new PHPMailer(); 301 } 302 else { 303 require_once(OSE_FRAMEWORKDIR.ODS.'oseframework'.ODS.'emails'.ODS.'phpmailer'.ODS.'phpmailer.php'); 304 require_once(OSE_FRAMEWORKDIR.ODS.'oseframework'.ODS.'emails'.ODS.'phpmailer'.ODS.'smtp.php'); 305 $mailer = new cPHPMailer(); 306 if ($config_var->mailer == 'smtp') 307 { 308 $mailer->useSMTP($config_var->smtpauth, $config_var->smtphost, $config_var->smtpuser, $config_var->smtppass, $config_var->smtpsecure, $config_var->smtpport); 309 } 310 } 311 $mailer->From = $config_var->mailfrom; 312 $mailer->FromName = $config_var->fromname; 313 $this->addRecipient($mailer, $receiptient->email); 314 $mailer->Subject = OSEMailHelper::cleanLine($email->subject); 315 $mailer->Body = OSEMailHelper::cleanText($email->body); 316 $mailer->IsHTML(true); 317 $mailer->Send(); 318 } 319 return true; 320 } 321 protected function addRecipient(&$mailer, $recipient) 322 { 323 // If the recipient is an array, add each recipient... otherwise just add the one 324 if (is_array($recipient)) 325 { 326 foreach ($recipient as $to) 327 { 328 $to = OSEMailHelper::cleanLine($to); 329 $mailer->AddAddress($to); 330 } 331 } 332 else 333 { 334 $recipient = OSEMailHelper::cleanLine($recipient); 335 $mailer->AddAddress($recipient); 336 } 337 } 338 protected function getReceiptients($emailid) 339 { 340 oseFirewall::callLibClass('convertviews', 'convertviews'); 341 if (OSE_CMS == 'joomla') 342 { 343 $attrList = array("`users`.`name` AS `name`, `users`.`email` AS `email`"); 344 } 345 else 346 { 347 $attrList = array("`users`.`display_name` AS `name`, `users`.`user_email` AS `email`"); 348 } 349 $sql = convertViews::convertAdminEmail($attrList); 350 $query = $sql." where `adminemail`.`email_id`= ".(int) $emailid; 351 $this->db->setQuery($query); 352 $items = $this->db->loadObjectList(); 353 return $items; 354 } 355 public function getTOS($id = null) 356 { 357 if (empty($id)) 358 { 359 $query = "SELECT * FROM `{$this->table}` where `type` = 'tos' ORDER BY id DESC LIMIT 1 "; 360 } 361 else 362 { 363 $query = "SELECT * FROM `{$this->table}` where `id` = ".(int) $id; 364 } 365 $this->db->setQuery($query); 366 $item = $this->db->loadObject(); 367 return $item; 368 } 369 public function closeDBO () { 370 $this->db->closeDBO (); 371 } 31 if (OSE_CMS =='wordpress') { 32 require_once (dirname(__FILE__).'/oseEmailWP.php'); 33 class oseEmail extends oseEmailWP 34 { 35 36 } 372 37 } 38 else { 39 require_once (dirname(__FILE__).'/oseEmailJL.php'); 40 class oseEmail extends oseEmailJL 41 { 42 43 } 44 }
Note: See TracChangeset
for help on using the changeset viewer.