Inactivo"; break; case "1": return "Activado"; break; default: return "Inactivo"; break; } } function makePHP_SELF(){ $uri = $_SERVER['REDIRECT_URL']; // FIND ? POSITION if (($questionPOS = strrpos($uri, "?")) !== false) { $page = substr($uri, 0, $questionPOS); $querystring = substr($uri, $questionPOS + 1, strlen($uri)); }else{ $page = $uri; } $_SERVER['QUERY_STRING'] = $querystring; $_SERVER['PHP_SELF'] = $page; } function makeHtmlLink($value) { $value = strtolower($value); $value = trim($value); $value = str_replace(".", "", $value); $value = str_replace("\"", "", $value); $value = str_replace("'", "", $value); $value = preg_replace("~&#([0-9]+);~e", "", $value); $value = html_entity_decode($value); do { $value = str_replace(" ", " ", $value); } while(strpos($value, " ") !== false); $value = str_replace(" ", "-" , $value); $value = strtr($value, "áéíóúñàèìòù", "aeiounaeiou"); $value = ereg_replace("[^a-zA-Z0-9-]", "-", $value); // REMOVE MORE THAN ONE - do { $value = str_replace("--", "-", $value); } while(strpos($value, "--") !== false); return $value; } function privileges($sections, $session_name = SESSION_ADMIN) { if ($_SESSION[$session_name][god]) { return true; }else{ if (is_array($sections)) { foreach ($sections AS $key => $section) { if (inArray($_SESSION[$session_name][privileges], $section)) { return true; } } }else{ if (inArray($_SESSION[$session_name][privileges], $sections)) { return true; } } return false; } } function privilegesSecurity($section, $session_name = SESSION_ADMIN) { if (!$_SESSION[$session_name][god]) { $exit = true; if (!is_array($section)) { if (inArray($_SESSION[$session_name][privileges], $section)) { $exit = false; } }else{ foreach ($section AS $key => $section_id) { if (inArray($_SESSION[$session_name][privileges], $section_id)) { $exit = false; } } } if ($exit) { header("location: ../logout.php"); exit; } } } function saveAdminAccess($id) { $sql = "INSERT INTO admin_access SET add_date = '" . strtotime("now") . "', admin_id = '" . $id . "'"; $result = mysql_query($sql); } function getAdminName($id) { $sql = "SELECT complete_name FROM admin_users WHERE id = '" . $id . "'"; $result = mysql_query($sql); if ($row = mysql_fetch_array($result)) { return $row[complete_name]; } } function showValue($value, $return = "n/d") { if ($value) { return $value; }else{ return $return; } } function formatNumber($number, $thousands = ",", $decimals = 2) { return number_format($number, $decimals, ".", $thousands); } function makeEmailsArray($addresses) { $arrEmails = false; $arrEmails = explode(",", $addresses); if (is_array($arrEmails)) { foreach ($arrEmails AS $key => $email) { $arrEmails[$key] = trim($email); } } return $arrEmails; } function isNumeric($value) { //$value = intval($value); if ($value AND is_numeric($value) AND $value > 0) { return true; }else{ return false; } } function invalidPrice($price, $digits = 5, $decimals = 2, $allow_zero = false) { if (!$price AND $allow_zero) { return false; }else{ if ($price) { if (eregi("[^0-9\.-]", $price)) { return true; }else{ if (strpos($price, ".") > $digits) { return true; }else{ if (!strpos($price, ".")) { if (strlen($price) > $digits) { return true; } }else{ // CHECK NUMBER OF DECIMALS if (strlen(strstr($price, ".")) > $decimals + 1) { return true; }else{ $realPrice = str_replace(".", "", $price); if (!$allow_zero) { if (intval($realPrice) == 0) { return true; }else{ return false; } }else{ return false; } } } } } }else{ return true; } } } function getFileInfo($file, $original_filename = NULL) { if (file_exists(PATH . $file)) { $size = getFileSize($file); $extension = (isset($original_filename)) ? getFileExt($original_filename) : getFileExt($file); $image = "default"; if (file_exists(PATH . "images/icons/filetypes/" . $extension . ".png")) { $image = $extension; } return array($image, $size); }else{ return false; } } function getFileExt($file){ $extension = explode(".", $file); $extension = strtolower($extension[count($extension) - 1]); return $extension; } function getFileSize($file){ if(file_exists(PATH . $file)){ $size = filesize(PATH . $file); $filesizename = array(" Bytes", " kb", " mb", " GB", " TB", " PB", " EB", " ZB", " YB"); return round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . $filesizename[$i]; }else{ return "0kb"; } } function getImages($folder, $id, $format, $total = 0, $start_from = 1, $return_complete_path = 0) { // $format = "ID_COUNTER_small"; // $format = "ID"; // $format = "ID_small"; // $format = "small_ID"; $available_images = array(".jpg", ".png", ".gif"); $return = false; if ($total) { for ($counter = $start_from; $counter <= $total; $counter++) { $fileName = $format; $fileName = str_replace("ID", $id, $fileName); $fileName = str_replace("COUNTER", $counter, $fileName); foreach($available_images as $key => $extension){ //echo PATH . $folder . $fileName . $extension . "<-
"; if (file_exists(PATH . $folder . $fileName . $extension)) { $return = PATH . $folder . $fileName . $extension; break(2); } } } }else{ $fileName = $format; $fileName = str_replace("ID", $id, $fileName); foreach($available_images as $key => $extension){ //echo PATH . $folder . $fileName . $extension . "<-
"; if (file_exists(PATH . $folder . $fileName . $extension)) { $return = PATH . $folder . $fileName . $extension; break; } } } if (!$return_complete_path) { $return = str_replace(PATH, "", $return); } return $return; } function getMultiImagesArray($folder, $id, $format, $total = 0, $start_from = 1) { // $format = "ID_COUNTER_small"; // $format = "ID"; // $format = "ID_small"; // $format = "small_ID"; $available_images = array(".jpg", ".png", ".gif"); $return = false; for ($counter = $start_from; $counter <= $total; $counter++) { $fileName = $format; $fileName = str_replace("ID", $id, $fileName); $fileName = str_replace("COUNTER", $counter, $fileName); foreach($available_images As $key => $extension){ if (file_exists(PATH . $folder . $fileName . $extension)) { $return[] = $folder . $fileName . $extension; break; } } } return $return; } function returnImageExtension($image) { // JPG / GIF / PNG $img_info = @getimagesize($image); switch ($img_info[2]) { case 1: return ".gif"; break; case 2: return ".jpg"; break; case 3: return ".png"; break; default: return false; break; } } function getSettings(){ $sql = "SELECT * FROM settings_main"; $result = mysql_query($sql); if ($row = mysql_fetch_array($result)){ do { define($row[config], $row[value]); } while($row = mysql_fetch_array($result)); } } function encryptPassword($password, $username = "") { if ($username) { $userLength = strlen($username); $userHalf = ceil($userLength / 2); $userStart = substr($username, 0, $userHalf); $userEnd = substr($username, $userHalf, $userLength); } return md5(sha1($userStart . $password . $userEnd)); } function getOperationResult($result) { switch ($result) { case "added": $text = "Información almacenada con éxito"; break; case "waiting": $text = "Información almacenada con éxito y en espera de revisión"; break; case "deleted": $text = "Información eliminada con éxito"; break; case "updated": $text = "Información modificada con éxito"; break; } return $text; } function invalidUserPass($value) { if ($value) { if (!eregi("[^A-Z0-9_-]", $value)) { // RIGHT return FALSE; }else{ // WRONG return TRUE; } }else{ // WRONG return TRUE; } } function fileSizeConvert($size) { $filesizename = array(" Bytes", " kb", " Mb", " Gb", " Tb", " Pb", " Eb", " Zb", " Yb"); return round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . $filesizename[$i]; } function convertVideo($tmp_name, $new_name, $folder) { $tmp_name = strtolower($tmp_name); // CHECK FILE EXTENSION, IF FLV: MOVE IT $videoExtension = explode(".", $tmp_name); $videoExtension = $videoExtension[(count($videoExtension) - 1)]; // MOVE VIDEO rename(TMP_UPLOAD_DIR . $tmp_name, PATH . $folder . $new_name . "." . $videoExtension); } function resize($tmp_name, $original_name, $new_name, $width, $height, $folder) { // echo "$tmp_name, $original_name, $new_name, $width, $height, $folder"; $img_info = getimagesize($tmp_name); $new_name .= returnImageExtension($tmp_name); if (!$width) { if ($img_info[1] <= $height) { copy($tmp_name, PATH . $folder . $new_name); $copied = 1; } }else if (!$height) { if ($img_info[0] <= $width) { copy($tmp_name, PATH . $folder . $new_name); $copied = 1; } }else{ if ($img_info[0] <= $width AND $img_info[1] <= $height) { copy($tmp_name, PATH . $folder . $new_name); $copied = 1; } } if (!$copied) { if(IMG_HANDLER == "GD"){ resize_image($tmp_name, $original_name, PATH . $folder . $new_name, $width, $height, $scale, true, 72); }else if(IMG_HANDLER == "ImageMagick"){ system(CONVERT_PATH . "convert -quality 80 -density 72x72 " . $tmp_name . " -resize " . $width . "x" . $height . " " . PATH . $folder . $new_name); } } } function resizeCrop($tmp_name, $original_name, $new_name, $width, $height, $folder, $cropPosition = "center") { // $img_info[0] = W - $img_info[1] = H $img_info = getimagesize($tmp_name); $new_name .= returnImageExtension($tmp_name); if (!$width) { if ($img_info[1] <= $height) { copy($tmp_name, PATH . $folder . $new_name); $copied = 1; } }else if (!$height) { if ($img_info[0] <= $width) { copy($tmp_name, PATH . $folder . $new_name); $copied = 1; } }else{ if ($img_info[0] <= $width AND $img_info[1] <= $height) { copy($tmp_name, PATH . $folder . $new_name); $copied = 1; } } if (!$copied) { system(CONVERT_PATH . "convert -quality 80 -density 72 " . $tmp_name . " -resize x" . ($height * 2) . " -resize \"" . ($width * 2) . "x<\" -resize 50% -gravity " . $cropPosition . " -crop " . $width . "x" . $height . "+0+0 +repage " . PATH . $folder . $new_name); } } function resize_image($tmp_name, $original_name, $dest_image, $max_width = null, $max_height = null, $scale = null, $relscale = true, $quality = 100){ $img = null; $extension = substr( $original_name, ( strrpos($original_name, '.') + 1 ) ) ; $extension = strtolower( $extension ) ; $ext = $extension; // NO USE IF SET CONSTANT IMG_HANDLER // $dest_image .= "." . $ext; if($ext == 'jpg' || $ext == 'jpeg'){ $img = @imagecreatefromjpeg($tmp_name); }else if($ext == 'png'){ $img = @imagecreatefrompng($tmp_name); }else if($ext == 'gif'){ $img = @imagecreatefromgif($tmp_name); } // If an image was successfully loaded, test the image for size if ($img) { // Get image size and scale ratio list($oldwidth, $oldheight) = getimagesize($tmp_name); if( $relscale == true && ( $max_width || $max_height ) ){ //Supply bounds, scale w/o loss to ratio if ($oldheight > $oldwidth || !$max_width){ $sizefactor = (double) ($max_height / $oldheight); $width = (int) ($oldwidth * $sizefactor); $height = (int) ($oldheight * $sizefactor); }else if($oldheight < $oldwidth || !$max_height){ $sizefactor = (double) ($max_width / $oldwidth) ; $width = (int) ($oldwidth * $sizefactor); $height = (int) ($oldheight * $sizefactor); }else{ //if the image has a ratio of 1, aka Height and Width ==, just do a generic resize $width = $max_width; $height = $max_height; } //Max Width And Height are new dimensions }else if( $max_width && $max_height && $relscale == false ){ $width = $max_width; $height = $max_height; }else if( $scale && !$max_width || !$max_height ){ //Scale Provided And No Max Width/Height $width = (int) ($oldwidth * ( $scale / 100 )); $height = (int) ($oldheight * ( $scale / 100 )); }else{ return false; //No Dimensions Specified BUT if this function were to be accidentally called... } $tmp_img = imagecreatetruecolor($width, $height); // Copy and resize old image into new image imagecopyresampled($tmp_img, $img, 0, 0, 0, 0, $width, $height, $oldwidth, $oldheight); imagedestroy($img); $img = $tmp_img; if (file_exists($dest_image)) { @unlink($dest_image); } if ($ext == 'png') { imagepng($img,$dest_image); } else if ($ext == 'gif') { imagegif($img,$dest_image); }else{ imagejpeg($img,$dest_image,$quality); } } } function id2data($field, $table, $id, $return = "n/d"){ $sql = "SELECT $field FROM $table WHERE id = '$id'"; $result = mysql_query($sql); if ($row = mysql_fetch_array($result)){ return $row[$field]; }else{ return $return; } } function data2data($field_select, $table, $field_where, $value, $extra_where = ""){ $sql = "SELECT $field_select FROM $table WHERE " . $field_where . " = '" . stripQuotes($value) . "'" . $extra_where; $result = mysql_query($sql); if ($row = mysql_fetch_array($result)){ return $row[$field_select]; }else{ return false; } } function invalidMail($email){ if (!ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'. '@'.'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email)){ return TRUE; }else{ return FALSE; } } function stripQuotes($value) { $value = htmlspecialchars($value); return str_replace("'", "'", $value); } function stripQuotesNoSpecials($value) { return str_replace("'", "'", $value); } function inArray($array, $value) { if (is_array($array)) { if (in_array($value, $array)) { return TRUE; }else{ return FALSE; } }else{ return FALSE; } } function makeMultiList($table, $where, $fieldName, $fieldClass, $order = " ORDER BY name", $select = 0, $size = 4, $fields = array("name")) { if ($where) { $sql = "SELECT * FROM " . $table . " WHERE " . $where . $order; }else{ $sql = "SELECT * FROM " . $table . $order; } $result = mysql_query($sql); if ($row = mysql_fetch_array($result)) { echo ""; } } function makeListByArray($array = array(0 => "Sin Datos"), $fieldName, $fieldClass, $select = 0, $attachedFunction = "") { if(!$array OR !is_array($array)){ return false; } echo ""; } function makeList($table, $where, $fieldName, $fieldClass, $select = 0, $attachedFunction = "", $order = " ORDER BY name", $fields = array("name")) { if ($where) { $sql = "SELECT * FROM " . $table . " WHERE " . $where . $order; }else{ $sql = "SELECT * FROM " . $table . $order; } $result = mysql_query($sql); echo ""; } } function makeListURL($table, $where, $fieldName, $fieldClass, $order_by = " ORDER BY name", $varsToSend = "") { if ($where) { $sql = "SELECT * FROM " . $table . " WHERE " . $where . $order_by; }else{ $sql = "SELECT * FROM " . $table . $order_by; } $result = mysql_query($sql); if ($row = mysql_fetch_array($result)) { if ($varsToSend) { // $varsToSend without initial & $onchange = " onchange=\"document.location.href = '" . $_SERVER['PHP_SELF'] . "?" . $fieldName . "=' + this.value + '" . $varsToSend . "'\""; }else{ $onchange = " onchange=\"document.location.href = '" . $_SERVER['PHP_SELF'] . "?" . $fieldName . "=' + this.value\""; } echo "\n"; } } function makeListURLcount($table, $where, $fieldName, $fieldClass, $countFrom, $countWhereField, $order_by = " ORDER BY name", $showEmpty = 1, $varsToSend = "") { if ($where) { $sql = "SELECT * FROM " . $table . " WHERE " . $where . $order_by; }else{ $sql = "SELECT * FROM " . $table . $order_by; } $result = mysql_query($sql); if ($row = mysql_fetch_array($result)) { if ($varsToSend) { // $varsToSend without initial & $onchange = " onchange=\"document.location.href = '" . $_SERVER['PHP_SELF'] . "?" . $fieldName . "=' + this.value + '" . $varsToSend . "'\""; }else{ $onchange = " onchange=\"document.location.href = '" . $_SERVER['PHP_SELF'] . "?" . $fieldName . "=' + this.value\""; } echo "\n"; } } function makeSearchRedirect ($fields) { if (is_array($fields)) { foreach ($fields AS $fieldName => $value) { if (strpos($fieldName, "srch_") === 0 AND $value) { $arr_querystring[] = $fieldName . "=" . $value; } } } if (is_array($arr_querystring)) { foreach ($arr_querystring AS $key => $value) { if ($querystring) { $querystring .= "&" . $value; }else{ $querystring = "?" . $value; } } if ($fields[page]) { $querystring .= "&page=" . $fields[page]; } if ($fields[sent]) { $querystring .= "&sent=" . $fields[sent]; } }else{ if ($fields[page]) { $querystring = "?page=" . $fields[page]; if ($fields[sent]) { $querystring .= "&sent=" . $fields[sent]; } }else{ if ($fields[sent]) { $querystring = "?sent=" . $fields[sent]; } } } if(!$querystring) $querystring = "?sent=1"; return $querystring; } function makeSearchFields ($fields) { if (is_array($fields)) { foreach ($fields AS $fieldName => $value) { if ($fieldName == "page") { $arr_fields[] = ""; } if ($fieldName == "sent") { $arr_fields[] = ""; } if (strpos($fieldName, "srch_") === 0 AND $value) { $arr_fields[] = ""; } } } if (is_array($arr_fields)) { foreach ($arr_fields AS $key => $field) { $return .= $field . "\n"; } } return $return; } function hasPics($table, $field, $id) { $sql_p = "SELECT id FROM " . $table . " WHERE " . $field . " = '" . $id . "' LIMIT 1"; $result_p = mysql_query($sql_p); if ($row_p = mysql_fetch_array($result_p)) { return true; }else{ return false; } } function hasComments($table, $field, $id) { $sql_p = "SELECT id FROM " . $table . " WHERE " . $field . " = '" . $id . "' LIMIT 1"; $result_p = mysql_query($sql_p); if ($row_p = mysql_fetch_array($result_p)) { return true; }else{ return false; } } function showDate($date, $format) { global $conf_days, $conf_months; $weekday = $conf_days[date("w", $date)]; $day = date("d", $date); $day_wo_zero = date("j", $date); $day_sub = date("S", $date); $month = date("m", $date); $month_wo_zero = date("n", $date); $month_name = $conf_months[date("n", $date)]; $year = date("Y", $date); $hours = date("H", $date); $minutes = date("i", $date); $seconds = date("s", $date); $final_date = $format; $final_date = str_replace("WEEKDAY", $weekday, $final_date); $final_date = str_replace("DAYSUB", $day_sub, $final_date); $final_date = str_replace("DAY0", $day_wo_zero, $final_date); $final_date = str_replace("DAY", $day, $final_date); $final_date = str_replace("MONTHNAME", $month_name, $final_date); $final_date = str_replace("MONTH0", $month_wo_zero, $final_date); $final_date = str_replace("MONTH", $month, $final_date); $final_date = str_replace("YEAR", $year, $final_date); $final_date = str_replace("HOUR", $hours, $final_date); $final_date = str_replace("MINUTE", $minutes, $final_date); $final_date = str_replace("SECOND", $seconds, $final_date); return $final_date; } function pager($amount, $page, $extra_vars, $table, $sql_where, $title, $class_id = "pager", $pageField = "page") { if ($page < 1) { $page = 1; } if ($title) { $title = $title . ": "; } if ($extra_vars) { $extra_vars = "&" . $extra_vars; } $sql = "SELECT COUNT(*) as n_registros FROM $table $sql_where"; $result = mysql_query($sql); if ($line = mysql_fetch_array($result)) { $count = $line[n_registros]; $pages = ceil($count / $amount); if ($page > 1) { $previous = "< Anterior | "; $from = $amount * ($page - 1) + 1; }else{ $from = 1; } if ($from == $count OR $count < $amount + $from) { $to = $count; }else{ $next = " | Siguiente >"; $to = $amount * $page; } if ($pages > 0) { $h_return = "
"; $h_return .= "$previous $title$from - $to de $count$next

Páginas: "; for ($n = 1; $n <= $pages; $n++){ if ($n == $page){ if ($return) { $return .= " - $n"; }else{ $return = "$n"; } }else{ if ($return) { $return .= " - $n"; }else{ $return .= "$n"; } } } $return .= "
 "; } $page = ($page - 1) * $amount; } return "" . $h_return . $return . ""; } function pagerSQL($amount, $page, $extra_vars, $sql, $title, $color = "", $class = "", $text_class = "", $pageField = "page") { if ($page < 1) { $page = 1; } if ($title) { $title = $title . ": "; } if ($extra_vars) { $extra_vars = "&" . $extra_vars; } if(!$sql) return false; $result = mysql_query($sql); if ($line = mysql_fetch_array($result)) { //$count = $line[n_registros]; $count = mysql_affected_rows(); $pages = ceil($count / $amount); if ($page > 1) { $previous = "« Anterior | "; $from = $amount * ($page - 1) + 1; }else{ $from = 1; } if ($from == $count OR $count < $amount + $from) { $to = $count; }else{ $next = " | Siguiente »"; $to = $amount * $page; } if ($pages > 0) { $h_return = "
"; $h_return .= "$previous $title$from - $to de $count$next

Páginas: "; for ($n = 1; $n <= $pages; $n++){ if ($n == $page){ if ($return) { $return .= " - $n"; }else{ $return = "$n"; } }else{ if ($return) { $return .= " - $n"; }else{ $return .= "$n"; } } } $return .= "
 
"; } $page = ($page - 1) * $amount; } return $h_return . $return; } ?>
Warning: ini_set(): Session ini settings cannot be changed after headers have already been sent in /var/www/vhosts/ecoviga.com.ar/public_html/inc/.ht_sessions.inc.php on line 2

Warning: session_start(): Session cannot be started after headers have already been sent in /var/www/vhosts/ecoviga.com.ar/public_html/inc/.ht_sessions.inc.php on line 3

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /var/www/vhosts/ecoviga.com.ar/public_html/inc/.ht_db.inc.php:17 Stack trace: #0 /var/www/vhosts/ecoviga.com.ar/public_html/inc/.ht_config.inc.php(23): include() #1 /var/www/vhosts/ecoviga.com.ar/public_html/trabajos.php(2): include('...') #2 {main} thrown in /var/www/vhosts/ecoviga.com.ar/public_html/inc/.ht_db.inc.php on line 17