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); }
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']; } $content = $data['intro'] . "\n\n" . $data['company'] . $data['lenses']; echo $content; emailCompanyReport($to, $subject, $content, $row['pn_comp_name_short'], $contact); updateLastEmail($row['pn_comp_tid']); }