function default_Disp($field_value = "") { if (!$this->getRData('hidden')) { $dbc = $this->getDbCon(); //$dbc = $GLOBALS['conx']; list($tablename, $fielduniqid, $fielddisplay, $defaultvalue, $query) = explode(":", $this->getRData('list')); if ($fielduniqid != $fielddisplay) { if (!empty($field_value)) { $qFieldDisplay = new sqlQuery($dbc); $qFieldDisplay->query("select {$fielduniqid}, {$fielddisplay} from {$tablename} where {$fielduniqid}='" . $field_value . "'"); $avfielddisplay = $qFieldDisplay->fetchArray(); $fval = ""; for ($i = 1; $i < count($avfielddisplay); $i++) { $fval .= $avfielddisplay[$i] . " "; } $fval = substr($fval, 0, strlen($fval) - 2); $qFieldDisplay->free(); } else { $fval = ""; } } else { $fval = $field_value; } if (!$this->getRdata('execute')) { $fval = $this->no_PhpCode($fval); } $this->processed .= $fval; } }
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"); }
/** * setEmailTemplate load an instance of an email message to be sent or merged * Loading the template directly from the database should not be used anymore, its keeped for compatiblity * reason. * @usage $emailier->setEmailTempalte(new EmailTemplate("email_template_name")); * @param mix sqlConnect $conx connexion to the database thrue an sqlConnect object or an EmailTemplate object. * @param string $templatename name of the template to load */ function setEmailTemplate($templatename = "", $conx = null) { if (is_object($templatename) && (get_class($templatename) == "EmailTemplate" || is_subclass_of($templatename, "EmailTemplate"))) { $EmailTemplate = $templatename; //echo $EmailTemplate->bodytext;exit; $this->setTemplateBodyText($EmailTemplate->bodytext); $this->setTemplateBodyHtml($EmailTemplate->bodyhtml); $this->setTemplateSubject($EmailTemplate->subject); //$this->setBody($EmailTemplate->body); //$this->setBodyHtml($EmailTemplate->bodyhtml); $this->setFrom($EmailTemplate->senderemail, $EmailTemplate->sendername); //$this->setFrom($EmailTemplate->sendername, $EmailTemplate->senderemail); $this->setHeader(); return true; } else { if (is_null($conx)) { $conx = $GLOBALS['conx']; } $qGetTplt = new sqlQuery($conx); $qGetTplt->query('select * from ' . $this->cfgTemplateTable . ' where name=\'' . $templatename . '\''); if ($qGetTplt->getNumRows() == 1) { $data = $qGetTplt->fetch(); $this->setTemplateSubject($data->subject); $this->setTemplateBodyText($data->bodytext); $this->setTemplateBodyHtml($data->bodyhtml); $this->setFrom($data->senderemail, $data->sendername); $this->setHeader(); return true; } else { return false; } } //return $this; }
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 eventStopSharingNotes(EventControler $evtcl) { $dispMsg = new Display($evtcl->goto); $q = new sqlQuery($this->getDbCon()); $q->query("UPDATE contact SET portal_code = '' WHERE idcontact =" . $this->idcontact); $_SESSION['in_page_message'] = 'url portal stoped'; $evtcl->setDisplayNext($dispMsg); }
function isOwner($id) { $q = new sqlQuery($this->getDbCon()); $q->query("Select * from " . $this->table . " where idautoresponder = " . $id . " AND iduser = " . $_SESSION['do_User']->iduser); if ($q->getNumRows()) { return true; } else { return false; } }
function isTemplateOwner($id) { $q = new sqlQuery($this->getDbCon()); $q->query("select * from " . $this->table . " where " . $this->primary_key . " = " . $id . " AND iduser = " . $_SESSION['do_User']->iduser); if ($q->getNumRows()) { return true; } else { return false; } }
function isNext($current_idtemplate) { $q = new sqlQuery($this->getDbCon()); $sql = "select name, language, count(*) as done from {$this->table} where (language='{$this->src_lng}' or language = '{$this->dest_lng}') AND idemailtemplate > {$current_idtemplate} group by name having done = 1 ORDER BY idemailtemplate ASC LIMIT 1"; $q->query($sql); if ($q->getNumRows()) { return true; } else { return false; } }
function isNext($current_idtemplate) { $q = new sqlQuery($this->getDbCon()); $sql = "select idmessage,key_name,content,context,can_close,close_duration,plan,language, count(*) as done from {$this->table} where (language='{$this->src_lng}' or language = '{$this->dest_lng}') AND idmessage > {$current_idtemplate} group by key_name having done = 1 ORDER BY idmessage ASC LIMIT 1"; $q->query($sql); if ($q->getNumRows()) { return true; } 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; } }
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 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; }
/** * Method to check if the plugin value is in the table plugin_enable * @param String $plugin, the plugin object name * @param Integer $iduser * @return false if no data found else the query object */ public function isPluginAddedBefore($plugin, $iduser = "") { if ($iduser == "") { $iduser = $_SESSION['do_User']->iduser; } $q = new sqlQuery($this->getDbCon()); $q->query("select * from {$this->table} where plugin = '{$plugin}' AND iduser = {$iduser}"); if ($q->getNumRows() > 0) { $q->fetch(); return $q; // return $q->getData("idplugin_enable"); } 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 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(); } }
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; } }
/** * LoadEmailer load an instance of an email message to be sent. * @param mix sqlConnect $conx connexion to the database thrue an sqlConnect object or an EmailTemplate object. * @param string $templatename name of the template to load */ function loadEmailer($conx, $templatename) { if (get_class($conx) == "EmailTemplate") { $EmailTemplate = $conx; $this->setSubject($EmailTemplate->subject); $this->setBody($EmailTemplate->body); $this->setBodyHtml($EmailTemplate->bodyhtml); $this->setSender($EmailTemplate->sendername, $EmailTemplate->senderemail); } else { $qGetTplt = new sqlQuery($conx); $qGetTplt->query("select * from {$this->cfgTemplateTable} where name='{$templatename}'"); if ($qGetTplt->getNumRows() == 1) { $data = $qGetTplt->fetch(); $this->setSubject($data->subject); $this->setBody($data->bodytext); $this->setBodyHtml($data->bodyhtml); $this->setSender($data->sendername, $data->senderemail); } } }
function default_Form($field_value = "") { // $rdata = $this->getRData('radiobutton'); $dbc = $this->getDbCon(); //$dbc = $GLOBALS['conx']; $fieldvalue = $field_value; $fname = $this->getFieldName(); if (!$this->getRData('hidden') && !$this->getRData('readonly')) { list($tablename, $fielduniqid, $fielddisplay, $defaultvalue) = explode(":", $this->getRData('radiobutton')); if (substr($defaultvalue, 0, 1) == "[" && substr($defaultvalue, strlen($defaultvalue) - 1, 1) == "]") { $defaultvar = substr($defaultvalue, 1, strlen($defaultvalue) - 2); if (preg_match("/\\;/i", $defaultvar)) { $a_paramdefaultvar = explode(";", $defaultvar); $defaultvalue = $a_paramdefaultvar[0]($a_paramdefaultvar); } else { global ${$defaultvar}; $defaultvalue = ${$defaultvar}; } } if (strlen($fieldvalue) > 0) { $defaultvalue = $fieldvalue; } $qlist = new sqlQuery($dbc); $qlist->query("select {$fielddisplay}, {$fielduniqid} from {$tablename} order by {$fielddisplay}"); while (list($vfielddisplay, $vfielduniqid) = $qlist->fetchArray()) { $tmp_selected = ""; if ($vfielduniqid == $defaultvalue) { $tmp_selected = " checked"; } $fval .= "<input type=\"radio\" name=\"fields[" . $fname . "]\" value=\"" . htmlentities($vfielduniqid) . "\"" . $tmp_selected . " />" . $this->no_PhpCode($vfielddisplay) . "\n"; if ($this->getRData("vertical") != "no") { $fval .= "<br/>"; } else { $fval .= " "; } $tmp_selected = ""; } $this->processed .= $fval; } }
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; }
/** * Try to create a new database * * @param string name new database name * @return true if succed false if not * @access public */ function createDatabase($name) { //$b_success = mysql_create_db($name); $q = new sqlQuery($this->getDbCon()); if ($q->query("CREATE DATABASE " . $name)) { if (strlen($q->getError()) < 5) { return true; } else { return false; } } else { return false; } #return $b_success; }
/** * Event method to validate the user info at the time of updatating data * @param object $evtcl */ function eventValidationOnUpdate(EventControler $evtcl) { $fields = $evtcl->fields; $do_user_rel = new UserRelations(); $errorpage = $evtcl->errPage; if (trim($fields["firstname"]) == "" || trim($fields["lastname"]) == "" || trim($fields["email"]) == "" || trim($fields["username"]) == "" || trim($fields["password"]) == "" || trim($evtcl->fieldrepeatpass["password"]) == "") { $evtcl->doSave = 'No'; $msg = "You must fill the required fields"; $errorpage = $evtcl->errorpage; $dispError = new Display($errorpage); $dispError->addParam("id", $evtcl->id); $dispError->addParam("message", $msg); $evtcl->setDisplayNext($dispError); } elseif (trim($fields["password"]) != trim($evtcl->fieldrepeatpass["password"])) { $evtcl->doSave = 'No'; $msg = "Both the Password are not matching"; $errorpage = $evtcl->errorpage; $dispError = new Display($errorpage); $dispError->addParam("id", $evtcl->id); $dispError->addParam("message", $msg); $evtcl->setDisplayNext($dispError); } else { $q = new sqlQuery($this->getDbCon()); $q->query("select * from user where email = '" . trim($fields["email"]) . "' AND iduser <> " . $_SESSION['do_User']->iduser); $q1 = new sqlQuery($this->getDbCon()); $q1->query("select * from user where username = '******'AND iduser <> " . $_SESSION['do_User']->iduser); if ($q->getNumRows() > 0 && $_SESSION['do_User']->email != trim($fields["email"])) { $evtcl->doSave = 'No'; $msg = "reg_duplicate_email"; $dispError = new Display($errorpage); $dispError->addParam("message", $msg); $evtcl->setDisplayNext($dispError); } elseif ($q1->getNumRows() > 0 && $_SESSION['do_User']->username != trim($fields["username"])) { $evtcl->doSave = 'No'; $msg = "Username is already in use"; $dispError = new Display($errorpage); $dispError->addParam("message", $msg); $evtcl->setDisplayNext($dispError); } else { $evtcl->doSave = 'yes'; } } }
/** * 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 git repository which is selected for the current project * @param Eventcontroller **/ function eventSelfDelProjectGitRepo(Eventcontroler $evtcl) { $goto = $evtcl->goto; $q = new sqlQuery($this->getDbCon()); $q->query("delete from git_project where idgit_project='" . $evtcl->idgit_project . "' limit 1"); $evtcl->setDisplayNext(new Display($goto)); }
$disp->addParam("primarykey", stripslashes($primarykey)); $disp->addParam("goto", $goto); $disp->addParam("primary_key_var", $primary_key_var); $disp->addParam($primary_key_var, $primary_key_value); //$disp->save("FormRecordEditData", $goto); $this->setDisplayNext($disp); } else { $dispError->addParam("message", $strMissingArgument); $this->setDisplayNext($dispError); } } elseif ($eventaction == "Delete") { $this->setLog("\n" . date("Ymd") . " - manageRecordEvent: delete from " . $table . " where " . $primarykey . " Confirm:" . $deleteconfirm); if ($submityes == $strYes || $deleteconfirm == "no") { $qdelete = new sqlQuery($dbc); $primarykey = stripslashes($primarykey); $qdelete->query("delete from {$table} where {$primarykey}"); if ($deleteconfirm != "no") { $goto = base64_decode($goto); } $disp->setPage($goto); $disp->addParam("mydb_num", $mydb_num); $this->setDisplayNext($disp); } elseif ($submitno == $strNo) { $goto = base64_decode($goto); $disp->setPage($goto); $disp->addParam("mydb_num", $mydb_num); $this->setDisplayNext($disp); } else { // built confirm message $goto = $goto; $goto = base64_encode($goto);
/** * 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(); }
$mprimarykey = $this->getParam("mprimarykey"); $mforeignkey = $this->getParam("mforeignkey"); if ($doSave == "yes") { if (is_array($multiselectfield)) { $this->setLog("\n multiselect field Array found with " . count($multiselectfield) . " records"); foreach ($multiselectfield as $ext_table_name) { $fieldname = $mprimarykey[$ext_table_name]; if (strlen($this->getParam($fieldname)) > 0) { $fieldvalue = $this->getParam($fieldname); } else { $fieldvalue = $this->getParam("insertid"); $this->setLog("\n insert id :" . $fieldvalue); } $this->setLog("\n processing field: " . $ext_table_name); $q_del = new sqlQuery($this->getDbCon()); $q_del->query("delete from " . $ext_table_name . " where " . $fieldname . "='" . $fieldvalue . "'"); $q_del->free(); $q_ins_new = new sqlQuery($this->getDbCon()); if (is_array($multiselectvalues[$ext_table_name])) { $this->setLog("\n multiselectvalues field Array found with " . count($multiselectvalues[$ext_table_name]) . " records"); foreach ($multiselectvalues[$ext_table_name] as $value) { $q_ins_new->query("insert into " . $ext_table_name . " ({$fieldname}, " . $mforeignkey[$ext_table_name] . ") values ('" . $fieldvalue . "', '" . $value . "')"); $this->setLog("\n" . $q_ins_new->getSqlQuery()); } } $q_ins_new->free(); } } } $this->setLog("\n --- End mydb.formatMultiSelectField "); $this->setLogRun(false);
$sqls[] = $sqlstatement; } return $sqls; } $conx = $this->getDbCon(); if ($mydb_key == $cfg_notrefererequestkey) { $fp = fopen($conx->getProjectDirectory() . "backupsync.struct.sql", "r"); $datastructure = fread($fp, filesize($conx->getProjectDirectory() . "backupsync.struct.sql")); fclose($fp); $queries = getSQLStatements($datastructure); $conx->setBackupSync(false); $runquery = new sqlQuery($conx); foreach ($queries as $query) { $query = trim($query); if (strlen($query) > 3) { $runquery->query($query); } } $fp = fopen($conx->getProjectDirectory() . "backupsync.struct.sql", "w"); fclose($fp); $error = false; if (strlen($runquery->getError()) > 5) { $this->setError("SQL query Error during structure importation : " . $runquery->getError()); $error = true; } if ($error) { $message = "Error, Datastructure import one or more query didn't go true during the structure importation"; $this->setError($message); } else { $message = "Importation done"; }
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(); } } }
function eventDelStripeDetail(EventControler $evtcl) { $q = new sqlQuery($this->getDbCon()); $qry = "delete from " . $this->table . " \n Where " . $this->primary_key . " IN (" . $evtcl->id_stripe_api_key . "," . $evtcl->id_stripe_publish_key . ") LIMIT 2 "; $q->query($qry); $_SESSION['in_page_message'] = _("Data Deleted"); }