public function getTopUsers() { $sql = 'SELECT * FROM user_info ORDER BY rank DESC Limit 0, 10;'; $sqlQuery = new sqlQuery($sql); $sqlQuery->setNumber($userId); return $this->getListUsers($sqlQuery); }
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 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 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; }
/** * 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 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 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 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 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; } }
/** * 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 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; } }
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; } }
/** * 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(); } }
/** * 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 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 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; }
/** * 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 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 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 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(); } } }
/** * 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; }
$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);
$goto = urlencode($urlnext); $disp->addParam("table", $table); $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
/** * 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)); }
/** * 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'; } } }