Ejemplo n.º 1
0
 public static function addView($servid, $field, $table)
 {
     if (Session::getUID() != "") {
         if (self::checkView($servid, $field, $table) == true) {
             $con = Database::getCon();
             $sql = "insert into {$table} (viewer_id, {$field},realip,created_at) value (" . Session::getUID() . ",{$servid},\"" . IpLogger::getRealIP() . "\",NOW())";
             if ($con->query($sql)) {
                 return true;
             } else {
                 return false;
             }
         }
     } else {
         if (self::checkView($servid, $field, $table) == true) {
             $con = Database::getCon();
             $tim = time();
             $sql = "insert into {$table} ({$field},realip,created_at) value ({$servid},\"" . IpLogger::getRealIP() . "\",NOW())";
             if ($con->query($sql)) {
                 return true;
             } else {
                 return false;
             }
         }
     }
 }
Ejemplo n.º 2
0
 public function FollowerData()
 {
     $this->id = "";
     $this->user_id = Session::getUID();
     $this->channel_id = "";
     $this->created_at = date("Y-m-d h:i:s", time());
 }
Ejemplo n.º 3
0
 public function CommentData()
 {
     $this->id = "";
     $this->user_id = Session::getUID();
     $this->image_id = "";
     $this->content = 0;
     $this->created_at = date('Y-m-d h:i:s', time());
 }
Ejemplo n.º 4
0
 public function IsLikeData()
 {
     $this->id = "";
     $this->user_id = Session::getUID();
     $this->image_id = "";
     $this->is_like = 0;
     $this->created_at = date('Y-m-d h:i:s', time());
 }
Ejemplo n.º 5
0
 public function NotificationData()
 {
     $this->id = "";
     $this->brief = "";
     $this->content = "";
     $this->channel_id = "";
     $this->image_id = "";
     $this->comment_id = "";
     $this->album_id = "";
     $this->notification_type_id = "";
     $this->user_id = Session::getUID();
     $this->is_read = 0;
     $this->created_at = date('Y-m-d h:i:s', time());
 }
Ejemplo n.º 6
0
 public static function verifyIP()
 {
     $con = Database::getCon();
     $sql = "select * from iplog where realip=\"" . self::getRealIP() . "\" and user_id=" . Session::getUID();
     $query = $con->query($sql);
     $found = false;
     $ca = "";
     while ($r = $query->fetch_array()) {
         $found = true;
         $ca = $r['created_at'];
     }
     if ($found == true) {
         $ca2 = $ca + 24 * 3600;
         if (time() >= $ca2) {
             $found = false;
         }
     }
     return $found;
 }
Ejemplo n.º 7
0
    public function renderHeader($channel)
    {
        $img = "";
        $url = "";
        $cfol = count(FollowerData::getByChannelId($_GET['id']));
        $ffol = "";
        $flink = "";
        if (Session::getUID() != "") {
            if (FollowerData::existFollowerChannel(Session::getUID(), $channel->id) == null) {
                $flink = "<a href='index.php?view=channelinfo&id={$channel->id}' class='btn btn-default'><i class='glyphicon glyphicon-ok'></i>&nbsp; Seguir</a>";
            } else {
                $flink = "<a href='#' class='btn btn-default btn-primary disabled'><i class='icon-ok'></i>&nbsp; Siguiendo</a>";
            }
        }
        if ($cfol == 1) {
            $ffol = "{$cfol} Seguidor";
        } else {
            $ffol = "{$cfol} Seguidores";
        }
        if ($channel->image != "") {
            $url = "storage/channel/{$channel->id}/profile/{$channel->image}";
        }
        if ($url != "") {
            $img = "<img class=media-object' src='{$url}' style='width:64px;height:64px;' data-src='holder.js/64x64'>";
        } else {
            $img = "<img class=media-object'  data-src='holder.js/80x80'>";
        }
        echo <<<AAA
<div class="media">
<!--  <a class="pull-left" href="#">
    {$img}
  </a> -->
\t\t\t<h1><b>{$channel->title}</b> <small class='f18'>{$ffol}</small></h1>
\t\t\t<p class='lead'>{$channel->description}</p>   
\t\t\t{$flink}
\t\t\t<br><br>
</div>
AAA;
    }
Ejemplo n.º 8
0
<?php 
// puedo cargar otras funciones iniciales
// dentro de la funcion donde cargo la vista actual
// como por ejemplo cargar el corte actual
View::load("start");
?>


      </div><!-- /#page-wrapper -->

    </div><!-- /#wrapper -->

    <!-- JavaScript -->
<?php 
if (Session::getUID() != "") {
    $channels = ChannelData::getAllByUID(Session::getUID());
    if (count($channels) > 0) {
        $channel = $channels[0];
        ?>

  <!-- Modal -->
  <div class="modal fade" id="uploadImageModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
          <h4 class="modal-title">Subir imagen</h4>
        </div>
        <div class="modal-body">

<form enctype="multipart/form-data" method='post' action='index.php?action=addimage' class='form-horizontal'  id='form_upload'>
Ejemplo n.º 9
0
<?php

$image = PostData::getById($_POST['post_id']);
$image->title = $_POST['title'];
$image->user_id = Session::getUID();
$image->update();
print "<script>window.location='index.php?view=slider';</script>";
//		}
Ejemplo n.º 10
0
 public static function getMyFriendTips()
 {
     $sql = "select *,tip.created_at as tcreated_at from follower inner join tip on (user_id=tip.author_id) where follower_id=" . Session::getUID() . " order by tcreated_at desc";
     $query = Executor::doit($sql);
     $array = array();
     $cnt = 0;
     while ($r = $query->fetch_array()) {
         $array[$cnt] = new TipData();
         $array[$cnt]->id = $r['id'];
         $array[$cnt]->title = $r['title'];
         $array[$cnt]->content = $r['content'];
         $array[$cnt]->author_id = $r['author_id'];
         $array[$cnt]->tags = $r['tags'];
         $array[$cnt]->created_at = $r['tcreated_at'];
         $array[$cnt]->is_public = $r['is_public'];
         $cnt++;
     }
     return $array;
 }
Ejemplo n.º 11
0
<?php

date_default_timezone_set("America/Hermosillo");
$user = UserData::getById(Session::getUID());
$operations = null;
$category = null;
if (!isset($_GET["cat_id"])) {
    $operations = OperationData::getAllByDate(date("Y-m-d", time()));
    $spents = SpentData::getAllByDate(date("Y-m-d", time()));
} else {
    $operations = OperationData::getAllByDateAndCategoryId(date("Y-m-d", time()), $_GET["cat_id"]);
    $spents = SpentData::getAllByDateAndCategoryId(date("Y-m-d", time()), $_GET["cat_id"]);
    $category = CategoryData::getById($_GET["cat_id"]);
}
$sell = 0;
$spent = 0;
$money = 0;
foreach ($operations as $career) {
    $sell += $career->q * $career->price;
}
foreach ($spents as $career) {
    $spent += $career->price;
}
$money = $sell - $spent;
?>
<section class="content-header">
	<h1>Resumen</h1>
<ol class="breadcrumb">
                        <li> Categoria</li>
                        <li class="active"><?php 
if ($category == null) {
Ejemplo n.º 12
0
    $product->price_in = $_POST["price_in"];
    $product->price_out = $_POST["price_out"];
    $product->unit = $_POST["unit"];
    $product->description = $_POST["description"];
    $product->presentation = $_POST["presentation"];
    $product->inventary_min = $_POST["inventary_min"];
    $category_id = "NULL";
    if ($_POST["category_id"] != "") {
        $category_id = $_POST["category_id"];
    }
    $is_active = 0;
    if (isset($_POST["is_active"])) {
        $is_active = 1;
    }
    $product->is_active = $is_active;
    $product->category_id = $category_id;
    $product->user_id = Session::getUID();
    $product->update();
    if (isset($_FILES["image"])) {
        $image = new Upload($_FILES["image"]);
        if ($image->uploaded) {
            $image->Process("storage/products/");
            if ($image->processed) {
                $product->image = $image->file_dst_name;
                $product->update_image();
            }
        }
    }
    setcookie("prdupd", "true");
    print "<script>window.location='index.php?view=editproduct&id={$_POST['product_id']}';</script>";
}
Ejemplo n.º 13
0
<?php

if (Session::getUID() != "") {
    $handle = new Upload($_FILES['image']);
    $post = new PostData();
    if ($handle->uploaded) {
        $url = "storage/images/";
        $handle->Process($url);
        $post->image = $handle->file_dst_name;
    }
    $content = "";
    $post->title = $_POST['title'];
    $post->content = "";
    $post->user_id = Session::getUID();
    $x = $post->add();
    //            setcookie("postadded",$x[1]);
    //            print "<script>window.location='index.php?module=editpost&id=$x[1]';</script>";
    print "<script>window.location='index.php?view=slider';</script>";
}
Ejemplo n.º 14
0
 public static function getAllBySender($sender_id)
 {
     $sql = "select * from " . self::$tablename . " where (receiver_id=" . Session::getUID() . " and sender_id={$sender_id}) or (sender_id=" . Session::getUID() . " and receiver_id={$sender_id}) order by created_at desc";
     $query = Executor::doit($sql);
     $array = array();
     $cnt = 0;
     while ($r = $query->fetch_array()) {
         $array[$cnt] = new MessageData();
         $array[$cnt]->id = $r['id'];
         $array[$cnt]->title = $r['title'];
         $array[$cnt]->content = $r['content'];
         $array[$cnt]->sender_id = $r['sender_id'];
         $array[$cnt]->receiver_id = $r['receiver_id'];
         $array[$cnt]->created_at = $r['created_at'];
         $array[$cnt]->is_read = $r['is_read'];
         $cnt++;
     }
     return $array;
 }
Ejemplo n.º 15
0
    public static function renderSearch()
    {
        if (count(self::$posts) > 0) {
            $last_id = null;
            // recorremos todos los posts
            foreach (self::$posts as $post) {
                $post_id = $post->id;
                $post_title = $post->title;
                $post_content = $post->content;
                $theme = ThemeData::getById($post->theme_id);
                $header_background_color = $theme->header_background_color;
                $header_text_color = $theme->header_text_color;
                $body_background_color = $theme->body_background_color;
                $body_text_color = $theme->body_text_color;
                $content = $post_content;
                $buttons = "";
                $love_button = "";
                $user_id = Session::getUID();
                $loved = false;
                //LoveData::LoveId($post->id);
                if ($loved == true) {
                    $love_button = '<button class="btn btn-danger"><i class="glyphicon glyphicon-heart"></i> Love It</button>';
                } else {
                    $love_button = <<<LLL
<button id="loveit-{$post_id}" class="btn btn-default "><i class="glyphicon glyphicon-heart"></i> Love It</button>
<script>
\$("#loveit-"+"{$post_id}").click(function(){
\txhr = new XMLHttpRequest();
\txhr.open("POST","index.php?view=loveit"+"&postid={$post_id}",false);
\txhr.send();
\tconsole.log(xhr.responseText);
\t\$("#loveit-"+"{$post_id}").removeClass("btn-default");
\t\$("#loveit-"+"{$post_id}").addClass("btn-danger");
});
</script>
LLL;
                }
                if ($post->image == null) {
                    $content = $post_content;
                }
                $buttons .= '<button id="reslidle-$post_id" class="btn btn-default "><i class="glyphicon glyphicon-th-large"></i> Reslidle It</button> ';
                $buttons .= $love_button;
                print <<<XXX
\t\t\t\t<div class="row">
\t\t\t\t\t<div class="col-md-12">
\t\t\t\t\t\t<div class="slide" style="box-shadow:-1px 1px 10px #999;">
\t\t\t\t\t\t\t<div class="header" style="background:{$header_background_color};color:{$header_text_color};padding:10px;">

\t\t\t\t\t\t\t\t<div class="btn-group pull-right">
\t\t\t\t\t\t\t\t  <button type="button" class="btn btn-link dropdown-toggle" data-toggle="dropdown">
\t\t\t\t\t\t\t\t<i class="glyphicon glyphicon-chevron-down"></i>
\t\t\t\t\t\t\t\t  </button>
\t\t\t\t\t\t\t\t  <ul class="dropdown-menu" role="menu">
\t\t\t\t\t\t\t\t    <li><a href="index.php?view=post&id={$post_id}" target="_blank"><i class="glyphicon glyphicon-eye-open"></i> Ver</a></li>
\t\t\t\t\t\t\t\t    <li><a href="index.php?view=editpost&id={$post_id}"><i class="glyphicon glyphicon-pencil"></i> Editar</a></li>
\t\t\t\t\t\t\t\t    <li class="divider"></li>
\t\t\t\t\t\t\t\t    <li><a href="#"><i class="glyphicon glyphicon-trash"></i> Eliminar</a></li>
\t\t\t\t\t\t\t\t  </ul>
\t\t\t\t\t\t\t\t</div>
\t\t\t
\t\t\t\t\t\t\t<div style="font-size:26px;">{$post_title}</div>
\t\t\t\t\t\t\t</div>

\t\t\t\t\t\t\t<div class="body" style="background:{$body_background_color};color:{$theme->body_text_color};padding:10px;font-size:18px;font-wieght:none;">
\t\t\t\t\t\t\t<p>{$content}</p>
\t\t\t\t\t\t\t<div class='pull-right'>
\t\t\t\t\t\t\t{$buttons}
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t<div class='clearfix'></div>

\t\t\t\t\t\t\t</div>

\t\t\t\t\t\t</div>\t
\t\t\t\t\t\t<br>\t\t\t\t
\t\t\t\t\t</div>
\t\t\t\t</div>


XXX;
                $last_id = $post_id;
            }
            /// aqui termina el foreach
            if (count(self::$posts) > 10) {
                print "<div id='more-1'><button id='btn-more-1' class='btn btn-default btn-lg btn-block'><i class='glyphicon glyphicon-refresh'></i> Cargar mas ...</button></div>";
                print <<<MMM
\t\t\t<script>
\t\t\t\t\$("#btn-more-1").click(function(){
\t\t\t\t\txhr = new XMLHttpRequest();
\t\t\t\t\txhr.open("GET","loadsldl.php?uid={$user_id}&from={$last_id}&ref=2",false);
\t\t\t\t\txhr.send();
\t\t\t\t\t\$("#more-1").html(xhr.responseText);
\t\t\t\t});
\t\t\t</script>
MMM;
            }
        } else {
            echo "<div class='jumbotron' style='background:#e74c3c;color:white;'><h2>No hay resultados.</h2><p>No hay resultados de su peticion de busqueda,le recomendamos verificar sus palabras clave.</p></div>";
        }
    }
Ejemplo n.º 16
0
	<div class='row'>
<?php 
$image_populars = $uac = FollowerData::getUserIdActivity(Session::getUID());
?>
		<div class="col-md-12">
			<?php 
if (count($image_populars) > 0) {
    ?>
			<h2 class='roboto'>Actividad <small>Actualizaciones de los canales que siguies</small></h2>
<br>
			  		<?php 
    foreach ($image_populars as $activity) {
        $image = $activity->getImage();
        $url = "storage/channel/{$image->channel_id}/" . $image->name;
        $chan = $image->getChannel();
        $chanurl = "storage/channel/{$image->channel_id}/profile/" . $chan->image;
        $chanimg = "";
        if ($image->getChannel()->image != "") {
            $chanimg = "<img src='{$chanurl}'>";
        } else {
            $chanimg = "<img data-src='holder.js/64x64'>";
        }
        $likes = count($image->getLikes());
        $views = count($image->getViews());
        echo <<<AAA
                    <div class='col-md-3 col-sm-3 col-xs-6'>
\t            \t\t<a style='color:#434343;text-transform:capitalize;font-weight:bold;' href='index.php?view=image&id={$image->id}'>
\t\t\t\t\t\t<img class='img-responsive' data-src="holder.js/360x270" src='{$url}' alt="">
\t            \t\t</a>
\t\t\t\t\t\t<br><div class='counts'>
\t\t\t\t\t\t\t<div class='count btn btn-default btn-xs'> {$likes}&nbsp;<i class='fa fa-thumbs-up'></i></div>
Ejemplo n.º 17
0
<?php

$sell = Selldata::getById($_GET["id"]);
$sell->cajero_id = Session::getUID();
$sell->apply();
// print_r($sell);
header("Location: index.php?view=onesell&id={$_GET['id']}");
Ejemplo n.º 18
0
<?php

$channel = new ChannelData();
$channel->title = $_POST['title'];
$channel->description = $_POST['description'];
$channel->user_id = Session::getUID();
$channel->add();
print "<script>window.location='index.php?view=mychannel';</script>";
Ejemplo n.º 19
0
<?php

if (Session::getUID() == "") {
    $user = $_POST['mail'];
    $pass = sha1(md5($_POST['password']));
    $base = new Database();
    $con = $base->connect();
    $sql = "select * from user where (email= \"" . $user . "\" or username= \"" . $user . "\") and password= \"" . $pass . "\" and is_active=1";
    //print $sql;
    $query = $con->query($sql);
    $found = false;
    $userid = null;
    while ($r = $query->fetch_array()) {
        $found = true;
        $userid = $r['id'];
    }
    if ($found == true) {
        //	print $userid;
        $_SESSION['user_id'] = $userid;
        //	setcookie('userid',$userid);
        //	print $_SESSION['userid'];
        print "Cargando ... {$user}";
        print "<script>window.location='index.php?view=home';</script>";
    } else {
        print "<script>window.location='index.php?view=login';</script>";
    }
} else {
    print "<script>window.location='index.php?view=home';</script>";
}
Ejemplo n.º 20
0
<?php

$f = new FollowerData();
$f->channel_id = $_POST['channel_id'];
$f->add();
$u = UserData::getById(Session::getUID());
$channel = ChannelData::getById($_POST['channel_id']);
$author = $channel->getUser();
$not_type = NotificationTypeData::getByName("Nuevo Seguidor");
$n = new NotificationData();
$n->brief = "<b>{$u->name} {$u->lastname}</b> Te Sigue";
$n->content = "";
$n->channel_id = $_POST['channel_id'];
$n->image_id = "NULL";
$n->comment_id = "NULL";
$n->album_id = "NULL";
$n->notification_type_id = $not_type->id;
$n->user_id = Session::getUID();
$n->add();
//index.php?module=channelinfo&id=1
print "<script>window.location='index.php?view=channelinfo&id={$_POST['channel_id']}';</script>";
Ejemplo n.º 21
0
<!DOCTYPE html>
<html>
  <head>

    <style type="text/css">
  
      body {
  background: url(img/calendario.jpg) no-repeat fixed center;   
      }
    </style>
  </head>
  <body>
      
      <?php 
if (Session::getUID() != "") {
    print "<script>window.location='index.php?view=home';</script>";
}
?>
<br><br><br><br><br>
<div class="row vertical-offset-100">
    	<div class="col-md-4 col-md-offset-4">
    	<?php 
if (isset($_COOKIE['password_updated'])) {
    ?>
    		<div class="alert alert-success">
    		<p><i class='glyphicon glyphicon-off'></i> Se ha cambiado la contraseña exitosamente !!</p>
    		<p>Pruebe iniciar sesion con su nueva contraseña.</p>

    		</div>
    	<?php 
    setcookie("password_updated", "", time() - 18600);
Ejemplo n.º 22
0
            ?>
</td>
  <td style="width:100px;"><?php 
            if ($product) {
                ?>
 <i class="fa fa-check"></i> <?php 
            }
            ?>
</td>
  <td style="width:90px;">
    <a class="btn btn-warning btn-xs" data-toggle="modal" href="#updateSell-<?php 
            echo $product->id;
            ?>
"><i class="glyphicon glyphicon-pencil"></i> </a>
<?php 
            if (Session::getUID()) {
                ?>
    <a href="index.php?view=delproductingredient&operation_id=<?php 
                echo $operation->id;
                ?>
&sell_id=<?php 
                echo $_GET["id"];
                ?>
" class="btn btn-danger btn-xs"><i class="glyphicon glyphicon-trash"></i> </a>
<?php 
            }
            ?>
  <!-- Button trigger modal -->

  <!-- Modal -->
  <div class="modal fade" id="updateSell-<?php