} else { $img = $_POST['img']; } } else { $img = ""; } $message = cleanMessage($_POST['message'], $max_chars, $userid); if (!is_numeric($message) || $message > 5) { $fields = array('userid' => $userid, 'message' => $message, 'img' => $img, 'time_start' => $_POST['time_start'], 'time_end' => $_POST['time_end'], 'days' => $_POST['days'], 'hour' => $_POST['hour'], 'publish_fb' => $_POST['publish_fb'], 'publish_tw' => $_POST['publish_tw'], 'publish_fbp' => $_POST['publish_fbp'], 'publish_fbgp' => $_POST['publish_group']); if (is_array($fields = makeTimes($fields))) { if ($_POST['edit'] == true) { unset($fields['userid']); if ($hdb->doUpdate($table, $fields, " id=" . $hdb->quote($_POST['mes_id']) . " AND userid=" . $hdb->quote($userid))) { $return = array("e" => 0, "c" => array("i" => $_POST['mes_id'], "m" => $fields['message'], "p" => $fields['img'], "ts_es" => formatTimeStamp($fields['time_start']), "ts_en" => date('Y-m-d', $fields['time_start']), "te_es" => formatTimeStamp($fields['time_end']), "te_en" => date('Y-m-d', $fields['time_end']), "t_p" => $fields['img'], "d" => $fields['days'], "h" => formatHour($fields['hour']), "tw" => $fields['publish_tw'], "fb" => $fields['publish_fb'], "fbp" => $fields['publish_fbp'], "gp" => $fields['publish_fbgp'])); } else { error_log($hdb->errorInfo()); $return = array("e" => 2); } } else { if ($hdb->doInsert($table, $fields)) { $return = array("e" => 0, "c" => array("i" => $hdb->lastInsertId(), "m" => $fields['message'], "p" => $fields['img'], "ts_es" => formatTimeStamp($fields['time_start']), "ts_en" => date('Y-m-d', $fields['time_start']), "te_es" => formatTimeStamp($fields['time_end']), "te_en" => date('Y-m-d', $fields['time_end']), "t_p" => $fields['img'], "d" => $fields['days'], "h" => formatHour($fields['hour']), "tw" => $fields['publish_tw'], "fb" => $fields['publish_fb'], "fbp" => $fields['publish_fbp'], "gp" => $fields['publish_fbgp'])); } else { error_log($hdb->errorInfo()); $return = array("e" => 2); } } } else { $return = array("e" => $fields); } } else { $return = array("e" => $message);
public function crearUsuario() { if (isset($this->n_identificacion) xor isset($this->j_rif)) { if (isset($this->a_seudonimo)) { $bd = new bd(); $result = $bd->doInsert($this->u_table, $this->serializarDatos("u_")); if ($result == true) { $result = 0; $this->id = $bd->lastInsertId(); $hnsc = new Handler_NewSocialConnection(); if ($red_social = $hnsc->returnTableAndBody($this->id)) { if (!$bd->doInsert($red_social['table'], $red_social['fields'])) { error_log('Error occurred:' . implode(":", $bd->errorInfo())); } } if (isset($this->n_identificacion)) { $result += $bd->doInsert($this->n_table, $this->serializarDatos("n_", $this->u_table)); } else { $result += $bd->doInsert($this->j_table, $this->serializarDatos("j_", $this->u_table)); } $result += $bd->doInsert($this->a_table, $this->serializarDatos("a_", $this->u_table)); $result += $bd->doInsert($this->s_table, $this->serializarDatos("s_", array($this->s_f_table, $this->u_table))); if ($result >= 3) { return true; } else { return false; } } else { return false; } } else { throw new Exception("Error Usuario 004: No se han definido datos de acceso"); } } else { throw new Exception("Error Usuario 003: No se han definido datos Juridicos o Naturales"); } }