You can now create, modify, delete, list and view posts

master
Klectik 2017-03-03 23:20:40 +01:00
parent 517481277d
commit ed2c60a8d1
13 changed files with 134 additions and 129 deletions

View File

@ -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()) {
?>
<tr <?php if ($odd) {
echo 'class="odd"';

View File

@ -164,7 +164,7 @@ if ($isAdmin) {
$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"] : "<a href=\"".$rowComment["web"]."\" rel=\"external\">".$rowComment["username"]."</a> | ".$rowComment["email"];
$input = array("{Permalink}", "{URL_Tumble}", "{Id_Comment}", "{Comment_Author}", "{Comment}");

View File

@ -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));

View File

@ -78,7 +78,7 @@ 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;

View File

@ -29,7 +29,7 @@ $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);

View File

@ -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)

View File

@ -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];
}
}

View File

@ -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];
}
}

View File

@ -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']);
}
/**

View File

@ -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');

View File

@ -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 = "";
@ -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"] : "<a href=\"".$rowComment["web"]."\" rel=\"external\">".$rowComment["username"]."</a>";
$answers['Id_Comment'] = $rowComment["id_comment"];

View File

@ -40,7 +40,7 @@ if (!defined('entry')) {
<?php
$rs = $tumble->getPosts("20");
if ($db->contarRegistros()>0) {
while ($register = mysql_fetch_array($rs)) {
while ($register = $rs->fetch()) {
$register["description"] = $register["description"];
switch ($register["type"]) {

View File

@ -32,7 +32,7 @@ if (!defined('entry')) {
<loc><?php echo $conf->urlGelato;?></loc>
<?php
if ($db->contarRegistros()>0) {
$register = mysql_fetch_array($rs);
$register = $rs->fetch();
$formatedDate = gmdate("Y-m-d", strtotime($register["date"]));
echo "\n\t<lastmod>".$formatedDate."</lastmod>";
}
@ -45,7 +45,7 @@ if (!defined('entry')) {
<?php
$rs = $tumble->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"])); ?>
<url>