diff --git a/admin/admin.php b/admin/admin.php index b0a02f8..7e134ac 100755 --- a/admin/admin.php +++ b/admin/admin.php @@ -31,22 +31,22 @@ if ($user->isAdmin()) { - - +
@@ -57,8 +57,8 @@ if ($user->isAdmin()) {
  • -
    - +
    +

     

    -".__("The user has been added successfully.")."
    "; } } - + if (isset($_GET["delete"])) { if ($_GET["delete"]=="true") { echo "
    ".__("The user has been eliminated successfully.")."
    "; } } - + if (isset($_GET["modified"])) { if ($_GET["modified"]=="true") { echo "
    ".__("The user has been modified successfully.")."
    "; } } - + if (isset($_GET["error"])) { if ($_GET["error"]==1) { echo "
    ".__("The username is not available.")."
    "; } elseif ($_GET["error"]==2) { echo "
    ".__("Error on the database server:.")." ".$_GET["des"]."
    "; } - } ?> + } ?>
    @@ -110,7 +110,7 @@ if ($user->isAdmin()) { $odd=false; $rs = $user->getUsers(); if ($db->contarRegistros()>0) { - while ($register = mysql_fetch_array($rs)) { + while ($register = $rs->fetch()) { ?> isAdmin()) { $odd=!$odd; ?>> - + - + - + isAdmin(); $isEdition = isset($_GET["edit"]); $commentId = ($isEdition) ? $_GET["edit"] : null; - + if (isset($_POST["btnAdd"])) { unset($_POST["btnAdd"]); - + $_POST["username"] = strip_tags($_POST["username"]); $_POST["email"] = strip_tags($_POST["email"]); $_POST["web"] = strip_tags($_POST["web"]); $_POST["content"] = util::removeBadTags($_POST["content"], true); - + if (isset($_POST["id_comment"])) { if ($isAdmin) { if ($comment->modifyComment($_POST, $_POST["id_comment"])) { @@ -45,7 +45,7 @@ if (isset($_POST["btnAdd"])) { $comment->generateCookie($_POST); $_POST["spam"] = ($comment->isSpam($_POST)) ? "1" : "0"; $_POST["ip_user"] = $_SERVER["REMOTE_ADDR"]; - + $strEnd=($conf->urlFriendly) ? "/" : ""; if ($comment->addComment($_POST)) { header("Location: ".$conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$_POST["id_post"].$strEnd); @@ -83,11 +83,11 @@ if ($isAdmin) { }); }); - - +
    @@ -97,21 +97,21 @@ if ($isAdmin) {
  • ">
  • -
    - +
    +
    -

     

    - 

    +".__("The comment has been eliminated successfully.")."
    "; @@ -120,7 +120,7 @@ if ($isAdmin) { echo "
    ".__("The post has NOT been eliminated.")."
    "; } } - + if (isset($_GET["modified"])) { if ($_GET["modified"]=="true") { echo "
    ".__("The comment has been modified successfully.")."
    "; @@ -129,15 +129,15 @@ if ($isAdmin) { echo "
    ".__("The post has NOT been modified.")."
    "; } } ?> -
    +
    getComment($_GET["edit"]); $date = strtotime($row["comment_date"]); - + $input = array("{User}", "{Email}", "{Web}", "{Comment}", "{Id_Post}", "{Date_Added}", "{Id_Comment}", "{Form_Action}"); $output = array($row["username"], $row["email"], $row["web"], $row["content"], $row["id_post"], $date, $row["id_comment"], $conf->urlGelato."/admin/comments.php"); - + $template->cargarPlantilla($input, $output, "template_comment_post"); $template->mostrarPlantilla(); } else { @@ -146,41 +146,41 @@ if ($isAdmin) { } else { $page_num = null; } - + $limit=$conf->postLimit; - + if (isset($page_num) && is_numeric($page_num) && $page_num>0) { $from = (($page_num-1) * $limit); } else { $from = 0; } - + if (isset($_GET["spam"]) && $_GET["spam"]=="true") { $sp = "1"; } else { $sp = null; } - + $rs = $comment->getComments(null, $limit, $from, $sp); - + if ($db->contarRegistros()>0) { - while ($rowComment = mysql_fetch_array($rs)) { + while ($rowComment = $rs->fetch()) { $commentAuthor = ($rowComment["web"]=="") ? $rowComment["username"]." | ".$rowComment["email"] : "".$rowComment["username"]." | ".$rowComment["email"]; - + $input = array("{Permalink}", "{URL_Tumble}", "{Id_Comment}", "{Comment_Author}", "{Comment}"); $output = array($conf->urlGelato."/index.php/post/".$rowComment["id_post"]."#comment-".$rowComment["id_comment"], $conf->urlGelato, $rowComment["id_comment"], $commentAuthor, $rowComment["content"]); - + $template->cargarPlantilla($input, $output, "template_comment"); $template->mostrarPlantilla(); } - + $p = new pagination; $p->items($comment->countComments()); $p->limit($limit); $p->currentPage(isset($page_num) ? $page_num : 1); $p->show(); } - } ?> + } ?>
    @@ -197,4 +197,4 @@ if ($isAdmin) { } else { header("Location: ".$conf->urlGelato."/login.php"); } -?> \ No newline at end of file +?> diff --git a/admin/index.php b/admin/index.php index 2c5a22d..e9da8f3 100755 --- a/admin/index.php +++ b/admin/index.php @@ -107,7 +107,7 @@ if ($user->isAuthenticated()) { $admin_includes = ""; $trigger->call('admin_includes'); $theme->set('admin_includes', $admin_includes); - + $theme->set('version', $util_class->version()); $theme->set('conf', array( 'urlGelato'=>$conf->urlGelato, @@ -240,7 +240,7 @@ if ($user->isAuthenticated()) { $rows = array(); if ($db->contarRegistros()>0) { - while ($register = mysql_fetch_array($rs)) { + while ($register = $rs->fetch()) { $row['postType'] = $util_class->type2Text($tumble->getType($register["id_post"])); $formatedDate = gmdate("M d", strtotime($register["date"]) + $util_class->transform_offset($conf->offsetTime)); diff --git a/api.php b/api.php index 3753ac2..eaba14c 100755 --- a/api.php +++ b/api.php @@ -15,11 +15,11 @@ if (!defined('entry')) { ?> set("feeds", $feeds); if ($hasType) { @@ -78,14 +78,14 @@ if (!defined('entry')) { $theme->set("start", $start); $theme->set("total", $total); - while ($post = mysql_fetch_assoc($rs)) { + while ($post = $rs->fetch()) { $post['desc'] = util::trimString($post["description"]); $strEnd = ($conf->urlFriendly) ? "/" : ""; $post['url'] = $conf->urlGelato.($conf->urlFriendly ? "/post/" : "/index.php?post=").$post["id_post"].$strEnd; $post['formatedDate'] = gmdate("D, d M Y H:i:s", strtotime($post["date"]) + util::transform_offset($conf->offsetTime)); - + $post["type"] = util::type2Text($post["type"]); - + switch ($post["type"]) { case "post": $post['tit'] = (empty($post["title"])) ? $post['desc'] : strip_tags($post["title"]); diff --git a/archive.php b/archive.php index 200c735..2ebd7b1 100755 --- a/archive.php +++ b/archive.php @@ -29,16 +29,16 @@ $video = array(); $dates = array(); $rs = $tumble->getPosts($tumble->getPostsNumber()); if ($db->contarRegistros()>0) { - while ($register = mysql_fetch_assoc($rs)) { + while ($register = $rs->fetch()) { $date = strtotime($register['date']); $year = date('Y', $date); $month = date('M', $date); $day = date('d', $date); $dates[$year][$month][$day] = true; $output = handleNode($register); - + $theType = $util_class->type2Text($register["type"]); - + switch ($theType) { case 'quote': $quote[] = $output; @@ -68,7 +68,7 @@ function handleNode($node) global $user, $tumble, $conf; $dateTmp = null; $formatedDate = gmdate("M d", strtotime($node["date"]) + $util_class->transform_offset($conf->offsetTime)); - + $output = array(); $output['url'] = $tumble->getPermalink($node["id_post"]); $output['date'] = $formatedDate; @@ -77,10 +77,10 @@ function handleNode($node) $year = date('Y', $date); $month = date('M', $date); $day = date('d', $date); - + $output['full_date'] = $day.' '.$month.' '.$year; $theType = $util_class->type2Text($node["type"]); - + switch ($theType) { case 'quote': $output['quote'] = $node["description"]; @@ -135,7 +135,7 @@ function handleNode($node) <?php echo $conf->title." » ".__(" archive"); ?> - + - +
    @@ -216,7 +216,7 @@ function handleNode($node)
  • Quotes
  • Videos
  • -
    +
    @@ -239,15 +239,15 @@ function handleNode($node) } ?> -
    +
    - - - + + +
    - +
    -
    - + -
    - + -
    - + - - - + -

     

    - +

     

    - + diff --git a/classes/comments.class.php b/classes/comments.class.php index dddad90..e7b740c 100755 --- a/classes/comments.class.php +++ b/classes/comments.class.php @@ -99,7 +99,7 @@ class comments public function getComment($id="") { $this->db->ejecutarConsulta("select * from ".$this->conf->tablePrefix."comments WHERE id_comment=".$id); - return mysql_fetch_array($this->db->mid_consulta); + return $this->db->mid_consulta->fetch(); } public function countComments($idPost=null) diff --git a/classes/feeds.class.php b/classes/feeds.class.php index a9978c0..b5b9dd5 100755 --- a/classes/feeds.class.php +++ b/classes/feeds.class.php @@ -169,7 +169,7 @@ class feeds extends Conexion_Mysql $timeToUpdate = trim($this->conf->rssImportFrec). ' ago'; $delta = time() - strtotime($timeToUpdate); $this->ejecutarConsulta('SELECT (UNIX_TIMESTAMP(updated_at) - '.$delta.') - UNIX_TIMESTAMP(NOW()) FROM '.$this->conf->tablePrefix.'feeds WHERE id_feed = '.$id); - $time = mysql_fetch_array($this->mid_consulta); + $time = $this->mid_consulta->fetch(); return $time[0]; } } diff --git a/classes/gelato.class.php b/classes/gelato.class.php index f251f1a..fa94e22 100755 --- a/classes/gelato.class.php +++ b/classes/gelato.class.php @@ -83,13 +83,13 @@ class gelato public function getPost($id="") { $this->db->ejecutarConsulta("select * from ".$this->conf->tablePrefix."data WHERE id_post=".$id); - return mysql_fetch_array($this->db->mid_consulta); + return $this->db->mid_consulta->fetch(); } public function getPostsNumber() { $this->db->ejecutarConsulta("select count(*) as total from ".$this->conf->tablePrefix."data"); - $row = mysql_fetch_assoc($this->db->mid_consulta); + $row = $this->db->mid_consulta->fetch(); return $row['total']; } @@ -97,7 +97,7 @@ class gelato { if ($this->db->ejecutarConsulta("select type from ".$this->conf->tablePrefix."data WHERE id_post=".$id)) { if ($this->db->contarRegistros()>0) { - while ($registro = mysql_fetch_array($this->db->mid_consulta)) { + while ($registro = $this->db->mid_consulta->fetch()) { return $registro[0]; } } diff --git a/classes/mysql_connection.class.php b/classes/mysql_connection.class.php index 5e9aa67..d1098e8 100755 --- a/classes/mysql_connection.class.php +++ b/classes/mysql_connection.class.php @@ -15,9 +15,9 @@ */ // constantes -define('MYSQL_TYPES_NUMERIC', 'int real '); +define('MYSQL_TYPES_NUMERIC', 'int real tiny long '); define('MYSQL_TYPES_DATE', 'datetime timestamp year date time '); -define('MYSQL_TYPES_STRING', 'string blob '); +define('MYSQL_TYPES_STRING', 'string blob var_string '); class Conexion_Mysql { @@ -119,7 +119,7 @@ class Conexion_Mysql $sqlValues .= "'$valor',"; } elseif (substr_count(MYSQL_TYPES_STRING, "$tipo_col ")) { $valor = $this->sql_escape($valor); - $sqlValues .= "'$valor',"; + $sqlValues .= "$valor,"; } } $cols = rtrim($cols, ',').')'; @@ -127,6 +127,7 @@ class Conexion_Mysql // inserta los valores en la DB $sql = "INSERT INTO $tabla $cols VALUES $sqlValues"; + return $this->ejecutarConsulta($sql); } @@ -168,7 +169,7 @@ class Conexion_Mysql $sql .= "'$valor',"; } elseif (substr_count(MYSQL_TYPES_STRING, "$tipo_col ")) { $valor = $this->sql_escape($valor); - $sql .= "'$valor',"; + $sql .= "$valor,"; } } $sql = rtrim($sql, ','); // elimina la ultima coma @@ -201,7 +202,7 @@ class Conexion_Mysql return false; } $r->closeCursor(); - return $ret; + return strtolower($ret['native_type']); } /** diff --git a/config.php b/config.php index 869a9cd..715d29b 100755 --- a/config.php +++ b/config.php @@ -14,3 +14,7 @@ if (!defined('entry') || !entry) { =========================== */ define('Table_prefix', 'gel_'); +define('DB_Server', 'localhost'); +define('DB_name', 'gelatocms'); +define('DB_User', 'gelatocms'); +define('DB_Password', 'testpassword'); diff --git a/index.php b/index.php index 2244b5e..94dedf2 100755 --- a/index.php +++ b/index.php @@ -56,7 +56,7 @@ $util_class = new util(); $feed_url = $conf->urlGelato.($conf->urlFriendly?"/rss/":"/rss.php"); - + $gelato_includes = " codeName()." (".$util_class -> version().")\" />\n"; $gelato_includes .= "\turlGelato."/images/favicon.ico\" />"; @@ -110,7 +110,7 @@ $util_class = new util(); if ($db->contarRegistros()>0) { $dateTmp = null; - while ($register = mysql_fetch_assoc($rs)) { + while ($register = $rs->fetch()) { $formatedDate = gmdate("M d", strtotime($register["date"]) + $util_class->transform_offset($conf->offsetTime)); if ($dateTmp != null && $formatedDate == $dateTmp) { $formatedDate = ""; @@ -189,7 +189,7 @@ $util_class = new util(); $rows[] = $row; } - + $trigger->call('post_content'); $theme->set('rows', $rows); @@ -296,7 +296,7 @@ $util_class = new util(); if ($conf->allowComments) { $rsComments = $comment->getComments($register["id_post"]); $comments = array(); - while ($rowComment = mysql_fetch_assoc($rsComments)) { + while ($rowComment = $rsComments->fetch()) { $commentAuthor = ($rowComment["web"]=="") ? $rowComment["username"] : "".$rowComment["username"].""; $answers['Id_Comment'] = $rowComment["id_comment"]; @@ -319,7 +319,7 @@ $util_class = new util(); } $rows[] = $row; - + $trigger->call('post_content'); $theme->set('rows', $rows); } diff --git a/rss.php b/rss.php index 1681bae..ae6e671 100755 --- a/rss.php +++ b/rss.php @@ -16,22 +16,22 @@ if (!defined('entry')) { call('feed_header'); - + header("Content-type: text/xml; charset=utf-8"); $isFeed = true; - + global $conf, $tumble; - + $util_class = new util(); - + echo "\n"; -?> +?> <?php echo htmlspecialchars($conf->title);?> urlGelato;?> description);?> - gelato CMS codeName()." (".$util_class->version().")"; ?> + gelato CMS codeName()." (".$util_class->version().")"; ?> urlGelato;?>/images/information.png <?php echo htmlspecialchars($conf->description);?> @@ -40,9 +40,9 @@ if (!defined('entry')) { getPosts("20"); if ($db->contarRegistros()>0) { - while ($register = mysql_fetch_array($rs)) { + while ($register = $rs->fetch()) { $register["description"] = $register["description"]; - + switch ($register["type"]) { case "1": $tit = ($register["title"]=="") ? $register["description"] : $register["title"]; @@ -86,11 +86,11 @@ if (!defined('entry')) { <?php echo $tit; ?> ]]> - - + + - diff --git a/sitemap.php b/sitemap.php index ddd064d..b9757b5 100755 --- a/sitemap.php +++ b/sitemap.php @@ -16,23 +16,23 @@ if (!defined('entry')) { \n"; echo "urlGelato."/sitemap.xsl\"?>\n"; - + $rs = $tumble->getPosts(1); ?> - + - urlGelato;?> + urlGelato;?> contarRegistros()>0) { - $register = mysql_fetch_array($rs); + $register = $rs->fetch(); $formatedDate = gmdate("Y-m-d", strtotime($register["date"])); echo "\n\t".$formatedDate.""; } @@ -42,14 +42,14 @@ if (!defined('entry')) { -getPosts($tumble->getPostsNumber()); if ($db->contarRegistros()>0) { - while ($register = mysql_fetch_array($rs)) { + while ($register = $rs->fetch()) { $url = $tumble->getPermalink($register["id_post"]); $formatedDate = gmdate("Y-m-d", strtotime($register["date"])); ?> - + daily 0.7 @@ -59,4 +59,4 @@ if (!defined('entry')) { } } ?> - \ No newline at end of file +
    ">"> ">">