Exemplo n.º 1
0
 public function saveSettings()
 {
     $eqApp = new Apps();
     if ($_POST['name']) {
         $check_q = "SELECT * FROM crm_settings";
         $check_r = mysql_query($check_q);
         if (mysql_num_rows($check_r) == 0) {
             $eqApp->insertSql("crm_settings");
         } else {
             $eqApp->udpdateSql("crm_settings");
         }
     }
 }
Exemplo n.º 2
0
 public function update()
 {
     //add or update company
     if (isset($_POST['name'])) {
         $eqapp = new Apps();
         $check_q = "SELECT * FROM settings";
         $check_r = mysql_query($check_q);
         if (mysql_num_rows($check_r) == 0) {
             //if a row doesnt exist, then add a row
             $eqapp->insertSql("settings");
         } else {
             //if a row does exist then update it
             $eqapp->udpdateSql("settings");
         }
     }
 }
 public function edit($id)
 {
     if (isset($_POST['name'])) {
         $eqapp = new Apps();
         $eqapp->udpdateSql("cms_plugins");
         header('Location:' . _EQROOT_ . 'cms_plugins/edit/' . $_POST['id']);
     } else {
         $query_q = 'SELECT * FROM cms_plugins 
                     WHERE 
                     id = "' . $id . '"';
         $query = mysql_query($query_q);
         if (mysql_num_rows($query) == 0) {
             header('Location:' . _EQROOT_ . 'cms_plugins');
         }
         $row = mysql_fetch_array($query);
         return $row;
     }
 }
Exemplo n.º 4
0
 /**
  * 	Function to save user by POST values
  */
 public function saveUser()
 {
     $eqApp = new Apps();
     //ajax function that saves a user
     if (isset($_POST['fname'])) {
         //create JSON header
         header('Content-type: application/json');
         //in case they change their email... check if that email already exists
         $checkEmail_q = 'SELECT * FROM crm_users WHERE email = "' . $_POST['email'] . '" AND id <> "' . $_POST['id'] . '"';
         $checkEmail_r = mysql_query($checkEmail_q);
         if (mysql_num_rows($checkEmail_r) > 0) {
             //if email exists return fail JSON object
             echo '{ "message": "fail" }';
         } else {
             if (isset($_SESSION['x_equi'])) {
                 //save and overwrite current session objects
                 $_SESSION['x_equi'] = $_POST['email'];
                 $_SESSION['x_equi_status'] = $_POST['status'];
                 $_SESSION['x_equi_name'] = $_POST['fname'] . ' ' . $_POST['lname'];
                 $_SESSION['x_equi_fname'] = $_POST['fname'];
                 $eqApp->udpdateSql("crm_users");
                 echo '{ "message": "success" }';
             }
         }
         exit;
     } else {
         header('location: ' . _EQROOT_);
     }
 }
Exemplo n.º 5
0
 public function editcat($id)
 {
     $eqApp = new Apps();
     if (isset($_POST['name'])) {
         header('Content-type: application/json');
         $getCat_q = 'SELECT * FROM crm_contacts_cats 
                      WHERE 
                      name = "' . $_POST['name'] . '" 
                      AND id <> "' . $_POST['id'] . '"';
         $getCat_r = mysql_query($getCat_q);
         if (mysql_num_rows($getCat_r) > 0) {
             echo '{ "message": "error" }';
         } else {
             $eqApp->udpdateSql("crm_contacts_cats");
             echo '{ "message": "success" , "id": "' . $_POST['id'] . '"  }';
         }
         exit;
     } else {
         $query_q = 'SELECT * FROM
                     crm_contacts_cats 
                     WHERE id = "' . $id . '" ';
         $query = mysql_query($query_q);
         if (mysql_num_rows($query) == 0) {
             header('Location:' . _EQROOT_ . 'contacts/cats');
         }
         $row = mysql_fetch_array($query);
         return $row;
     }
 }