function getFieldsByWebFormUser($id) { $q = new sqlQuery($this->getDbCon()); $q->query("select * from " . $this->table . " where idwebformuser = "******"name"] = $q->getData("name"); $field_arr["size"] = $q->getData("size"); $field_arr["label"] = $q->getData("label"); $data[] = $field_arr; } return $data; }
function updatePaymentExtraAmount($idpaylog, $extra_amt, $mode) { $q = new sqlQuery($this->getDbCon()); $q_update = new sqlQuery($this->getDbCon()); $q->query("select * from paymentlog_extra_amount where idpaymentlog = " . $idpaylog); if ($q->getNumRows()) { $q->fetch(); $idpaymentlog_extra_amount = $q->getData("idpaymentlog_extra_amount"); switch ($mode) { case 'update': $query = "update paymentlog_extra_amount set extra_amt = " . $extra_amt . " \r\n where idpaymentlog_extra_amount= " . $idpaymentlog_extra_amount; break; case 'delete': $query = "delete from paymentlog_extra_amount where \r\n idpaymentlog_extra_amount= " . $idpaymentlog_extra_amount . " Limit 1"; break; } } else { switch ($mode) { case 'update': $query = "Insert Into paymentlog_extra_amount \r\n (`idpaymentlog`,`extra_amt`,`iduser`)\r\n values (" . $idpaylog . "," . $extra_amt . "," . $_SESSION['do_User']->iduser . ")\r\n "; break; } } $q_update->query($query); //echo $query.'<br />';exit; }
function getTaskCategoryName($id) { $q = new sqlQuery($this->getDbCon()); $q->query("select name from task_category where idtask_category =" . $id); $q->fetch(); return $q->getData("name"); }
function getSettingValue($setting_name, $iduser = "") { if ($iduser == "") { $iduser = $_SESSION['do_User']->iduser; } $q = new sqlQuery($this->getDbCon()); $q->query("Select iduser_settings,setting_value from " . $this->table . "\n where iduser = "******" AND setting_name = '" . $setting_name . "'\n "); if ($q->getNumRows()) { $data = array(); while ($q->fetch()) { $data["iduser_settings"] = $q->getData("iduser_settings"); $data["setting_value"] = $q->getData("setting_value"); } return $data; } else { return false; } }
function isDiscussionAlertSet($id, $setting_level, $iduser = "") { if ($iduser == "") { $iduser = $_SESSION['do_User']->iduser; } $q = new sqlQuery($this->getDbCon()); $q->query("Select iddiscussion_email_setting,discussion_email_alert from " . $this->table . " \n Where iduser = "******" AND id = " . $id . " AND setting_level = '" . $setting_level . "'"); if ($q->getNumRows()) { $data = array(); while ($q->fetch()) { $data["iddiscussion_email_setting"] = $q->getData("iddiscussion_email_setting"); $data["discussion_email_alert"] = $q->getData("discussion_email_alert"); } return $data; } else { return false; } }
function isDraftExist($id, $type) { $q = new sqlQuery($this->getDbCon()); $q->query("select * from " . $this->table . " Where id= " . $id . " AND id_type = '" . $type . "' \n AND iduser = "******"idnote_draft"); } else { return false; } }
/** * Get when the user logged in last time * @param integer $iduser * @return idlogin_audit if logged in else return false when the user has never logged in to the system. */ public function getLastLogin($iduser) { $q = new sqlQuery($this->getDbCon()); $q->query("select * from " . $this->table . " where iduser = "******"idlogin_audit"); } else { return false; } }
public function getUserIdRegistered($idinvoice, $iduser) { $q = new sqlQuery($this->getDbCon()); $q->query("select * from " . $this->table . " Where idinvoice = " . $idinvoice . " AND iduser = "******"reg_iduser"); } else { return false; } }
function has_cc_info($idrecurrent) { $q = new sqlQuery($this->getDbCon()); //echo "select * from ".$this->table." where idrecurrentinvoice = ".$idrecurrent; $q->query("select * from " . $this->table . " where idrecurrentinvoice = " . $idrecurrent); if ($q->getNumRows()) { $q->fetch(); return $q->getData("idrecurrent_invoice_cc"); } else { return false; } }
public function checkIfInvoiceIsInRecurrent($idinvoice) { $q = new sqlQuery($this->getDbCon()); // echo "<br /> select * from ".$this->table." where idinvoice = ".$idinvoice.'<br />'; $q->query("select * from " . $this->table . " where idinvoice = " . $idinvoice); if ($q->getNumRows()) { $q->fetch(); return $q->getData("idrecurrentinvoice"); } else { return false; } }
function isNextUrl($idinvoice) { $q = new sqlQuery($this->getDbCon()); $q->query("select * from " . $this->table . " where idinvoice = " . $idinvoice); if ($q->getNumRows()) { $q->fetch(); $next_url = $q->getData("next_url"); if ($next_url != '' && !empty($next_url)) { return $next_url; } else { return false; } } else { return false; } }
function checkIfNotesShared($idcontact = '') { if (empty($idcontact)) { $idcontact = $this->idcontact; } $q = new sqlQuery($this->getDbCon()); $q->query("SELECT portal_code FROM contact WHERE idcontact=" . $idcontact . " AND portal_code != ''"); if ($q->getNumRows()) { while ($q->fetch()) { $portal_code = $q->getData("portal_code"); return $portal_code; } } else { return null; } }
function addUpdateReportData($iduser) { $do_contact = new Contact(); $total_contacts = $do_contact->getTotalNumContactsForUser($iduser); $do_contact_notes = new ContactNotes(); $total_notes = $do_contact_notes->getTotalNumContactNotesForUser($iduser); $do_contact_projects = new Project(); $total_projects = $do_contact_projects->getTotalNumProjectsForUser($iduser); $do_task = new Task(); $total_tasks = $do_task->getTotalNumTasksForUser($iduser); $do_proj_discussion = new ProjectDiscuss(); $total_proj_discussions = $do_proj_discussion->getTotalNumProjectDiscussionsForUser($iduser); $do_invoice = new Invoice(); $total_invoices = $do_invoice->getTotalNumInvoicesForUser($iduser); //total email sent today $msg_con = new sqlQuery($this->getDbCon()); $sql_msg_check = "SELECT SUM(`num_msg_sent`) AS num_msg_sent FROM `message_usage` WHERE `iduser` = " . $iduser; $msg_con->query($sql_msg_check); $total_email_sent = 0; if ($msg_con->getNumRows()) { $msg_con->fetch(); $total_email_sent = $msg_con->getData("num_msg_sent"); } $this->getId($iduser); if ($this->hasData()) { $this->total_contacts = $total_contacts; $this->total_notes = $total_notes; $this->total_projects = $total_projects; $this->total_tasks = $total_tasks; $this->total_discussion = $total_proj_discussions; $this->total_invoices = $total_invoices; $this->current_date = date("Y-m-d"); $this->total_email_sent = $total_email_sent; $this->update(); } else { $this->total_contacts = $total_contacts; $this->total_notes = $total_notes; $this->total_projects = $total_projects; $this->total_tasks = $total_tasks; $this->total_discussion = $total_proj_discussions; $this->total_invoices = $total_invoices; $this->current_date = date("Y-m-d"); $this->iduser = $iduser; $this->total_email_sent = $total_email_sent; $this->add(); } }
public function checkFileAccessSecurity($filename) { $return = false; /* Check if the request is from the Contact Portal and then do the operation */ if ($_SESSION['portal_idcontact'] != '') { $do_cnt_note = new ContactNotes(); if ($do_cnt_note->isDocumentForContact($_SESSION['portal_idcontact'], $filename)) { $return = true; } } elseif ($_SESSION['do_User']->iduser != '') { // We have userid set then the request is from a loggedin user $q_project_discuss = new sqlQuery($this->getDbCon()); $q_project_discuss->query("select idproject_task from project_discuss where document = '" . $filename . "'"); // Check if the file is in project_discuss if ($q_project_discuss->getNumRows()) { $q_project_discuss->fetch(); $do_proj_task = new ProjectTask(); if ($do_proj_task->isProjectTaskReletedToUser($q_project_discuss->getData("idproject_task"), $_SESSION['do_User']->iduser)) { $return = true; } } else { // Not in project Discuss then check in contact_note $q_cnt_note = new ContactNotes(); $q_cnt_note->query("select idcontact from contact_note where document = '" . $filename . "'"); if ($q_cnt_note->getNumRows()) { $q_cnt_note->fetch(); $do_cont = new Contact(); if ($do_cont->isContactRelatedToUser($q_cnt_note->getData("idcontact"))) { $return = true; } } } } return $return; }
/** * Function to get the contact id by email * @param integer $iduser * @param string $email */ function getContactIdByEmail($email, $iduser = "") { if ($iduser == "") { $iduser = $_SESSION['do_User']->iduser; } $q = new sqlQuery($this->getDbCon()); $q->query("select contact.idcontact as idcontact from contact\n left join contact_email\n on contact.idcontact = contact_email.idcontact\n where contact_email.email_address = '" . $email . "' AND contact.iduser = "******"idcontact"); } else { return false; } }
/** * eventSendMessage * This will send a message to one or multiple users. * @todo Problem with the getBodyText(true) it returns some bad encoding and no newline, could also be the problem in the template it self... */ function eventSendMessage(EventControler $event_controler) { $this->setLog("\n eventSendMessage (" . date("Y/m/d H:i:s") . ")"); if ($event_controler->send == _('Send Mailing')) { $email_template = $_SESSION['do_message']; $email_template->setApplyFieldFormating(false); $this->setLog("\n EmailTemplate id: " . $email_template->getPrimarykeyValue()); //$this->setLogObject($email_template); $this->setLog("\n SQL:" . $this->getSqlQuery()); $this->query(); $this->setLog("\n " . $this->getNumRows() . " contacts to send the message"); while ($this->next()) { set_time_limit(500); if ($event_controler->unsubtag == 'on') { // set unsubscribe auto-responder list $values_contact = $this->getValues(); $tag_values = array("flag" => "unsubscribe_autoresponder", "idtag" => $event_controler->idtag); $values = array_merge($values_contact, $tag_values); $message = $this->sendMessage($email_template, $values); } else { $message = $this->sendMessage($email_template, $this->getValues()); } if ($this->last_message_sent) { //$do_contact_notes->iduser = $_SESSION['do_User']->iduser; $do_contact_notes = new ContactNotes(); $do_contact_notes->iduser = $_SESSION['do_User']->iduser; //$do_contact_notes->note = '<b>'.$message->getSubject().'</b><br/>'.$message->getBodyText(true); //->getTemplateBodyHtml(); $note_text = preg_replace('/^(.*?)<hr>.*$/', '$1', str_replace("\n", '', $message->getBodyHtml(true))); $do_contact_notes->note = '<b>' . $message->getSubject() . '</b><br/>' . $note_text; $do_contact_notes->date_added = date("Y-m-d"); $do_contact_notes->idcontact = $this->getPrimaryKeyValue(); $do_contact_notes->add(); /* * Recording the messages sent by User */ $msg_con = new sqlQuery($this->getDbCon()); $sql_msg_check = "SELECT * FROM `message_usage` WHERE `iduser` = " . $_SESSION['do_User']->iduser . " AND `date_sent` = '" . date("Y-m-d") . "'"; $msg_con->query($sql_msg_check); if ($msg_con->getNumRows()) { $msg_con->fetch(); $sql_con_update = new sqlQuery($this->getDbCon()); $sql_msg_update = "UPDATE `message_usage` SET `num_msg_sent` = num_msg_sent+1 WHERE `idmessage_usage` = " . $msg_con->getData("idmessage_usage"); $sql_con_update->query($sql_msg_update); } else { $sql_con_ins = new sqlQuery($this->getDbCon()); $sql_msg_ins = "INSERT INTO `message_usage`(iduser,date_sent,num_msg_sent) VALUES(" . $_SESSION['do_User']->iduser . ",'" . date("Y-m-d") . "',1)"; $sql_con_ins->query($sql_msg_ins); } } } } else { $event_controler->goto = "contacts.php"; } $this->clearSearch(); $this->free(); }
/** * createDate * static version of getCreateDate * @see getCreateDate */ function createDate($tablename, $primary_key_value = 0) { $q = new sqlQuery($GLOBALS['conx']); if (is_object($tablename)) { $actual_tablename = $tablename->getTable(); $primary_key_value = $tablename->getPrimaryKeyValue(); } else { $actual_tablename = $tablename; } $q->query("SELECT created_date FROM `" . $this->getTable() . "` WHERE \n `table_name`='" . $q->quote($actual_tablename) . "' AND \n `id`='" . $q->quote($primary_key_value) . "'"); if ($q->getNumRows() > 0) { return $q->getData("created_date"); } else { return false; } $q->free(); }
/** * Function to update the contact tables for the co-workers at the time of contact merging if the contacts are shared * @param integer $id_to_keep * @param integer $contact_id_del */ function resetContactSharingOnMerging($id_to_keep, $contact_id_del) { $q = new sqlQuery($this->getDbCon()); $q_update = new sqlQuery($this->getDbCon()); $q->query("select * from " . $this->table . " where iduser = "******" AND idcontact = " . $contact_id_del); if ($q->getNumRows() > 0) { while ($q->fetch()) { $q_update->query("update " . $this->table . " set idcontact = " . $id_to_keep . " where idcontact_sharing = " . $q->getData("idcontact_sharing") . " Limit 1"); $co_worker_view = "userid" . $q->getData("idcoworker") . "_contact"; $q_update->query("update " . $co_worker_view . " set idcontact = " . $id_to_keep . " where idcontact = " . $contact_id_del); } } }
/** * Get the Invoice Totals on on the status and then display with displayInvoiceTotals() with the Year * @param $obj -- Object * @param $idcontact -- INT * @param $idcompany -- INT * @return $html_data -- STRING */ function getInvoiceTotals($obj, $idcontact = 0, $idcompany = 0) { $html_data = ''; $q = new sqlQuery($this->getDbCon()); if ($idcontact != 0) { $q->query("select distinct(DATE_FORMAT( datecreated,'%Y')) as year_created from invoice where idcontact = " . $idcontact . " AND status <> 'Cancel'"); } else { if ($idcompany != 0) { $q->query("select distinct(DATE_FORMAT( datecreated,'%Y')) as year_created from invoice where idcompany = " . $idcompany . " AND status <> 'Cancel'"); } } //echo $q->getNumRows(); if ($q->getNumRows()) { while ($q->fetch()) { if ($q->getNumRows() == 1 && $q->getData("year_created") == date("Y")) { $html_data .= $this->displayInvoiceTotals($obj, "Quote", $q->getData("year_created"), $idcontact, $idcompany); $html_data .= $this->displayInvoiceTotals($obj, "Invoice", $q->getData("year_created"), $idcontact, $idcompany); $html_data .= $this->displayInvoiceTotals($obj, "Paid", $q->getData("year_created"), $idcontact, $idcompany); $html_data .= $this->displayInvoiceTotals($obj, "Overdue", $q->getData("year_created"), $idcontact, $idcompany); } else { $html_data .= '<tr><td VALIGN="middle"><b>' . $q->getData("year_created") . '</b></td></tr>'; $html_data .= $this->displayInvoiceTotals($obj, "Quote", $q->getData("year_created"), $idcontact, $idcompany); $html_data .= $this->displayInvoiceTotals($obj, "Invoice", $q->getData("year_created"), $idcontact, $idcompany); $html_data .= $this->displayInvoiceTotals($obj, "Paid", $q->getData("year_created"), $idcontact, $idcompany); $html_data .= $this->displayInvoiceTotals($obj, "Overdue", $q->getData("year_created"), $idcontact, $idcompany); } } } return $html_data; }
echo 'User Name : ' . $user_email . '<br />'; echo 'Date :' . $date_log . '<br />'; if (!empty($time)) { echo 'Time :' . $time . '<br />'; } //preg_match("|\d+|", $note, $task_id); //echo 'Task ID :'.$task_id[0].'<br />'; echo 'Task ID :' . $task_id . '<br />'; //var_dump($m); echo 'Msg : ' . $note . '<br />' . 'Commit Id : <a href="#">' . $commit_hash[0] . '</a><br /><br />'; $note .= '<br />Commit Id : <a href="/plugin/Git/git_commitlog.php?repo_name=' . $repo_name . '&commithash=' . $commit_hash[0] . '">' . $commit_hash[0] . '</a><br /><br />'; $q = new sqlQuery($conx); $q->query("select iduser from user where email='" . $user_email . "'"); if ($q->getNumRows() >= 1) { $q->fetch(); $iduser = $q->getData('iduser'); //echo '<br />Iduser : '******'<br /><br /><br />'; $do_plugin_enable = new PluginEnable(); $id_plugin_enable = $do_plugin_enable->isEnabled("Git Repository", $iduser); if (!empty($id_plugin_enable)) { $do_project_task = new ProjectTask(); $do_project_task->getid($task_id); if ($do_project_task->getNumRows() >= 1) { $q1 = new sqlQuery($conx); $q1->query("select * from project_discuss where idproject_task='" . $task_id[0] . "' and discuss = '" . $note . "' and iduser='******' and date_added ='" . $date_log . "'"); if ($q1->getNumRows() == 0) { $do_project_diss = new ProjectDiscuss(); $do_project_diss->addnew(); $do_project_diss->idproject_task = $task_id; $do_project_diss->discuss = $note; $do_project_diss->date_added = $date_log;
function getCompanyName($idcompany) { $q = new sqlQuery($this->getDbCon()); $q->query("select name from company where idcompany = " . $idcompany); while ($q->fetch()) { $name = $q->getData("name"); $lname = $q->getData("lastname"); } return $name; }
function getInvoiceUrl($id) { $q = new sqlQuery($this->getDbCon()); $q->query("select num from invoice where idinvoice = " . $id); $q->fetch(); $URLstring = '<a href="/Invoice/' . $id . '">Invoice #' . $q->getData('num') . '</a>'; return $URLstring; }
/** * Get the monthly hours worked * @param $iduser -- Int * @param $idproject -- Int * @return total hours */ function getTotalHoursEnteredByIndividual($iduser, $type) { switch ($type) { case 'Today': $where .= " AND project_discuss.date_added= CURDATE()"; break; case 'PreviousDay': $where .= " AND project_discuss.date_added = DATE_SUB(CURDATE(),INTERVAL 1 DAY)"; break; case 'LastWeek': $where .= " where project_discuss.date_added <= CURDATE() AND project_discuss.date_added >= DATE_SUB(CURDATE(),INTERVAL 7 day)"; break; } $where .= " AND project_discuss.hours_work <>'0.00' "; if ($iduser != "") { $where .= " AND project_discuss.iduser = "******"SELECT sum( project_discuss.hours_work ) AS total_hrs FROM project_task\n left JOIN project_discuss ON project_discuss.idproject_task = project_task.idproject_task\n " . $where . " "; //echo $qry;exit; $q->query($qry); $q->fetch(); return $q->getData("total_hrs"); }
/** * Determine if tweets should be imported */ function cronFeedStatus($iduser, $tw_friend_id, $tweettime) { $q = new sqlQuery($this->getDbCon()); $q->query("SELECT c.idcontact, cw.idcontact_website FROM contact c INNER JOIN contact_website cw ON c.idcontact = cw.idcontact WHERE c.tw_user_id = " . $tw_friend_id . " AND c.iduser = "******" AND cw.website_type = 'Twitter' AND cw.feed_auto_fetch = 'Yes' AND cw.feed_last_fetch <> '" . $tweettime . "'"); if ($q->getNumRows()) { $q->fetch(); $idcontact = $q->getData("idcontact"); $idcontact_website = $q->getData("idcontact_website"); $q->query("UPDATE contact_website SET feed_last_fetch = '" . $tweettime . "' WHERE idcontact_website = " . $idcontact_website); return $idcontact; } return false; }
/** * Function to delete the invoice payment * For single payment and single invoice it will delete the data straight away * If the payment is attached to multiple invoices then it will first show the alert to the user and * if user wants to delete the payment then it will delete the payment from the attached invoices * @param object $evtcl */ function eventDeletePaymentLog(EventControler $evtcl) { if ($evtcl->id) { $q = new sqlQuery($this->getDbCon()); $q1 = new sqlQuery($this->getDbCon()); $sql = "SELECT COUNT(payment_invoice.idpayment) AS num_inv \n FROM payment_invoice INNER JOIN paymentlog \n ON paymentlog.idpaymentlog = payment_invoice.idpayment\n WHERE paymentlog.idpaymentlog = {$evtcl->id}\n "; $q->query($sql); if ($q->getNumRows()) { $q->fetch(); $num_inv = $q->getData("num_inv"); if ($num_inv == 1) { $do_inv = new Invoice(); $this->getId($evtcl->id); $idinvoice = $this->idinvoice; $sql_del_paymentlog = "DELETE FROM {$this->table} WHERE idpaymentlog = '{$evtcl->id}'"; $sql_del_paymentinv = "DELETE FROM payment_invoice WHERE idpayment = '{$evtcl->id}'"; $sql_del_ext_amt = "DELETE FROM paymentlog_extra_amount WHERE idpaymentlog = '{$evtcl->id}'"; $q->query($sql_del_paymentlog); $q->query($sql_del_paymentinv); $q->query($sql_del_ext_amt); $do_inv->deletePaymentFromInvoice($idinvoice, $evtcl->amt); $_SESSION['in_page_message'] = _("Payment has been deducted from the invoice."); } if ($num_inv > 1) { $do_inv = new Invoice(); if ($evtcl->del_mul_confirm != 'Yes') { $_SESSION['in_page_message'] = _("This Payment is shared with multiple invoices."); $_SESSION['in_page_message_inv_mul_pay_del'] = 'Yes'; $_SESSION['in_page_message_inv_idpaymentlog'] = (int) $evtcl->id; $evtcl->setDisplayNext(new Display("invoice_alert.php")); } else { $sql = "SELECT payment_invoice.* \n FROM payment_invoice \n INNER JOIN paymentlog \n ON paymentlog.idpaymentlog = payment_invoice.idpayment\n WHERE paymentlog.idpaymentlog = {$evtcl->id}\n "; $q1->query($sql); if ($q1->getNumRows() > 0) { while ($q1->fetch()) { $idinvoice = $q1->getData("idinvoice"); $idpayment = $q1->getData("idpayment"); $amt = $q1->getData("amount"); $do_inv->deletePaymentFromInvoice($idinvoice, $amt); } $sql_del_paymentlog = "DELETE FROM {$this->table} WHERE idpaymentlog = '{$idpayment}'"; $sql_del_paymentinv = "DELETE FROM payment_invoice WHERE idpayment = '{$idpayment}'"; $sql_del_ext_amt = "DELETE FROM paymentlog_extra_amount WHERE idpaymentlog = '{$idpayment}'"; $q1->query($sql_del_paymentlog); $q1->query($sql_del_paymentinv); $q1->query($sql_del_ext_amt); $evtcl->setDisplayNext(new Display("/Invoice/" . $_SESSION['do_invoice']->idinvoice)); } } } } } }
/** * Function to check the project is already associated with git repository * @param idproject * @return Git Repository Name **/ function CheckGitProjectExist($idproject) { $q = new sqlQuery($this->getDbCon()); $q->query("SELECT u.git_repo as git_repo,g.idgit_project as idgit_project from git_project g inner join user_gitrepo u on g.iduser_gitrepo=u.iduser_gitrepo where g.idproject='" . $idproject . "'"); if ($q->getNumRows() >= 1) { $data = array(); while ($q->fetch()) { $data['git_repo'] = $q->getData('git_repo'); $data['idgit_project'] = $q->getData('idgit_project'); } return $data; } else { return false; } }
/** * Get the Total Number of project discussion for a user * @param $iduser -- Int * @return numbers */ function getTotalNumProjectDiscussionsForUser($iduser) { $q = new sqlQuery($this->getDbCon()); $sql = "SELECT COUNT(idproject_discuss) AS total_project_discuss\n\t\t\t FROM `{$this->table}` \n\t\t\t WHERE `iduser` = {$iduser}\n\t\t\t"; $q->query($sql); if ($q->getNumRows()) { $q->fetch(); return $q->getData("total_project_discuss"); } else { return "0"; } }
public function eventAjaxCloseMessage(EventControler $event_controler) { $this->getId($event_controler->idmessage); $q_check = new sqlQuery($this->getDbCon()); $q_check->query("select idmessage_user from message_user where key_name='" . $this->key_name . "' and iduser="******"update message_user set closed_until=date_add(now(), interval " . $this->close_duration . ") where idmessage_user="******"idmessage_user")); } else { $q_set->query("insert into message_user values ('', '" . $this->key_name . "', " . $_SESSION['do_User']->iduser . ", date_add(now(), interval " . $this->close_duration . "))"); } //$this->setLog($q_set->getSqlQuery()); $_SESSION['message_closed'][$this->key_name] = true; $q_check->free(); $q_set->free(); }
function insertNoteForAutoFetchOn() { $q = new sqlQuery($this->getDbCon()); $q->query("SELECT * FROM contact_website WHERE feed_auto_fetch = 'Yes' AND website_type <> 'Twitter'"); if ($q->getNumRows()) { $f_feed = new Feed(); while ($q->fetch()) { $do_contact_note = new ContactNotes($this->getDbCon()); $this->getId($q->getData("idcontact_website")); $do_contact = new Contact(); $do_contact->getId($this->idcontact); //print_r($do_contact); //exit; if (!$do_contact->hasData()) { continue; } $do_user = $do_contact->getParentUser(); if (!$do_user->hasData()) { continue; } //print_r($do_user); //exit; $website = $q->getData("website"); $website = (substr(ltrim($website), 0, 7) != 'http://' ? 'http://' : '') . $website; $arr_item = array(); //try { $arr_items = $f_feed->retrieveSinceLastFetch($website, $q->getData("idcontact_website")); //}catch(Exception $ex){ // $f_feed->turnFeedOff($q->getData("idcontact_website")); //} if (is_array($arr_items)) { foreach ($arr_items as $arr_item) { if ($q->getData("feed_last_fetch") < $arr_item[1]) { $do_contact_note->idcontact = $q->getData("idcontact"); $link = "<br /><a href='" . $website . "' target='_blank'>" . _('Back to the Source of the Article') . "</a><br />"; $search = array('<br />', '<br>', '<br >', '<br/>'); $replace = "\n"; $note_content = $arr_item[0]; $note_content = nl2br(strip_tags($note_content)); $note_content = preg_replace('/(<br[^>]*>\\s*){2,}/', '<br/>', $note_content); $do_contact_note->note = $note_content . $link; //$do_contact_note->note = nl2br(strip_tags(str_replace($search, $replace, $arr_item[0]))).$link; $do_contact_note->date_added = date('Y-m-d'); //$do_contact_note->iduser = $do_contact->getIdUser($q->getData("idcontact")); $do_contact_note->iduser = $do_user->iduser; $do_contact_note->type = 'RSS'; //$do_contact_note->iduser = 20; //$do_contact_note->iduser = $_SESSION['do_User']->iduser; $do_contact_note->add(); $do_wf_rss_feed_import = new WorkFeedRssFeedImport(); $do_wf_rss_feed_import->addRssFeed($do_contact_note, $website, $note_content); } } } $this->feed_last_fetch = time(); $this->update(); //$do_contact_note->free(); } } }
$do_tag->getId($idtag); $tag_name = $do_tag->tag_name; $do_user = new User(); $do_user->getId($iduser); $user_idcontact = $do_user->idcontact; $q_auto_resp = new sqlQuery($GLOBALS['conx']); /*$sql_auto_resp = "SELECT ar.name,arem.subject FROM autoresponder AS ar INNER JOIN autoresponder_email AS arem ON ar.idautoresponder = arem.idautoresponder WHERE ar.iduser = {$iduser} AND ar.tag_name = '{$tag_name}'";*/ $sql_auto_resp = "SELECT `name` FROM autoresponder\n WHERE iduser = {$iduser} AND tag_name = '{$tag_name}'"; $q_auto_resp->query($sql_auto_resp); $responder = ""; $resp_email_subj = ""; if ($q_auto_resp->getNumRows()) { $q_auto_resp->fetch(); $responder = $q_auto_resp->getData("name"); //$resp_email_subj = $q_auto_resp->getData("subject"); } else { $message = 'already_unsub_from_list'; } $do_cont_note = new ContactNotes(); $do_cont_note->addNew(); $do_cont_note->idcontact = $idcontact; $do_cont_note->note = $firstname . " " . $lastname . " has unsubscribed from the autoresponder series called " . $responder; $do_cont_note->date_added = date("Y-m-d"); $do_cont_note->iduser = $iduser; $do_cont_note->add(); $do_workfeed_uns = new WorkFeedContactUnsubscibeEmails(); $do_workfeed_uns->addUnsubscribeEmailWorkfeed($do_cont_note, $responder); $q = new sqlQuery($GLOBALS['conx']); $sql = "DELETE FROM `tag` WHERE iduser={$iduser} AND idreference={$idcontact} AND idtag={$idtag}";