} if ($_POST['img']) { if (substr($_POST['img'], 0, 4) == "data") { $fotob = new fotos(); if ($img = $fotob->subirFotoManager($_POST['img'], $userid)) { } else { error_log("Error al subir foto"); $img = ""; } } 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 {
global $gbAllowedTags; $string = trim($string); $string = strip_tags($string, $gbAllowedTags); $string = str_replace("|", "¦", $string); $string = str_replace("\"", """, $string); $string = str_replace("\n", "<br>", $string); $string = str_replace("\r", "", $string); $string = stripslashes($string); return $string; } $name = $_POST["name"]; $email = $_POST["email"]; $url = $_POST["url"]; $msg = $_POST["msg"]; $spam = $_POST["spam"]; if ($spam == "no") { $name = cleanField($name); $email = cleanField($email); $url = cleanField($url); $msg = cleanMessage($msg); $date = Time(); $ip = $_SERVER["REMOTE_ADDR"]; $newEntry = $name . "|" . $email . "|" . $url . "|" . $msg . "|" . $date . "|" . $ip; $fp = fopen("gb_data.txt", "a"); fwrite($fp, $newEntry . "\n"); fclose($fp); echo Date("d. F H:i", Time()); //echo "true"; } else { echo false; }
} return $message; } session_start(); $hdb = new bd(); $userid = $_SESSION["id"]; $table = "manager_messages_scheduled"; $sql = "SELECT * FROM {$table} userid=" . $hdb->quote($userid); if ($res = $hdb->query($sql)) { if ($res->rowCount() < 11) { if ($_POST['publish_tw'] == 1) { $max_chars = 140; } else { $max_chars = 2000; } $message = cleanMessage($_POST['message'], $max_charts); if (!is_numeric($message) || $message > 5) { $fields = array('userid' => $userid, 'message' => $message, '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_group' => $_POST['publish_group']); if (is_array($fields = makeTimes($fields))) { if ($hdb->doInsert($table, $fields)) { $return = array("e" => 0); } else { $return = array("e" => 2); } } else { $return = array("e" => $fields); } } else { $return = array("e" => $message); } } else {