Ejemplo n.º 1
0
 function display($tpl = null)
 {
     global $mainframe;
     $id = JRequest::getVar('cid', array(0), '', 'array');
     $boxchecked = JRequest::getVar('boxchecked');
     $uid = (int) @$id[0];
     //$info[0]['comp_name'] = 'aquavue';
     //$data[] = $info;
     $data = getCompanyReport($uid);
     //had to reset the database, otherwise joomla was looking for the component in the 'eyedock_data' database and causing an error (I assume the function above was causing this database switch)
     $connect = mysql_connect('mysql.eyedock.com', 'eyedockdatauser', 'kvBS^VQR');
     $database = mysql_select_db("eyedockjoomla", $connect);
     $this->assignRef('companyInfo', $data);
     parent::display($tpl);
 }
Ejemplo n.º 2
0
 function display($tpl = null)
 {
     global $mainframe;
     $id = JRequest::getVar('cid', array(0), '', 'array');
     $boxchecked = JRequest::getVar('boxchecked');
     //echo $boxchecked;
     $uid = (int) @$id[0];
     $data['company'] = nl2br(getCompanyReport($uid));
     //$date['company'] = str_replace("\n", "<br/>");
     $data['lenses'] = nl2br(getCompanyLensesReport($uid));
     $mysqli = DBAccess::getConnection();
     $sql = "SELECT * from pn_lenses_companies WHERE pn_comp_tid = {$uid}";
     $result = $mysqli->selectQuery($sql);
     $row = $result->fetch_assoc();
     //massage the data for the email
     if ($row['pn_contact_email'] == "") {
         $row['pn_contact_email'] = $row['pn_email'];
     }
     if ($row['pn_comp_name_short'] == "") {
         $row['pn_comp_name_short'] = $row['pn_comp_name'];
     }
     //get the email intro content
     $row['content'] = makeEmailIntro($row);
     //pass along the contact person
     $row['contact'] = $row['pn_contact_nameF'] . " " . $row['pn_contact_nameL'];
     if ($row['pn_contact_nameF'] == "") {
         $row['contact'] = $row['pn_comp_name_short'];
     }
     //echo $data['lenses'];
     //had to reset the database, otherwise joomla was looking for the component in the 'eyedock_data' database and causing an error (I assume the function above was causing this database switch)
     //$connect =mysql_connect('mysql.eyedock.com', 'eyedockdatauser', 'kvBS^VQR');
     //mysql_connect('localhost', 'root', 'root');
     $connect = getCONNECT();
     $database = mysql_select_db("eyedockjoomla", $connect);
     $this->assignRef('data', $data);
     $this->assignRef('companyData', $row);
     parent::display($tpl);
 }
Ejemplo n.º 3
0
<?php

/*ini_set('display_errors', 1); 
ini_set('log_errors', 1); 
ini_set('error_log', dirname(__FILE__) . '/error_log.txt'); 
error_reporting(E_ALL);
ini_set('html_errors', 'On');
*/
include_once $_SERVER['DOCUMENT_ROOT'] . "/eyedock.com/api_new/dataGetters.php";
$company = $_REQUEST['id'];
//the company ID
$data = getCompanyReport($company);
//print_r($data);
$companyInfo = $data['info'][0];
//print_r($companyInfo);
$infoText = "<table border='1' cellspacing='0' bordercolor='#cae0eb' ><tr><td colspan='2'><h2>" . $companyInfo['comp_name'] . "</h2></td></tr>";
$infoText .= "<tr><td>Phone:</td><td> " . $companyInfo['phone'] . "</td></tr>";
$infoText .= "<tr><td>Address: </td><td>" . $companyInfo['address'] . "</td></tr>";
$infoText .= "<tr><td>Website: </td><td><a href='" . $companyInfo['website'] . "'>" . $companyInfo['website'] . " </a></td></tr>";
$infoText .= "<tr><td>Email address: </td><td><a href='mailto:" . $companyInfo['email'] . "'>" . $companyInfo['email'] . " </a><br/>";
$infoText .= "<tr><td>Description: </td><td>" . $companyInfo['description'] . "</td></tr>";
$infoText .= "<tr><td>Contact name*</td><td> " . $companyInfo['contactName'] . "</td></tr>";
$infoText .= "<tr><td>Contact email*</td><td> " . $companyInfo['contactEmail'] . "</td></tr></table>";
$infoText .= "<br/>* the contact name and email are where we (Eyedock) will direct questions regarding " . $companyInfo['comp_name_short'] . "lenses. This information will not be displayed on the website.";
$infoText .= "</p>";
$infoText .= "<p>";
$allLenses = $data['cls'];
//print_r( $allLenses[0]);
$discontinuedArray = array();
foreach ($allLenses as $lens) {
    if ($lens['discontinued'] == 1) {
Ejemplo n.º 4
0
 }
 $lastEmail = strtotime($row['pn_last_email']);
 $interval = $row['pn_email_interval'];
 $daysSinceEmail = (time() - $lastEmail) / 60 / 60 / 24;
 //echo " [" . $daysSinceEmail . " < ". $interval . "], ";
 if ($daysSinceEmail < $interval) {
     continue;
 }
 //it hasn't been long enough
 //just a safeguard (don't automatically send anyone more than 1 email in a month)
 if ($daysSinceEmail < 30) {
     continue;
 }
 $count++;
 //echo "-> " . $row['pn_comp_tid'] . ", ";
 $data['company'] = getCompanyReport($row['pn_comp_tid']);
 $data['lenses'] = getCompanyLensesReport($row['pn_comp_tid']);
 //massage the data for the email
 if ($row['pn_contact_email'] == "") {
     $row['pn_contact_email'] = $row['pn_email'];
 }
 if ($row['pn_comp_name_short'] == "") {
     $row['pn_comp_name_short'] = $row['pn_comp_name'];
 }
 //get the email intro content
 $data['intro'] = makeEmailIntro($row);
 $to = $row['pn_contact_email'];
 $subject = $row['pn_comp_name_short'] . " lenses on EyeDock";
 $contact = $row['pn_contact_nameF'] . " " . $row['pn_contact_nameL'];
 if ($row['pn_contact_nameF'] == "") {
     $contact = $row['pn_comp_name_short'];
Ejemplo n.º 5
0
//not using joomla api. A cron job will call this file directly...
ini_set('display_errors', 1);
ini_set('log_errors', 1);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
error_reporting(E_ALL);
ini_set('html_errors', 'On');
//include_once $_SERVER['DOCUMENT_ROOT']. "/eyedock.com/api_new/dataGetters.php";
include_once "comp_db.php";
include_once "companyFunctions.php";
//get all the companies
$companiesSQL = "SELECT pn_comp_tid from pn_lenses_companies";
$results = $mysqli->query($companiesSQL);
while ($row = $results->fetch_assoc()) {
    //print_r($row['pn_comp_tid']);
    //echo "<br/>";
    $report = getCompanyReport($row['pn_comp_tid']);
    echo "<br/>" . $report;
    $lensReport = getCompanyLensesReport($row['pn_comp_tid']);
}
/*
// multiple recipients (note the commas)
$to = "*****@*****.**";


// subject
$subject = "Testing CL company reports";

// compose message
$message = "
<html>
  <head>
Ejemplo n.º 6
0
<?php

// ini_set('display_errors', 1);
// ini_set('log_errors', 1);
// ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
// error_reporting(E_ALL);
// ini_set('html_errors', 'On');
require_once 'emailer.php';
require_once 'companyFunctions.php';
$to = $_REQUEST['to'];
$subject = $_REQUEST['subject'];
//$report_content = $_REQUEST['report_content'];
$intro = $_REQUEST['email_body'];
$company = $_REQUEST['company'];
$contact = $_REQUEST['contact'];
$id = $_REQUEST['id'];
$companyReport = getCompanyReport($id);
$lensesReport = getCompanyLensesReport($id);
$lensesReport = str_replace("&deg", "", $lensesReport);
$lensesReport = str_replace("<br/>", "\n", $lensesReport);
$content = $intro . "\n\n\n" . $companyReport . "\n\n\n" . $lensesReport;
//echo $content;
emailCompanyReport($to, $subject, $content, $company, $contact);
updateLastEmail($id);